UI: Add "View" menu to control visibility of UI widgets

Adds a little improvement to quality-of-life, a typical "View" menu with
the ability to show/hide the following (for now):

- Listbox toolbars
- Status bar
- Transitions pane (some people don't really need/use/care about it)
master
jp9000 2016-06-30 14:52:56 -07:00
parent fc45a94775
commit 3bc9e042a5
5 changed files with 318 additions and 201 deletions

View File

@ -341,6 +341,13 @@ Basic.MainMenu.Edit.Order.MoveToTop="Move to &Top"
Basic.MainMenu.Edit.Order.MoveToBottom="Move to &Bottom"
Basic.MainMenu.Edit.AdvAudio="&Advanced Audio Properties"
# basic mode view menu
Basic.MainMenu.View="&View
Basic.MainMenu.View.Toolbars="&Toolbars"
Basic.MainMenu.View.Toolbars.Listboxes="&Listboxes"
Basic.MainMenu.View.SceneTransitions="S&cene Transitions"
Basic.MainMenu.View.StatusBar="&Status Bar"
# basic mode profile/scene collection menus
Basic.MainMenu.SceneCollection="&Scene Collection"
Basic.MainMenu.Profile="&Profile"

View File

@ -575,213 +575,224 @@
</property>
</widget>
</item>
<item row="1" column="3">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>4</number>
</property>
<item>
<widget class="QComboBox" name="transitions">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="spacing">
<number>4</number>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="transitionAdd">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="toolTip">
<string>Basic.AddTransition</string>
</property>
<property name="accessibleName">
<string>Basic.AddTransition</string>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="icon">
<iconset resource="obs.qrc">
<normaloff>:/res/images/add.png</normaloff>:/res/images/add.png</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
<property name="themeID" stdset="0">
<string notr="true">addIconSmall</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="transitionRemove">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="toolTip">
<string>Basic.RemoveTransition</string>
</property>
<property name="accessibleName">
<string>Basic.RemoveTransition</string>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="icon">
<iconset resource="obs.qrc">
<normaloff>:/res/images/list_remove.png</normaloff>:/res/images/list_remove.png</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
<property name="themeID" stdset="0">
<string notr="true">removeIconSmall</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="transitionProps">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="toolTip">
<string>Basic.TransitionProperties</string>
</property>
<property name="accessibleName">
<string>Basic.TransitionProperties</string>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="icon">
<iconset resource="obs.qrc">
<normaloff>:/res/images/configuration21_16.png</normaloff>:/res/images/configuration21_16.png</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
<property name="themeID" stdset="0">
<string notr="true">configIconSmall</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>4</number>
</property>
<item>
<widget class="QLabel" name="transitionDurationLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Basic.TransitionDuration</string>
</property>
<property name="buddy">
<cstring>transitionDuration</cstring>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="transitionDuration">
<property name="suffix">
<string>ms</string>
</property>
<property name="minimum">
<number>2</number>
</property>
<property name="maximum">
<number>10000</number>
</property>
<property name="singleStep">
<number>50</number>
</property>
<property name="value">
<number>300</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="sceneTransitionsLabel">
<property name="text">
<string>Basic.SceneTransitions</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QWidget" name="transitionsContainer" native="true">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>4</number>
</property>
<property name="leftMargin">
<number>1</number>
</property>
<property name="topMargin">
<number>1</number>
</property>
<property name="rightMargin">
<number>1</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<widget class="QComboBox" name="transitions">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="spacing">
<number>4</number>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="transitionAdd">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="toolTip">
<string>Basic.AddTransition</string>
</property>
<property name="accessibleName">
<string>Basic.AddTransition</string>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="icon">
<iconset resource="obs.qrc">
<normaloff>:/res/images/add.png</normaloff>:/res/images/add.png</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
<property name="themeID" stdset="0">
<string notr="true">addIconSmall</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="transitionRemove">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="toolTip">
<string>Basic.RemoveTransition</string>
</property>
<property name="accessibleName">
<string>Basic.RemoveTransition</string>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="icon">
<iconset resource="obs.qrc">
<normaloff>:/res/images/list_remove.png</normaloff>:/res/images/list_remove.png</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
<property name="themeID" stdset="0">
<string notr="true">removeIconSmall</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="transitionProps">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="toolTip">
<string>Basic.TransitionProperties</string>
</property>
<property name="accessibleName">
<string>Basic.TransitionProperties</string>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="icon">
<iconset resource="obs.qrc">
<normaloff>:/res/images/configuration21_16.png</normaloff>:/res/images/configuration21_16.png</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
<property name="themeID" stdset="0">
<string notr="true">configIconSmall</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>4</number>
</property>
<item>
<widget class="QLabel" name="transitionDurationLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Basic.TransitionDuration</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="transitionDuration">
<property name="suffix">
<string>ms</string>
</property>
<property name="minimum">
<number>2</number>
</property>
<property name="maximum">
<number>10000</number>
</property>
<property name="singleStep">
<number>50</number>
</property>
<property name="value">
<number>300</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
@ -887,8 +898,23 @@
<addaction name="actionRemoveSceneCollection"/>
<addaction name="separator"/>
</widget>
<widget class="QMenu" name="viewMenu">
<property name="title">
<string>Basic.MainMenu.View</string>
</property>
<widget class="QMenu" name="viewMenuToolbars">
<property name="title">
<string>Basic.MainMenu.View.Toolbars</string>
</property>
<addaction name="toggleListboxToolbars"/>
</widget>
<addaction name="viewMenuToolbars"/>
<addaction name="toggleSceneTransitions"/>
<addaction name="toggleStatusBar"/>
</widget>
<addaction name="menu_File"/>
<addaction name="menuBasic_MainMenu_Edit"/>
<addaction name="viewMenu"/>
<addaction name="profileMenu"/>
<addaction name="sceneCollectionMenu"/>
<addaction name="menuBasic_MainMenu_Help"/>
@ -1251,6 +1277,39 @@
<string>Basic.MainMenu.AlwaysOnTop</string>
</property>
</action>
<action name="toggleListboxToolbars">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>Basic.MainMenu.View.Toolbars.Listboxes</string>
</property>
</action>
<action name="toggleSceneTransitions">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>Basic.MainMenu.View.SceneTransitions</string>
</property>
</action>
<action name="toggleStatusBar">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>Basic.MainMenu.View.StatusBar</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@ -358,6 +358,12 @@ bool OBSApp::InitGlobalConfigDefaults()
"RecordWhenStreaming", false);
config_set_default_bool(globalConfig, "BasicWindow",
"KeepRecordingWhenStreamStops", false);
config_set_default_bool(globalConfig, "BasicWindow",
"ShowTransitions", true);
config_set_default_bool(globalConfig, "BasicWindow",
"ShowListboxToolbars", true);
config_set_default_bool(globalConfig, "BasicWindow",
"ShowStatusBar", true);
#ifdef __APPLE__
config_set_default_bool(globalConfig, "Video", "DisableOSXVSync", true);

