/
githubmirror
/
obs-studio
Обзор
Документация
Войти
/
githubmirror
/
obs-studio
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
31.0.4
UI/window-dock.cpp
44 строки
1 KB
Ryan Foster
clang-format: Increase column limit from 80 to 120
05 окт 2024, 01:19
05 окт 2024, 01:19
a1fbf10
Код
Авторство
О чём код?
#include "moc_window-dock.cpp" #include "obs-app.hpp" #include "window-basic-main.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()->GetUserConfig(), "General", "WarnedAboutClosingDocks", true); config_save_safe(App()->GetUserConfig(), "tmp", nullptr); } }; bool warned = config_get_bool(App()->GetUserConfig(), "General", "WarnedAboutClosingDocks"); if (!OBSBasic::Get()->Closing() && !warned) { QMetaObject::invokeMethod(App(), "Exec", Qt::QueuedConnection, Q_ARG(VoidFunc, msgBox)); } QDockWidget::closeEvent(event); if (widget() && event->isAccepted()) { QEvent widgetEvent(QEvent::Type(QEvent::User + QEvent::Close)); qApp->sendEvent(widget(), &widgetEvent); } } void OBSDock::showEvent(QShowEvent *event) { QDockWidget::showEvent(event); }