Commit 56c443ad authored by Yannick Bass's avatar Yannick Bass
Browse files

upgrade gui

parent ca4a4877
Loading
Loading
Loading
Loading
+1 −1
Changes for GUI/GUI.pro: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -8,8 +8,8 @@ QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

QT      += charts

QT      += widgets
TARGET = GUI
TEMPLATE = app

+31 −1
Changes for GUI/mainwindow.cpp: 31 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -17,6 +17,9 @@ MainWindow::MainWindow(QWidget *parent) :

    connect(ui->Browser, SIGNAL(clicked(bool)), this, SLOT(findFile()));
    connect(ui->startButton, SIGNAL(clicked(bool)), this, SLOT(startGame()));
    connect(ui->withcountButton,SIGNAL(clicked()),this,SLOT(enableWithCount()));
    connect(ui->classicButton,SIGNAL(clicked()),this,SLOT(disableWithCount()));
    connect(ui->hiderareCheckBox,SIGNAL(clicked(bool)),this,SLOT(hiderare(bool)));
}


@@ -31,7 +34,7 @@ MainWindow::~MainWindow()
/***************************************************/

void MainWindow::findFile() {
    filename = QFileDialog::getOpenFileName(this, tr("Browser"), QDir::currentPath(), tr("Text files (*.txt)"));
    QString filename = QFileDialog::getOpenFileName(this, tr("Browser"), QDir::currentPath(), tr("Text files (*.txt)"));
    ui->fileLine->setText(filename);
}

@@ -39,6 +42,10 @@ void MainWindow::findFile() {
void MainWindow::startGame() {
    stats = new Statsgen();
    stats->setFilename(ui->fileLine->text().toStdString());

    if(ui->withcountButton->isChecked())
        stats->setWithcount(true);

    stats->setTop(10);
    stats->setNbThread(4);

@@ -46,7 +53,9 @@ void MainWindow::startGame() {
    connect(workerThread, SIGNAL(resultReady()), this, SLOT(handleResults()));
    connect(workerThread, SIGNAL(finished()), workerThread, SLOT(deleteLater()));
    workerThread->start();
    waitBox.setText("Analysis in progress");

    waitBox.exec();
/*
    QFile file(filename);

@@ -64,7 +73,28 @@ void MainWindow::startGame() {

}

void MainWindow::enableWithCount()
{
    ui->classicButton->setChecked(false);
}

void MainWindow::disableWithCount()
{
    ui->withcountButton->setChecked(false);
}

void MainWindow::handleResults()
{
    waitBox.close();
    stats->print_stats();
}

void MainWindow::hiderare(bool checked)
{
    if(checked)
        stats->setHiderare(1);
    else
        stats->setHiderare(0);
}

+8 −1
Changes for GUI/mainwindow.h: 8 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -5,6 +5,8 @@

#include <QMainWindow>
#include <QThread>
#include <QMessageBox>

namespace Ui {
class MainWindow;
}
@@ -23,13 +25,18 @@ public slots:
    void findFile();
    void startGame();
    void handleResults();
    void enableWithCount();
    void disableWithCount();
    void hiderare(bool);
    void top(bool);



private:
    Ui::MainWindow *ui;
    QString filename;
    Statsgen * stats;
    QMessageBox waitBox;

};


+5 −5
Changes for GUI/mainwindow.ui: 5 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -109,14 +109,14 @@
            <widget class="QLineEdit" name="lineEdit_2"/>
           </item>
           <item row="0" column="0">
            <widget class="QRadioButton" name="radioButton">
            <widget class="QRadioButton" name="withcountButton">
             <property name="text">
              <string>Withcount</string>
             </property>
            </widget>
           </item>
           <item row="0" column="1">
            <widget class="QRadioButton" name="radioButton_2">
            <widget class="QRadioButton" name="classicButton">
             <property name="text">
              <string>Classic</string>
             </property>
@@ -179,17 +179,17 @@
          </property>
          <layout class="QGridLayout" name="gridLayout_3">
           <item row="0" column="0">
            <widget class="QCheckBox" name="checkBox_5">
            <widget class="QCheckBox" name="topCheckBox">
             <property name="text">
              <string>Top X answers to display</string>
             </property>
            </widget>
           </item>
           <item row="0" column="1">
            <widget class="QLineEdit" name="lineEdit_5"/>
            <widget class="QLineEdit" name="topLineEdit"/>
           </item>
           <item row="1" column="0">
            <widget class="QCheckBox" name="checkBox_6">
            <widget class="QCheckBox" name="hiderareCheckBox">
             <property name="text">
              <string>Hide rare stats</string>
             </property>