1#include <QWindowCapture>
3#include <QLoggingCategory>
6#include "ui_DlgCapture.h"
7#include "ParameterRecordUI.h"
9static Q_LOGGING_CATEGORY(log,
"Screen.Capture.Dialog")
13 , m_pParameters(pPara)
17 setWindowTitle(tr(
"Screen capture"));
18 setWindowIcon(QIcon::fromTheme(
"camera-photo"));
20 auto screens = QGuiApplication::screens();
21 ui->sbScreen->setMinimum(0);
22 ui->sbScreen->setMaximum(screens.size() - 1);
23 ui->sbScreen->setValue(m_pParameters->GetScreen());
25 m_Windows = QWindowCapture::capturableWindows();
26 foreach(
auto w, m_Windows)
27 ui->cmbWindows->addItem(w.description());
30 ui->rbCustomize->setVisible(
false);
31 ui->rbCustomRectangle->setVisible(
false);
33 switch(m_pParameters->GetTarget())
35 case CParameterScreenCapture::TARGET::Screen:
36 ui->rbScreen->setChecked(
true);
38 case CParameterScreenCapture::TARGET::Window:
39 ui->rbWindow->setChecked(
true);
41 case CParameterScreenCapture::TARGET::CustomRectangle:
42 ui->rbCustomRectangle->setChecked(
true);
44 case CParameterScreenCapture::TARGET::Curstomize:
45 ui->rbCustomize->setChecked(
true);
49 switch(m_pParameters->GetOperate())
51 case CParameterScreenCapture::OPERATE::Shot:
52 ui->rbShot->setChecked(
true);
54 case CParameterScreenCapture::OPERATE::Record:
55 ui->rbRecord->setChecked(
true);
60 m_pRecordUI->SetParameter(&m_pParameters->m_Record);
61 ui->objTab->addTab(m_pRecordUI, m_pRecordUI->windowIcon(), m_pRecordUI->windowTitle());
64CDlgCapture::~CDlgCapture()
69void CDlgCapture::accept()
74 ui->objTab->setCurrentWidget(m_pRecordUI);
78 if(ui->rbScreen->isChecked())
79 m_pParameters->SetTarget(CParameterScreenCapture::TARGET::Screen);
80 else if(ui->rbWindow->isChecked())
81 m_pParameters->SetTarget(CParameterScreenCapture::TARGET::Window);
82 else if(ui->rbCustomRectangle->isChecked())
83 m_pParameters->SetTarget(CParameterScreenCapture::TARGET::CustomRectangle);
84 else if(ui->rbCustomize->isChecked())
85 m_pParameters->SetTarget(CParameterScreenCapture::TARGET::Curstomize);
87 if(ui->rbShot->isChecked())
88 m_pParameters->SetOperate(CParameterScreenCapture::OPERATE::Shot);
89 else if(ui->rbRecord->isChecked())
90 m_pParameters->SetOperate(CParameterScreenCapture::OPERATE::Record);
92 m_pParameters->SetScreen(ui->sbScreen->value());
93 int nIndex = ui->cmbWindows->currentIndex();
94 if(-1 < nIndex && nIndex < m_Windows.size())
95 m_pParameters->SetWindow(m_Windows.at(nIndex));
97 nRet = m_pRecordUI->Accept();
virtual bool CheckValidity(bool validity=false)
Check parameters validity.