* \brief Page for the 'General' settings of the Labplot settings dialog. */
| 20 | * \brief Page for the 'General' settings of the Labplot settings dialog. |
| 21 | */ |
| 22 | SettingsGeneralPage::SettingsGeneralPage(QWidget* parent, const QLocale& locale) |
| 23 | : SettingsPage(parent) |
| 24 | , m_defaultSystemLocale(locale) { |
| 25 | ui.setupUi(this); |
| 26 | ui.sbAutoSaveInterval->setSuffix(i18n("min.")); |
| 27 | #ifdef NDEBUG |
| 28 | ui.chkDebugTrace->setVisible(false); |
| 29 | #endif |
| 30 | retranslateUi(); |
| 31 | |
| 32 | connect(ui.cbLoadOnStart, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SettingsGeneralPage::loadOnStartChanged); |
| 33 | connect(ui.cbNewProject, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SettingsGeneralPage::newProjectChanged); |
| 34 | connect(ui.cbNewProjectNotebook, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SettingsGeneralPage::changed); |
| 35 | connect(ui.cbDockWindowPositionReopen, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SettingsGeneralPage::changed); |
| 36 | connect(ui.cbLoadOnStart, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SettingsGeneralPage::changed); |
| 37 | connect(ui.cbTitleBar, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SettingsGeneralPage::changed); |
| 38 | connect(ui.cbUnits, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SettingsGeneralPage::changed); |
| 39 | connect(ui.cbNumberFormat, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SettingsGeneralPage::changed); |
| 40 | connect(ui.chkGUMTerms, &QCheckBox::toggled, this, &SettingsGeneralPage::changed); |
| 41 | connect(ui.chkOmitGroupSeparator, &QCheckBox::toggled, this, &SettingsGeneralPage::changed); |
| 42 | connect(ui.chkOmitLeadingZeroInExponent, &QCheckBox::toggled, this, &SettingsGeneralPage::changed); |
| 43 | connect(ui.chkIncludeTrailingZeroesAfterDot, &QCheckBox::toggled, this, &SettingsGeneralPage::changed); |
| 44 | connect(ui.chkUseHyphen, &QCheckBox::toggled, this, &SettingsGeneralPage::changed); |
| 45 | connect(ui.chkAutoSave, &QCheckBox::toggled, this, &SettingsGeneralPage::autoSaveChanged); |
| 46 | connect(ui.chkSaveDockStates, &QCheckBox::toggled, this, &SettingsGeneralPage::changed); |
| 47 | connect(ui.chkSaveCalculations, &QCheckBox::toggled, this, &SettingsGeneralPage::changed); |
| 48 | connect(ui.chkCompatible, &QCheckBox::toggled, this, &SettingsGeneralPage::changed); |
| 49 | connect(ui.chkInfoTrace, &QCheckBox::toggled, this, &SettingsGeneralPage::changed); |
| 50 | connect(ui.chkDebugTrace, &QCheckBox::toggled, this, &SettingsGeneralPage::changed); |
| 51 | connect(ui.chkPerfTrace, &QCheckBox::toggled, this, &SettingsGeneralPage::changed); |
| 52 | |
| 53 | #ifdef HAVE_CANTOR_LIBS |
| 54 | for (auto* backend : Cantor::Backend::availableBackends()) { |
| 55 | if (backend->isEnabled()) |
| 56 | ui.cbNewProjectNotebook->addItem(QIcon::fromTheme(backend->icon()), backend->name()); |
| 57 | } |
| 58 | #endif |
| 59 | |
| 60 | loadSettings(); |
| 61 | autoSaveChanged(ui.chkAutoSave->isChecked()); |
| 62 | } |
| 63 | |
| 64 | QLocale::Language SettingsGeneralPage::numberFormat() const { |
| 65 | return static_cast<QLocale::Language>(ui.cbNumberFormat->currentData().toInt()); |
nothing calls this directly
no test coverage detected