Skip to content

Commit

Permalink
UI: Remove Qt Windows Extras for Qt 6 and later
Browse files Browse the repository at this point in the history
Co-Authored-By: Matt Gajownik <[email protected]>
  • Loading branch information
2 people authored and jp9000 committed Dec 17, 2021
1 parent 91a9688 commit c83b758
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
9 changes: 6 additions & 3 deletions UI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ find_package(Threads REQUIRED)
find_package(Qt5Network ${FIND_MODE})
find_package(Qt5Widgets ${FIND_MODE})
find_package(Qt5Svg ${FIND_MODE})
if(WIN32)
if(WIN32 AND (Qt5Widgets_VERSION VERSION_LESS 6.0.0))
find_package(Qt5WinExtras ${FIND_MODE})
endif()
find_package(Qt5Xml ${FIND_MODE})
Expand Down Expand Up @@ -452,8 +452,11 @@ if(WIN32)
set_target_properties(obs
PROPERTIES
OUTPUT_NAME "obs${_output_suffix}")
target_link_libraries(obs
Qt5::WinExtras)

if(Qt5Widgets_VERSION VERSION_LESS 6.0.0)
target_link_libraries(obs
Qt5::WinExtras)
endif()
endif()

target_link_libraries(obs
Expand Down
14 changes: 7 additions & 7 deletions UI/window-basic-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1976,7 +1976,7 @@ void OBSBasic::OBSInit()
SystemTray(true);
#endif

#ifdef _WIN32
#if defined(_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
taskBtn->setWindow(windowHandle());
#endif

Expand Down Expand Up @@ -6542,7 +6542,7 @@ inline void OBSBasic::OnActivate(bool force)
App()->IncrementSleepInhibition();
UpdateProcessPriority();

#ifdef _WIN32
#if defined(_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
taskBtn->setOverlayIcon(QIcon::fromTheme(
"obs-active", QIcon(":/res/images/active.png")));
#endif
Expand Down Expand Up @@ -6573,7 +6573,7 @@ inline void OBSBasic::OnDeactivate()
App()->DecrementSleepInhibition();
ClearProcessPriority();

#ifdef _WIN32
#if defined(_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
taskBtn->clearOverlayIcon();
#endif
if (trayIcon && trayIcon->isVisible()) {
Expand All @@ -6600,7 +6600,7 @@ inline void OBSBasic::OnDeactivate()
#endif
trayIcon->setIcon(QIcon::fromTheme("obs-tray-paused",
trayIconFile));
#ifdef _WIN32
#if defined(_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
taskBtn->setOverlayIcon(QIcon::fromTheme(
"obs-paused",
QIcon(":/res/images/paused.png")));
Expand All @@ -6616,7 +6616,7 @@ inline void OBSBasic::OnDeactivate()
#endif
trayIcon->setIcon(QIcon::fromTheme("obs-tray-active",
trayIconFile));
#ifdef _WIN32
#if defined(_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
taskBtn->setOverlayIcon(QIcon::fromTheme(
"obs-active",
QIcon(":/res/images/active.png")));
Expand Down Expand Up @@ -9537,7 +9537,7 @@ void OBSBasic::PauseRecording()

ui->statusbar->RecordingPaused();

#ifdef _WIN32
#if defined(_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
taskBtn->setOverlayIcon(QIcon::fromTheme(
"obs-paused", QIcon(":/res/images/paused.png")));
#endif
Expand Down Expand Up @@ -9581,7 +9581,7 @@ void OBSBasic::UnpauseRecording()

ui->statusbar->RecordingUnpaused();

#ifdef _WIN32
#if defined(_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
taskBtn->setOverlayIcon(QIcon::fromTheme(
"obs-active", QIcon(":/res/images/active.png")));
#endif
Expand Down
4 changes: 2 additions & 2 deletions UI/window-basic-main.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <QThread>
#include <QWidgetAction>
#include <QSystemTrayIcon>
#ifdef _WIN32
#if defined(_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QWinTaskbarButton>
#endif
#include <QStyledItemDelegate>
Expand Down Expand Up @@ -317,7 +317,7 @@ class OBSBasic : public OBSMainWindow {
QPointer<QAction> renameScene;
QPointer<QAction> renameSource;

#ifdef _WIN32
#if defined(_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QWinTaskbarButton *taskBtn = new QWinTaskbarButton(this);
#endif

Expand Down

0 comments on commit c83b758

Please sign in to comment.