diff --git a/widgets/snapshotDialog/SnapshotDialog.cc b/widgets/snapshotDialog/SnapshotDialog.cc index eea1fbe405175bf457264152730da88dbfe194b9..270be989c77303535925a2889a5e38628ba4099e 100644 --- a/widgets/snapshotDialog/SnapshotDialog.cc +++ b/widgets/snapshotDialog/SnapshotDialog.cc @@ -70,6 +70,9 @@ SnapshotDialog::SnapshotDialog(QString _suggest, bool _captureViewers, int _w, i snapWidth->setValue(_w); snapHeight->setValue(_h); + // Load button states + loadStates(); + connect(snapWidth, SIGNAL(valueChanged(int)), this, SLOT(snapWidthChanged(int)) ); connect(snapHeight, SIGNAL(valueChanged(int)), this, SLOT(snapHeightChanged(int)) ); @@ -79,6 +82,28 @@ SnapshotDialog::SnapshotDialog(QString _suggest, bool _captureViewers, int _w, i connect(okButton, SIGNAL(clicked()), this, SLOT(slotOk()) ); } +void SnapshotDialog::saveStates() { + + OpenFlipperSettings().setValue( "Viewer/SnapshotDialog/SnapWidth", snapWidth->value()); + OpenFlipperSettings().setValue( "Viewer/SnapshotDialog/SnapHeight", snapHeight->value()); + OpenFlipperSettings().setValue( "Viewer/SnapshotDialog/KeepAspect", keepAspect->isChecked()); + OpenFlipperSettings().setValue( "Viewer/SnapshotDialog/Transparent", transparent->isChecked()); + OpenFlipperSettings().setValue( "Viewer/SnapshotDialog/HideCoordsys", hideCoordsys->isChecked()); + OpenFlipperSettings().setValue( "Viewer/SnapshotDialog/Multisampling", multisampling->isChecked()); + OpenFlipperSettings().setValue( "Viewer/SnapshotDialog/NumSamples", num_samples->value()); +} + +void SnapshotDialog::loadStates() { + + snapWidth->setValue( OpenFlipperSettings().value( "Viewer/SnapshotDialog/SnapWidth", snapWidth->value()).toInt()); + snapHeight->setValue( OpenFlipperSettings().value( "Viewer/SnapshotDialog/SnapHeight", snapHeight->value()).toInt()); + keepAspect->setChecked( OpenFlipperSettings().value( "Viewer/SnapshotDialog/KeepAspect", false).toBool()); + transparent->setChecked( OpenFlipperSettings().value( "Viewer/SnapshotDialog/Transparent", false).toBool()); + hideCoordsys->setChecked( OpenFlipperSettings().value( "Viewer/SnapshotDialog/HideCoordsys", false).toBool()); + multisampling->setChecked( OpenFlipperSettings().value( "Viewer/SnapshotDialog/Multisampling", true).toBool()); + num_samples->setValue( OpenFlipperSettings().value( "Viewer/SnapshotDialog/NumSamples", 16).toInt()); +} + void SnapshotDialog::snapWidthChanged(int _w) { if(blockSpinBox_) return; @@ -120,6 +145,9 @@ void SnapshotDialog::slotOk() if ( !captureViewers_ ) emit resizeApplication(snapWidth->value(), snapHeight->value()); + // Remember button states for next time... + saveStates(); + accept(); } diff --git a/widgets/snapshotDialog/SnapshotDialog.hh b/widgets/snapshotDialog/SnapshotDialog.hh index 461ecb162876076b1631cb70eb9d06d7871776e5..4b849132e2c42d52ae094dab6db9abde56a36005 100644 --- a/widgets/snapshotDialog/SnapshotDialog.hh +++ b/widgets/snapshotDialog/SnapshotDialog.hh @@ -55,7 +55,7 @@ class SnapshotDialog : public QDialog, public Ui::SnapshotDialog double aspect_; bool blockSpinBox_; - + private slots: void slotOk(); void findFile(); @@ -63,6 +63,9 @@ class SnapshotDialog : public QDialog, public Ui::SnapshotDialog void snapWidthChanged(int _w); void snapHeightChanged(int _h); + + void saveStates(); + void loadStates(); signals: void resizeApplication(int _width, int _height); diff --git a/widgets/snapshotDialog/SnapshotDialog.ui b/widgets/snapshotDialog/SnapshotDialog.ui index 52bb0f5ecb0119ac750cc72f14b4c1871fc79b0f..ada066f694d82e5a8737d3a8276e35f7af6e2217 100644 --- a/widgets/snapshotDialog/SnapshotDialog.ui +++ b/widgets/snapshotDialog/SnapshotDialog.ui @@ -51,7 +51,7 @@ - + 0 @@ -74,7 +74,7 @@ 8192 - 800 + 600 @@ -93,7 +93,7 @@ - + 80 @@ -110,7 +110,7 @@ 8192 - 600 + 800 @@ -249,6 +249,20 @@ + + filename + findButton + snapWidth + snapHeight + keepAspect + resButton + transparent + hideCoordsys + multisampling + num_samples + cancelButton + okButton +