UI: Add splitter to main window

Allows adjusting the size of the bottom section of the main window
master
jp9000 2016-01-09 14:20:46 -08:00
parent 9cded466dc
commit d7d5e55d2c
2 changed files with 468 additions and 475 deletions

View File

@ -7,8 +7,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>920</width> <width>957</width>
<height>700</height> <height>724</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -34,7 +34,17 @@
<string notr="true"/> <string notr="true"/>
</property> </property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSplitter" name="mainSplitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="childrenCollapsible">
<bool>false</bool>
</property>
<widget class="QWidget" name="verticalLayoutWidget_7">
<layout class="QVBoxLayout" name="verticalLayout_14">
<item> <item>
<widget class="OBSBasicPreview" name="preview" native="true"> <widget class="OBSBasicPreview" name="preview" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
@ -55,7 +65,6 @@
<property name="contextMenuPolicy"> <property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum> <enum>Qt::CustomContextMenu</enum>
</property> </property>
<addaction name="actionRemoveSource"/>
</widget> </widget>
</item> </item>
<item> <item>
@ -77,27 +86,52 @@
</property> </property>
</widget> </widget>
</item> </item>
<item alignment="Qt::AlignHCenter|Qt::AlignVCenter"> </layout>
<widget class="QWidget" name="controlsContainer" native="true"> </widget>
<widget class="QWidget" name="gridLayoutWidget_2">
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="2">
<widget class="VScrollArea" name="scrollArea">
<property name="minimumSize">
<size>
<width>220</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="volumeWidgets">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>242</width>
<height>16</height>
</rect>
</property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize"> <layout class="QVBoxLayout" name="verticalLayout_18">
<size> <property name="spacing">
<width>720</width> <number>0</number>
<height>0</height>
</size>
</property> </property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>165</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
@ -110,11 +144,108 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<property name="verticalSpacing"> </layout>
<number>2</number> </widget>
</widget>
</item>
<item row="1" column="0">
<layout class="QVBoxLayout" name="scenesVLayout">
<property name="spacing">
<number>0</number>
</property> </property>
<item row="0" column="3"> <item>
<spacer name="mixadvHSpacer_2"> <widget class="QFrame" name="scenesFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>160</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>260</width>
<height>16777215</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_11">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QListWidget" name="scenes">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="showDropIndicator" stdset="0">
<bool>true</bool>
</property>
<property name="dragEnabled">
<bool>true</bool>
</property>
<property name="dragDropMode">
<enum>QAbstractItemView::InternalMove</enum>
</property>
<property name="defaultDropAction">
<enum>Qt::TargetMoveAction</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolBar" name="scenesToolbar">
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="floatable">
<bool>false</bool>
</property>
<addaction name="actionAddScene"/>
<addaction name="actionRemoveScene"/>
<addaction name="separator"/>
<addaction name="actionSceneUp"/>
<addaction name="actionSceneDown"/>
</widget>
</item>
<item>
<spacer name="scenesFixedSizeHSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -129,6 +260,11 @@
</property> </property>
</spacer> </spacer>
</item> </item>
</layout>
</widget>
</item>
</layout>
</item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLabel" name="sourcesLabel"> <widget class="QLabel" name="sourcesLabel">
<property name="text"> <property name="text">
@ -136,6 +272,186 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2">
<layout class="QHBoxLayout" name="mixadvHLayout">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="mixerLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Mixer</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="advAudioProps">
<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="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>
<item>
<spacer name="mixadvHSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="1">
<layout class="QVBoxLayout" name="sourcesVLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="sourcesFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>160</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>260</width>
<height>16777215</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_16">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="SourceListWidget" name="sources">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="showDropIndicator" stdset="0">
<bool>true</bool>
</property>
<property name="dragEnabled">
<bool>true</bool>
</property>
<property name="dragDropMode">
<enum>QAbstractItemView::InternalMove</enum>
</property>
<property name="defaultDropAction">
<enum>Qt::TargetMoveAction</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolBar" name="sourcesToolbar">
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="floatable">
<bool>false</bool>
</property>
<addaction name="actionAddSource"/>
<addaction name="actionRemoveSource"/>
<addaction name="actionSourceProperties"/>
<addaction name="separator"/>
<addaction name="actionSourceUp"/>
<addaction name="actionSourceDown"/>
</widget>
</item>
<item>
<spacer name="sourcesFixedSizeHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="scenesLabel"> <widget class="QLabel" name="scenesLabel">
<property name="text"> <property name="text">
@ -200,357 +516,10 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="0" column="2">
<layout class="QHBoxLayout" name="mixadvHLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="mixerLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Mixer</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="advAudioProps">
<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="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>
<item>
<spacer name="mixadvHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="2">
<widget class="VScrollArea" name="scrollArea">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="volumeWidgets">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>209</width>
<height>16</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout> </layout>
</widget> </widget>
</widget> </widget>
</item> </item>
<item row="1" column="1">
<layout class="QVBoxLayout" name="sourcesVLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="sourcesFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>160</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="SourceListWidget" name="sources">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="showDropIndicator" stdset="0">
<bool>true</bool>
</property>
<property name="dragEnabled">
<bool>true</bool>
</property>
<property name="dragDropMode">
<enum>QAbstractItemView::InternalMove</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="defaultDropAction">
<enum>Qt::TargetMoveAction</enum>
</property>
<addaction name="actionRemoveSource"/>
</widget>
</item>
<item>
<widget class="QToolBar" name="sourcesToolbar">
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="floatable">
<bool>false</bool>
</property>
<addaction name="actionAddSource"/>
<addaction name="actionRemoveSource"/>
<addaction name="actionSourceProperties"/>
<addaction name="separator"/>
<addaction name="actionSourceUp"/>
<addaction name="actionSourceDown"/>
</widget>
</item>
<item>
<spacer name="sourcesFixedSizeHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QVBoxLayout" name="scenesVLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="scenesFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>160</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QListWidget" name="scenes">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="showDropIndicator" stdset="0">
<bool>true</bool>
</property>
<property name="dragEnabled">
<bool>true</bool>
</property>
<property name="dragDropMode">
<enum>QAbstractItemView::InternalMove</enum>
</property>
<property name="defaultDropAction">
<enum>Qt::TargetMoveAction</enum>
</property>
<addaction name="actionRemoveScene"/>
</widget>
</item>
<item>
<widget class="QToolBar" name="scenesToolbar">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="floatable">
<bool>false</bool>
</property>
<addaction name="actionAddScene"/>
<addaction name="actionRemoveScene"/>
<addaction name="separator"/>
<addaction name="actionSceneUp"/>
<addaction name="actionSceneDown"/>
</widget>
</item>
<item>
<spacer name="scenesFixedSizeHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QMenuBar" name="menubar"> <widget class="QMenuBar" name="menubar">
@ -558,7 +527,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>920</width> <width>957</width>
<height>21</height> <height>21</height>
</rect> </rect>
</property> </property>
@ -1058,12 +1027,12 @@
<slot>close()</slot> <slot>close()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>697</x> <x>838</x>
<y>615</y> <y>272</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>463</x> <x>902</x>
<y>351</y> <y>-10</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>

