summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIoannis Christoforidis2021-04-05 22:44:52 +0200
committerIoannis Christoforidis2021-04-05 22:44:52 +0200
commit5df17b16bba055275fb1e94ab6781e45aaf2051e (patch)
tree7c5ac334c34ee7bdc06577efb1b5d8c409f9c409
parenttrivial console mode implemented (diff)
downloadspeedcheck-5df17b16bba055275fb1e94ab6781e45aaf2051e.tar.gz
speedcheck-5df17b16bba055275fb1e94ab6781e45aaf2051e.tar.xz
speedcheck-5df17b16bba055275fb1e94ab6781e45aaf2051e.zip
add Dialogue to add new Test
-rw-r--r--src/addserver.cpp45
-rw-r--r--src/addserver.h29
-rw-r--r--src/speedcheck.cpp8
-rw-r--r--src/speedcheck.h1
-rw-r--r--src/ui/addserver.ui112
-rw-r--r--src/ui/speedcheck.ui74
6 files changed, 240 insertions, 29 deletions
diff --git a/src/addserver.cpp b/src/addserver.cpp
new file mode 100644
index 0000000..be57ef4
--- /dev/null
+++ b/src/addserver.cpp
@@ -0,0 +1,45 @@
+#include "addserver.h"
+#include "ui_addserver.h"
+#include <QFileDialog>
+
+AddServer::AddServer(QWidget *parent) :
+ QWidget(parent),
+ _ui(new Ui::AddServer)
+{
+ _ui->setupUi(this);
+ connect(_ui->radioButton, SIGNAL(clicked(bool)), this, SLOT(serverClicked(bool)));
+ connect(_ui->radioButton_2, SIGNAL(clicked(bool)), this, SLOT(fileClicked(bool)));
+ connect(_ui->buttonBox,SIGNAL(rejected()), this, SLOT(rejected()));
+ connect(_ui->selectedFile_2,SIGNAL(clicked(bool)), this, SLOT(selectClicked(bool)));
+
+}
+
+void AddServer::serverClicked(bool) {
+ _ui->comboBox->setEnabled(true);
+ _ui->selectedFile_2->setEnabled(false);
+}
+void AddServer::fileClicked(bool) {
+ _ui->selectedFile_2->setEnabled(true);
+ _ui->comboBox->setEnabled(false);
+}
+void AddServer::selectClicked(bool) {
+ _filename = QFileDialog::getOpenFileName(this, tr("Select benchmark file"));
+ _ui->selectedFile->text() = _filename;
+}
+void AddServer::rejected() {
+ this->~AddServer();
+}
+void AddServer::accepted() {
+ if (_ui->radioButton->isChecked()) {
+ _filename = _ui->comboBox->currentText();
+ _ui->selectedFile->text() = _filename;
+ }
+ else if (_ui->radioButton_2->isChecked()) {
+ _filename = _ui->selectedFile_2->text();
+ _ui->selectedFile->text() = _filename;
+ }
+}
+AddServer::~AddServer()
+{
+ delete _ui;
+}
diff --git a/src/addserver.h b/src/addserver.h
new file mode 100644
index 0000000..561178b
--- /dev/null
+++ b/src/addserver.h
@@ -0,0 +1,29 @@
+#ifndef ADDSERVER_H
+#define ADDSERVER_H
+
+#include <QWidget>
+
+namespace Ui {
+class AddServer;
+}
+
+class AddServer : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit AddServer(QWidget *parent = nullptr);
+ ~AddServer();
+
+private slots:
+ void serverClicked(bool);
+ void fileClicked(bool);
+ void selectClicked(bool);
+ void rejected();
+ void accepted();
+private:
+ Ui::AddServer *_ui;
+ QString _filename;
+};
+
+#endif // ADDSERVER_H
diff --git a/src/speedcheck.cpp b/src/speedcheck.cpp
index f26bb1e..344be46 100644
--- a/src/speedcheck.cpp
+++ b/src/speedcheck.cpp
@@ -11,6 +11,7 @@
#include <QFileDialog>
#include <QDebug>
#include <QTimer>
+#include "addserver.h"
SpeedCheck::SpeedCheck(QString fileName, bool cml)
: _ui(new Ui::MainWindow),
@@ -24,6 +25,7 @@ SpeedCheck::SpeedCheck(QString fileName, bool cml)
connect(_ui->btnselect, SIGNAL(clicked(bool)), this, SLOT(selectClicked(bool)));
connect(_ui->btnrefreshNetwork, SIGNAL(clicked(bool)), this, SLOT(networkrefreshClicked(bool)));
connect(_ui->comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateNetworkInfos(int)));
+ connect(_ui-> actionAdd_Server, SIGNAL(triggered(bool)), this, SLOT(addServerClicked(bool)));
_ui->filelabel->setText("Selected File: " + _fileName);
_timer.setInterval(200);
connect(&_timer, SIGNAL(timeout()), this, SLOT(updateTimer()));
@@ -90,6 +92,7 @@ void SpeedCheck::testFinished()
_ui->comboBox->setEnabled(true);
_ui->btnrefreshNetwork->setEnabled(true);
quitClicked(true);
+ // TODO start next test if available
}
void SpeedCheck::networkrefreshClicked(bool)
{
@@ -139,3 +142,8 @@ void SpeedCheck::updateTimer()
_ui->picCpu->readNextValue();
_ui->picSpeed->readNextValue();
}
+void SpeedCheck::addServerClicked(bool) {
+ QWidget *wdg = new AddServer();
+ wdg->show();
+ logMessage("Hi");
+}
diff --git a/src/speedcheck.h b/src/speedcheck.h
index 37e3a25..bdb4a81 100644
--- a/src/speedcheck.h
+++ b/src/speedcheck.h
@@ -25,6 +25,7 @@ private slots:
void selectClicked(bool);
void quitClicked(bool);
void networkrefreshClicked(bool);
+ void addServerClicked(bool);
void updateNetworkInfos(int);
void testFinished();
void updateTimer();
diff --git a/src/ui/addserver.ui b/src/ui/addserver.ui
new file mode 100644
index 0000000..3e26a58
--- /dev/null
+++ b/src/ui/addserver.ui
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>AddServer</class>
+ <widget class="QWidget" name="AddServer">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>187</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Test hinzufügen</string>
+ </property>
+ <widget class="QRadioButton" name="radioButton">
+ <property name="geometry">
+ <rect>
+ <x>30</x>
+ <y>30</y>
+ <width>110</width>
+ <height>25</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Serverliste</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton" name="radioButton_2">
+ <property name="geometry">
+ <rect>
+ <x>30</x>
+ <y>80</y>
+ <width>110</width>
+ <height>25</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>File</string>
+ </property>
+ </widget>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="geometry">
+ <rect>
+ <x>70</x>
+ <y>130</y>
+ <width>187</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ <widget class="QComboBox" name="comboBox">
+ <property name="geometry">
+ <rect>
+ <x>160</x>
+ <y>30</y>
+ <width>211</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <item>
+ <property name="text">
+ <string>server1</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>server2</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>server3</string>
+ </property>
+ </item>
+ </widget>
+ <widget class="QLabel" name="selectedFile">
+ <property name="geometry">
+ <rect>
+ <x>160</x>
+ <y>80</y>
+ <width>141</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Select File...</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="selectedFile_2">
+ <property name="geometry">
+ <rect>
+ <x>290</x>
+ <y>80</y>
+ <width>88</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Select</string>
+ </property>
+ </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/ui/speedcheck.ui b/src/ui/speedcheck.ui
index dfcce4a..095b86b 100644
--- a/src/ui/speedcheck.ui
+++ b/src/ui/speedcheck.ui
@@ -16,19 +16,6 @@
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
- <widget class="QLabel" name="lblNetwork">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Network (100MBit / 1GBit)</string>
- </property>
- </widget>
- </item>
- <item>
<widget class="QFrame" name="frame">
<property name="enabled">
<bool>true</bool>
@@ -159,6 +146,19 @@
</widget>
</item>
<item>
+ <widget class="QLabel" name="lblNetwork">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Network (100MBit / 1GBit)</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="GraphWidget" name="picSpeed" native="true"/>
</item>
<item>
@@ -273,6 +273,13 @@
</spacer>
</item>
<item>
+ <widget class="QLabel" name="filelabel">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QPushButton" name="btnQuit">
<property name="text">
<string>Quit</string>
@@ -282,25 +289,34 @@
</layout>
</widget>
</item>
- <item>
- <widget class="QLabel" name="filelabel">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
</layout>
</widget>
<widget class="QStatusBar" name="statusBar"/>
+ <widget class="QMenuBar" name="menuBar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>768</width>
+ <height>24</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menu_misc">
+ <property name="title">
+ <string>Misc</string>
+ </property>
+ <addaction name="actionAdd_Server"/>
+ </widget>
+ <addaction name="menu_misc"/>
+ </widget>
+ <action name="actionAdd_Server">
+ <property name="text">
+ <string>Add Test</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+A</string>
+ </property>
+ </action>
</widget>
<customwidgets>
<customwidget>