Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Add dock widget title bars #6358

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions UI/data/locale/en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ TwitchAuth.Feed="Twitch Activity Feed"
TwitchAuth.TwoFactorFail.Title="Could not query stream key"
TwitchAuth.TwoFactorFail.Text="OBS was unable to connect to your Twitch account. Please make sure two-factor authentication is set up in your <a href='https://www.twitch.tv/settings/security'>Twitch security settings</a> as this is required to stream."
RestreamAuth.Channels="Restream Channels"
SetFloating="Set Floating"
SetDocked="Set Docked"

# copy filters
Copy.Filters="Copy Filters"
Expand Down
22 changes: 7 additions & 15 deletions UI/data/themes/Acri.qss
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,6 @@ QListView QLineEdit {
}

/* Dock stuff */
QDockWidget {
titlebar-close-icon: url('./Dark/close.svg');
titlebar-normal-icon: url('./Dark/popout.svg');
}

QDockWidget {
background: palette(window);
Expand All @@ -167,7 +163,7 @@ QDockWidget {
border-bottom: 2px solid rgb(47,47,47);
}

QDockWidget::title {
QFrame#dockTitleBar {
border-bottom: 2px solid rgb(47,47,47);
margin-left: 5px;
margin-right: 5px;
Expand All @@ -181,20 +177,16 @@ QDockWidget::title {
background-repeat: none;
}

QDockWidget::close-button,
QDockWidget::float-button {
icon-size: 20px;
subcontrol-position: top right;
subcontrol-origin: padding;
right: 0px;
margin: 0px;
QFrame#dockTitleBar > QLabel {
font-weight: bold;
font-size: 12px;
background: transparent;
}

QDockWidget::float-button {
right: 20px;
* [themeID="dotsIcon"] {
qproperty-icon: url(./Dark/dots.svg);
}


QListView#scenes,
SourceListWidget {
border: none;
Expand Down
32 changes: 19 additions & 13 deletions UI/data/themes/Dark.qss
Original file line number Diff line number Diff line change
Expand Up @@ -119,28 +119,34 @@ SourceTree QLineEdit {

/* Dock Widget */

QDockWidget {
titlebar-close-icon: url('./Dark/close.svg');
titlebar-normal-icon: url('./Dark/popout.svg');
QFrame#dockTitleBar {
background-color: rgb(70,69,70);
}

QFrame#dockTitleBar > QLabel {
font-weight: bold;
font-size: 12px;
background: transparent;
}

QDockWidget::title {
text-align: center;
QPushButton#dockTitleBarButton::flat {
background-color: rgb(70,69,70);
}

QDockWidget::close-button, QDockWidget::float-button {
border: 1px solid transparent;
background: transparent;
padding: 0px;
QPushButton#dockTitleBarButton::flat:hover {
background-color: rgb(122,121,122); /* light */
}

QDockWidget::close-button:hover, QDockWidget::float-button:hover {
background: transparent;
QPushButton#dockTitleBarButton::flat:pressed {
background-color: palette(base);
}

QPushButton#dockTitleBarButton::flat:disabled {
background-color: rgb(46,45,46);
}

QDockWidget::close-button:pressed, QDockWidget::float-button:pressed {
padding: 1px -1px -1px 1px;
* [themeID="dotsIcon"] {
qproperty-icon: url(./Dark/dots.svg);
}

/* Group Box */
Expand Down
3 changes: 3 additions & 0 deletions UI/data/themes/Dark/dots.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 23 additions & 16 deletions UI/data/themes/Rachni.qss
Original file line number Diff line number Diff line change
Expand Up @@ -188,38 +188,45 @@ QListView::item:hover:!active {
/* --- Dock widget --- */
/***********************/

QDockWidget {
titlebar-close-icon: url('./Dark/close.svg');
titlebar-normal-icon: url('./Dark/popout.svg');
}

QDockWidget {
background: palette(window);
border: 1px solid rgb(58, 64, 69); /* Light Blue-gray */
}

QDockWidget::title {
text-align: left;
QFrame#dockTitleBar {
background: palette(shadow);
padding-left: 5px;
}


QDockWidget::close-button, QDockWidget::float-button {
border: 1px solid transparent;
border-radius: 2px;
QFrame#dockTitleBar > QLabel {
font-weight: bold;
font-size: 12px;
background: transparent;
}

QDockWidget::close-button:hover, QDockWidget::float-button:hover {
background: rgba(255, 148, 194, 0.25); /* Light Pink (Secondary Light) */
QPushButton#dockTitleBarButton::flat {
background-color: palette(shadow);
border: none;
outline: none;
}

QPushButton#dockTitleBarButton::flat:hover {
background-color: rgba(240, 98, 146, 0.5); /* Pink (Secondary) */
margin: 0;
padding: 0;
border-radius: 2px;
border: none;
outline: none;
}

QDockWidget::close-button:pressed, QDockWidget::float-button:pressed {
padding: 1px -1px -1px 1px;
background: rgba(255, 148, 194, 0.25); /* Light Pink (Secondary Light) */
QPushButton#dockTitleBarButton::flat:pressed {
background-color: rgb(240, 98, 146); /* Pink (Secondary) */
border: 1px solid rgb(240, 98, 146); /* Pink (Secondary) */
}

* [themeID="dotsIcon"] {
qproperty-icon: url(./Dark/dots.svg);
}

/***********************/
/* --- Group Boxes --- */
Expand Down
11 changes: 11 additions & 0 deletions UI/data/themes/System.qss
Original file line number Diff line number Diff line change
Expand Up @@ -357,4 +357,15 @@ QCalendarWidget #qt_calendar_nextmonth {
padding: 2px;
qproperty-icon: url(./Dark/expand.svg);
icon-size: 16px, 16px;
}

/* Dock Title Bar */
#dockTitleBar > QLabel {
font-weight: bold;
font-size: 12px;
background: transparent;
}

* [themeID="dotsIcon"] {
qproperty-icon: url(:/res/images/dots.svg);
}
38 changes: 0 additions & 38 deletions UI/forms/OBSBasic.ui
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,6 @@
</action>
<addaction name="actionFullscreenInterface"/>
<addaction name="separator"/>
<addaction name="toggleListboxToolbars"/>
<addaction name="toggleContextBar"/>
<addaction name="toggleSourceIcons"/>
<addaction name="toggleStatusBar"/>
Expand Down Expand Up @@ -800,24 +799,6 @@
<addaction name="actionRemoveScene"/>
</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">
Expand Down Expand Up @@ -935,25 +916,6 @@
<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">
Expand Down
3 changes: 3 additions & 0 deletions UI/forms/images/dots.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions UI/forms/obs.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<file>images/media/media_restart.svg</file>
<file>images/media/media_stop.svg</file>
<file>images/interact.svg</file>
<file>images/dots.svg</file>
</qresource>
<qresource prefix="/settings">
<file>images/settings/output.svg</file>
Expand Down
70 changes: 39 additions & 31 deletions UI/window-basic-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,12 @@ OBSBasic::OBSBasic(QWidget *parent)
statsDock->setFeatures(QDockWidget::DockWidgetClosable |
QDockWidget::DockWidgetMovable |
QDockWidget::DockWidgetFloatable);
statsDock->setWindowTitle(QTStr("Basic.Stats"));
statsDock->SetTitle(QTStr("Basic.Stats"));
addDockWidget(Qt::BottomDockWidgetArea, statsDock);
statsDock->setVisible(false);
statsDock->setFloating(true);
statsDock->resize(700, 200);

copyActionsDynamicProperties();

char styleSheetPath[512];
int ret = GetProfilePath(styleSheetPath, sizeof(styleSheetPath),
"stylesheet.qss");
Expand Down Expand Up @@ -573,26 +571,6 @@ static obs_data_t *GenerateSaveData(obs_data_array_t *sceneOrder,
return saveData;
}

void OBSBasic::copyActionsDynamicProperties()
{
// Themes need the QAction dynamic properties
for (QAction *x : ui->scenesToolbar->actions()) {
QWidget *temp = ui->scenesToolbar->widgetForAction(x);

for (QByteArray &y : x->dynamicPropertyNames()) {
temp->setProperty(y, x->property(y));
}
}

for (QAction *x : ui->sourcesToolbar->actions()) {
QWidget *temp = ui->sourcesToolbar->widgetForAction(x);

for (QByteArray &y : x->dynamicPropertyNames()) {
temp->setProperty(y, x->property(y));
}
}
}

void OBSBasic::UpdateVolumeControlsDecayRate()
{
double meterDecayRate =
Expand Down Expand Up @@ -1923,6 +1901,8 @@ void OBSBasic::OBSInit()
sysTrayEnabled &&
(opt_minimize_tray || sysTrayWhenStarted);

SetupDockTitleBars();

#ifdef _WIN32
SetWin32DropStyle(this);

Expand Down Expand Up @@ -8892,15 +8872,9 @@ void OBSBasic::on_lockUI_toggled(bool lock)
extraDocks[i]->setFeatures(features);
}
}
}

