-
-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathDlgScreenCapture.cpp
More file actions
54 lines (48 loc) · 1.5 KB
/
DlgScreenCapture.cpp
File metadata and controls
54 lines (48 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "DlgScreenCapture.h"
#include "ui_DlgScreenCapture.h"
CDlgScreenCapture::CDlgScreenCapture(const QWebEngineDesktopMediaRequest request, QWidget *parent)
: QDialog(parent)
, ui(new Ui::CDlgScreenCapture)
{
ui->setupUi(this);
for(int i = 0; i < request.screensModel()->rowCount(); i++) {
QModelIndex index;
auto model = request.screensModel();
index = model->index(i, 0);
ui->cbScreen->addItem(QString::number(i) + ": " + model->data(index).toString());
}
for(int w = 0; w < request.windowsModel()->rowCount(); w++) {
QModelIndex index;
auto model = request.windowsModel();
index = model->index(w, 0);
ui->cbWindow->addItem(QString::number(w) + ": " + model->data(index).toString());
}
if(ui->cbScreen->count()> 0)
ui->rbScreens->setChecked(true);
}
CDlgScreenCapture::~CDlgScreenCapture()
{
delete ui;
}
void CDlgScreenCapture::on_cbScreen_currentIndexChanged(int index)
{
ui->rbScreens->setChecked(true);
}
void CDlgScreenCapture::on_cbWindow_currentIndexChanged(int index)
{
ui->rbWindows->setChecked(true);
}
int CDlgScreenCapture::GetIndex(Type &type, int &id)
{
if(ui->rbScreens->isChecked()) {
type = Type::Screen;
id = ui->cbScreen->currentIndex();
}
if(ui->rbWindows->isChecked()) {
type = Type::Window;
id = ui->cbWindow->currentIndex();
}
if(id < 0)
return -1;
return 0;
}