From 7d4b8a4bd8ff991db67ac07216197f103fce5376 Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Mon, 12 Aug 2024 11:45:31 +0500 Subject: [PATCH] UI: ProgramEdit: Exclude from capture --- src/ui/form/controls/formwindow.cpp | 13 +++++++++++-- src/ui/form/controls/formwindow.h | 5 +++++ src/ui/form/prog/programswindow.cpp | 2 ++ src/ui/util/window/widgetwindow.cpp | 7 +++++++ src/ui/util/window/widgetwindow.h | 1 + 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/ui/form/controls/formwindow.cpp b/src/ui/form/controls/formwindow.cpp index 6a401d96..0e9dffc3 100644 --- a/src/ui/form/controls/formwindow.cpp +++ b/src/ui/form/controls/formwindow.cpp @@ -1,7 +1,6 @@ #include "formwindow.h" #include -#include #include FormWindow::FormWindow(QWidget *parent, Qt::WindowFlags f) : @@ -9,6 +8,16 @@ FormWindow::FormWindow(QWidget *parent, Qt::WindowFlags f) : { } +void FormWindow::setExcludeFromCapture(bool v) +{ + if (m_excludeFromCapture == v) + return; + + m_excludeFromCapture = v; + + excludeWindowFromCapture(this, excludeFromCapture()); +} + void FormWindow::setupFormWindow(IniUser *iniUser, const QString &iniGroup) { setupStateWatcher(); @@ -25,6 +34,6 @@ void FormWindow::setupStateWatcher() void FormWindow::setupWindowCapture(IniUser *iniUser, const QString &iniGroup) { if (iniUser->valueBool(iniGroup + "/excludeFromCapture", iniUser->excludeFromCapture())) { - OsUtil::excludeWindowFromCapture(this); + setExcludeFromCapture(true); } } diff --git a/src/ui/form/controls/formwindow.h b/src/ui/form/controls/formwindow.h index 61756f89..46256d5c 100644 --- a/src/ui/form/controls/formwindow.h +++ b/src/ui/form/controls/formwindow.h @@ -27,6 +27,9 @@ public: virtual WindowCode windowCode() const { return WindowNone; } + bool excludeFromCapture() const { return m_excludeFromCapture; } + void setExcludeFromCapture(bool v); + WidgetWindowStateWatcher *stateWatcher() const { return m_stateWatcher; } virtual void saveWindowState(bool wasVisible) { Q_UNUSED(wasVisible); } @@ -40,6 +43,8 @@ private: void setupWindowCapture(IniUser *iniUser, const QString &iniGroup); private: + bool m_excludeFromCapture = false; + WidgetWindowStateWatcher *m_stateWatcher = nullptr; }; diff --git a/src/ui/form/prog/programswindow.cpp b/src/ui/form/prog/programswindow.cpp index 84539c42..e1c99dbd 100644 --- a/src/ui/form/prog/programswindow.cpp +++ b/src/ui/form/prog/programswindow.cpp @@ -542,6 +542,8 @@ void ProgramsWindow::openAppEditForm(const AppRow &appRow, const QVector { if (!m_formAppEdit) { m_formAppEdit = new ProgramEditDialog(ctrl(), this); + + m_formAppEdit->setExcludeFromCapture(this->excludeFromCapture()); } m_formAppEdit->initialize(appRow, appIdList); diff --git a/src/ui/util/window/widgetwindow.cpp b/src/ui/util/window/widgetwindow.cpp index 9b2f536d..9bc07a05 100644 --- a/src/ui/util/window/widgetwindow.cpp +++ b/src/ui/util/window/widgetwindow.cpp @@ -2,6 +2,8 @@ #include +#include + WidgetWindow::WidgetWindow(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f) { } void WidgetWindow::showWindow(bool activate) @@ -52,6 +54,11 @@ void WidgetWindow::exposeWidget(QWidget *w) w->activateWindow(); } +void WidgetWindow::excludeWindowFromCapture(QWidget *w, bool exclude) +{ + OsUtil::excludeWindowFromCapture(w, exclude); +} + void WidgetWindow::moveEvent(QMoveEvent *event) { QWidget::moveEvent(event); diff --git a/src/ui/util/window/widgetwindow.h b/src/ui/util/window/widgetwindow.h index d4086cb8..0499f510 100644 --- a/src/ui/util/window/widgetwindow.h +++ b/src/ui/util/window/widgetwindow.h @@ -19,6 +19,7 @@ public: static void showWidget(QWidget *w, bool activate = true); static void exposeWidget(QWidget *w); + static void excludeWindowFromCapture(QWidget *w, bool exclude = true); signals: void activationChanged(bool isActive);