diff options
-rw-r--r-- | client/Client.cpp | 4 | ||||
-rw-r--r-- | client/Client.h | 2 | ||||
-rw-r--r-- | client/client.pro.user | 260 | ||||
-rw-r--r-- | client/mainwindow.cpp | 23 | ||||
-rw-r--r-- | client/mainwindow.h | 1 |
5 files changed, 15 insertions, 275 deletions
diff --git a/client/Client.cpp b/client/Client.cpp index 16b9bf3..263a57f 100644 --- a/client/Client.cpp +++ b/client/Client.cpp @@ -34,7 +34,7 @@ void Client::ClientEcho() { connect(socket, &QTcpSocket::disconnected, [&]() { socket->disconnectFromHost(); lineCounter = 0; - refreshChart=true; + refreshChart=true; }); timer->start(1000); @@ -53,8 +53,6 @@ void Client::timeFunction() { socket->connectToHost(networkAddress, tcpPortAddress); socket->write(msgToSend); - - } void Client::missingRecords() { diff --git a/client/Client.h b/client/Client.h index cb6e6b8..59e0841 100644 --- a/client/Client.h +++ b/client/Client.h @@ -17,11 +17,11 @@ class Client : public QObject public: Client(QObject *parent = 0); virtual ~Client(); + bool refreshChart; public slots: void ClientEcho(); // function to ask data from wheather station void timeFunction(); // function to look every second what time currently is en handle if minute is passed - bool refreshChart; private: void missingRecords(); diff --git a/client/client.pro.user b/client/client.pro.user deleted file mode 100644 index 0490100..0000000 --- a/client/client.pro.user +++ /dev/null @@ -1,260 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE QtCreatorProject> -<!-- Written by QtCreator 8.0.1, 2022-10-30T21:37:24. --> -<qtcreator> - <data> - <variable>EnvironmentId</variable> - <value type="QByteArray">{aa240e53-c124-4cf0-84a8-30bfe8a2cf83}</value> - </data> - <data> - <variable>ProjectExplorer.Project.ActiveTarget</variable> - <value type="qlonglong">0</value> - </data> - <data> - <variable>ProjectExplorer.Project.EditorSettings</variable> - <valuemap type="QVariantMap"> - <value type="bool" key="EditorConfiguration.AutoIndent">true</value> - <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> - <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> - <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> - <value type="QString" key="language">Cpp</value> - <valuemap type="QVariantMap" key="value"> - <value type="QByteArray" key="CurrentPreferences">CppGlobal</value> - </valuemap> - </valuemap> - <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> - <value type="QString" key="language">QmlJS</value> - <valuemap type="QVariantMap" key="value"> - <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> - </valuemap> - </valuemap> - <value type="qlonglong" key="EditorConfiguration.CodeStyle.Count">2</value> - <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> - <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> - <value type="int" key="EditorConfiguration.IndentSize">4</value> - <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> - <value type="int" key="EditorConfiguration.MarginColumn">80</value> - <value type="bool" key="EditorConfiguration.MouseHiding">true</value> - <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> - <value type="int" key="EditorConfiguration.PaddingMode">1</value> - <value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value> - <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> - <value type="bool" key="EditorConfiguration.ShowMargin">false</value> - <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> - <value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value> - <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> - <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> - <value type="int" key="EditorConfiguration.TabSize">8</value> - <value type="bool" key="EditorConfiguration.UseGlobal">true</value> - <value type="bool" key="EditorConfiguration.UseIndenter">false</value> - <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> - <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> - <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> - <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> - <value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value> - <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> - <value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value> - </valuemap> - </data> - <data> - <variable>ProjectExplorer.Project.PluginSettings</variable> - <valuemap type="QVariantMap"> - <valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks"> - <value type="bool" key="AutoTest.Framework.Boost">true</value> - <value type="bool" key="AutoTest.Framework.CTest">false</value> - <value type="bool" key="AutoTest.Framework.Catch">true</value> - <value type="bool" key="AutoTest.Framework.GTest">true</value> - <value type="bool" key="AutoTest.Framework.QtQuickTest">true</value> - <value type="bool" key="AutoTest.Framework.QtTest">true</value> - </valuemap> - <valuemap type="QVariantMap" key="AutoTest.CheckStates"/> - <value type="int" key="AutoTest.RunAfterBuild">0</value> - <value type="bool" key="AutoTest.UseGlobal">true</value> - <valuemap type="QVariantMap" key="ClangTools"> - <value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value> - <value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value> - <value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value> - <value type="int" key="ClangTools.ParallelJobs">4</value> - <valuelist type="QVariantList" key="ClangTools.SelectedDirs"/> - <valuelist type="QVariantList" key="ClangTools.SelectedFiles"/> - <valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/> - <value type="bool" key="ClangTools.UseGlobalSettings">true</value> - </valuemap> - </valuemap> - </data> - <data> - <variable>ProjectExplorer.Project.Target.0</variable> - <valuemap type="QVariantMap"> - <value type="QString" key="DeviceType">Desktop</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 6.4.0 MinGW 64-bit</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 6.4.0 MinGW 64-bit</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt6.640.win64_mingw_kit</value> - <value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> - <value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> - <value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> - <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> - <value type="int" key="EnableQmlDebugging">0</value> - <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:\Github2\avans-whether-station\build-client-Desktop_Qt_6_4_0_MinGW_64_bit-Debug</value> - <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">D:/Github2/avans-whether-station/build-client-Desktop_Qt_6_4_0_MinGW_64_bit-Debug</value> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> - <valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> - </valuemap> - <value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> - </valuemap> - <value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> - <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> - <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/> - <value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value> - <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> - <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> - <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:\Github2\avans-whether-station\build-client-Desktop_Qt_6_4_0_MinGW_64_bit-Release</value> - <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">D:/Github2/avans-whether-station/build-client-Desktop_Qt_6_4_0_MinGW_64_bit-Release</value> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> - <valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> - </valuemap> - <value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> - </valuemap> - <value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> - <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> - <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/> - <value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value> - <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> - <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> - <value type="int" key="QtQuickCompiler">0</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2"> - <value type="int" key="EnableQmlDebugging">0</value> - <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:\Github2\avans-whether-station\build-client-Desktop_Qt_6_4_0_MinGW_64_bit-Profile</value> - <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">D:/Github2/avans-whether-station/build-client-Desktop_Qt_6_4_0_MinGW_64_bit-Profile</value> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> - <valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> - </valuemap> - <value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> - </valuemap> - <value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> - <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> - <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/> - <value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value> - <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> - <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> - <value type="int" key="QtQuickCompiler">0</value> - <value type="int" key="SeparateDebugInfo">0</value> - </valuemap> - <value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">3</value> - <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> - <value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> - <valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/> - <value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> - </valuemap> - <value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> - <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> - <value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value> - <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value> - <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> - <valuelist type="QVariantList" key="CustomOutputParsers"/> - <value type="int" key="PE.EnvironmentAspect.Base">2</value> - <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value> - <value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value> - <value type="bool" key="RunConfiguration.UseCppDebugger">false</value> - <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> - <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> - <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> - </valuemap> - <value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value> - </valuemap> - </data> - <data> - <variable>ProjectExplorer.Project.TargetCount</variable> - <value type="qlonglong">1</value> - </data> - <data> - <variable>ProjectExplorer.Project.Updater.FileVersion</variable> - <value type="int">22</value> - </data> - <data> - <variable>Version</variable> - <value type="int">22</value> - </data> -</qtcreator> diff --git a/client/mainwindow.cpp b/client/mainwindow.cpp index 6f2337d..597b122 100644 --- a/client/mainwindow.cpp +++ b/client/mainwindow.cpp @@ -12,6 +12,9 @@ MainWindow::MainWindow(QWidget *parent) { ui->setupUi(this); client.ClientEcho(); + timer = new QTimer(this); + connect(timer, SIGNAL(timeout()), this, SLOT(timeFunction())); + timer->start(1000); _dbConenctor = new dbConnector(this); } @@ -22,15 +25,14 @@ MainWindow::~MainWindow() delete ui; } -void MainWindow::timeFunction() -{ - client.timeFunction(); - if(client.refreshChart==true){ - drawGraph(); - client.refreshChart=false; - } - - +void MainWindow::timeFunction() { + printf("timeFunction\n"); + client.timeFunction(); // segfault ->? + if(client.refreshChart == true){ + client.refreshChart = false; + printf("redrawing...\n"); + drawGraph(); + } } void MainWindow::on_actionConnection_triggered() @@ -41,7 +43,7 @@ void MainWindow::on_actionConnection_triggered() void MainWindow::on_actionRefresh_triggered() { - // drawGraph(); + drawGraph(); } void MainWindow::on_actionDisconnenct_triggered() @@ -55,7 +57,6 @@ void MainWindow::drawGraph(){ QLineSeries *seriesHumidity = new QLineSeries(); QLineSeries *seriesPressure = new QLineSeries(); - if(dbRef.open()){ QSqlQuery queryGraphData; // queryGraphData.exec("select `tblMain`.`ID`, `temperature`, `humidity`, `pressure` FROM `tblMain` ORDER BY `tblMain`.`ID` DESC limit 16;"); diff --git a/client/mainwindow.h b/client/mainwindow.h index 6bcc329..8b5395b 100644 --- a/client/mainwindow.h +++ b/client/mainwindow.h @@ -45,6 +45,7 @@ private: Ui::MainWindow *ui; Client client; dbConnector *_dbConenctor; + QTimer *timer; // timer to read every second what time it curruntly is. QChart *_pChart; // QLineSeries *_pSeries; |