src/dialogs/configdialog.cpp

changeset 1323
05b3e173c900
parent 1319
39d7a9642eea
child 1326
69a90bd2dba2
equal deleted inserted replaced
1322:d8935cdb24c0 1323:05b3e173c900
72 72
73 ConfigDialog::ConfigDialog (QWidget* parent, ConfigDialog::Tab defaulttab, Qt::WindowFlags f) : 73 ConfigDialog::ConfigDialog (QWidget* parent, ConfigDialog::Tab defaulttab, Qt::WindowFlags f) :
74 QDialog (parent, f), 74 QDialog (parent, f),
75 HierarchyElement (parent), 75 HierarchyElement (parent),
76 ui (*new Ui_ConfigDialog), 76 ui (*new Ui_ConfigDialog),
77 m_settings (MainWindow::makeSettings (this)), 77 libraries {config::libraries()},
78 libraries {::config->libraries()},
79 librariesModel {new LibrariesModel {this->libraries, this}} 78 librariesModel {new LibrariesModel {this->libraries, this}}
80 { 79 {
81 ui.setupUi (this); 80 ui.setupUi (this);
82 ui.librariesView->setModel(this->librariesModel); 81 ui.librariesView->setModel(this->librariesModel);
83 82
84 // Set defaults 83 // Set defaults
85 applyToWidgetOptions([&](QWidget* widget, QString confname) 84 applyToWidgetOptions([&](QWidget* widget, QString confname)
86 { 85 {
87 QVariant value = m_settings->value (confname, m_config->defaultValueByName (confname)); 86 QVariant value = ::settingsObject().value(confname, config::defaults().value(confname));
88 QLineEdit* lineedit; 87 QLineEdit* lineedit;
89 QSpinBox* spinbox; 88 QSpinBox* spinbox;
90 QDoubleSpinBox* doublespinbox; 89 QDoubleSpinBox* doublespinbox;
91 QSlider* slider; 90 QSlider* slider;
92 QCheckBox* checkbox; 91 QCheckBox* checkbox;
274 if (not widget->objectName().startsWith ("config")) 273 if (not widget->objectName().startsWith ("config"))
275 continue; 274 continue;
276 275
277 QString optionname (widget->objectName().mid (strlen ("config"))); 276 QString optionname (widget->objectName().mid (strlen ("config")));
278 277
279 if (m_config->existsEntry (optionname)) 278 if (config::exists(optionname))
280 func (widget, optionname); 279 func (widget, optionname);
281 else 280 else
282 print ("Couldn't find configuration entry named %1", optionname); 281 print ("Couldn't find configuration entry named %1", optionname);
283 } 282 }
284 } 283 }
314 { 313 {
315 print ("Unknown widget of type %1\n", widget->metaObject()->className()); 314 print ("Unknown widget of type %1\n", widget->metaObject()->className());
316 return; 315 return;
317 } 316 }
318 317
319 m_settings->setValue (confname, value); 318 settingsObject().setValue(confname, value);
320 }); 319 });
321 320
322 // Rebuild the quick color toolbar 321 // Rebuild the quick color toolbar
323 m_window->setQuickColors (quickColors); 322 m_window->setQuickColors (quickColors);
324 m_config->setQuickColorToolbar (quickColorString()); 323 config::setQuickColorToolbar (quickColorString());
325 ::config->setLibraries(this->libraries); 324 config::setLibraries(this->libraries);
326 325
327 // Ext program settings 326 // Ext program settings
328 for (int i = 0; i < NumExternalPrograms; ++i) 327 for (int i = 0; i < NumExternalPrograms; ++i)
329 { 328 {
330 ExtProgramType program = (ExtProgramType) i; 329 ExtProgramType program = (ExtProgramType) i;
341 { 340 {
342 auto item = static_cast<ShortcutListItem*> (ui.shortcutsList->item (i)); 341 auto item = static_cast<ShortcutListItem*> (ui.shortcutsList->item (i));
343 item->action()->setShortcut (item->sequence()); 342 item->action()->setShortcut (item->sequence());
344 } 343 }
345 344
346 m_window->syncSettings(); 345 settingsObject().sync();
347 m_documents->loadLogoedStuds(); 346 m_documents->loadLogoedStuds();
348 m_window->renderer()->setBackground(); 347 m_window->renderer()->setBackground();
349 m_window->doFullRefresh(); 348 m_window->doFullRefresh();
350 m_window->updateDocumentList(); 349 m_window->updateDocumentList();
351 } 350 }

mercurial