mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-01-26 07:08:34 -05:00
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.
28 lines
675 B
C++
28 lines
675 B
C++
#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);
|
|
}
|