diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,7 +38,7 @@ find_package(Qwt 6.1 REQUIRED) include_directories(${QWT_INCLUDE_DIR}) # wrap UI files -qt5_wrap_ui(UI_FILES mainwindow.ui) +qt5_wrap_ui(UI_FILES mainwindow.ui about_dialog.ui) # Tell CMake to create the helloworld executable add_executable(serialplot main.cpp mainwindow.cpp customcheckablebutton.cpp ${UI_FILES}) diff --git a/about_dialog.ui b/about_dialog.ui new file mode 100644 --- /dev/null +++ b/about_dialog.ui @@ -0,0 +1,88 @@ + + + AboutDialog + + + + 0 + 0 + 487 + 300 + + + + About + + + + + + <html><head/><body><p align="center"><span style=" font-size:14pt;">SerialPlot</span></p><p align="center"><span style=" font-size:10pt;">v0.1</span></p><p align="center">Developed by Hasan Yavuz Ă–zderya</p><p align="center">Using Qt and Qwt (<a href="http://qwt.sf.net"><span style=" text-decoration: underline; color:#0000ff;">http://qwt.sf.net</span></a>)</p><p align="center"><br/></p><p align="center">This software is GPL licensed. You can obtain source code from <a href="https://bitbucket.org/hyOzd/serialplot"><span style=" text-decoration: underline; color:#0000ff;">https://bitbucket.org/hyOzd/serialplot</span></a>.<br/></p></body></html> + + + true + + + true + + + + + + + + + About Qt + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Close + + + + + + + + + + + buttonBox + accepted() + AboutDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + AboutDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/mainwindow.cpp b/mainwindow.cpp --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -20,6 +20,7 @@ #include "mainwindow.h" #include "ui_mainwindow.h" #include +#include #include #include #include @@ -30,8 +31,15 @@ MainWindow::MainWindow(QWidget *parent) ui(new Ui::MainWindow) { ui->setupUi(this); + setupAboutDialog(); // init UI signals + + // menu signals + QObject::connect(ui->actionHelpAbout, &QAction::triggered, + &aboutDialog, &QWidget::show); + + // port tab signals QObject::connect(ui->pbReloadPorts, &QPushButton::clicked, this, &MainWindow::loadPortList); @@ -168,6 +176,15 @@ MainWindow::~MainWindow() delete ui; } +void MainWindow::setupAboutDialog() +{ + Ui_AboutDialog uiAboutDialog; + uiAboutDialog.setupUi(&aboutDialog); + + QObject::connect(uiAboutDialog.pbAboutQt, &QPushButton::clicked, + [](){ QApplication::aboutQt();}); +} + void MainWindow::loadPortList() { QString currentSelection = ui->cbPortList->currentText(); diff --git a/mainwindow.h b/mainwindow.h --- a/mainwindow.h +++ b/mainwindow.h @@ -28,6 +28,8 @@ #include #include +#include "ui_about_dialog.h" + namespace Ui { class MainWindow; } @@ -58,6 +60,9 @@ private: QButtonGroup stopBitsButtons; QButtonGroup flowControlButtons; + QDialog aboutDialog; + void setupAboutDialog(); + QSerialPort serialPort; unsigned int numOfSamples; diff --git a/serialplot.pro b/serialplot.pro --- a/serialplot.pro +++ b/serialplot.pro @@ -41,6 +41,7 @@ HEADERS += mainwindow.h \ utils.h \ customcheckablebutton.h -FORMS += mainwindow.ui +FORMS += mainwindow.ui \ + about_dialog.ui CONFIG += c++11