mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Show warning if system tray is disabled in OBS settings
This commit is contained in:
parent
74dc0c871b
commit
003ffc161b
|
|
@ -853,6 +853,7 @@ AdvSceneSwitcher.action.systray.title="Title:"
|
|||
AdvSceneSwitcher.action.systray.message="Message:"
|
||||
AdvSceneSwitcher.action.systray.icon="Icon:"
|
||||
AdvSceneSwitcher.action.systray.iconHint="Leave blank to use the default icon"
|
||||
AdvSceneSwitcher.action.systray.disabled="System tray notifications seem to be disabled in the OBS settings!"
|
||||
AdvSceneSwitcher.action.screenshot="Screenshot"
|
||||
AdvSceneSwitcher.action.screenshot.save.default="Default"
|
||||
AdvSceneSwitcher.action.screenshot.save.custom="Custom"
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@
|
|||
#include "layout-helpers.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
|
||||
#include <obs-frontend-api.h>
|
||||
#include <util/config-file.h>
|
||||
|
||||
namespace advss {
|
||||
|
||||
const std::string MacroActionSystray::id = "systray_notification";
|
||||
|
|
@ -72,7 +75,9 @@ MacroActionSystrayEdit::MacroActionSystrayEdit(
|
|||
: QWidget(parent),
|
||||
_message(new VariableLineEdit(this)),
|
||||
_title(new VariableLineEdit(this)),
|
||||
_iconPath(new FileSelection())
|
||||
_iconPath(new FileSelection()),
|
||||
_trayDisableWarning(
|
||||
new QLabel("AdvSceneSwitcher.action.systray.disabled"))
|
||||
{
|
||||
_iconPath->setToolTip(
|
||||
obs_module_text("AdvSceneSwitcher.action.systray.iconHint"));
|
||||
|
|
@ -85,25 +90,35 @@ MacroActionSystrayEdit::MacroActionSystrayEdit(
|
|||
SLOT(IconPathChanged(const QString &)));
|
||||
|
||||
auto layout = new QGridLayout();
|
||||
int row = 0;
|
||||
layout->addWidget(new QLabel(obs_module_text(
|
||||
"AdvSceneSwitcher.action.systray.title")),
|
||||
0, 0);
|
||||
layout->addWidget(_title, 0, 1);
|
||||
row, 0);
|
||||
layout->addWidget(_title, ++row, 1);
|
||||
layout->addWidget(new QLabel(obs_module_text(
|
||||
"AdvSceneSwitcher.action.systray.message")),
|
||||
1, 0);
|
||||
layout->addWidget(_message, 1, 1);
|
||||
row, 0);
|
||||
layout->addWidget(_message, ++row, 1);
|
||||
layout->addWidget(new QLabel(obs_module_text(
|
||||
"AdvSceneSwitcher.action.systray.icon")),
|
||||
2, 0);
|
||||
layout->addWidget(_iconPath, 2, 1);
|
||||
setLayout(layout);
|
||||
row, 0);
|
||||
layout->addWidget(_iconPath, ++row, 1);
|
||||
|
||||
auto mainlayout = new QVBoxLayout();
|
||||
mainlayout->addLayout(layout);
|
||||
mainlayout->addWidget(_trayDisableWarning);
|
||||
setLayout(mainlayout);
|
||||
|
||||
_entryData = entryData;
|
||||
_message->setText(_entryData->_message);
|
||||
_title->setText(_entryData->_title);
|
||||
_iconPath->SetPath(_entryData->_iconPath);
|
||||
_loading = false;
|
||||
|
||||
CheckIfTrayIsDisabled();
|
||||
QWidget::connect(&_checkTrayDisableTimer, SIGNAL(timeout()), this,
|
||||
SLOT(CheckIfTrayIsDisabled()));
|
||||
_checkTrayDisableTimer.start(1000);
|
||||
}
|
||||
|
||||
void MacroActionSystrayEdit::TitleChanged()
|
||||
|
|
@ -126,6 +141,19 @@ void MacroActionSystrayEdit::IconPathChanged(const QString &text)
|
|||
_entryData->_iconPath = text.toStdString();
|
||||
}
|
||||
|
||||
void MacroActionSystrayEdit::CheckIfTrayIsDisabled()
|
||||
{
|
||||
auto config = obs_frontend_get_global_config();
|
||||
if (!config) {
|
||||
return;
|
||||
}
|
||||
|
||||
_trayDisableWarning->setVisible(
|
||||
!config_get_bool(config, "BasicWindow", "SysTrayEnabled"));
|
||||
adjustSize();
|
||||
updateGeometry();
|
||||
}
|
||||
|
||||
void MacroActionSystrayEdit::MessageChanged()
|
||||
{
|
||||
if (_loading || !_entryData) {
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ private slots:
|
|||
void MessageChanged();
|
||||
void TitleChanged();
|
||||
void IconPathChanged(const QString &text);
|
||||
void CheckIfTrayIsDisabled();
|
||||
|
||||
protected:
|
||||
std::shared_ptr<MacroActionSystray> _entryData;
|
||||
|
|
@ -58,6 +59,9 @@ private:
|
|||
VariableLineEdit *_message;
|
||||
VariableLineEdit *_title;
|
||||
FileSelection *_iconPath;
|
||||
QLabel *_trayDisableWarning;
|
||||
|
||||
QTimer _checkTrayDisableTimer;
|
||||
bool _loading = true;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user