mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-09-07 17:16:00 -05:00
Use theme based icons for status dock, group, and duration icon
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user