force UI colors -> use skin colors + related adjustments

This commit is contained in:
Martin Rotter 2022-03-15 06:49:05 +01:00
parent 5f14f2cc82
commit 2ef9a373b3
10 changed files with 26 additions and 20 deletions

View File

@ -26,7 +26,7 @@
<url type="donation">https://github.com/sponsors/martinrotter</url>
<content_rating type="oars-1.1" />
<releases>
<release version="4.1.2" date="2022-03-14"/>
<release version="4.1.2" date="2022-03-15"/>
</releases>
<content_rating type="oars-1.0">
<content_attribute id="violence-cartoon">none</content_attribute>

View File

@ -11,7 +11,7 @@
<color key="FgSelectedError">#910303</color>
<color key="Allright">#44AA44</color>
</palette>
<forced-style-palette>false</forced-style-palette>
<forced-skin-colors>false</forced-skin-colors>
<style-palette>
<group id="All">
<color role="Base">#373A3D</color>

View File

@ -2025,6 +2025,9 @@ void DatabaseQueries::createOverwriteFeed(const QSqlDatabase& db, Feed* feed, in
}
}
// TODO: pokus se kanál přesouvá mezi kategoriemi či rootem
// je třeba nejdříve kanál přesunout na dno a pak ho vložit do nové kategorie
q.prepare("UPDATE Feeds "
"SET title = :title, ordr = :ordr, description = :description, date_created = :date_created, "
" icon = :icon, category = :category, source = :source, update_type = :update_type, "

View File

@ -30,7 +30,7 @@ SettingsGui::SettingsGui(Settings* settings, QWidget* parent) : SettingsPanel(se
m_ui->m_editorFeedsToolbar->availableItemsWidget()->viewport()->installEventFilter(this);
m_ui->m_treeSkins->setColumnCount(4);
m_ui->m_treeSkins->setHeaderHidden(false);
m_ui->m_treeSkins->setHeaderLabels({ tr("Name"), tr("Author"), tr("Forced style"), tr("Forced UI colors") });
m_ui->m_treeSkins->setHeaderLabels({ tr("Name"), tr("Author"), tr("Forced style"), tr("Forced skin colors") });
m_ui->m_tabUi->setTabVisible(m_ui->m_tabUi->indexOf(m_ui->m_tabTaskBar),
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) || defined(Q_OS_WIN)
@ -122,12 +122,12 @@ void SettingsGui::updateSkinOptions() {
}
const Skin skin = it->data(0, Qt::ItemDataRole::UserRole).value<Skin>();
const bool skin_has_palette = !skin.m_stylePalette.isEmpty();
const bool skin_forces_palette = skin.m_forcedStylePalette;
const bool skin_has_palette_or_css = !skin.m_stylePalette.isEmpty() || !skin.m_rawData.isEmpty();
const bool skin_forces_palette = skin.m_forcedSkinColors;
const bool skin_forces_style = !skin.m_forcedStyles.isEmpty();
m_ui->m_cmbStyles->setEnabled(!qApp->skins()->styleIsFrozen() && !skin_forces_style);
m_ui->m_checkForceAlternativePalette->setEnabled(skin_has_palette && !skin_forces_palette);
m_ui->m_checkForceAlternativePalette->setEnabled(skin_has_palette_or_css && !skin_forces_palette);
}
void SettingsGui::loadSettings() {
@ -192,7 +192,7 @@ void SettingsGui::loadSettings() {
m_ui->m_cmbStyles->setCurrentIndex(item_style);
}
m_ui->m_checkForceAlternativePalette->setChecked(settings()->value(GROUP(GUI), SETTING(GUI::ForceSkinPalette)).toBool());
m_ui->m_checkForceAlternativePalette->setChecked(settings()->value(GROUP(GUI), SETTING(GUI::ForcedSkinColors)).toBool());
// Load skin.
const QString selected_skin = qApp->skins()->selectedSkinName();
@ -219,7 +219,7 @@ void SettingsGui::loadSettings() {
new_item->setIcon(2, qApp->icons()->fromTheme(QSL("dialog-cancel"), QSL("gtk-cancel")));
}
new_item->setIcon(3, skin.m_forcedStylePalette
new_item->setIcon(3, skin.m_forcedSkinColors
? qApp->icons()->fromTheme(QSL("dialog-yes"), QSL("dialog-ok"))
: qApp->icons()->fromTheme(QSL("dialog-cancel"), QSL("gtk-cancel")));
@ -403,7 +403,7 @@ void SettingsGui::saveSettings() {
}
if (m_ui->m_checkForceAlternativePalette->isEnabled()) {
settings()->setValue(GROUP(GUI), GUI::ForceSkinPalette, m_ui->m_checkForceAlternativePalette->isChecked());
settings()->setValue(GROUP(GUI), GUI::ForcedSkinColors, m_ui->m_checkForceAlternativePalette->isChecked());
}
// Save tab settings.

View File

@ -109,7 +109,7 @@
<item row="2" column="1">
<widget class="QCheckBox" name="m_checkForceAlternativePalette">
<property name="text">
<string>Force UI colors defined in skin</string>
<string>Use skin colors</string>
</property>
</widget>
</item>

View File

@ -260,8 +260,8 @@ DVALUE(bool) GUI::HideMainWindowWhenMinimizedDef = false;
DKEY GUI::MonochromeTrayIcon = "monochrome_tray_icon";
DVALUE(bool) GUI::MonochromeTrayIconDef = false;
DKEY GUI::ForceSkinPalette = "force_skin_palette";
DVALUE(bool) GUI::ForceSkinPaletteDef = true;
DKEY GUI::ForcedSkinColors = "forced_skin_colors";
DVALUE(bool) GUI::ForcedSkinColorsDef = true;
DKEY GUI::UnreadNumbersInTrayIcon = "show_unread_numbers_in_tray_icon";
DVALUE(bool) GUI::UnreadNumbersInTrayIconDef = true;

View File

@ -258,8 +258,8 @@ namespace GUI {
KEY HideMainWindowWhenMinimized;
VALUE(bool) HideMainWindowWhenMinimizedDef;
KEY ForceSkinPalette;
VALUE(bool) ForceSkinPaletteDef;
KEY ForcedSkinColors;
VALUE(bool) ForcedSkinColorsDef;
KEY AlternateRowColorsInLists;
VALUE(bool) AlternateRowColorsInListsDef;

View File

@ -84,9 +84,12 @@ void SkinFactory::loadSkinFromData(const Skin& skin) {
// they specifically set object name to style name.
m_currentStyle = qApp->style()->objectName();
const bool use_skin_colors = skin.m_forcedSkinColors ||
qApp->settings()->value(GROUP(GUI), SETTING(GUI::ForcedSkinColors)).toBool();
if (isStyleGoodForAlternativeStylePalette(m_currentStyle) &&
!skin.m_stylePalette.isEmpty() &&
(skin.m_forcedStylePalette || qApp->settings()->value(GROUP(GUI), SETTING(GUI::ForceSkinPalette)).toBool())) {
use_skin_colors) {
qDebugNN << LOGSEC_GUI << "Activating alternative palette.";
QPalette pal = skin.extractPalette();
@ -96,7 +99,7 @@ void SkinFactory::loadSkinFromData(const Skin& skin) {
}
if (!skin.m_rawData.isEmpty()) {
if (qApp->styleSheet().simplified().isEmpty()) {
if (qApp->styleSheet().simplified().isEmpty() && use_skin_colors) {
qApp->setStyleSheet(skin.m_rawData);
}
else {
@ -218,8 +221,8 @@ Skin SkinFactory::skinInfo(const QString& skin_name, bool* ok) const {
QString::SplitBehavior::SkipEmptyParts);
#endif
skin.m_forcedStylePalette = skin_node.namedItem(QSL("forced-style-palette")).toElement().text() ==
QVariant(true).toString();
skin.m_forcedSkinColors = skin_node.namedItem(QSL("forced-skin-colors")).toElement().text() ==
QVariant(true).toString();
QDomElement style_palette_root = skin_node.namedItem(QSL("style-palette")).toElement();

View File

@ -52,7 +52,7 @@ struct RSSGUARD_DLLSPEC Skin {
QString m_enclosureMarkup;
QHash<SkinEnums::PaletteColors, QColor> m_colorPalette;
QStringList m_forcedStyles;
bool m_forcedStylePalette;
bool m_forcedSkinColors;
QMultiHash<QPalette::ColorGroup, QPair<QPalette::ColorRole, QPair<QColor, Qt::BrushStyle>>> m_stylePalette;
QVariant colorForModel(SkinEnums::PaletteColors type, bool ignore_custom_colors = false) const;

View File

@ -24,7 +24,7 @@ class FormFeedDetails : public QDialog {
virtual ~FormFeedDetails() = default;
template<class T>
T* addEditFeed(T* account_to_edit = nullptr);
T* addEditFeed(T* feed_to_edit = nullptr);
template<class T>
T* feed() const;