UI: Match Windows taskbar state to tray icon
This adds a status icon for active/paused outputs. Stripped down version of #2442
This commit is contained in:
parent
1392ea5ca6
commit
a2c3896e1a
@ -73,6 +73,9 @@ find_package(Threads REQUIRED)
|
||||
find_package(Qt5Network ${FIND_MODE})
|
||||
find_package(Qt5Widgets ${FIND_MODE})
|
||||
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)
|
||||
@ -447,6 +450,8 @@ if(WIN32)
|
||||
set_target_properties(obs
|
||||
PROPERTIES
|
||||
OUTPUT_NAME "obs${_output_suffix}")
|
||||
target_link_libraries(obs
|
||||
Qt5::WinExtras)
|
||||
endif()
|
||||
|
||||
target_link_libraries(obs
|
||||
|
BIN
UI/forms/images/active.png
Normal file
BIN
UI/forms/images/active.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
BIN
UI/forms/images/paused.png
Normal file
BIN
UI/forms/images/paused.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
@ -17,6 +17,8 @@
|
||||
<file>images/obs_paused_macos.svg</file>
|
||||
<file>images/tray_active.png</file>
|
||||
<file>images/tray_active_macos.svg</file>
|
||||
<file>images/paused.png</file>
|
||||
<file>images/active.png</file>
|
||||
<file>images/expand.svg</file>
|
||||
<file>images/unlocked.svg</file>
|
||||
<file>images/locked.svg</file>
|
||||
|
@ -2014,6 +2014,10 @@ void OBSBasic::OBSInit()
|
||||
SystemTray(true);
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
taskBtn->setWindow(windowHandle());
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
disableColorSpaceConversion(this);
|
||||
#endif
|
||||
@ -6489,6 +6493,10 @@ inline void OBSBasic::OnActivate()
|
||||
App()->IncrementSleepInhibition();
|
||||
UpdateProcessPriority();
|
||||
|
||||
#ifdef _WIN32
|
||||
taskBtn->setOverlayIcon(QIcon::fromTheme(
|
||||
"obs-active", QIcon(":/res/images/active.png")));
|
||||
#endif
|
||||
if (trayIcon && trayIcon->isVisible()) {
|
||||
#ifdef __APPLE__
|
||||
QIcon trayMask =
|
||||
@ -6516,6 +6524,9 @@ inline void OBSBasic::OnDeactivate()
|
||||
App()->DecrementSleepInhibition();
|
||||
ClearProcessPriority();
|
||||
|
||||
#ifdef _WIN32
|
||||
taskBtn->clearOverlayIcon();
|
||||
#endif
|
||||
if (trayIcon && trayIcon->isVisible()) {
|
||||
#ifdef __APPLE__
|
||||
QIcon trayIconFile =
|
||||
@ -6540,6 +6551,11 @@ inline void OBSBasic::OnDeactivate()
|
||||
#endif
|
||||
trayIcon->setIcon(QIcon::fromTheme("obs-tray-paused",
|
||||
trayIconFile));
|
||||
#ifdef _WIN32
|
||||
taskBtn->setOverlayIcon(QIcon::fromTheme(
|
||||
"obs-paused",
|
||||
QIcon(":/res/images/paused.png")));
|
||||
#endif
|
||||
} else {
|
||||
#ifdef __APPLE__
|
||||
QIcon trayIconFile =
|
||||
@ -6551,6 +6567,11 @@ inline void OBSBasic::OnDeactivate()
|
||||
#endif
|
||||
trayIcon->setIcon(QIcon::fromTheme("obs-tray-active",
|
||||
trayIconFile));
|
||||
#ifdef _WIN32
|
||||
taskBtn->setOverlayIcon(QIcon::fromTheme(
|
||||
"obs-active",
|
||||
QIcon(":/res/images/active.png")));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9539,6 +9560,10 @@ void OBSBasic::PauseRecording()
|
||||
|
||||
ui->statusbar->RecordingPaused();
|
||||
|
||||
#ifdef _WIN32
|
||||
taskBtn->setOverlayIcon(QIcon::fromTheme(
|
||||
"obs-paused", QIcon(":/res/images/paused.png")));
|
||||
#endif
|
||||
if (trayIcon && trayIcon->isVisible()) {
|
||||
#ifdef __APPLE__
|
||||
QIcon trayIconFile =
|
||||
@ -9579,6 +9604,10 @@ void OBSBasic::UnpauseRecording()
|
||||
|
||||
ui->statusbar->RecordingUnpaused();
|
||||
|
||||
#ifdef _WIN32
|
||||
taskBtn->setOverlayIcon(QIcon::fromTheme(
|
||||
"obs-active", QIcon(":/res/images/active.png")));
|
||||
#endif
|
||||
if (trayIcon && trayIcon->isVisible()) {
|
||||
#ifdef __APPLE__
|
||||
QIcon trayIconFile =
|
||||
|
@ -22,6 +22,9 @@
|
||||
#include <QThread>
|
||||
#include <QWidgetAction>
|
||||
#include <QSystemTrayIcon>
|
||||
#ifdef _WIN32
|
||||
#include <QWinTaskbarButton>
|
||||
#endif
|
||||
#include <QStyledItemDelegate>
|
||||
#include <obs.hpp>
|
||||
#include <vector>
|
||||
@ -300,6 +303,10 @@ private:
|
||||
QPointer<QAction> renameScene;
|
||||
QPointer<QAction> renameSource;
|
||||
|
||||
#ifdef _WIN32
|
||||
QWinTaskbarButton *taskBtn = new QWinTaskbarButton(this);
|
||||
#endif
|
||||
|
||||
QPointer<QWidget> programWidget;
|
||||
QPointer<QVBoxLayout> programLayout;
|
||||
QPointer<QLabel> programLabel;
|
||||
|
@ -172,6 +172,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/Qt5Networkd.dll"
|
||||
"${Qt5Core_DIR}/../../../bin/libGLESv2d.dll"
|
||||
@ -193,6 +194,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/Qt5Network.dll"
|
||||
"${Qt5Core_DIR}/../../../bin/libGLESv2.dll"
|
||||
|
Loading…
x
Reference in New Issue
Block a user