- enhancement: theme now have default icon set

- fix: wrong icons for file associations
This commit is contained in:
Roy Qu 2022-02-01 21:39:31 +08:00
parent 476899022f
commit 9e3f593641
10 changed files with 39 additions and 2 deletions

View File

@ -9,6 +9,8 @@ Red Panda C++ Version 0.14.1
- enhancement: new header dialog for project - enhancement: new header dialog for project
- enhancement: new contrast icon set, contributed by Alan-CRL - enhancement: new contrast icon set, contributed by Alan-CRL
- enhancement: new contrast theme, contributed by Alan-CRL - enhancement: new contrast theme, contributed by Alan-CRL
- enhancement: theme now have default icon set
- fix: wrong icons for file associations
Red Panda C++ Version 0.14.0 Red Panda C++ Version 0.14.0
- enhancement: custom icon set ( in the configuration folder) - enhancement: custom icon set ( in the configuration folder)

View File

@ -381,7 +381,7 @@ RESOURCES += \
icons.qrc \ icons.qrc \
translations.qrc translations.qrc
RC_ICONS = images/devcpp.ico images/associations/c.ico images/associations/cpp.ico images/associations/h.ico images/associations/hpp.ico images/associations/dev.ico RC_ICONS = images/devcpp.ico images/associations/c.ico images/associations/cpp.ico images/associations/dev.ico images/associations/c.ico images/associations/cpp.ico images/associations/h.ico images/associations/hpp.ico
# fixed lrelease.prf # fixed lrelease.prf

View File

@ -2902,7 +2902,7 @@ void Settings::Environment::doLoad()
mInterfaceFont = stringValue("interface_font",defaultFontName); mInterfaceFont = stringValue("interface_font",defaultFontName);
mInterfaceFontSize = intValue("interface_font_size",12); mInterfaceFontSize = intValue("interface_font_size",12);
mLanguage = stringValue("language", QLocale::system().name()); mLanguage = stringValue("language", QLocale::system().name());
mIconSet = stringValue("icon_set","newlook"); mIconSet = stringValue("icon_set","contrast");
mUseCustomIconSet = boolValue("use_custom_icon_set", false); mUseCustomIconSet = boolValue("use_custom_icon_set", false);
mUseCustomTheme = boolValue("use_custom_theme", false); mUseCustomTheme = boolValue("use_custom_theme", false);

View File

@ -101,3 +101,18 @@ void EnvironmentAppearenceWidget::init()
} }
SettingsWidget::init(); SettingsWidget::init();
} }
void EnvironmentAppearenceWidget::on_cbTheme_currentIndexChanged(int /* index */)
{
ThemeManager themeManager;
PAppTheme appTheme = themeManager.theme(ui->cbTheme->currentData().toString());
if (appTheme && !appTheme->defaultIconSet().isEmpty()) {
for (int i=0; i<ui->cbIconSet->count();i++) {
if (ui->cbIconSet->itemData(i) == appTheme->defaultIconSet()) {
ui->cbIconSet->setCurrentIndex(i);
break;
}
}
}
}

View File

@ -43,6 +43,8 @@ protected:
// SettingsWidget interface // SettingsWidget interface
public: public:
void init() override; void init() override;
private slots:
void on_cbTheme_currentIndexChanged(int index);
}; };
#endif // ENVIRONMENTAPPEARENCEWIDGET_H #endif // ENVIRONMENTAPPEARENCEWIDGET_H

View File

@ -196,6 +196,7 @@ void AppTheme::load(const QString &filename)
mDisplayName = localeName; mDisplayName = localeName;
mIsDark = obj["isDark"].toBool(false); mIsDark = obj["isDark"].toBool(false);
mDefaultColorScheme = obj["default scheme"].toString(); mDefaultColorScheme = obj["default scheme"].toString();
mDefaultIconSet = obj["default iconset"].toString();
QJsonObject colors = obj["palette"].toObject(); QJsonObject colors = obj["palette"].toObject();
const QMetaObject &m = *metaObject(); const QMetaObject &m = *metaObject();
QMetaEnum e = m.enumerator(m.indexOfEnumerator("ColorRole")); QMetaEnum e = m.enumerator(m.indexOfEnumerator("ColorRole"));
@ -237,6 +238,16 @@ QPalette AppTheme::initialPalette()
return palette; return palette;
} }
const QString &AppTheme::defaultIconSet() const
{
return mDefaultIconSet;
}
void AppTheme::setDefaultIconSet(const QString &newDefaultIconSet)
{
mDefaultIconSet = newDefaultIconSet;
}
const QString &AppTheme::name() const const QString &AppTheme::name() const
{ {
return mName; return mName;

View File

@ -89,6 +89,9 @@ public:
const QString &name() const; const QString &name() const;
const QString &defaultIconSet() const;
void setDefaultIconSet(const QString &newDefaultIconSet);
private: private:
static QPalette initialPalette(); static QPalette initialPalette();
private: private:
@ -97,6 +100,7 @@ private:
QString mDisplayName; QString mDisplayName;
bool mIsDark; bool mIsDark;
QString mDefaultColorScheme; QString mDefaultColorScheme;
QString mDefaultIconSet;
}; };
using PAppTheme = std::shared_ptr<AppTheme>; using PAppTheme = std::shared_ptr<AppTheme>;

View File

@ -3,6 +3,7 @@
"name_zh_CN": "高对比度主题", "name_zh_CN": "高对比度主题",
"isDark": true, "isDark": true,
"default scheme": "Twilight", "default scheme": "Twilight",
"default iconset": "contrast",
"palette": { "palette": {
"PaletteWindow":"#000000", "PaletteWindow":"#000000",
"PaletteWindowText":"#FFFFFF", "PaletteWindowText":"#FFFFFF",

View File

@ -3,6 +3,7 @@
"name_zh_CN": "深色主题", "name_zh_CN": "深色主题",
"isDark": true, "isDark": true,
"default scheme": "VS Code", "default scheme": "VS Code",
"default iconset": "contrast",
"palette": { "palette": {
"PaletteWindow":"#19232D", "PaletteWindow":"#19232D",
"PaletteWindowText":"#E0E1E3", "PaletteWindowText":"#E0E1E3",

View File

@ -3,6 +3,7 @@
"name_zh_CN":"浅色主题", "name_zh_CN":"浅色主题",
"isDark":false, "isDark":false,
"default scheme": "Intellij Classic", "default scheme": "Intellij Classic",
"default iconset": "newlook",
"palette": { "palette": {
"PaletteHighlight":"#ffdddddd", "PaletteHighlight":"#ffdddddd",
"PaletteHighlightedText":"#ff000000" "PaletteHighlightedText":"#ff000000"