@@ -89,32 +89,6 @@ void SettingsDialog::initSettings()
89
89
}
90
90
}
91
91
92
- void SettingsDialog::initSettings (const QString& sysroot, const QString& appPath, const QString& extraLibPaths,
93
- const QString& debugPaths, const QString& kallsyms, const QString& arch,
94
- const QString& objdump)
95
- {
96
- auto fromPathString = [](KEditListWidget* listWidget, const QString& string) {
97
- listWidget->setItems (string.split (QLatin1Char (' :' ), Qt::SkipEmptyParts));
98
- };
99
- fromPathString (unwindPage->extraLibraryPaths , extraLibPaths);
100
- fromPathString (unwindPage->debugPaths , debugPaths);
101
-
102
- unwindPage->lineEditSysroot ->setText (sysroot);
103
- unwindPage->lineEditApplicationPath ->setText (appPath);
104
- unwindPage->lineEditKallsyms ->setText (kallsyms);
105
- unwindPage->lineEditObjdump ->setText (objdump);
106
-
107
- int itemIndex = 0 ;
108
- if (!arch.isEmpty ()) {
109
- itemIndex = unwindPage->comboBoxArchitecture ->findText (arch);
110
- if (itemIndex == -1 ) {
111
- itemIndex = unwindPage->comboBoxArchitecture ->count ();
112
- unwindPage->comboBoxArchitecture ->addItem (arch);
113
- }
114
- }
115
- unwindPage->comboBoxArchitecture ->setCurrentIndex (itemIndex);
116
- }
117
-
118
92
QString SettingsDialog::sysroot () const
119
93
{
120
94
return unwindPage->lineEditSysroot ->text ();
@@ -188,6 +162,33 @@ void SettingsDialog::addPathSettingsPage()
188
162
auto * label = new QLabel (this );
189
163
label->setText (tr (" Config:" ));
190
164
165
+ auto loadFromSettings = [this ]() {
166
+ auto settings = Settings::instance ();
167
+ auto fromPathString = [](KEditListWidget* listWidget, const QString& string) {
168
+ listWidget->setItems (string.split (QLatin1Char (' :' ), Qt::SkipEmptyParts));
169
+ };
170
+ fromPathString (unwindPage->extraLibraryPaths , settings->extraLibPaths ());
171
+ fromPathString (unwindPage->debugPaths , settings->debugPaths ());
172
+
173
+ unwindPage->lineEditSysroot ->setText (settings->sysroot ());
174
+ unwindPage->lineEditApplicationPath ->setText (settings->appPath ());
175
+ unwindPage->lineEditKallsyms ->setText (settings->kallsyms ());
176
+ unwindPage->lineEditObjdump ->setText (settings->objdump ());
177
+
178
+ const auto arch = settings->arch ();
179
+ int itemIndex = 0 ;
180
+ if (!arch.isEmpty ()) {
181
+ itemIndex = unwindPage->comboBoxArchitecture ->findText (arch);
182
+ if (itemIndex == -1 ) {
183
+ itemIndex = unwindPage->comboBoxArchitecture ->count ();
184
+ unwindPage->comboBoxArchitecture ->addItem (arch);
185
+ }
186
+ }
187
+ unwindPage->comboBoxArchitecture ->setCurrentIndex (itemIndex);
188
+ };
189
+
190
+ loadFromSettings ();
191
+
191
192
auto saveFunction = [this ](KConfigGroup group) {
192
193
group.writeEntry (" sysroot" , sysroot ());
193
194
group.writeEntry (" appPath" , appPath ());
@@ -198,16 +199,26 @@ void SettingsDialog::addPathSettingsPage()
198
199
group.writeEntry (" objdump" , objdump ());
199
200
};
200
201
201
- auto restoreFunction = [this ](const KConfigGroup& group) {
202
+ auto restoreFunction = [this , loadFromSettings](const KConfigGroup& group) {
203
+ ::config ().writeEntry(" lastUsed" , m_configs->currentConfig ());
204
+ auto settings = Settings::instance();
205
+
202
206
const auto sysroot = group.readEntry (" sysroot" );
207
+ settings->setSysroot (sysroot);
203
208
const auto appPath = group.readEntry (" appPath" );
209
+ settings->setAppPath (appPath);
204
210
const auto extraLibPaths = group.readEntry (" extraLibPaths" );
211
+ settings->setExtraLibPaths (extraLibPaths);
205
212
const auto debugPaths = group.readEntry (" debugPaths" );
213
+ settings->setDebugPaths (debugPaths);
206
214
const auto kallsyms = group.readEntry (" kallsyms" );
215
+ settings->setKallsyms (kallsyms);
207
216
const auto arch = group.readEntry (" arch" );
217
+ settings->setArch (arch);
208
218
const auto objdump = group.readEntry (" objdump" );
209
- initSettings (sysroot, appPath, extraLibPaths, debugPaths, kallsyms, arch, objdump);
210
- ::config ().writeEntry(" lastUsed" , m_configs->currentConfig ());
219
+ settings->setObjdump (objdump);
220
+
221
+ loadFromSettings ();
211
222
};
212
223
213
224
m_configs = new MultiConfigWidget (this );
0 commit comments