Use theme based icons for status dock, group, and duration icon

This commit is contained in:
WarmUpTill
2023-03-18 15:27:51 +01:00
committed by WarmUpTill
parent e66d0bc6b8
commit 9e4b003608
11 changed files with 52 additions and 12 deletions

View File

@@ -16,6 +16,7 @@
#include <QSystemTrayIcon>
#include <QGuiApplication>
#include <QCursor>
#include <QMainWindow>
#include <unordered_map>
#include <regex>
#include <set>
@@ -867,6 +868,22 @@ bool windowPosValid(QPoint pos)
return !!QGuiApplication::screenAt(pos);
}
std::string GetThemeTypeName()
{
#if LIBOBS_API_VER >= MAKE_SEMANTIC_VERSION(29, 0, 0)
return obs_frontend_is_theme_dark() ? "Dark" : "Light";
#else
auto mainWindow =
static_cast<QMainWindow *>(obs_frontend_get_main_window());
if (!mainWindow) {
return "Dark";
}
QColor color = mainWindow->palette().text().color();
const bool themeDarkMode = !(color.redF() < 0.5);
return themeDarkMode ? "Dark" : "Light";
#endif
}
QMetaObject::Connection PulseWidget(QWidget *widget, QColor startColor,
QColor endColor, bool once)
{

View File

@@ -105,6 +105,7 @@ int findIdxInRagne(QComboBox *list, int start, int stop,
bool DisplayMessage(const QString &msg, bool question = false);
void DisplayTrayMessage(const QString &title, const QString &msg);
bool windowPosValid(QPoint pos);
std::string GetThemeTypeName();
/* Generic helpers */