Skip to content

Commit

Permalink
[win-nix] debug for portal's tab color
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkadushkin committed Nov 3, 2023
1 parent aca6c84 commit 303530e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 4 additions & 0 deletions win-linux/src/components/asctabwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,10 @@ void CAscTabWidget::setTabTheme(int index, const QString& type, const QString& c

if ( !color.isEmpty() ) {
m_pBar->setActiveTabColor(index, color);

if ( type.isEmpty() ) {
m_pBar->setTabThemeType(index, CThemes::isColorDark(color) ? CTabBar::DarkTab : CTabBar::LightTab);
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions win-linux/src/cthemes.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ class CThemes
// auto isThemeDark(const std::wstring& id) -> bool;
auto themeActualId(const std::wstring& id) const -> std::wstring;

auto isColorDark(const std::wstring&) -> bool;
auto isColorDark(const QString&) -> bool;
static auto isColorDark(const std::wstring&) -> bool;
static auto isColorDark(const QString&) -> bool;

auto onSystemDarkColorScheme(bool isdark) -> void;
auto isSystemSchemeDark() -> const bool;
Expand Down
10 changes: 7 additions & 3 deletions win-linux/src/windows/cmainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,10 +696,14 @@ void CMainWindow::onPortalLogin(int viewid, const std::wstring &json)

if( jerror.error == QJsonParseError::NoError ) {
QJsonObject objRoot = jdoc.object();
QString _ui_theme = objRoot["uiTheme"].toString();
QJsonValue value = objRoot["uiTheme"];

if ( value.isString() )
onPortalUITheme(viewid, value.toString().toStdWString());
else
if ( value.isObject() )
onPortalUITheme(viewid, QString(QJsonDocument(value.toObject()).toJson(QJsonDocument::Compact)).toStdWString());

if ( !_ui_theme.isEmpty() )
onPortalUITheme(viewid, _ui_theme.toStdWString());
}
}
}
Expand Down

0 comments on commit 303530e

Please sign in to comment.