From 07c5f6ec23fcf9237a24e71adcfacabce677f818 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Fri, 29 Apr 2022 10:48:09 +0200 Subject: Change file organization. --- src/bin/gui/gui.pri | 10 +++++++ src/bin/gui/mainwindow.cpp | 27 +++++++++++++++++ src/bin/gui/mainwindow.h | 28 +++++++++++++++++ src/bin/gui/mainwindow.ui | 75 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 140 insertions(+) create mode 100644 src/bin/gui/gui.pri create mode 100644 src/bin/gui/mainwindow.cpp create mode 100644 src/bin/gui/mainwindow.h create mode 100644 src/bin/gui/mainwindow.ui (limited to 'src/bin/gui') diff --git a/src/bin/gui/gui.pri b/src/bin/gui/gui.pri new file mode 100644 index 0000000..c31fd79 --- /dev/null +++ b/src/bin/gui/gui.pri @@ -0,0 +1,10 @@ +QT += gui + +FORMS += \ + $$PWD/mainwindow.ui + +HEADERS += \ + $$PWD/mainwindow.h + +SOURCES += \ + $$PWD/mainwindow.cpp diff --git a/src/bin/gui/mainwindow.cpp b/src/bin/gui/mainwindow.cpp new file mode 100644 index 0000000..5b8422e --- /dev/null +++ b/src/bin/gui/mainwindow.cpp @@ -0,0 +1,27 @@ +#include "mainwindow.h" +#include "ui_mainwindow.h" + +#include "diceparser.h" + +MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWindow) +{ + ui->setupUi(this); + + connect(ui->m_rollButton, SIGNAL(pressed()), this, SLOT(rollDiceCommand())); + m_dieParser= new DiceParser(); +} + +MainWindow::~MainWindow() +{ + delete ui; +} +void MainWindow::rollDiceCommand() +{ + QString cmd= ui->m_cmdEdit->text(); + + if(m_dieParser->parseLine(cmd)) + { + m_dieParser->Start(); + m_dieParser->displayResult(); + } +} diff --git a/src/bin/gui/mainwindow.h b/src/bin/gui/mainwindow.h new file mode 100644 index 0000000..bd19b34 --- /dev/null +++ b/src/bin/gui/mainwindow.h @@ -0,0 +1,28 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +class DiceParser; +namespace Ui +{ + class MainWindow; +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit MainWindow(QWidget* parent= 0); + ~MainWindow(); + +protected slots: + void rollDiceCommand(); + +private: + Ui::MainWindow* ui; + DiceParser* m_dieParser; +}; + +#endif // MAINWINDOW_H diff --git a/src/bin/gui/mainwindow.ui b/src/bin/gui/mainwindow.ui new file mode 100644 index 0000000..d09f866 --- /dev/null +++ b/src/bin/gui/mainwindow.ui @@ -0,0 +1,75 @@ + + + MainWindow + + + + 0 + 0 + 800 + 600 + + + + MainWindow + + + + + + + + + + + + Roll + + + + + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + 0 + 0 + 800 + 29 + + + + + + + + -- cgit v1.2.3-70-g09d2