diff --git a/src/commandwidget.ui b/src/commandwidget.ui index bef71f7..671a1c1 100644 --- a/src/commandwidget.ui +++ b/src/commandwidget.ui @@ -13,197 +13,236 @@ Form - + + + 1 + - 6 + 4 - 6 + 4 - 6 + 4 - 6 + 4 - - - 14 + + + #frame{ + border: 1px solid white; + border-radius:6px; +} - - - - 方位+ - - - - - - - 俯仰+ - - - - - - - 画中画开 - - - - - - - 方位- - - - - - - - 俯仰- - - - - - - - 画中画关 - - - - - - - 变焦推远 - - - - - - - 扫描 - - - - - - - 复位 - - - - - - - 变焦拉近 - - - - - - - 吊舱 - - - - - - - 锁定 - - - - - - - 红外小 - - - - - - - 图像切换 - - - - - - - 0-3图拼接 - - - - - - - 红外大 - - - - - - - 4-6图拼接 - - - - - - - 连接 - - - - - - - - - - ... - - - - - - - ... - - - - - - - Qt::Orientation::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - Qt::Orientation::Vertical + + QFrame::Shape::StyledPanel - - - 20 - 40 - + + QFrame::Shadow::Raised - + + + 2 + + + 0 + + + 2 + + + 0 + + + + + 6 + + + 6 + + + 14 + + + + + 方位+ + + + + + + + 俯仰+ + + + + + + + 画中画开 + + + + + + + 方位- + + + + + + + 俯仰- + + + + + + + 画中画关 + + + + + + + 变焦推远 + + + + + + + 扫描 + + + + + + + 复位 + + + + + + + 变焦拉近 + + + + + + + 吊舱 + + + + + + + 锁定 + + + + + + + 红外小 + + + + + + + 图像切换 + + + + + + + 0-3图拼接 + + + + + + + 红外大 + + + + + + + 4-6图拼接 + + + + + + + 连接 + + + + + + + + + + ... + + + + + + + ... + + + + + + + Qt::Orientation::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + Qt::Orientation::Vertical + + + + 20 + 219 + + + + + + diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 6338b60..a80d30d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -57,6 +57,8 @@ MainWindow::MainWindow(QWidget *parent) initNotifyMessageConnection(); initChangeVideoLayoutConnection(); + initHideButton(); + setSavedVideoDir(); // ui->stackedWidget->setCurrentIndex(1); // ui->videoWidget1->play(list.at(0)); @@ -85,6 +87,17 @@ bool MainWindow::nativeEvent(const QByteArray &eventType, void *message, return QMainWindow::nativeEvent(eventType, message, result); } +void MainWindow::paintEvent(QPaintEvent *ev) { + int offset = 0; + if (ui->commandWidget->isHidden()) { + offset = hideCommandWidgetBtn->width() / 2; + } + + hideCommandWidgetBtn->move(ui->stackedWidget->width() - offset, + ui->commandWidget->height() / 2); + int i = 0; +} + void MainWindow::initSignalConnection() { connect(ui->commandWidget, &CommandWidget::startConnectionSignal, ui->videoWidget, &VideoWidget::udpPlay, Qt::UniqueConnection); @@ -140,6 +153,8 @@ void MainWindow::installWindowAgent() { playBackAction->setIcon(QIcon(":/images/playback.png")); playBackAction->setIconText("回放"); menuBar->addAction(playBackAction); + connect(playBackAction, &QAction::triggered, this, + &MainWindow::openSavedVideoDirSlot); QAction *pushStreamAction = new QAction(this); pushStreamAction->setIcon(QIcon(":/images/pushstream.png")); @@ -266,6 +281,16 @@ void MainWindow::setSavedVideoDir() { ui->videoWidget4->setVedioSaveFileDirPath("./video/video4"); } +void MainWindow::initHideButton() { + hideCommandWidgetBtn = new QToolButton(this); + hideCommandWidgetBtn->setIcon(QIcon(":/images/right.png")); + hideCommandWidgetBtn->setIconSize(QSize(24, 24)); + hideCommandWidgetBtn->setFixedSize(30, 30); + + connect(hideCommandWidgetBtn, &QToolButton::clicked, this, + &MainWindow::hideCommandWidgetSlot); +} + void MainWindow::showSettingDlgSlot() { settingDlg.exec(); } @@ -274,4 +299,17 @@ void MainWindow::showStreamSettingsDlgSlot() { streamAddrSettingsDlg.exec(); } -void MainWindow::changeVideoLayout(int index) {} +void MainWindow::hideCommandWidgetSlot() { + if (ui->commandWidget->isHidden()) { + ui->commandWidget->show(); + hideCommandWidgetBtn->setIcon(QIcon(":/images/right.png")); + } else { + ui->commandWidget->hide(); + hideCommandWidgetBtn->setIcon(QIcon(":/images/left.png")); + } +} + +void MainWindow::openSavedVideoDirSlot() { + QDesktopServices::openUrl( + QUrl(QApplication::applicationDirPath() + "/video")); +} diff --git a/src/mainwindow.h b/src/mainwindow.h index e023b16..769a248 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -2,7 +2,9 @@ #define MAINWINDOW_H #include +#include #include +#include #include #include "NotifyManager.h" @@ -43,7 +45,8 @@ public: Q_ENUM(Theme) protected: bool nativeEvent(const QByteArray &eventType, void *message, - qintptr *result); + qintptr *result) override; + void paintEvent(QPaintEvent *ev) override; signals: void themeChanged(); @@ -58,10 +61,13 @@ private: void installWindowAgent(); void loadStyleSheet(Theme theme); void setSavedVideoDir(); + + void initHideButton(); private slots: void showSettingDlgSlot(); void showStreamSettingsDlgSlot(); - void changeVideoLayout(int index); + void hideCommandWidgetSlot(); + void openSavedVideoDirSlot(); private: Ui::MainWindow *ui; @@ -71,5 +77,6 @@ private: QWK::WidgetWindowAgent *windowAgent; Theme currentTheme{}; NotifyManager *m_notifyManager = nullptr; + QToolButton *hideCommandWidgetBtn = nullptr; }; #endif // MAINWINDOW_H diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 112c626..f172b02 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -35,6 +35,9 @@ 4 + + 0 + diff --git a/src/resources/Qss/qss.qss b/src/resources/Qss/qss.qss index 28f5f34..7c5ebf9 100644 --- a/src/resources/Qss/qss.qss +++ b/src/resources/Qss/qss.qss @@ -323,3 +323,4 @@ QDoubleSpinBox color:white; } +