Disable modification buttons for builtin color themes (#1615)

This commit is contained in:
optizone 2019-06-21 18:27:21 +03:00 committed by Itay Cohen
parent 594896c06f
commit 8138a43923
2 changed files with 12 additions and 4 deletions

View File

@ -61,9 +61,7 @@ AppearanceOptionsWidget::AppearanceOptionsWidget(PreferencesDialog *dialog)
&AppearanceOptionsWidget::updateFontFromConfig);
connect(ui->colorComboBox, &QComboBox::currentTextChanged,
this, [this](const QString &str) {
ui->editButton->setEnabled(ThemeWorker().isCustomTheme(str));
});
this, &AppearanceOptionsWidget::updateModificationButtons);
}
AppearanceOptionsWidget::~AppearanceOptionsWidget() {}
@ -90,7 +88,7 @@ void AppearanceOptionsWidget::updateThemeFromConfig(bool interfaceThemeChanged)
}
ui->themeComboBox->setCurrentIndex(currInterfaceThemeIndex);
ui->colorComboBox->updateFromConfig(interfaceThemeChanged);
ui->editButton->setEnabled(ThemeWorker().isCustomTheme(ui->colorComboBox->currentText()));
updateModificationButtons(ui->colorComboBox->currentText());
}
void AppearanceOptionsWidget::on_fontSelectionButton_clicked()
@ -245,6 +243,14 @@ void AppearanceOptionsWidget::onLanguageComboBoxCurrentIndexChanged(int index)
qWarning() << tr("Cannot set language, not found in available ones");
}
void AppearanceOptionsWidget::updateModificationButtons(const QString& theme)
{
bool editable = ThemeWorker().isCustomTheme(theme);
ui->editButton->setEnabled(editable);
ui->deleteButton->setEnabled(editable);
ui->renameButton->setEnabled(editable);
}
QIcon AppearanceOptionsWidget::getIconFromSvg(const QString& fileName, const QColor& after, const QColor& before)
{
QFile file(fileName);

View File

@ -53,6 +53,8 @@ private slots:
void on_editButton_clicked();
void onLanguageComboBoxCurrentIndexChanged(int index);
void updateModificationButtons(const QString& theme);
/**
* @brief Changes all @a before colors in given @a fileName svg file to @a after