diff options
author | daniel-Jones <daniel@danieljon.es> | 2016-05-30 10:08:26 +0930 |
---|---|---|
committer | daniel-Jones <daniel@danieljon.es> | 2016-05-30 10:08:26 +0930 |
commit | 410fbd473ad039dc815bc450f3b26732b13ac4dc (patch) | |
tree | 64ffc2a0d7e3ff0881f3a2500d6d63d8d52f7dba /qt/RGBController | |
download | RGB-Controller-410fbd473ad039dc815bc450f3b26732b13ac4dc.tar.gz RGB-Controller-410fbd473ad039dc815bc450f3b26732b13ac4dc.zip |
First code commit
Diffstat (limited to 'qt/RGBController')
-rwxr-xr-x | qt/RGBController/RGBController.pro | 22 | ||||
-rwxr-xr-x | qt/RGBController/RGBController.pro.user | 336 | ||||
-rwxr-xr-x | qt/RGBController/controllerwindow.cpp | 255 | ||||
-rwxr-xr-x | qt/RGBController/controllerwindow.h | 75 | ||||
-rwxr-xr-x | qt/RGBController/controllerwindow.ui | 210 | ||||
-rwxr-xr-x | qt/RGBController/main.cpp | 11 | ||||
-rw-r--r-- | qt/RGBController/serial_communication.cpp | 47 | ||||
-rw-r--r-- | qt/RGBController/serial_communication.h | 23 |
8 files changed, 979 insertions, 0 deletions
diff --git a/qt/RGBController/RGBController.pro b/qt/RGBController/RGBController.pro new file mode 100755 index 0000000..d075466 --- /dev/null +++ b/qt/RGBController/RGBController.pro @@ -0,0 +1,22 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2016-03-07T11:25:55 +# +#------------------------------------------------- + +QT += core gui serialport network + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = RGBController +TEMPLATE = app + + +SOURCES += main.cpp\ + controllerwindow.cpp \ + serial_communication.cpp + +HEADERS += controllerwindow.h \ + serial_communication.h + +FORMS += controllerwindow.ui diff --git a/qt/RGBController/RGBController.pro.user b/qt/RGBController/RGBController.pro.user new file mode 100755 index 0000000..1b89dcd --- /dev/null +++ b/qt/RGBController/RGBController.pro.user @@ -0,0 +1,336 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE QtCreatorProject> +<!-- Written by QtCreator 4.0.0, 2016-05-29T21:56:23. --> +<qtcreator> + <data> + <variable>EnvironmentId</variable> + <value type="QByteArray">{c148e485-3cf0-4847-b5fd-56246b2688e8}</value> + </data> + <data> + <variable>ProjectExplorer.Project.ActiveTarget</variable> + <value type="int">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="int" 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.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="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="bool" key="EditorConfiguration.inEntireDocument">false</value> + </valuemap> + </data> + <data> + <variable>ProjectExplorer.Project.PluginSettings</variable> + <valuemap type="QVariantMap"/> + </data> + <data> + <variable>ProjectExplorer.Project.Target.0</variable> + <valuemap type="QVariantMap"> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{a6071b8b-a567-46c9-babb-33312c5773b5}</value> + <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> + <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> + <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/daniel_j/documents/school/2016 research project/RGBController/qt/build/degub</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.DefaultDisplayName">qmake</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value> + <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> + <value type="QString">-w</value> + <value type="QString">-r</value> + </valuelist> + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></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.DefaultDisplayName">Make</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> + <value type="QString">-w</value> + <value type="QString">-r</value> + </valuelist> + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></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.UserEnvironmentChanges"/> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> + <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value> + <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/daniel_j/documents/school/research_project/2016 research project/RGBController/qt/build-RGBController-Desktop-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.DefaultDisplayName">qmake</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> + <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> + <value type="QString">-w</value> + <value type="QString">-r</value> + </valuelist> + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></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.DefaultDisplayName">Make</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> + <value type="QString">-w</value> + <value type="QString">-r</value> + </valuelist> + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></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.UserEnvironmentChanges"/> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> + <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> + <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2"> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/daniel_j/documents/school/research_project/2016 research project/RGBController/qt/build-RGBController-Desktop-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.DefaultDisplayName">qmake</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value> + <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> + <value type="QString">-w</value> + <value type="QString">-r</value> + </valuelist> + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></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.DefaultDisplayName">Make</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> + <value type="QString">-w</value> + <value type="QString">-r</value> + </valuelist> + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></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.UserEnvironmentChanges"/> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Profile</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> + <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> + <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> + </valuemap> + <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> + </valuemap> + <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> + <value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value> + <value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value> + <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value> + <value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value> + <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value> + <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> + <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> + <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> + <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> + <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> + <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> + <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> + <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> + <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> + <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> + <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> + <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> + <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> + <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> + <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> + <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> + <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> + <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> + <value type="int">0</value> + <value type="int">1</value> + <value type="int">2</value> + <value type="int">3</value> + <value type="int">4</value> + <value type="int">5</value> + <value type="int">6</value> + <value type="int">7</value> + <value type="int">8</value> + <value type="int">9</value> + <value type="int">10</value> + <value type="int">11</value> + <value type="int">12</value> + <value type="int">13</value> + <value type="int">14</value> + </valuelist> + <value type="int" key="PE.EnvironmentAspect.Base">2</value> + <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">RGBController</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">RGBController2</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/daniel_j/documents/school/2016 research project/RGBController/qt/RGBController/RGBController.pro</value> + <value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value> + <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> + <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">RGBController.pro</value> + <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> + <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> + <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">/home/daniel_j/documents/school/2016 research project/RGBController/qt/build/degub</value> + <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> + <value type="bool" key="RunConfiguration.UseCppDebugger">false</value> + <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> + <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> + <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> + <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> + </valuemap> + <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> + </valuemap> + </data> + <data> + <variable>ProjectExplorer.Project.TargetCount</variable> + <value type="int">1</value> + </data> + <data> + <variable>ProjectExplorer.Project.Updater.FileVersion</variable> + <value type="int">18</value> + </data> + <data> + <variable>Version</variable> + <value type="int">18</value> + </data> +</qtcreator> diff --git a/qt/RGBController/controllerwindow.cpp b/qt/RGBController/controllerwindow.cpp new file mode 100755 index 0000000..302e3d2 --- /dev/null +++ b/qt/RGBController/controllerwindow.cpp @@ -0,0 +1,255 @@ +#include "controllerwindow.h" + +controllerWindow::controllerWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::controllerWindow) +{ + /* this is our setup function, we set things up here */ + ui->setupUi(this); + info_log("RGB Controller started"); + /* disable buttons and widgets that should not be enabled yet, set slider values to 0 */ + ui->disconnect_button->setEnabled(false); + ui->connect_button->setEnabled(false); + ui->red_button->setEnabled(false); + ui->green_button->setEnabled(false); + ui->blue_button->setEnabled(false); + ui->off_button->setEnabled(false); + ui->reload_preset_button->setEnabled(false); + ui->set_preset_button->setEnabled(false); + ui->presets_dropdown->setEnabled(false); + ui->r_slider->setEnabled(false); + ui->g_slider->setEnabled(false); + ui->b_slider->setEnabled(false); + ui->r_slider->setValue(0); + ui->g_slider->setValue(0); + ui->b_slider->setValue(0); + /* set some crucial ints */ + preset_index = 0, r = 0, g = 0, b = 0; + /* populate our serial port dropdown box */ + populate_serial_list(); + /* load our presets file */ + load_presets(); +} + +controllerWindow::~controllerWindow() +{ + /* this function will end our program and clean up */ + delete ui; +} + +void controllerWindow::info_log(QString text) +{ + /* this function is used to append logging information to our text area */ + ui->info_log_textarea->append(text); +} + +void controllerWindow::populate_serial_list() +{ + /* + * things to be done here: + * - clear anything inside our serial dropdown box + * - re-populate the serial dropdown box + */ + + /* remove anything in the list */ + ui->arduino_port_dropdown->clear(); + /* populate the list */ + for (int x = 0; x < QSerialPortInfo::availablePorts().size(); x++) + { + if (!QSerialPortInfo::availablePorts().at(x).description().isEmpty()) + ui->arduino_port_dropdown->addItem(QSerialPortInfo::availablePorts().at(x).portName()); + } + if (!ui->arduino_port_dropdown->itemText(0).isEmpty()) + { + ui->connect_button->setEnabled(true); + info_log("Serial port list populated"); + } else + { + info_log("No serial port found!"); + ui->arduino_port_dropdown->addItem("None"); + } +} + +void controllerWindow::load_presets() +{ + /* + * this function will load presets from file and put them into a drop down box + * How i plan for it to work: + * -> load file + * -> parse line by line + * -> split line at delimeter + * -> add [0] to dropdown (name), add [1] to an array that stores all the values + */ + QFile inputFile("presets.txt"); + if (inputFile.open(QIODevice::ReadOnly)) + { + QTextStream in(&inputFile); + while (!in.atEnd()) + { + QString line = in.readLine(); + if (line.contains("=")) + { + ui->presets_dropdown->addItem(line.split("=")[0]); + presets.append(line.split("=")[1]); + } + } + inputFile.close(); + info_log("Presets loaded"); + } else + info_log("Presets file not found."); +} + +void controllerWindow::serial_rgb_change(int r, int g, int b) +{ + portf.rgb_change(r, g, b); +} + + +/* + * + * button and widget functions below + * + */ + +void controllerWindow::on_connect_button_clicked() +{ + /* + * here we need to call our serial port connect function + * if our connection is sucessful we need to enable and disable a few buttons and widgets + * we must also change our rgb sliders etc + */ + port = ui->arduino_port_dropdown->currentText(); + if (portf.serial_connect(port)) + { // if true we are connected + info_log("Connection established"); + ui->arduino_status_label->setText("<font color=green>Connected</font>"); + /* now we need to disabled and enable some buttons and objects */ + ui->disconnect_button->setEnabled(true); + ui->connect_button->setEnabled(false); + ui->red_button->setEnabled(true); + ui->green_button->setEnabled(true); + ui->blue_button->setEnabled(true); + ui->off_button->setEnabled(true); + ui->reload_preset_button->setEnabled(true); + ui->set_preset_button->setEnabled(true); + ui->presets_dropdown->setEnabled(true); + ui->r_slider->setEnabled(true); + ui->g_slider->setEnabled(true); + ui->b_slider->setEnabled(true); + ui->refresh_port_button->setEnabled(false); + ui->arduino_port_dropdown->setEnabled(false); + } else + { + info_log("Unable to connect (port in use?)"); + } + +} + +void controllerWindow::on_disconnect_button_clicked() +{ + /* + * here we will attempt to disconnect from our serial port + * we will also enable/disable some buttons and widgets and set slider values to 0 + */ + if (portf.serial_disconnect()) + { + info_log("Disconnected from serial port"); + ui->arduino_status_label->setText("<font color=red>Disconnected</font>"); + ui->disconnect_button->setEnabled(false); + ui->connect_button->setEnabled(true); + ui->red_button->setEnabled(false); + ui->green_button->setEnabled(false); + ui->blue_button->setEnabled(false); + ui->off_button->setEnabled(false); + ui->reload_preset_button->setEnabled(false); + ui->set_preset_button->setEnabled(false); + ui->presets_dropdown->setEnabled(false); + ui->refresh_port_button->setEnabled(true); + ui->arduino_port_dropdown->setEnabled(true); + ui->r_slider->setEnabled(false); + ui->g_slider->setEnabled(false); + ui->b_slider->setEnabled(false); + ui->r_slider->setValue(0); + ui->g_slider->setValue(0); + ui->b_slider->setValue(0); + + } else + { + /* I have no clue how we'd get here */ + info_log("Cannot disconnect"); + } +} + +void controllerWindow::on_refresh_port_button_clicked() +{ + populate_serial_list(); +} + +void controllerWindow::on_reload_preset_button_clicked() +{ + ui->presets_dropdown->clear(); + presets.clear(); + preset_index = 0; + load_presets(); +} + +void controllerWindow::on_r_slider_valueChanged(int value) +{ + r = value; + serial_rgb_change(r, g, b); +} + +void controllerWindow::on_g_slider_valueChanged(int value) +{ + g = value; + serial_rgb_change(r, g, b); +} + +void controllerWindow::on_b_slider_valueChanged(int value) +{ + b = value; + serial_rgb_change(r, g, b); +} + +void controllerWindow::on_red_button_clicked() +{ + ui->r_slider->setValue(255); + ui->g_slider->setValue(0); + ui->b_slider->setValue(0); +} + +void controllerWindow::on_green_button_clicked() +{ + ui->r_slider->setValue(0); + ui->g_slider->setValue(255); + ui->b_slider->setValue(0); +} + +void controllerWindow::on_blue_button_clicked() +{ + ui->r_slider->setValue(0); + ui->g_slider->setValue(0); + ui->b_slider->setValue(255); +} + +void controllerWindow::on_off_button_clicked() +{ + ui->r_slider->setValue(0); + ui->g_slider->setValue(0); + ui->b_slider->setValue(0); +} + +void controllerWindow::on_set_preset_button_clicked() +{ + QString tempstore = presets.at(preset_index); + QStringList temparray = tempstore.split(","); + info_log("Preset selected: " + temparray[0] + " " + temparray[1] + " " + temparray[2]); + ui->r_slider->setValue(temparray[0].toInt()); + ui->g_slider->setValue(temparray[1].toInt()); + ui->b_slider->setValue(temparray[2].toInt()); +} + +void controllerWindow::on_presets_dropdown_currentIndexChanged(int index) +{ + preset_index = index; +} diff --git a/qt/RGBController/controllerwindow.h b/qt/RGBController/controllerwindow.h new file mode 100755 index 0000000..350a599 --- /dev/null +++ b/qt/RGBController/controllerwindow.h @@ -0,0 +1,75 @@ +#ifndef CONTROLLERWINDOW_H +#define CONTROLLERWINDOW_H + +/* includes */ + +#include <QMainWindow> +#include <QDebug> +#include <QFile> +#include <QSerialPortInfo> +#include <QTextStream> +#include "serial_communication.h" +#include "ui_controllerwindow.h" + +namespace Ui { + class controllerWindow; +} + +class controllerWindow : public QMainWindow +{ + Q_OBJECT + + public: + explicit controllerWindow(QWidget *parent = 0); + ~controllerWindow(); + + /* public functions */ + void info_log(QString text); + void populate_serial_list(); + void load_presets(); + void serial_rgb_change(int r, int g, int b); + /*public variables */ + /* these three ints will hold the current value (0 - 255) of each slider */ + int r, g, b; + /* this list will contain all the presets loaded from file */ + QStringList presets; + /* this string will hold our selected serial port */ + QString port; + /* this int will contain the current preset index selected */ + int preset_index; + +private slots: + /* these slots are used to trigger button clicks and drop down items selections etc */ + void on_connect_button_clicked(); + + void on_disconnect_button_clicked(); + + void on_refresh_port_button_clicked(); + + void on_reload_preset_button_clicked(); + + void on_r_slider_valueChanged(int value); + + void on_g_slider_valueChanged(int value); + + void on_b_slider_valueChanged(int value); + + void on_red_button_clicked(); + + void on_green_button_clicked(); + + void on_blue_button_clicked(); + + void on_off_button_clicked(); + + void on_set_preset_button_clicked(); + + void on_presets_dropdown_currentIndexChanged(int index); + +private: + Ui::controllerWindow *ui; + /* serial communication object */ + serial_communication portf; +}; + +#endif // CONTROLLERWINDOW_H diff --git a/qt/RGBController/controllerwindow.ui b/qt/RGBController/controllerwindow.ui new file mode 100755 index 0000000..1907b33 --- /dev/null +++ b/qt/RGBController/controllerwindow.ui @@ -0,0 +1,210 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>controllerWindow</class> + <widget class="QMainWindow" name="controllerWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>229</width> + <height>394</height> + </rect> + </property> + <property name="windowTitle"> + <string>RGB Controller</string> + </property> + <widget class="QWidget" name="centralWidget"> + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="status_label"> + <property name="text"> + <string>Status</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="arduino_status_label"> + <property name="text"> + <string><font color = red>Disconnected</font></string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="arduino_port_label"> + <property name="minimumSize"> + <size> + <width>120</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Arduino port</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="arduino_port_dropdown"/> + </item> + <item row="2" column="1"> + <widget class="QPushButton" name="refresh_port_button"> + <property name="text"> + <string>Refresh</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QPushButton" name="connect_button"> + <property name="text"> + <string>Connect</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QPushButton" name="disconnect_button"> + <property name="text"> + <string>Disconnect</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="rgb_label"> + <property name="text"> + <string>RGB colors</string> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QPushButton" name="red_button"> + <property name="text"> + <string>Red</string> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QSlider" name="r_slider"> + <property name="minimumSize"> + <size> + <width>120</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>120</width> + <height>16777215</height> + </size> + </property> + <property name="maximum"> + <number>255</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item row="6" column="0"> + <widget class="QSlider" name="g_slider"> + <property name="minimumSize"> + <size> + <width>120</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>120</width> + <height>16777215</height> + </size> + </property> + <property name="maximum"> + <number>255</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item row="7" column="0"> + <widget class="QSlider" name="b_slider"> + <property name="minimumSize"> + <size> + <width>120</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>120</width> + <height>16777215</height> + </size> + </property> + <property name="maximum"> + <number>255</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item row="6" column="1"> + <widget class="QPushButton" name="green_button"> + <property name="text"> + <string>Green</string> + </property> + </widget> + </item> + <item row="7" column="1"> + <widget class="QPushButton" name="blue_button"> + <property name="text"> + <string>Blue</string> + </property> + </widget> + </item> + <item row="9" column="0"> + <widget class="QLabel" name="presets_label"> + <property name="text"> + <string>Presets</string> + </property> + </widget> + </item> + <item row="8" column="1"> + <widget class="QPushButton" name="off_button"> + <property name="text"> + <string>Off</string> + </property> + </widget> + </item> + <item row="12" column="0"> + <widget class="QLabel" name="info_log_label"> + <property name="text"> + <string>Information log</string> + </property> + </widget> + </item> + <item row="11" column="1"> + <widget class="QPushButton" name="reload_preset_button"> + <property name="text"> + <string>Reload</string> + </property> + </widget> + </item> + <item row="10" column="1"> + <widget class="QPushButton" name="set_preset_button"> + <property name="text"> + <string>Set</string> + </property> + </widget> + </item> + <item row="10" column="0"> + <widget class="QComboBox" name="presets_dropdown"/> + </item> + <item row="13" column="0" colspan="2"> + <widget class="QTextEdit" name="info_log_textarea"/> + </item> + </layout> + </widget> + </widget> + <layoutdefault spacing="6" margin="11"/> + <resources/> + <connections/> +</ui> diff --git a/qt/RGBController/main.cpp b/qt/RGBController/main.cpp new file mode 100755 index 0000000..4d44399 --- /dev/null +++ b/qt/RGBController/main.cpp @@ -0,0 +1,11 @@ +#include "controllerwindow.h" +#include <QApplication> + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + controllerWindow w; + w.show(); + + return a.exec(); +} diff --git a/qt/RGBController/serial_communication.cpp b/qt/RGBController/serial_communication.cpp new file mode 100644 index 0000000..94e75db --- /dev/null +++ b/qt/RGBController/serial_communication.cpp @@ -0,0 +1,47 @@ +#include "serial_communication.h" +#include "controllerwindow.h" +serial_communication::serial_communication() +{ + +} + +bool serial_communication::serial_connect(QString port) +{ + /* this function will attempt a serial connection if we are not already connected */ + if (!serial.isOpen()) + { + serial.setPortName(port); + serial.setBaudRate(QSerialPort::Baud9600); + serial.setDataBits(QSerialPort::Data8); + serial.setParity(QSerialPort::NoParity); + serial.setStopBits(QSerialPort::OneStop); + serial.setFlowControl(QSerialPort::NoFlowControl); + serial.open(QIODevice::ReadWrite); + serial.waitForBytesWritten(9000); + if (serial.isWritable()) { + return true; + } + } + return false; +} + +bool serial_communication::serial_disconnect() +{ + /* this function disconnects from the serial port if it is connected already */ + if (serial.isOpen()) + { + serial.close(); + return true; + } + return false; +} + +void serial_communication::rgb_change(int r, int g, int b) +{ + /* here we send our rgb values to the serial port */ + data = ""; + /* the 0 is a hack, i need to look into it at some point */ + data.append("0" + QString::number(r) + "," + QString::number(g) + "," + QString::number(b) + "\n"); + if (serial.isOpen()) + serial.write(data); +} diff --git a/qt/RGBController/serial_communication.h b/qt/RGBController/serial_communication.h new file mode 100644 index 0000000..d037757 --- /dev/null +++ b/qt/RGBController/serial_communication.h @@ -0,0 +1,23 @@ +#ifndef SERIAL_COMMUNICATION_H +#define SERIAL_COMMUNICATION_H + +/* includes */ +#include <QSerialPort> +#include <QSerialPortInfo> + + +class serial_communication +{ +public: + /* function declares */ + serial_communication(); + bool serial_connect(QString port); + bool serial_disconnect(); + void rgb_change(int r, int g, int b); + /* variables */ + QString port_name; + QSerialPort serial; + QByteArray data; +}; + +#endif // SERIAL_COMMUNICATION_H |