View File

@ -1022,6 +1022,21 @@ void OBSBasic::OBSInit()
SetPreviewProgramMode(config_get_bool(App()->GlobalConfig(),
"BasicWindow", "PreviewProgramMode"));
#define SET_VISIBILITY(name, control) \
do { \
if (config_has_user_value(App()->GlobalConfig(), \
"BasicWindow", name)) { \
bool visible = config_get_bool(App()->GlobalConfig(), \
"BasicWindow", name); \
ui->control->setChecked(visible); \
} \
} while (false)
SET_VISIBILITY("ShowTransitions", toggleSceneTransitions);
SET_VISIBILITY("ShowListboxToolbars", toggleListboxToolbars);
SET_VISIBILITY("ShowStatusBar", toggleStatusBar);
#undef SET_VISIBILITY
{
ProfileScope("OBSBasic::Load");
disableSaving--;
@ -4179,3 +4194,29 @@ int OBSBasic::GetProfilePath(char *path, size_t size, const char *file) const
return snprintf(path, size, "%s/%s/%s", profiles_path, profile, file);
}
void OBSBasic::on_toggleSceneTransitions_toggled(bool visible)
{
ui->sceneTransitionsLabel->setVisible(visible);
ui->transitionsContainer->setVisible(visible);
config_set_bool(App()->GlobalConfig(), "BasicWindow",
"ShowTransitions", visible);
}
void OBSBasic::on_toggleListboxToolbars_toggled(bool visible)
{
ui->sourcesToolbar->setVisible(visible);
ui->scenesToolbar->setVisible(visible);
config_set_bool(App()->GlobalConfig(), "BasicWindow",
"ShowListboxToolbars", visible);
}
void OBSBasic::on_toggleStatusBar_toggled(bool visible)
{
ui->statusbar->setVisible(visible);
config_set_bool(App()->GlobalConfig(), "BasicWindow",
"ShowStatusBar", visible);
}

View File

@ -483,6 +483,10 @@ private slots:
void on_actionAlwaysOnTop_triggered();
void on_toggleSceneTransitions_toggled(bool visible);
void on_toggleListboxToolbars_toggled(bool visible);
void on_toggleStatusBar_toggled(bool visible);
void on_transitions_currentIndexChanged(int index);
void on_transitionAdd_clicked();
void on_transitionRemove_clicked();