config: save style

This commit is contained in:
itsmattkc
2020-08-10 21:37:04 +10:00
parent 03e33227b3
commit 08d4c7b385
6 changed files with 43 additions and 85 deletions
@@ -44,19 +44,19 @@ PreferencesAppearanceTab::PreferencesAppearanceTab()
// Appearance -> Theme
appearance_layout->addWidget(new QLabel(tr("Theme")), row, 0);
style_ = new QComboBox();
style_combobox_ = new QComboBox();
style_list_ = StyleManager::ListInternal();
const QMap<QString, QString>& themes = StyleManager::available_themes();
QMap<QString, QString>::const_iterator i;
for (i=themes.cbegin(); i!=themes.cend(); i++) {
style_combobox_->addItem(i.value(), i.key());
foreach (const StyleDescriptor& s, style_list_) {
style_->addItem(s.name(), s.path());
if (s.path() == StyleManager::GetStyle()) {
style_->setCurrentIndex(style_->count()-1);
if (StyleManager::GetStyle() == i.key()) {
style_combobox_->setCurrentIndex(style_combobox_->count()-1);
}
}
appearance_layout->addWidget(style_, row, 1);
appearance_layout->addWidget(style_combobox_, row, 1);
row++;
@@ -89,7 +89,7 @@ PreferencesAppearanceTab::PreferencesAppearanceTab()
void PreferencesAppearanceTab::Accept()
{
QString style_path = style_->currentData().toString();
QString style_path = style_combobox_->currentData().toString();
if (style_path != StyleManager::GetStyle()) {
StyleManager::SetStyle(style_path);
@@ -49,14 +49,7 @@ private:
/**
* @brief UI widget for selecting the current UI style
*/
QComboBox* style_;
/**
* @brief List of internal styles
*/
QList<StyleDescriptor> style_list_;
QString custom_style_path_;
QComboBox* style_combobox_;
QList<QColor> colors_;