UI: Add system tray capability

This adds a system tray when enabled. There is also a option to minimize
to the system tray when the app is started.

Closes jp9000/obs-studio#595
This commit is contained in:
cg2121
2016-08-13 09:36:17 -05:00
committed by jp9000
parent 276e8530d9
commit b71f5cc4fc
11 changed files with 298 additions and 22 deletions

View File

@@ -274,6 +274,8 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
HookWidget(ui->hideProjectorCursor, CHECK_CHANGED, GENERAL_CHANGED);
HookWidget(ui->recordWhenStreaming, CHECK_CHANGED, GENERAL_CHANGED);
HookWidget(ui->keepRecordStreamStops,CHECK_CHANGED, GENERAL_CHANGED);
HookWidget(ui->systemTrayEnabled, CHECK_CHANGED, GENERAL_CHANGED);
HookWidget(ui->systemTrayWhenStarted,CHECK_CHANGED, GENERAL_CHANGED);
HookWidget(ui->snappingEnabled, CHECK_CHANGED, GENERAL_CHANGED);
HookWidget(ui->screenSnapping, CHECK_CHANGED, GENERAL_CHANGED);
HookWidget(ui->centerSnapping, CHECK_CHANGED, GENERAL_CHANGED);
@@ -845,6 +847,14 @@ void OBSBasicSettings::LoadGeneralSettings()
"BasicWindow", "KeepRecordingWhenStreamStops");
ui->keepRecordStreamStops->setChecked(keepRecordStreamStops);
bool systemTrayEnabled = config_get_bool(GetGlobalConfig(),
"BasicWindow", "SysTrayEnabled");
ui->systemTrayEnabled->setChecked(systemTrayEnabled);
bool systemTrayWhenStarted = config_get_bool(GetGlobalConfig(),
"BasicWindow", "SysTrayWhenStarted");
ui->systemTrayWhenStarted->setChecked(systemTrayWhenStarted);
bool snappingEnabled = config_get_bool(GetGlobalConfig(),
"BasicWindow", "SnappingEnabled");
ui->snappingEnabled->setChecked(snappingEnabled);
@@ -2235,6 +2245,16 @@ void OBSBasicSettings::SaveGeneralSettings()
config_set_bool(GetGlobalConfig(), "BasicWindow",
"KeepRecordingWhenStreamStops",
ui->keepRecordStreamStops->isChecked());
if (WidgetChanged(ui->systemTrayEnabled))
config_set_bool(GetGlobalConfig(), "BasicWindow",
"SysTrayEnabled",
ui->systemTrayEnabled->isChecked());
if (WidgetChanged(ui->systemTrayWhenStarted))
config_set_bool(GetGlobalConfig(), "BasicWindow",
"SysTrayWhenStarted",
ui->systemTrayWhenStarted->isChecked());
}
void OBSBasicSettings::SaveStream1Settings()