void OBSBasic::on_toggleListboxToolbars_toggled(bool visible)
{
ui->sourcesToolbar->setVisible(visible);
ui->scenesToolbar->setVisible(visible);

config_set_bool(App()->GlobalConfig(), "BasicWindow",
"ShowListboxToolbars", visible);
QList<OBSDock *> list = findChildren<OBSDock *>();
foreach(OBSDock * dock, list) { dock->EnableControlMenu(lock); }
}

void OBSBasic::ShowContextBar()
Expand Down Expand Up @@ -10140,3 +10114,37 @@ void OBSBasic::SetDisplayAffinity(QWindow *window)
UNUSED_PARAMETER(hideFromCapture);
#endif
}

void OBSBasic::SetupDockTitleBars()
{
ui->scenesDock->SetTitle(QTStr("Basic.Main.Scenes"));
ui->scenesDock->AddButton("addIconSmall", QTStr("Add"), this,
SLOT(on_actionAddScene_triggered()));
ui->scenesDock->AddButton("removeIconSmall", QTStr("Remove"), this,
SLOT(on_actionRemoveScene_triggered()));
ui->scenesDock->AddSeparator();
ui->scenesDock->AddButton("upArrowIconSmall", QTStr("MoveUp"), this,
SLOT(on_actionSceneUp_triggered()));
ui->scenesDock->AddButton("downArrowIconSmall", QTStr("MoveDown"), this,
SLOT(on_actionSceneDown_triggered()));

ui->sourcesDock->SetTitle(QTStr("Basic.Main.Sources"));
ui->sourcesDock->AddButton("addIconSmall", QTStr("Add"), this,
SLOT(on_actionAddSource_triggered()));
ui->sourcesDock->AddButton("removeIconSmall", QTStr("Remove"), this,
SLOT(on_actionRemoveSource_triggered()));
ui->sourcesDock->AddButton("configIconSmall", QTStr("Properties"), this,
SLOT(on_actionSourceProperties_triggered()));
ui->sourcesDock->AddSeparator();
ui->sourcesDock->AddButton("upArrowIconSmall", QTStr("MoveUp"), this,
SLOT(on_actionSourceUp_triggered()));
ui->sourcesDock->AddButton("downArrowIconSmall", QTStr("MoveDown"),
this, SLOT(on_actionSourceDown_triggered()));

ui->mixerDock->SetTitle(QTStr("Mixer"));
ui->transitionsDock->SetTitle(QTStr("Basic.SceneTransitions"));
ui->controlsDock->SetTitle(QTStr("Basic.Main.Controls"));

QList<OBSDock *> list = findChildren<OBSDock *>();
foreach(OBSDock * dock, list) { dock->AddControlMenu(); }
}
Loading