提交 b40d0006 编写于 作者: C Clayton Groeneveld 提交者: jp9000

UI: Add (Do not show again) checkbox to dock closing warning

Closes obsproject/obs-studio#1717
上级 4c786005
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册