diff --git a/UI/CMakeLists.txt b/UI/CMakeLists.txt index a660f3267..3bb97eb87 100644 --- a/UI/CMakeLists.txt +++ b/UI/CMakeLists.txt @@ -57,6 +57,9 @@ set(CMAKE_INCLUDE_CURRENT_DIR TRUE) set(CMAKE_AUTOMOC TRUE) find_package(Qt5Svg ${FIND_MODE}) +if(WIN32) + find_package(Qt5WinExtras ${FIND_MODE}) +endif() find_package(Qt5Xml ${FIND_MODE}) find_package(FFmpeg REQUIRED COMPONENTS avcodec avutil avformat) @@ -385,6 +388,8 @@ if(WIN32) set_target_properties(obs PROPERTIES OUTPUT_NAME "obs${_output_suffix}") + target_link_libraries(obs + Qt5::WinExtras) endif() target_link_libraries(obs diff --git a/UI/forms/images/active.png b/UI/forms/images/active.png new file mode 100644 index 000000000..c3fd4669e Binary files /dev/null and b/UI/forms/images/active.png differ diff --git a/UI/forms/images/paused.png b/UI/forms/images/paused.png new file mode 100644 index 000000000..66eece08c Binary files /dev/null and b/UI/forms/images/paused.png differ diff --git a/UI/forms/obs.qrc b/UI/forms/obs.qrc index 040e9af58..e37f05577 100644 --- a/UI/forms/obs.qrc +++ b/UI/forms/obs.qrc @@ -12,6 +12,8 @@ images/obs.png images/obs_paused.png images/tray_active.png + images/paused.png + images/active.png images/expand.svg images/unlocked.svg images/locked.svg diff --git a/UI/window-basic-main.cpp b/UI/window-basic-main.cpp index 09304eb15..fb011d654 100644 --- a/UI/window-basic-main.cpp +++ b/UI/window-basic-main.cpp @@ -1780,6 +1780,11 @@ void OBSBasic::OBSInit() SystemTray(true); #endif +#ifdef _WIN32 + taskBtn->setWindow(windowHandle()); + taskProg->setRange(0, 1); +#endif + bool has_last_version = config_has_user_value(App()->GlobalConfig(), "General", "LastVersion"); bool first_run = @@ -5292,6 +5297,13 @@ inline void OBSBasic::OnActivate() App()->IncrementSleepInhibition(); UpdateProcessPriority(); +#ifdef _WIN32 + taskProg->show(); + taskProg->resume(); + taskProg->setValue(1); + taskBtn->setOverlayIcon(QIcon::fromTheme( + "obs-active", QIcon(":/res/images/active.png"))); +#endif if (trayIcon) trayIcon->setIcon(QIcon::fromTheme( "obs-tray-active", @@ -5313,12 +5325,34 @@ inline void OBSBasic::OnDeactivate() if (trayIcon) trayIcon->setIcon(QIcon::fromTheme( "obs-tray", QIcon(":/res/images/obs.png"))); - } else if (trayIcon) { - if (os_atomic_load_bool(&recording_paused)) - trayIcon->setIcon(QIcon(":/res/images/obs_paused.png")); - else - trayIcon->setIcon( - QIcon(":/res/images/tray_active.png")); +#ifdef _WIN32 + taskProg->hide(); + taskBtn->clearOverlayIcon(); +#endif + } else { + if (os_atomic_load_bool(&recording_paused)) { +#ifdef _WIN32 + taskProg->show(); + taskProg->pause(); + taskBtn->setOverlayIcon(QIcon::fromTheme( + "obs-paused", + QIcon(":/res/images/paused.png"))); +#endif + if (trayIcon) + trayIcon->setIcon( + QIcon(":/res/images/obs_paused.png")); + } else { +#ifdef _WIN32 + taskProg->show(); + taskProg->resume(); + taskBtn->setOverlayIcon(QIcon::fromTheme( + "obs-active", + QIcon(":/res/images/active.png"))); +#endif + if (trayIcon) + trayIcon->setIcon( + QIcon(":/res/images/tray_active.png")); + } } } @@ -7698,6 +7732,11 @@ void OBSBasic::PauseRecording() ui->statusbar->RecordingPaused(); +#ifdef _WIN32 + taskProg->pause(); + taskBtn->setOverlayIcon(QIcon::fromTheme( + "obs-paused", QIcon(":/res/images/paused.png"))); +#endif if (trayIcon) trayIcon->setIcon(QIcon(":/res/images/obs_paused.png")); @@ -7727,6 +7766,11 @@ void OBSBasic::UnpauseRecording() ui->statusbar->RecordingUnpaused(); +#ifdef _WIN32 + taskProg->resume(); + taskBtn->setOverlayIcon(QIcon::fromTheme( + "obs-active", QIcon(":/res/images/active.png"))); +#endif if (trayIcon) trayIcon->setIcon( QIcon(":/res/images/tray_active.png")); diff --git a/UI/window-basic-main.hpp b/UI/window-basic-main.hpp index 7d47ce286..b612be047 100644 --- a/UI/window-basic-main.hpp +++ b/UI/window-basic-main.hpp @@ -21,6 +21,10 @@ #include #include #include +#ifdef _WIN32 +#include +#include +#endif #include #include #include @@ -272,6 +276,11 @@ private: QPointer perSceneTransitionMenu; QPointer shortcutFilter; +#ifdef _WIN32 + QWinTaskbarButton *taskBtn = new QWinTaskbarButton(this); + QWinTaskbarProgress *taskProg = taskBtn->progress(); +#endif + QPointer programWidget; QPointer programLayout; QPointer programLabel; diff --git a/cmake/Modules/CopyMSVCBins.cmake b/cmake/Modules/CopyMSVCBins.cmake index 504d7b1ca..e0b6ca835 100644 --- a/cmake/Modules/CopyMSVCBins.cmake +++ b/cmake/Modules/CopyMSVCBins.cmake @@ -158,6 +158,7 @@ file(GLOB QT_DEBUG_BIN_FILES "${Qt5Core_DIR}/../../../bin/Qt5Guid.dll" "${Qt5Core_DIR}/../../../bin/Qt5Widgetsd.dll" "${Qt5Core_DIR}/../../../bin/Qt5Svgd.dll" + "${Qt5Core_DIR}/../../../bin/Qt5WinExtrasd.dll" "${Qt5Core_DIR}/../../../bin/Qt5Xmld.dll" "${Qt5Core_DIR}/../../../bin/libGLESv2d.dll" "${Qt5Core_DIR}/../../../bin/libEGLd.dll") @@ -176,6 +177,7 @@ file(GLOB QT_BIN_FILES "${Qt5Core_DIR}/../../../bin/Qt5Gui.dll" "${Qt5Core_DIR}/../../../bin/Qt5Widgets.dll" "${Qt5Core_DIR}/../../../bin/Qt5Svg.dll" + "${Qt5Core_DIR}/../../../bin/Qt5WinExtras.dll" "${Qt5Core_DIR}/../../../bin/Qt5Xml.dll" "${Qt5Core_DIR}/../../../bin/libGLESv2.dll" "${Qt5Core_DIR}/../../../bin/libEGL.dll")