View File

@ -925,6 +925,25 @@ void OBSBasic::OBSInit()
connect(ui->preview, &OBSQTDisplay::DisplayCreated, addDisplay); connect(ui->preview, &OBSQTDisplay::DisplayCreated, addDisplay);
show(); show();
QList<int> defSizes;
int top = config_get_int(App()->GlobalConfig(), "BasicWindow",
"splitterTop");
int bottom = config_get_int(App()->GlobalConfig(), "BasicWindow",
"splitterBottom");
if (!top || !bottom) {
defSizes = ui->mainSplitter->sizes();
int total = defSizes[0] + defSizes[1];
defSizes[0] = total * 75 / 100;
defSizes[1] = total - defSizes[0];
} else {
defSizes.push_back(top);
defSizes.push_back(bottom);
}
ui->mainSplitter->setSizes(defSizes);
} }
void OBSBasic::InitHotkeys() void OBSBasic::InitHotkeys()
@ -1153,6 +1172,7 @@ OBSBasic::~OBSBasic()
LIBOBS_API_VER); LIBOBS_API_VER);
QRect lastGeom = normalGeometry(); QRect lastGeom = normalGeometry();
QList<int> splitterSizes = ui->mainSplitter->sizes();
config_set_int(App()->GlobalConfig(), "BasicWindow", "cx", config_set_int(App()->GlobalConfig(), "BasicWindow", "cx",
lastGeom.width()); lastGeom.width());
@ -1162,6 +1182,10 @@ OBSBasic::~OBSBasic()
lastGeom.x()); lastGeom.x());
config_set_int(App()->GlobalConfig(), "BasicWindow", "posy", config_set_int(App()->GlobalConfig(), "BasicWindow", "posy",
lastGeom.y()); lastGeom.y());
config_set_int(App()->GlobalConfig(), "BasicWindow", "splitterTop",
splitterSizes[0]);
config_set_int(App()->GlobalConfig(), "BasicWindow", "splitterBottom",
splitterSizes[1]);
config_set_bool(App()->GlobalConfig(), "BasicWindow", "PreviewEnabled", config_set_bool(App()->GlobalConfig(), "BasicWindow", "PreviewEnabled",
previewEnabled); previewEnabled);
config_save_safe(App()->GlobalConfig(), "tmp", nullptr); config_save_safe(App()->GlobalConfig(), "tmp", nullptr);