diff --git a/win-linux/res/styles/editor_unix.qss b/win-linux/res/styles/editor_unix.qss index b221996c4..6941fb929 100644 --- a/win-linux/res/styles/editor_unix.qss +++ b/win-linux/res/styles/editor_unix.qss @@ -30,6 +30,39 @@ #mainPanel[window=pretty] QPushButton#toolButtonMaximize[class=min][unix=true][kde=true]:hover {image: url(:/maximize_kde_hover_light.svg);} #mainPanel[window=pretty] QPushButton#toolButtonMaximize[class=min][unix=true][kde=true]:pressed {image: url(:/maximize_kde_pressed_light.svg);} + +#mainPanel[uitheme=theme-gray][window=pretty] QPushButton#toolButtonMinimize[unix=true] {image: url(:/minimize_unix_normal.svg);} +#mainPanel[uitheme=theme-gray][window=pretty] QPushButton#toolButtonMinimize[unix=true]:hover {image: url(:/minimize_unix_hover.svg);} +#mainPanel[uitheme=theme-gray][window=pretty] QPushButton#toolButtonMinimize[unix=true]:pressed {image: url(:/minimize_unix_pressed.svg);} + +#mainPanel[uitheme=theme-gray][window=pretty] QPushButton#toolButtonMinimize[unix=true][kde=true] {image: url(:/minimize_kde_normal.svg);} +#mainPanel[uitheme=theme-gray][window=pretty] QPushButton#toolButtonMinimize[unix=true][kde=true]:hover {image: url(:/minimize_kde_hover.svg);} +#mainPanel[uitheme=theme-gray][window=pretty] QPushButton#toolButtonMinimize[unix=true][kde=true]:pressed {image: url(:/minimize_kde_pressed.svg);} + +#mainPanel[uitheme=theme-gray][window=pretty] QPushButton#toolButtonClose[unix=true] {image: url(:/close_unix_normal.svg);} +#mainPanel[uitheme=theme-gray][window=pretty] QPushButton#toolButtonClose[unix=true]:hover {image: url(:/close_unix_hover.svg);} +#mainPanel[uitheme=theme-gray][window=pretty] QPushButton#toolButtonClose[unix=true]:pressed {image: url(:/close_unix_pressed.svg);} + +#mainPanel[uitheme=theme-gray][window=pretty] QPushButton#toolButtonClose[unix=true][kde=true] {image: url(:/close_kde_normal.svg);} +#mainPanel[uitheme=theme-gray][window=pretty] QPushButton#toolButtonClose[unix=true][kde=true]:hover {image: url(:/close_kde_hover.svg);} +#mainPanel[uitheme=theme-gray][window=pretty] QPushButton#toolButtonClose[unix=true][kde=true]:pressed {image: url(:/close_kde_pressed.svg);} + +#mainPanel[uitheme=theme-gray][window=pretty] QPushButton#toolButtonMaximize[unix=true] {image: url(:/restore_unix_normal.svg);} +#mainPanel[uitheme=theme-gray][window=pretty] QPushButton#toolButtonMaximize[unix=true]:hover {image: url(:/restore_unix_hover.svg);} +#mainPanel[uitheme=theme-gray][window=pretty] QPushButton#toolButtonMaximize[unix=true]:pressed {image: url(:/restore_unix_pressed.svg);} + +#mainPanel[uitheme=theme-gray][window=pretty] QPushButton#toolButtonMaximize[unix=true][kde=true] {image: url(:/restore_kde_normal.svg);} +#mainPanel[uitheme=theme-gray][window=pretty] QPushButton#toolButtonMaximize[unix=true][kde=true]:hover {image: url(:/restore_kde_hover.svg);} +#mainPanel[uitheme=theme-gray][window=pretty] QPushButton#toolButtonMaximize[unix=true][kde=true]:pressed {image: url(:/restore_kde_pressed.svg);} + +#mainPanel[uitheme=theme-gray][window=pretty] QPushButton#toolButtonMaximize[class=min][unix=true] {image: url(:/maximize_unix_normal.svg);} +#mainPanel[uitheme=theme-gray][window=pretty] QPushButton#toolButtonMaximize[class=min][unix=true]:hover {image: url(:/maximize_unix_hover.svg);} +#mainPanel[uitheme=theme-gray][window=pretty] QPushButton#toolButtonMaximize[class=min][unix=true]:pressed {image: url(:/maximize_unix_pressed.svg);} + +#mainPanel[uitheme=theme-gray][window=pretty] QPushButton#toolButtonMaximize[class=min][unix=true][kde=true] {image: url(:/maximize_kde_normal.svg);} +#mainPanel[uitheme=theme-gray][window=pretty] QPushButton#toolButtonMaximize[class=min][unix=true][kde=true]:hover {image: url(:/maximize_kde_hover.svg);} +#mainPanel[uitheme=theme-gray][window=pretty] QPushButton#toolButtonMaximize[class=min][unix=true][kde=true]:pressed {image: url(:/maximize_kde_pressed.svg);} + /* 1.0x */ #toolButtonMinimize[kde=true], #toolButtonClose[kde=true], diff --git a/win-linux/res/styles/theme-gray.json b/win-linux/res/styles/theme-gray.json new file mode 100644 index 000000000..1c021aea2 --- /dev/null +++ b/win-linux/res/styles/theme-gray.json @@ -0,0 +1,55 @@ +{ + "id": "theme-gray", + "type": "light", + "values": { + "brand-word": "#f7f7f7", + "brand-slide": "#f7f7f7", + "brand-cell": "#f7f7f7", + "brand-pdf": "#f7f7f7", + + "window-background": "#fff", + "window-border": "#cbcbcb", + + "text-normal": "#444", + "text-pretty": "#fff", + + "tool-button-background": "#fff", + "tool-button-hover-background": "#fbfbfb", + "tool-button-pressed-background": "#b7b7b7", + "tool-button-active-background": "#f3f3f3", + + "download-widget-background": "#fff", + "download-widget-border": "#cbcbcb", + "download-item-hover-background": "#e0e0e0", + + "download-ghost-button-text": "#3a83db", + "download-ghost-button-text-hover": "#444", + "download-ghost-button-text-pressed": "#a5a5a5", + "download-ghost-button-text-pressed-item-hover": "#868686", + + "download-label-text": "#444", + "download-label-text-info": "#a5a5a5", + "download-label-text-info-item-hover": "#868686", + + "download-progressbar-chunk": "#3a83db", + "download-progressbar-background": "#e6e6e6", + "download-progressbar-background-item-hover": "#cacaca", + + "download-scrollbar-handle": "#cacaca", + + "tooltip-text": "#313131", + "tooltip-border": "#c0c0c0", + "tooltip-background": "#fff", + + "tab-active-background": "#f1f1f1", + "tab-simple-active-background": "#fff", + "tab-simple-active-text": "#444", + "tab-default-active-background": "#fff", + "tab-default-active-text": "#444", + "tab-divider": "#c0c0c0", + + "button-normal-opacity": "rgba(49,49,49,255)", + "logo-type": "dark", + "tab-editor-theme-type": "light" + } +} diff --git a/win-linux/resources.qrc b/win-linux/resources.qrc index d89398431..34b0e064d 100644 --- a/win-linux/resources.qrc +++ b/win-linux/resources.qrc @@ -229,5 +229,6 @@ res/styles/theme-classic-light.json res/styles/theme-dark.json res/styles/theme-contrast-dark.json + res/styles/theme-gray.json diff --git a/win-linux/src/components/asctabwidget.cpp b/win-linux/src/components/asctabwidget.cpp index d9e8c7f42..c0b10e564 100644 --- a/win-linux/src/components/asctabwidget.cpp +++ b/win-linux/src/components/asctabwidget.cpp @@ -465,20 +465,16 @@ int CAscTabWidget::insertPanel(QWidget * panel, int index) switch ( tab_type ) { case AscEditorType::etPresentation: tabcolor = QString::fromStdWString(ui_theme.value(CTheme::ColorRole::ecrTabSlideActive)); - m_pBar->setTabThemeType(tabindex, CTabBar::DarkTab); break; case AscEditorType::etSpreadsheet: tabcolor = QString::fromStdWString(ui_theme.value(CTheme::ColorRole::ecrTabCellActive)); - m_pBar->setTabThemeType(tabindex, CTabBar::DarkTab); break; case AscEditorType::etDocumentMasterForm: case AscEditorType::etDocument: tabcolor = QString::fromStdWString(ui_theme.value(CTheme::ColorRole::ecrTabWordActive)); - m_pBar->setTabThemeType(tabindex, CTabBar::DarkTab); break; case AscEditorType::etPdf: tabcolor = QString::fromStdWString(ui_theme.value(CTheme::ColorRole::ecrTabViewerActive)); - m_pBar->setTabThemeType(tabindex, CTabBar::DarkTab); break; case etPortal: tabcolor = QString::fromStdWString(ui_theme.value(CTheme::ColorRole::ecrTabSimpleActiveBackground)); @@ -489,6 +485,18 @@ int CAscTabWidget::insertPanel(QWidget * panel, int index) m_pBar->setTabThemeType(tabindex, /*ui_theme.isDark() ? CTabBar::DarkTab :*/ CTabBar::LightTab); } + switch ( tab_type ) { + case AscEditorType::etPresentation: + case AscEditorType::etSpreadsheet: + case AscEditorType::etDocumentMasterForm: + case AscEditorType::etPdf: + case AscEditorType::etDocument: + m_pBar->setTabThemeType(tabindex, + ui_theme.value(CTheme::ColorRole::ecrTabThemeType, L"dark") == L"dark" ? CTabBar::DarkTab : CTabBar::LightTab); + break; + default: break; + } + m_pBar->setActiveTabColor(tabindex, tabcolor); const char *icon_name = tabindex == m_pBar->currentIndex() ? m_mapTabIcons.at(tab_type).second : m_mapTabIcons.at(tab_type).first; @@ -797,31 +805,30 @@ void CAscTabWidget::applyDocumentChanging(int id, int type) switch (AscEditorType(type)) { case AscEditorType::etDocument: panel(tabIndex)->applyLoader("loader:style", "word"); - m_pBar->setTabThemeType(tabIndex, CTabBar::DarkTab); m_pBar->setActiveTabColor(tabIndex, QString::fromStdWString(ui_theme.value(CTheme::ColorRole::ecrTabWordActive))); break; case AscEditorType::etSpreadsheet: panel(tabIndex)->applyLoader("loader:style", "cell"); - m_pBar->setTabThemeType(tabIndex, CTabBar::DarkTab); m_pBar->setActiveTabColor(tabIndex, QString::fromStdWString(ui_theme.value(CTheme::ColorRole::ecrTabCellActive))); break; case AscEditorType::etPresentation: panel(tabIndex)->applyLoader("loader:style", "slide"); - m_pBar->setTabThemeType(tabIndex, CTabBar::DarkTab); m_pBar->setActiveTabColor(tabIndex, QString::fromStdWString(ui_theme.value(CTheme::ColorRole::ecrTabSlideActive))); break; case AscEditorType::etPdf: panel(tabIndex)->applyLoader("loader:style", "pdf"); - m_pBar->setTabThemeType(tabIndex, CTabBar::DarkTab); m_pBar->setActiveTabColor(tabIndex, QString::fromStdWString(ui_theme.value(CTheme::ColorRole::ecrTabViewerActive))); break; default: break; } + m_pBar->setTabThemeType(tabIndex, + ui_theme.value(CTheme::ColorRole::ecrTabThemeType, L"dark") == L"dark" ? CTabBar::DarkTab : CTabBar::LightTab); + const char *icon_name = tabIndex == m_pBar->currentIndex() ? m_mapTabIcons.at(AscEditorType(type)).second : m_mapTabIcons.at(AscEditorType(type)).first; m_pBar->setTabIcon(tabIndex, QIcon(icon_name)); @@ -1201,10 +1208,12 @@ void CAscTabWidget::applyUITheme(const std::wstring& theme) QString::fromStdWString(ui_theme.value(CTheme::ColorRole::ecrTabCellActive)), QString::fromStdWString(ui_theme.value(CTheme::ColorRole::ecrTabSlideActive))}; QColor back_color = ui_theme.color(CTheme::ColorRole::ecrWindowBackground); + const auto tab_theme = ui_theme.value(CTheme::ColorRole::ecrTabThemeType, L"dark") == L"dark" ? CTabBar::DarkTab : CTabBar::LightTab; for (int i(count()); i-- > 0; ) { panel(i)->setBackground(back_color); - switch ( panel(i)->data()->contentType() ) { + const auto tab_type = panel(i)->data()->contentType(); + switch ( tab_type ) { case AscEditorType::etPresentation: m_pBar->setActiveTabColor(i, tab_color.at(2)); break; @@ -1227,6 +1236,17 @@ void CAscTabWidget::applyUITheme(const std::wstring& theme) m_pBar->setActiveTabColor(i, QString::fromStdWString(ui_theme.value(CTheme::ColorRole::ecrTabDefaultActiveBackground))); break; } + + switch ( tab_type ) { + case AscEditorType::etPresentation: + case AscEditorType::etSpreadsheet: + case AscEditorType::etDocumentMasterForm: + case AscEditorType::etPdf: + case AscEditorType::etDocument: + m_pBar->setTabThemeType(i, tab_theme); + break; + default: break; + } } m_pBar->refreshTheme(); diff --git a/win-linux/src/cthemes.cpp b/win-linux/src/cthemes.cpp index 4cc644ae1..bf53c67b8 100644 --- a/win-linux/src/cthemes.cpp +++ b/win-linux/src/cthemes.cpp @@ -22,7 +22,7 @@ #define REGISTRY_THEME_KEY "UITheme" #define REGISTRY_THEME_KEY_7_2 "UITheme2" #define THEME_DEFAULT_DARK_ID "theme-dark" -#define THEME_DEFAULT_LIGHT_ID "theme-classic-light" +#define THEME_DEFAULT_LIGHT_ID "theme-gray" #define THEME_ID_SYSTEM "theme-system" namespace NSTheme { @@ -82,7 +82,8 @@ namespace NSTheme { {CTheme::ColorRole::ecrTabDivider, "tab-divider"}, {CTheme::ColorRole::ecrButtonNormalOpacity, "button-normal-opacity"}, - {CTheme::ColorRole::ecrLogoColor, "logo"} + {CTheme::ColorRole::ecrLogoColor, "logo"}, + {CTheme::ColorRole::ecrTabThemeType, "tab-editor-theme-type"} }; static const std::map map_alias_names = { @@ -178,6 +179,7 @@ public: {"theme-classic-light", ":/themes/theme-classic-light.json"}, {"theme-dark", ":/themes/theme-dark.json"}, {"theme-contrast-dark", ":/themes/theme-contrast-dark.json"}, + {"theme-gray", ":/themes/theme-gray.json"}, }; GET_REGISTRY_USER(_reg_user); @@ -442,7 +444,7 @@ auto CTheme::stype() const -> QString } } -auto CTheme::value(ColorRole r) const -> std::wstring +auto CTheme::value(ColorRole r, const std::wstring& def) const -> std::wstring { if ( NSTheme::map_names.find(r) != NSTheme::map_names.end() ) { if ( m_priv->jsonValues.contains(NSTheme::map_names.at(r)) ) { @@ -450,7 +452,7 @@ auto CTheme::value(ColorRole r) const -> std::wstring } } - return L""; + return def; } auto CTheme::color(ColorRole role) const -> QColor diff --git a/win-linux/src/cthemes.h b/win-linux/src/cthemes.h index 3a764a7c8..aeb7e5f52 100644 --- a/win-linux/src/cthemes.h +++ b/win-linux/src/cthemes.h @@ -59,6 +59,7 @@ public: , ecrToolTipBorder , ecrToolTipBackground , ecrTabDivider + , ecrTabThemeType }; auto fromFile(const QString&) -> bool; @@ -71,7 +72,7 @@ public: #ifdef Q_OS_WIN auto colorRef(ColorRole r) const -> COLORREF; #endif - auto value(ColorRole) const -> std::wstring; + auto value(ColorRole, const std::wstring& def = L"") const -> std::wstring; auto isDark() const -> bool; auto isSystem() const -> bool; diff --git a/win-linux/src/windows/ceditorwindow_p.h b/win-linux/src/windows/ceditorwindow_p.h index 789e89720..bed014ada 100644 --- a/win-linux/src/windows/ceditorwindow_p.h +++ b/win-linux/src/windows/ceditorwindow_p.h @@ -502,6 +502,8 @@ public: background = GetColorValueByRole(ecrWindowBackground); border = GetColorValueByRole(ecrWindowBorder); } + if (GetCurrentTheme().id() == L"theme-gray") + border = GetColorValueByRole(ecrWindowBorder); window->setWindowColors(QColor(QString::fromStdWString(background)), QColor(QString::fromStdWString(border)), window->isActiveWindow()); }