ScreenRecorder: Allow only one screen recorder dialog at a time

And show the dialog if it was already open but minimized.

Change-Id: I9aebebba88488c795b253f6dadda7f356ffc9dc4
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
Alessandro Portale
2023-10-12 13:36:35 +02:00
parent 7cd63a597e
commit 1418dc04e0

View File

@@ -94,6 +94,19 @@ public:
layout()->setSizeConstraint(QLayout::SetFixedSize);
}
static void showDialog()
{
static QPointer<QDialog> staticInstance;
if (staticInstance.isNull()) {
staticInstance = new ScreenRecorderDialog(Core::ICore::dialogParent());
staticInstance->setAttribute(Qt::WA_DeleteOnClose);
}
staticInstance->show();
staticInstance->raise();
staticInstance->activateWindow();
}
private:
RecordWidget *m_recordWidget;
TemporaryFile m_recordFile;
@@ -132,9 +145,7 @@ private:
return;
}
auto dialog = new ScreenRecorderDialog(Core::ICore::dialogParent());
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show();
ScreenRecorderDialog::showDialog();
}
};