| 11 | #include <QTimer> |
| 12 | #include <QVBoxLayout> |
| 13 | T_ElaScreen::T_ElaScreen(QWidget* parent) |
| 14 | : T_BasePage(parent) |
| 15 | { |
| 16 | // 预览窗口标题 |
| 17 | setWindowTitle("ElaScreen"); |
| 18 | |
| 19 | // 顶部元素 |
| 20 | createCustomWidget("DXGI录制组件被放置于此,可在此界面预览录制效果"); |
| 21 | |
| 22 | ElaDxgiManager* dxgiManager = ElaDxgiManager::getInstance(); |
| 23 | dxgiManager->setGrabArea(1920, 1080); |
| 24 | |
| 25 | ElaScrollPageArea* dxgiScreenArea = new ElaScrollPageArea(this); |
| 26 | dxgiScreenArea->setFixedHeight(700); |
| 27 | QHBoxLayout* dxgiScreenLayout = new QHBoxLayout(dxgiScreenArea); |
| 28 | _dxgiScreen = new ElaDxgiScreen(this); |
| 29 | _dxgiScreen->setFixedSize(1200, 678); |
| 30 | dxgiScreenLayout->addWidget(_dxgiScreen); |
| 31 | |
| 32 | ElaText* dxText = new ElaText("显卡选择", this); |
| 33 | dxText->setTextPixelSize(15); |
| 34 | _dxComboBox = new ElaComboBox(this); |
| 35 | _dxComboBox->addItems(dxgiManager->getDxDeviceList()); |
| 36 | _dxComboBox->setCurrentIndex(dxgiManager->getDxDeviceID()); |
| 37 | |
| 38 | ElaText* outputText = new ElaText("屏幕选择", this); |
| 39 | outputText->setTextPixelSize(15); |
| 40 | _outputComboBox = new ElaComboBox(this); |
| 41 | _outputComboBox->addItems(dxgiManager->getOutputDeviceList()); |
| 42 | _outputComboBox->setCurrentIndex(dxgiManager->getOutputDeviceID()); |
| 43 | |
| 44 | connect(_dxComboBox, QOverload<int>::of(&ElaComboBox::currentIndexChanged), this, [=](int index) { |
| 45 | dxgiManager->setDxDeviceID(index); |
| 46 | _outputComboBox->blockSignals(true); |
| 47 | _outputComboBox->clear(); |
| 48 | _outputComboBox->addItems(dxgiManager->getOutputDeviceList()); |
| 49 | _outputComboBox->setCurrentIndex(dxgiManager->getOutputDeviceID()); |
| 50 | _outputComboBox->blockSignals(false); |
| 51 | _dxgiScreen->update(); |
| 52 | }); |
| 53 | connect(_outputComboBox, QOverload<int>::of(&ElaComboBox::currentIndexChanged), this, [=](int index) { |
| 54 | dxgiManager->setOutputDeviceID(index); |
| 55 | _dxgiScreen->update(); |
| 56 | }); |
| 57 | |
| 58 | ElaToggleButton* startButton = new ElaToggleButton("捕获", this); |
| 59 | connect(startButton, &ElaToggleButton::toggled, this, [=](bool isToggled) { |
| 60 | if (isToggled) |
| 61 | { |
| 62 | dxgiManager->startGrabScreen(); |
| 63 | } |
| 64 | else |
| 65 | { |
| 66 | dxgiManager->stopGrabScreen(); |
| 67 | _dxgiScreen->update(); |
| 68 | } |
| 69 | }); |
| 70 |
nothing calls this directly
no test coverage detected