Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using QSettings to persist application settings for selected ratio scale #1299

Merged
merged 1 commit into from Oct 19, 2018

Conversation

Projects
None yet
3 participants
@elliottminns
Copy link
Contributor

commented Oct 12, 2018

Uses the QSettings class to provide persistence for QT Settings, in this case the XRB scale ratio as set by the radio button group in the Advanced tab.

Closes #511

@rkeene rkeene requested a review from cryptocode Oct 12, 2018

@rkeene rkeene added the enhancement label Oct 12, 2018

@cryptocode
Copy link
Collaborator

left a comment

@elliottminns This looks good and works fine on my machine. There's a bit of a source code formatting problem that can be fixed by running ci/clang-format-all.sh

The unit labels should actually be updated to use the new units; https://github.com/nanocurrency/raiblocks/wiki/Distribution,-Mining-and-Units#divider. If you want, feel free to make another PR fixing that :)

@rkeene rkeene added this to the V17.0 milestone Oct 12, 2018

@rkeene

This comment has been minimized.

Copy link
Contributor

commented Oct 12, 2018

Formatting changes needed to pass the automated formatting validator:

--- a/rai/qt/qt.cpp
+++ b/rai/qt/qt.cpp
@@ -1768,25 +1768,25 @@ wallet (wallet_a)
 	QObject::connect (mrai, &QRadioButton::toggled, [this]() {
 		if (mrai->isChecked ())
 		{
-			QSettings().setValue (saved_ratio_key, ratio_group->id (mrai));
+			QSettings ().setValue (saved_ratio_key, ratio_group->id (mrai));
 			this->wallet.change_rendering_ratio (rai::Mxrb_ratio);
 		}
 	});
 	QObject::connect (krai, &QRadioButton::toggled, [this]() {
 		if (krai->isChecked ())
 		{
-			QSettings().setValue (saved_ratio_key, ratio_group->id (krai));
+			QSettings ().setValue (saved_ratio_key, ratio_group->id (krai));
 			this->wallet.change_rendering_ratio (rai::kxrb_ratio);
 		}
 	});
 	QObject::connect (rai, &QRadioButton::toggled, [this]() {
 		if (rai->isChecked ())
 		{
-			QSettings().setValue (saved_ratio_key, ratio_group->id (rai));
+			QSettings ().setValue (saved_ratio_key, ratio_group->id (rai));
 			this->wallet.change_rendering_ratio (rai::xrb_ratio);
 		}
 	});
-	auto selected_ratio_id (QSettings().value (saved_ratio_key, ratio_group->id (mrai)).toInt ());
+	auto selected_ratio_id (QSettings ().value (saved_ratio_key, ratio_group->id (mrai)).toInt ());
 	auto selected_ratio_button = ratio_group->button (selected_ratio_id);
 	assert (selected_ratio_button != nullptr);
 
diff --git a/rai/qt_system/entry.cpp b/rai/qt_system/entry.cpp
index d709237..2581645 100644
--- a/rai/qt_system/entry.cpp
+++ b/rai/qt_system/entry.cpp
@@ -6,9 +6,9 @@
 int main (int argc, char ** argv)
 {
 	QApplication application (argc, argv);
-	QCoreApplication::setOrganizationName("Nano");
-	QCoreApplication::setOrganizationDomain("nano.org");
-	QCoreApplication::setApplicationName("Nano Wallet");
+	QCoreApplication::setOrganizationName ("Nano");
+	QCoreApplication::setOrganizationDomain ("nano.org");
+	QCoreApplication::setApplicationName ("Nano Wallet");
 	rai_qt::eventloop_processor processor;
 	static int count (16);
 	rai::system system (24000, count);
@rkeene

This comment has been minimized.

Copy link
Contributor

commented Oct 12, 2018

Be careful running ci/clang-format-all.sh if you don't have a new enough clang-format it'll wipe your working copy :-)

@elliottminns elliottminns force-pushed the elliottminns:feature/qsettings branch from 7aafd2e to 999053d Oct 13, 2018

@elliottminns

This comment has been minimized.

Copy link
Contributor Author

commented Oct 13, 2018

Formatting fixed, @rkeene ty for heads up on ci/clang-format-all.sh!

@cryptocode Sure! Happy to take a look at the new unit labelling.

@cryptocode

This comment has been minimized.

Copy link
Collaborator

commented Oct 17, 2018

@elliottminns I merged your units PR, which means this one will need a rebase.

@elliottminns elliottminns force-pushed the elliottminns:feature/qsettings branch from 999053d to d3b2d4f Oct 17, 2018

@elliottminns

This comment has been minimized.

Copy link
Contributor Author

commented Oct 17, 2018

@cryptocode rebased.

@cryptocode cryptocode merged commit d3e6757 into nanocurrency:master Oct 19, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.