Skip to content

Commit

Permalink
UI: Show a message when openning a legacy dock
Browse files Browse the repository at this point in the history
The message include a "Do not show again" checkbox
  • Loading branch information
tytan652 committed Mar 25, 2022
1 parent 5c9b1ff commit 73f16ff
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions UI/window-basic-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,27 @@ static void AddExtraModulePaths()

extern obs_frontend_callbacks *InitializeAPIInterface(OBSBasic *main);

static inline void legacyDockMessage()
{
QMessageBox msgbox(App()->GetMainWindow());
msgbox.setWindowTitle(
QTStr("Basic.MainMenu.Docks.LegacyDocksWarning.Title"));
msgbox.setText(QTStr("Basic.MainMenu.Docks.LegacyDocksWarning.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",
"InformedOfLegacyDocks", true);
config_save_safe(App()->GlobalConfig(), "tmp", nullptr);
}
}

void assignLegacyDockToggle(QDockWidget *dock, QAction *action)
{
auto handleWindowToggle = [action](bool vis) {
Expand All @@ -211,6 +232,14 @@ void assignLegacyDockToggle(QDockWidget *dock, QAction *action)
action->blockSignals(false);
};
auto handleMenuToggle = [dock](bool check) {
if (check) {
bool informed = config_get_bool(
App()->GlobalConfig(), "General",
"InformedOfLegacyDocks");

if (!informed)
legacyDockMessage();
}
dock->blockSignals(true);
dock->setVisible(check);
dock->blockSignals(false);
Expand Down

0 comments on commit 73f16ff

Please sign in to comment.