added new override color option for new articles, fixed regression crash from previous commit

This commit is contained in:
Martin Rotter 2022-12-01 09:57:57 +01:00
parent a3a77211d0
commit 1e28d482fc
7 changed files with 46 additions and 26 deletions

View File

@ -7,6 +7,8 @@
<palette>
<color key="FgInteresting">#85ACF6</color>
<color key="FgSelectedInteresting">#D9E3F7</color>
<color key="FgNewMessages">#c684f4</color>
<color key="FgSelectedNewMessages">#d3a3f4</color>
<color key="FgError">#DF5656</color>
<color key="FgSelectedError">#910303</color>
<color key="Allright">#44AA44</color>

View File

@ -6,6 +6,8 @@
<palette>
<color key="FgInteresting">#3A6FE4</color>
<color key="FgSelectedInteresting">#F0F2FC</color>
<color key="FgNewMessages">#cc39e2</color>
<color key="FgSelectedNewMessages">#d57fe2</color>
<color key="FgError">#E74343</color>
<color key="FgSelectedError">#FFD7D7</color>
<color key="Allright">#77dd77</color>

View File

@ -12,8 +12,13 @@
-->
<color key="FgInteresting">#3A4EE4</color>
<color key="FgSelectedInteresting">#ff66cc</color>
<color key="FgNewMessages">#3A4EE4</color>
<color key="FgSelectedNewMessages">#ff66cc</color>
<color key="FgError">#4EE43A</color>
<color key="FgSelectedError">#ff99ff</color>
<color key="Allright">#00ff99</color>
</palette>
</skin>

View File

@ -239,8 +239,9 @@ void Application::performLogging(QtMsgType type, const QMessageLogContext& conte
}
}
qApp->displayLogMessageInDialog(console_message);
if (qApp != nullptr) {
qApp->displayLogMessageInDialog(console_message);
}
if (type == QtMsgType::QtFatalMsg) {
qApp->exit(EXIT_FAILURE);
}

View File

@ -478,7 +478,6 @@ QString SkinEnums::palleteColorText(PaletteColors col) {
case SkinEnums::PaletteColors::FgSelectedInteresting:
return QObject::tr("interesting stuff (highlighted)");
;
case SkinEnums::PaletteColors::FgError:
return QObject::tr("errored items");
@ -486,6 +485,12 @@ QString SkinEnums::palleteColorText(PaletteColors col) {
case SkinEnums::PaletteColors::FgSelectedError:
return QObject::tr("errored items (highlighted)");
case SkinEnums::PaletteColors::FgNewMessages:
return QObject::tr("items with new articles");
case SkinEnums::PaletteColors::FgSelectedNewMessages:
return QObject::tr("items with new articles (highlighted)");
case SkinEnums::PaletteColors::Allright:
return QObject::tr("OK-ish color");

View File

@ -17,7 +17,7 @@
class RootItem;
class SkinEnums : public QObject {
Q_OBJECT
Q_OBJECT
public:
enum class PaletteColors {
@ -34,7 +34,13 @@ class SkinEnums : public QObject {
FgSelectedError = 8,
// OK-ish color (background of list with test results of article filter).
Allright = 16
Allright = 16,
// Foreground color of items with new articles.
FgNewMessages = 32,
// Foreground color of selected items with new articles.
FgSelectedNewMessages = 64
};
static QString palleteColorText(PaletteColors col);
@ -43,24 +49,24 @@ class SkinEnums : public QObject {
};
struct RSSGUARD_DLLSPEC Skin {
QString m_baseName;
QString m_visibleName;
QString m_author;
QString m_version;
QString m_description;
QString m_rawData;
QString m_adblocked;
QString m_layoutMarkupWrapper;
QString m_enclosureImageMarkup;
QString m_layoutMarkup;
QString m_enclosureMarkup;
QHash<SkinEnums::PaletteColors, QColor> m_colorPalette;
QStringList m_forcedStyles;
bool m_forcedSkinColors;
QMultiHash<QPalette::ColorGroup, QPair<QPalette::ColorRole, QPair<QColor, Qt::BrushStyle>>> m_stylePalette;
QString m_baseName;
QString m_visibleName;
QString m_author;
QString m_version;
QString m_description;
QString m_rawData;
QString m_adblocked;
QString m_layoutMarkupWrapper;
QString m_enclosureImageMarkup;
QString m_layoutMarkup;
QString m_enclosureMarkup;
QHash<SkinEnums::PaletteColors, QColor> m_colorPalette;
QStringList m_forcedStyles;
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;
QPalette extractPalette() const;
QVariant colorForModel(SkinEnums::PaletteColors type, bool ignore_custom_colors = false) const;
QPalette extractPalette() const;
};
uint qHash(const SkinEnums::PaletteColors& key);
@ -68,7 +74,7 @@ uint qHash(const SkinEnums::PaletteColors& key);
Q_DECLARE_METATYPE(Skin)
class RSSGUARD_DLLSPEC SkinFactory : public QObject {
Q_OBJECT
Q_OBJECT
public:
explicit SkinFactory(QObject* parent = nullptr);
@ -104,7 +110,6 @@ class RSSGUARD_DLLSPEC SkinFactory : public QObject {
QString currentStyle() const;
private:
// Loads the skin from given skin_data.
void loadSkinFromData(const Skin& skin);

View File

@ -59,7 +59,7 @@ QVariant Feed::data(int column, int role) const {
case HIGHLIGHTED_FOREGROUND_TITLE_ROLE:
switch (status()) {
case Status::NewMessages:
return qApp->skins()->currentSkin().colorForModel(SkinEnums::PaletteColors::FgSelectedInteresting);
return qApp->skins()->currentSkin().colorForModel(SkinEnums::PaletteColors::FgSelectedNewMessages);
case Status::Normal:
if (countOfUnreadMessages() > 0) {
@ -82,7 +82,7 @@ QVariant Feed::data(int column, int role) const {
case Qt::ItemDataRole::ForegroundRole:
switch (status()) {
case Status::NewMessages:
return qApp->skins()->currentSkin().colorForModel(SkinEnums::PaletteColors::FgInteresting);
return qApp->skins()->currentSkin().colorForModel(SkinEnums::PaletteColors::FgNewMessages);
case Status::Normal:
if (countOfUnreadMessages() > 0) {