1
0
Fork 0

Show the current theme with a checkbox

This commit is contained in:
Duncan Ogilvie 2022-07-10 15:05:25 +02:00
parent 08c4941784
commit 3d949b9847
2 changed files with 15 additions and 0 deletions

View File

@ -611,18 +611,27 @@ void MainWindow::setupThemesMenu()
{
return QFile(str).exists();
};
char selectedTheme[MAX_SETTING_SIZE];
BridgeSettingGet("Theme", "Selected", selectedTheme);
QDirIterator it(QString("%1/../themes").arg(QCoreApplication::applicationDirPath()), QDir::NoDotAndDotDot | QDir::Dirs);
auto actionGroup = new QActionGroup(ui->menuTheme);
actionGroup->addAction(ui->actionDefaultTheme);
while(it.hasNext())
{
auto dir = it.next();
auto nameIdx = dir.lastIndexOf('/');
auto name = dir.mid(nameIdx + 1);
// The Default theme folder is a hidden theme to override the default theme
if(name == "Default")
continue;
auto action = ui->menuTheme->addAction(name);
connect(action, SIGNAL(triggered()), this, SLOT(themeTriggeredSlot()));
action->setText(name);
action->setData(dir);
action->setCheckable(true);
actionGroup->addAction(action);
if(name == selectedTheme)
action->setChecked(true);
}
}

View File

@ -1470,6 +1470,12 @@
</property>
</action>
<action name="actionDefaultTheme">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;Default</string>
</property>