UI: ProgramEdit: Exclude from capture

This commit is contained in:
Nodir Temirkhodjaev 2024-08-12 11:45:31 +05:00
parent 63db20043a
commit 7d4b8a4bd8
5 changed files with 26 additions and 2 deletions

View File

@ -1,7 +1,6 @@
#include "formwindow.h"
#include <user/iniuser.h>
#include <util/osutil.h>
#include <util/window/widgetwindowstatewatcher.h>
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);
}
}

View File

@ -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;
};

View File

@ -542,6 +542,8 @@ void ProgramsWindow::openAppEditForm(const AppRow &appRow, const QVector<qint64>
{
if (!m_formAppEdit) {
m_formAppEdit = new ProgramEditDialog(ctrl(), this);
m_formAppEdit->setExcludeFromCapture(this->excludeFromCapture());
}
m_formAppEdit->initialize(appRow, appIdList);

View File

@ -2,6 +2,8 @@
#include <QWindowStateChangeEvent>
#include <util/osutil.h>
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);

View File

@ -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);