Commit 592c113f6818ad8d67d18041d89a5fc2be6ff2f3
1 parent
89bc72bd
added help menu
Showing
2 changed files
with
53 additions
and
14 deletions
app/OpenBR/CMakeLists.txt
| 1 | +include_directories(${CMAKE_CURRENT_BINARY_DIR}) | ||
| 1 | add_executable(OpenBR OpenBR.cpp) | 2 | add_executable(OpenBR OpenBR.cpp) |
| 2 | qt5_use_modules(OpenBR ${QT_DEPENDENCIES}) | 3 | qt5_use_modules(OpenBR ${QT_DEPENDENCIES}) |
| 3 | target_link_libraries(OpenBR openbr ${BR_THIRDPARTY_LIBS}) | 4 | target_link_libraries(OpenBR openbr ${BR_THIRDPARTY_LIBS}) |
app/OpenBR/OpenBR.cpp
| @@ -2,34 +2,72 @@ | @@ -2,34 +2,72 @@ | ||
| 2 | #include <QGridLayout> | 2 | #include <QGridLayout> |
| 3 | #include <QLabel> | 3 | #include <QLabel> |
| 4 | #include <QMainWindow> | 4 | #include <QMainWindow> |
| 5 | +#include <QMenu> | ||
| 6 | +#include <QMenuBar> | ||
| 7 | +#include <QMessageBox> | ||
| 5 | #include <openbr/openbr_plugin.h> | 8 | #include <openbr/openbr_plugin.h> |
| 6 | #include <openbr/gui/tail.h> | 9 | #include <openbr/gui/tail.h> |
| 7 | #include <openbr/gui/templateviewer.h> | 10 | #include <openbr/gui/templateviewer.h> |
| 8 | 11 | ||
| 9 | using namespace br; | 12 | using namespace br; |
| 10 | 13 | ||
| 14 | +class MainWindow : public QMainWindow | ||
| 15 | +{ | ||
| 16 | + Q_OBJECT | ||
| 17 | + | ||
| 18 | +public: | ||
| 19 | + explicit MainWindow(QWidget *parent = 0) | ||
| 20 | + : QMainWindow(parent) | ||
| 21 | + { | ||
| 22 | + QGridLayout *gridLayout = new QGridLayout(); | ||
| 23 | + TemplateViewer *target = new TemplateViewer(); | ||
| 24 | + TemplateViewer *query = new TemplateViewer(); | ||
| 25 | + Tail *tail = new Tail(); | ||
| 26 | + gridLayout->addWidget(query, 0, 0, 1, 1); | ||
| 27 | + gridLayout->addWidget(target, 0, 1, 1, 1); | ||
| 28 | + gridLayout->addWidget(tail, 1, 0, 1, 2); | ||
| 29 | + | ||
| 30 | + QMenuBar *menuBar = new QMenuBar(); | ||
| 31 | + QMenu *helpMenu = new QMenu("Help"); | ||
| 32 | + QAction *aboutAction = new QAction("About", this); | ||
| 33 | + QAction *contactAction = new QAction("Contact", this); | ||
| 34 | + helpMenu->addAction(aboutAction); | ||
| 35 | + helpMenu->addAction(contactAction); | ||
| 36 | + connect(aboutAction, SIGNAL(triggered()), this, SLOT(about())); | ||
| 37 | + connect(contactAction, SIGNAL(triggered()), this, SLOT(contact())); | ||
| 38 | + menuBar->addMenu(helpMenu); | ||
| 39 | + | ||
| 40 | + setGeometry(0, 0, 800, 600); | ||
| 41 | + setMenuBar(menuBar); | ||
| 42 | + setWindowIcon(QIcon(":/openbr.png")); | ||
| 43 | + setWindowTitle("OpenBR"); | ||
| 44 | + setCentralWidget(new QWidget(this)); | ||
| 45 | + centralWidget()->setLayout(gridLayout); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | +private slots: | ||
| 49 | + void about() | ||
| 50 | + { | ||
| 51 | + QMessageBox::about(this, "About", Context::about()); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + void contact() | ||
| 55 | + { | ||
| 56 | + QMessageBox::about(this, "Contact", "openbr-dev@googlegroups.com\n\nPlease reach out to us with questions and comments on this public mailing list!"); | ||
| 57 | + } | ||
| 58 | +}; | ||
| 59 | + | ||
| 11 | int main(int argc, char *argv[]) | 60 | int main(int argc, char *argv[]) |
| 12 | { | 61 | { |
| 13 | QApplication application(argc, argv); | 62 | QApplication application(argc, argv); |
| 14 | Context::initialize(argc, argv); | 63 | Context::initialize(argc, argv); |
| 15 | 64 | ||
| 16 | - QGridLayout *gridLayout = new QGridLayout(); | ||
| 17 | - TemplateViewer *target = new TemplateViewer(); | ||
| 18 | - TemplateViewer *query = new TemplateViewer(); | ||
| 19 | - Tail *tail = new Tail(); | ||
| 20 | - gridLayout->addWidget(query, 0, 0, 1, 1); | ||
| 21 | - gridLayout->addWidget(target, 0, 1, 1, 1); | ||
| 22 | - gridLayout->addWidget(tail, 1, 0, 1, 2); | ||
| 23 | - | ||
| 24 | - QMainWindow mainWindow; | ||
| 25 | - mainWindow.setGeometry(0, 0, 800, 600); | ||
| 26 | - mainWindow.setWindowIcon(QIcon(":/openbr.png")); | ||
| 27 | - mainWindow.setWindowTitle("OpenBR"); | ||
| 28 | - mainWindow.setCentralWidget(new QWidget(&mainWindow)); | ||
| 29 | - mainWindow.centralWidget()->setLayout(gridLayout); | 65 | + MainWindow mainWindow; |
| 30 | mainWindow.show(); | 66 | mainWindow.show(); |
| 31 | 67 | ||
| 32 | const int result = application.exec(); | 68 | const int result = application.exec(); |
| 33 | Context::finalize(); | 69 | Context::finalize(); |
| 34 | return result; | 70 | return result; |
| 35 | } | 71 | } |
| 72 | + | ||
| 73 | +#include "OpenBR.moc" |