提交 4450843a 编写于 作者: J jp9000

UI: Warn when closing dock widgets for first time

Users don't realize that dockable windows can be closed (hidden) and can
be shown again via the View menu.  This adds an explicit warning when
the user first closes a dockable window for their first time.  In future
versions, this should be changed to a dialog box with a "Do not show
again" checkbox.
上级 10622215
......@@ -178,6 +178,7 @@ set(obs_SOURCES
${obs_libffutil_SOURCES}
../deps/json11/json11.cpp
obs-app.cpp
window-dock.cpp
api-interface.cpp
window-basic-main.cpp
window-basic-stats.cpp
......@@ -234,6 +235,7 @@ set(obs_HEADERS
../deps/json11/json11.hpp
obs-app.hpp
platform.hpp
window-dock.hpp
window-main.hpp
window-basic-main.hpp
window-basic-stats.hpp
......
......@@ -9,6 +9,7 @@
#include "window-basic-main.hpp"
#include "remote-text.hpp"
#include "window-dock.hpp"
#include <json11.hpp>
......@@ -204,9 +205,9 @@ bool MixerAuth::LoadInternal()
return OAuthStreamKey::LoadInternal();
}
class MixerChat : public QDockWidget {
class MixerChat : public OBSDock {
public:
inline MixerChat() : QDockWidget() {}
inline MixerChat() : OBSDock() {}
QScopedPointer<QCefWidget> widget;
};
......
......@@ -9,6 +9,7 @@
#include "window-basic-main.hpp"
#include "remote-text.hpp"
#include "window-dock.hpp"
#include <json11.hpp>
......@@ -165,9 +166,9 @@ bool TwitchAuth::LoadInternal()
return OAuthStreamKey::LoadInternal();
}
class TwitchWidget : public QDockWidget {
class TwitchWidget : public OBSDock {
public:
inline TwitchWidget() : QDockWidget() {}
inline TwitchWidget() : OBSDock() {}
QScopedPointer<QCefWidget> widget;
......
......@@ -91,6 +91,10 @@ AlreadyRunning.Title="OBS is already running"
AlreadyRunning.Text="OBS is already running! Unless you meant to do this, please shut down any existing instances of OBS before trying to run a new instance. If you have OBS set to minimize to the system tray, please check to see if it's still running there."
AlreadyRunning.LaunchAnyway="Launch Anyway"
# warning when closing docks. it's frustrating that we actually need this.
DockCloseWarning.Title="Closing Dockable Window"
DockCloseWarning.Text="You just closed a dockable window. If you'd like to show it again, use the View → Docks menu on the menu bar."
# Auth
Auth.Authing.Title="Authenticating..."
Auth.Authing.Text="Authenticating with %1, please wait..."
......
......@@ -113,7 +113,7 @@
<x>0</x>
<y>0</y>
<width>1079</width>
<height>25</height>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menu_File">
......@@ -336,7 +336,7 @@
<addaction name="menuBasic_MainMenu_Help"/>
</widget>
<widget class="OBSBasicStatusBar" name="statusbar"/>
<widget class="QDockWidget" name="scenesDock">
<widget class="OBSDock" name="scenesDock">
<property name="features">
<set>QDockWidget::AllDockWidgetFeatures</set>
</property>
......@@ -468,7 +468,7 @@
</layout>
</widget>
</widget>
<widget class="QDockWidget" name="sourcesDock">
<widget class="OBSDock" name="sourcesDock">
<property name="features">
<set>QDockWidget::AllDockWidgetFeatures</set>
</property>
......@@ -601,7 +601,7 @@
</layout>
</widget>
</widget>
<widget class="QDockWidget" name="mixerDock">
<widget class="OBSDock" name="mixerDock">
<property name="features">
<set>QDockWidget::AllDockWidgetFeatures</set>
</property>
......@@ -651,7 +651,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>82</width>
<width>80</width>
<height>16</height>
</rect>
</property>
......@@ -705,7 +705,7 @@
<x>0</x>
<y>0</y>
<width>16</width>
<height>26</height>
<height>28</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -738,7 +738,7 @@
</layout>
</widget>
</widget>
<widget class="QDockWidget" name="transitionsDock">
<widget class="OBSDock" name="transitionsDock">
<property name="features">
<set>QDockWidget::AllDockWidgetFeatures</set>
</property>
......@@ -985,7 +985,7 @@
</layout>
</widget>
</widget>
<widget class="QDockWidget" name="controlsDock">
<widget class="OBSDock" name="controlsDock">
<property name="features">
<set>QDockWidget::AllDockWidgetFeatures</set>
</property>
......@@ -1712,6 +1712,12 @@
<extends>QListView</extends>
<header>source-tree.hpp</header>
</customwidget>
<customwidget>
<class>OBSDock</class>
<extends>QDockWidget</extends>
<header>window-dock.hpp</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="obs.qrc"/>
......
......@@ -216,7 +216,7 @@ OBSBasic::OBSBasic(QWidget *parent)
startingDockLayout = saveState();
statsDock = new QDockWidget();
statsDock = new OBSDock();
statsDock->setObjectName(QStringLiteral("statsDock"));
statsDock->setFeatures(QDockWidget::AllDockWidgetFeatures);
statsDock->setWindowTitle(QTStr("Basic.Stats"));
......
#include "window-dock.hpp"
#include "obs-app.hpp"
#include <QMessageBox>
void OBSDock::closeEvent(QCloseEvent *event)
{
auto msgBox = [] ()
{
QMessageBox::information(App()->GetMainWindow(),
QTStr("DockCloseWarning.Title"),
QTStr("DockCloseWarning.Text"));
};
bool warned = config_get_bool(App()->GlobalConfig(), "General",
"WarnedAboutClosingDocks");
if (!warned) {
QMetaObject::invokeMethod(App(), "Exec",
Qt::QueuedConnection,
Q_ARG(VoidFunc, msgBox));
config_set_bool(App()->GlobalConfig(), "General",
"WarnedAboutClosingDocks", true);
config_save_safe(App()->GlobalConfig(), "tmp", nullptr);
}
QDockWidget::closeEvent(event);
}
#pragma once
#include <QDockWidget>
class OBSDock : public QDockWidget {
Q_OBJECT
public:
inline OBSDock(QWidget *parent = nullptr) : QDockWidget(parent) {}
virtual void closeEvent(QCloseEvent *event);
};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册