f53df7da64
Code submissions have continually suffered from formatting inconsistencies that constantly have to be addressed. Using clang-format simplifies this by making code formatting more consistent, and allows automation of the code formatting so that maintainers can focus more on the code itself instead of code formatting.
37 lines
952 B
C++
37 lines
952 B
C++
#include "window-dock.hpp"
|
|
#include "obs-app.hpp"
|
|
|
|
#include <QMessageBox>
|
|
#include <QCheckBox>
|
|
|
|
void OBSDock::closeEvent(QCloseEvent *event)
|
|
{
|
|
auto msgBox = []() {
|
|
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",
|
|
"WarnedAboutClosingDocks");
|
|
if (!warned) {
|
|
QMetaObject::invokeMethod(App(), "Exec", Qt::QueuedConnection,
|
|
Q_ARG(VoidFunc, msgBox));
|
|
}
|
|
|
|
QDockWidget::closeEvent(event);
|
|
}
|