UI: Add (Do not show again) checkbox to dock closing warning
Closes obsproject/obs-studio#1717
This commit is contained in:
committed by
jp9000
parent
4c7860056e
commit
b40d000648
@@ -85,6 +85,7 @@ StudioMode.Program="Program"
|
||||
ShowInMultiview="Show in Multiview"
|
||||
VerticalLayout="Vertical Layout"
|
||||
Group="Group"
|
||||
DoNotShowAgain="Do not show again"
|
||||
|
||||
# warning if program already open
|
||||
AlreadyRunning.Title="OBS is already running"
|
||||
|
@@ -2,14 +2,28 @@
|
||||
#include "obs-app.hpp"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QCheckBox>
|
||||
|
||||
void OBSDock::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
auto msgBox = [] ()
|
||||
{
|
||||
QMessageBox::information(App()->GetMainWindow(),
|
||||
QTStr("DockCloseWarning.Title"),
|
||||
QTStr("DockCloseWarning.Text"));
|
||||
QMessageBox msgbox(App()->GetMainWindow());
|
||||
msgbox.setWindowTitle(QTStr("DockCloseWarning.Title"));
|
||||
msgbox.setText(QTStr("DockCloseWarning.Text"));
|
||||
msgbox.setIcon(QMessageBox::Icon::Information);
|
||||
msgbox.addButton(QMessageBox::Ok);
|
||||
|
||||
QCheckBox *cb = new QCheckBox(QTStr("DoNotShowAgain"));
|
||||
msgbox.setCheckBox(cb);
|
||||
|
||||
msgbox.exec();
|
||||
|
||||
if (cb->isChecked()) {
|
||||
config_set_bool(App()->GlobalConfig(), "General",
|
||||
"WarnedAboutClosingDocks", true);
|
||||
config_save_safe(App()->GlobalConfig(), "tmp", nullptr);
|
||||
}
|
||||
};
|
||||
|
||||
bool warned = config_get_bool(App()->GlobalConfig(), "General",
|
||||
@@ -18,9 +32,6 @@ void OBSDock::closeEvent(QCloseEvent *event)
|
||||
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