diff options
Diffstat (limited to 'gui')
-rw-r--r-- | gui/correlation-calibrator.ui | 2 | ||||
-rw-r--r-- | gui/init.cpp | 34 | ||||
-rw-r--r-- | gui/process_detector.cpp | 5 |
3 files changed, 40 insertions, 1 deletions
diff --git a/gui/correlation-calibrator.ui b/gui/correlation-calibrator.ui index d351d5da..02fdf1d2 100644 --- a/gui/correlation-calibrator.ui +++ b/gui/correlation-calibrator.ui @@ -40,7 +40,7 @@ Press "clear calibration" to remove any calibration data pertaining to <enum>Qt::ScrollBarAlwaysOff</enum> </property> <property name="sizeAdjustPolicy"> - <enum>QAbstractScrollArea::AdjustToContentsOnFirstShow</enum> + <enum>QAbstractScrollArea::AdjustToContents</enum> </property> <property name="autoScroll"> <bool>true</bool> diff --git a/gui/init.cpp b/gui/init.cpp index 3aae5772..2b7b01ad 100644 --- a/gui/init.cpp +++ b/gui/init.cpp @@ -159,6 +159,39 @@ static void qdebug_to_console(QtMsgType loglevel, const QMessageLogContext& ctx, #ifdef _WIN32 +static void apply_dark_windows_theme_if_needed() +{ + // On Windows apply dark theme if requested by user settings + QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", QSettings::NativeFormat); + if (settings.value("AppsUseLightTheme") == 0) { + qApp->setStyle(QStyleFactory::create("Dark")); + QPalette darkPalette; + QColor darkColor = QColor(45, 45, 45); + QColor disabledColor = QColor(127, 127, 127); + darkPalette.setColor(QPalette::Window, darkColor); + darkPalette.setColor(QPalette::WindowText, Qt::white); + darkPalette.setColor(QPalette::Base, QColor(18, 18, 18)); + darkPalette.setColor(QPalette::AlternateBase, darkColor); + darkPalette.setColor(QPalette::ToolTipBase, Qt::white); + darkPalette.setColor(QPalette::ToolTipText, Qt::white); + darkPalette.setColor(QPalette::Text, Qt::white); + darkPalette.setColor(QPalette::Disabled, QPalette::Text, disabledColor); + darkPalette.setColor(QPalette::Button, darkColor); + darkPalette.setColor(QPalette::ButtonText, Qt::white); + darkPalette.setColor(QPalette::Disabled, QPalette::ButtonText, disabledColor); + darkPalette.setColor(QPalette::BrightText, Qt::red); + darkPalette.setColor(QPalette::Link, QColor(42, 130, 218)); + + darkPalette.setColor(QPalette::Highlight, QColor(42, 130, 218)); + darkPalette.setColor(QPalette::HighlightedText, Qt::black); + darkPalette.setColor(QPalette::Disabled, QPalette::HighlightedText, disabledColor); + + qApp->setPalette(darkPalette); + + qApp->setStyleSheet("QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }"); + } +} + static void add_win32_path() { // see https://software.intel.com/en-us/articles/limitation-to-the-length-of-the-system-path-variable @@ -270,6 +303,7 @@ int otr_main(int argc, char** argv, std::function<std::unique_ptr<QWidget>()> co QApplication app(argc, argv); #ifdef _WIN32 + apply_dark_windows_theme_if_needed(); add_win32_path(); attach_parent_console(); #endif diff --git a/gui/process_detector.cpp b/gui/process_detector.cpp index b8de227d..58ea4ca9 100644 --- a/gui/process_detector.cpp +++ b/gui/process_detector.cpp @@ -56,6 +56,10 @@ void proc_detector_settings::set_is_enabled(bool enabled) }); } +#ifdef __GNUG__ +# pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + QHash<QString, QString> proc_detector_settings::split_process_names() { QString str = get_game_list(); @@ -163,6 +167,7 @@ void process_detector::save() void process_detector::revert() { load_rows(); + ui.enabled->setChecked(s.is_enabled()); } void process_detector::add() |