This commit is contained in:
DavidXanatos 2022-07-20 20:54:09 +02:00
parent 5e0f8c50af
commit 4f7c43a438
3 changed files with 21 additions and 4 deletions

View File

@ -483,7 +483,7 @@
<item row="8" column="1">
<widget class="QComboBox" name="cmbFontScale">
<property name="editable">
<bool>false</bool>
<bool>true</bool>
</property>
</widget>
</item>

View File

@ -464,6 +464,9 @@ void CSandMan::CreateMenus(bool bAdvanced)
m_pMenuSettings = m_pMenuOptions->addAction(CSandMan::GetIcon("Settings"), tr("Global Settings"), this, SLOT(OnSettings()));
m_pMenuResetMsgs = m_pMenuOptions->addAction(tr("Reset all hidden messages"), this, SLOT(OnResetMsgs()));
m_pMenuResetGUI = m_pMenuOptions->addAction(tr("Reset all GUI options"), this, SLOT(OnResetGUI()));
m_pMenuResetGUI->setShortcut(QKeySequence("Ctrl+Shift+R"));
m_pMenuResetGUI->setShortcutContext(Qt::WidgetWithChildrenShortcut);
this->addAction(m_pMenuResetGUI);
m_pMenuOptions->addSeparator();
m_pEditIni = m_pMenuOptions->addAction(CSandMan::GetIcon("EditIni"), tr("Edit ini file"), this, SLOT(OnEditIni()));
m_pReloadIni = m_pMenuOptions->addAction(CSandMan::GetIcon("ReloadIni"), tr("Reload ini file"), this, SLOT(OnReloadIni()));
@ -577,6 +580,9 @@ void CSandMan::CreateOldMenus()
m_pMenuResetMsgs = m_pMenuOptions->addAction(tr("Reset all hidden messages"), this, SLOT(OnResetMsgs()));
m_pMenuResetGUI = m_pMenuOptions->addAction(tr("Reset all GUI options"), this, SLOT(OnResetGUI()));
m_pMenuResetGUI->setShortcut(QKeySequence("Ctrl+Shift+R"));
m_pMenuResetGUI->setShortcutContext(Qt::WidgetWithChildrenShortcut);
this->addAction(m_pMenuResetGUI);
m_pMenuOptions->addSeparator();
QAction* m_pConfigLock = m_pMenuOptions->addAction(CSandMan::GetIcon("Lock"), tr("Lock Configuration"), this, SLOT(OnSettingsAction()));
m_pConfigLock->setData(CSettingsWindow::eConfigLock);
@ -2032,6 +2038,10 @@ void CSandMan::UpdateSettings(bool bRebuildUI)
StoreState();
this->removeAction(m_pRefreshAll);
this->removeAction(m_pMenuBrowse);
this->removeAction(m_pMenuResetGUI);
m_pMainWidget->deleteLater();
m_pMainWidget = new QWidget(this);
CreateUI();

View File

@ -128,7 +128,7 @@ CSettingsWindow::CSettingsWindow(QWidget *parent)
int FontScales[] = { 75,100,125,150,175,200,225,250,275,300,350,400, 0 };
for(int* pFontScales = FontScales; *pFontScales != 0; pFontScales++)
ui.cmbFontScale->addItem(tr("%1 %").arg(*pFontScales), *pFontScales);
ui.cmbFontScale->addItem(tr("%1").arg(*pFontScales), *pFontScales);
QSettings settings("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", QSettings::NativeFormat);
if (settings.value("CurrentBuild").toInt() >= 22000) { // Windows 11
@ -150,6 +150,7 @@ CSettingsWindow::CSettingsWindow(QWidget *parent)
//connect(ui.chkOptTree, SIGNAL(stateChanged(int)), this, SLOT(OnChangeGUI()));
connect(ui.chkColorIcons, SIGNAL(stateChanged(int)), this, SLOT(OnChangeGUI()));
connect(ui.cmbFontScale, SIGNAL(currentIndexChanged(int)), this, SLOT(OnChangeGUI()));
connect(ui.cmbFontScale, SIGNAL(currentTextChanged(const QString&)), this, SLOT(OnChangeGUI()));
m_bRebuildUI = false;
@ -330,7 +331,8 @@ void CSettingsWindow::LoadSettings()
ui.chkOptTree->setCheckState(CSettingsWindow__Int2Chk(theConf->GetInt("Options/OptionTree", 2)));
ui.chkColorIcons->setChecked(theConf->GetBool("Options/ColorBoxIcons", false));
ui.cmbFontScale->setCurrentIndex(ui.cmbFontScale->findData(theConf->GetInt("Options/FontScaling", 100)));
//ui.cmbFontScale->setCurrentIndex(ui.cmbFontScale->findData(theConf->GetInt("Options/FontScaling", 100)));
ui.cmbFontScale->setCurrentText(QString::number(theConf->GetInt("Options/FontScaling", 100)));
ui.chkNotifications->setChecked(theConf->GetBool("Options/ShowNotifications", true));
@ -471,7 +473,12 @@ void CSettingsWindow::SaveSettings()
theConf->SetValue("Options/OptionTree", CSettingsWindow__Chk2Int(ui.chkOptTree->checkState()));
theConf->SetValue("Options/ColorBoxIcons", ui.chkColorIcons->isChecked());
theConf->SetValue("Options/FontScaling", ui.cmbFontScale->currentData());
int Scaling = ui.cmbFontScale->currentText().toInt();
if (Scaling < 75)
Scaling = 75;
else if (Scaling > 500)
Scaling = 500;
theConf->SetValue("Options/FontScaling", Scaling);
AutorunEnable(ui.chkAutoStart->isChecked());