-
Notifications
You must be signed in to change notification settings - Fork 269
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
refactor: Pass interfaces::Node references to OptionsModel constructor #601
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -261,7 +261,7 @@ void BitcoinApplication::createPaymentServer() | |
|
||
void BitcoinApplication::createOptionsModel(bool resetSettings) | ||
{ | ||
optionsModel = new OptionsModel(this, resetSettings); | ||
optionsModel = new OptionsModel(node(), this, resetSettings); | ||
} | ||
|
||
void BitcoinApplication::createWindow(const NetworkStyle *networkStyle) | ||
|
@@ -292,7 +292,6 @@ void BitcoinApplication::createNode(interfaces::Init& init) | |
{ | ||
assert(!m_node); | ||
m_node = init.makeNode(); | ||
if (optionsModel) optionsModel->setNode(*m_node); | ||
if (m_splash) m_splash->setNode(*m_node); | ||
} | ||
|
||
|
@@ -633,6 +632,12 @@ int GuiMain(int argc, char* argv[]) | |
// Allow parameter interaction before we create the options model | ||
app.parameterSetup(); | ||
GUIUtil::LogQtInfo(); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This hunk was moved because now |
||
if (gArgs.GetBoolArg("-splash", DEFAULT_SPLASHSCREEN) && !gArgs.GetBoolArg("-min", false)) | ||
app.createSplashScreen(networkStyle.data()); | ||
|
||
app.createNode(*init); | ||
|
||
// Load GUI settings from QSettings | ||
app.createOptionsModel(gArgs.GetBoolArg("-resetguisettings", false)); | ||
|
||
|
@@ -641,11 +646,6 @@ int GuiMain(int argc, char* argv[]) | |
app.InitPruneSetting(prune_MiB); | ||
} | ||
|
||
if (gArgs.GetBoolArg("-splash", DEFAULT_SPLASHSCREEN) && !gArgs.GetBoolArg("-min", false)) | ||
app.createSplashScreen(networkStyle.data()); | ||
|
||
app.createNode(*init); | ||
|
||
int rv = EXIT_SUCCESS; | ||
try | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ class OptionsModel : public QAbstractListModel | |
Q_OBJECT | ||
|
||
public: | ||
explicit OptionsModel(QObject *parent = nullptr, bool resetSettings = false); | ||
explicit OptionsModel(interfaces::Node& node, QObject *parent = nullptr, bool resetSettings = false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems to not be strictly necessary to have to initialize There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nevermind, I see how this is needed in consideration of future changes :D |
||
|
||
enum OptionID { | ||
StartAtStartup, // bool | ||
|
@@ -103,11 +103,10 @@ class OptionsModel : public QAbstractListModel | |
void setRestartRequired(bool fRequired); | ||
bool isRestartRequired() const; | ||
|
||
interfaces::Node& node() const { assert(m_node); return *m_node; } | ||
void setNode(interfaces::Node& node) { assert(!m_node); m_node = &node; } | ||
interfaces::Node& node() const { return m_node; } | ||
|
||
private: | ||
interfaces::Node* m_node = nullptr; | ||
interfaces::Node& m_node; | ||
/* Qt-only settings */ | ||
bool m_show_tray_icon; | ||
bool fMinimizeToTray; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noting that
node()
asserts form_node
.