From 549e57efdf779c726f80f7b53072d2250fa400ff Mon Sep 17 00:00:00 2001 From: Mike Kremer Date: Tue, 19 Oct 2010 12:52:15 +0000 Subject: [PATCH] Gave snapshot dialog a memory to remember what the user has checked the last time. git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@10194 383ad7c9-94d9-4d36-a494-682f7c89f535 --- widgets/snapshotDialog/SnapshotDialog.cc | 28 ++++++++++++++++++++++++ widgets/snapshotDialog/SnapshotDialog.hh | 5 ++++- widgets/snapshotDialog/SnapshotDialog.ui | 22 +++++++++++++++---- 3 files changed, 50 insertions(+), 5 deletions(-) diff --git a/widgets/snapshotDialog/SnapshotDialog.cc b/widgets/snapshotDialog/SnapshotDialog.cc index eea1fbe4..270be989 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 461ecb16..4b849132 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 52bb0f5e..ada066f6 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 + -- GitLab