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.
This commit is contained in:
27
UI/window-dock.cpp
Normal file
27
UI/window-dock.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#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);
|
||||
}
|
Reference in New Issue
Block a user