2019-03-05 14:37:01 -08:00
|
|
|
#include "window-dock.hpp"
|
|
|
|
#include "obs-app.hpp"
|
|
|
|
|
|
|
|
#include <QMessageBox>
|
2019-03-05 15:16:16 -08:00
|
|
|
#include <QCheckBox>
|
2019-03-05 14:37:01 -08:00
|
|
|
|
|
|
|
void OBSDock::closeEvent(QCloseEvent *event)
|
|
|
|
{
|
2019-06-22 22:13:45 -07:00
|
|
|
auto msgBox = []() {
|
2019-03-05 15:16:16 -08:00
|
|
|
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);
|
|
|
|
}
|
2019-03-05 14:37:01 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
bool warned = config_get_bool(App()->GlobalConfig(), "General",
|
2019-06-22 22:13:45 -07:00
|
|
|
"WarnedAboutClosingDocks");
|
2019-03-05 14:37:01 -08:00
|
|
|
if (!warned) {
|
2019-06-22 22:13:45 -07:00
|
|
|
QMetaObject::invokeMethod(App(), "Exec", Qt::QueuedConnection,
|
|
|
|
Q_ARG(VoidFunc, msgBox));
|
2019-03-05 14:37:01 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
QDockWidget::closeEvent(event);
|
|
|
|
}
|