tabs: Status, Configuration, About v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Mon, 02 Sep 2019 00:23:37 +0200
branchv_0
changeset 17 d37c6dd9aa20
parent 16 2705911938b4
child 18 7323a89c15e9
tabs: Status, Configuration, About
cadMousePro-gui/nbproject/configurations.xml
cadMousePro-gui/src/MouseMainWindow.cpp
cadMousePro-gui/src/MouseMainWindow.h
--- a/cadMousePro-gui/nbproject/configurations.xml	Fri Aug 30 01:22:12 2019 +0200
+++ b/cadMousePro-gui/nbproject/configurations.xml	Mon Sep 02 00:23:37 2019 +0200
@@ -107,9 +107,9 @@
         <rebuildPropChanged>false</rebuildPropChanged>
       </toolsSet>
       <flagsDictionary>
-        <element flagsID="0"
+        <element flagsID="0" commonFlags="-fsanitize=address -fPIC -std=gnu++11"/>
+        <element flagsID="1"
                  commonFlags="-mtune=generic -march=x86-64 -std=gnu++11 -fsanitize=address -fPIC -fstack-protector-strong"/>
-        <element flagsID="1" commonFlags="-std=c++14"/>
       </flagsDictionary>
       <codeAssistance>
       </codeAssistance>
@@ -119,7 +119,7 @@
           <buildCommand>${MAKE} -f Makefile</buildCommand>
           <cleanCommand>${MAKE} -f Makefile clean</cleanCommand>
           <executablePath>build/Debug/src/cadMousePro-gui</executablePath>
-          <ccTool flags="-fsanitize=address -fPIC -std=gnu++11">
+          <ccTool flags="0">
           </ccTool>
         </makeTool>
         <preBuild>
@@ -132,8 +132,6 @@
             ex="false"
             tool="1"
             flavor2="11">
-        <ccTool flags="1">
-        </ccTool>
       </item>
       <item path="build/Debug/src/cadMousePro-gui_autogen/EWIEGA46WW/moc_MouseMainWindow.cpp"
             ex="true"
@@ -163,24 +161,28 @@
             ex="false"
             tool="1"
             flavor2="8">
-        <ccTool flags="0">
+        <ccTool flags="1">
         </ccTool>
       </item>
       <item path="build/qt/src/generated-sources/Proxy.cpp"
             ex="false"
             tool="1"
             flavor2="8">
-        <ccTool flags="0">
+        <ccTool flags="1">
         </ccTool>
       </item>
       <folder path="0/build/Debug">
         <ccTool>
           <incDir>
-            <pElem>build/Debug/src/generated-sources</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtCore</pElem>
+            <pElem>build/Debug/src</pElem>
+            <pElem>src</pElem>
+            <pElem>build/Debug/src/cadMousePro-gui_autogen/include</pElem>
+            <pElem>/usr/include/x86_64-linux-gnu/qt5</pElem>
             <pElem>/usr/include/x86_64-linux-gnu/qt5/QtDBus</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5</pElem>
-            <pElem>build/Debug/src</pElem>
+            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtCore</pElem>
+            <pElem>/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++</pElem>
+            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtWidgets</pElem>
+            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtGui</pElem>
           </incDir>
           <preprocessorList>
             <Elem>QT_CORE_LIB</Elem>
@@ -218,6 +220,27 @@
           </incDir>
         </ccTool>
       </folder>
+      <folder path="0/src">
+        <ccTool>
+          <incDir>
+            <pElem>build/Debug/src</pElem>
+            <pElem>src</pElem>
+            <pElem>build/Debug/src/cadMousePro-gui_autogen/include</pElem>
+            <pElem>/usr/include/x86_64-linux-gnu/qt5</pElem>
+            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtDBus</pElem>
+            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtCore</pElem>
+            <pElem>/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++</pElem>
+            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtWidgets</pElem>
+            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtGui</pElem>
+          </incDir>
+          <preprocessorList>
+            <Elem>QT_CORE_LIB</Elem>
+            <Elem>QT_DBUS_LIB</Elem>
+            <Elem>QT_GUI_LIB</Elem>
+            <Elem>QT_WIDGETS_LIB</Elem>
+          </preprocessorList>
+        </ccTool>
+      </folder>
       <folder path="Modules">
         <ccTool>
           <incDir>
@@ -243,45 +266,30 @@
       <folder path="cadMousePro-gui_autogen">
         <ccTool>
           <incDir>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtCore</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtDBus</pElem>
-            <pElem>build/Debug/src/generated-sources</pElem>
-            <pElem>build/Debug/src/cadMousePro-gui_autogen/S5VNLJ26FI</pElem>
+            <pElem>build/Debug/src</pElem>
             <pElem>src</pElem>
-            <pElem>build/Debug/src/cadMousePro-gui_autogen/EWIEGA46WW</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtGui</pElem>
+            <pElem>build/Debug/src/cadMousePro-gui_autogen/include</pElem>
+            <pElem>/usr/include/x86_64-linux-gnu/qt5</pElem>
+            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtDBus</pElem>
+            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtCore</pElem>
+            <pElem>/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++</pElem>
             <pElem>/usr/include/x86_64-linux-gnu/qt5/QtWidgets</pElem>
-            <pElem>build/Debug/src/cadMousePro-gui_autogen</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5</pElem>
-            <pElem>build/Debug/src</pElem>
+            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtGui</pElem>
           </incDir>
+          <preprocessorList>
+            <Elem>QT_CORE_LIB</Elem>
+            <Elem>QT_DBUS_LIB</Elem>
+            <Elem>QT_GUI_LIB</Elem>
+            <Elem>QT_WIDGETS_LIB</Elem>
+          </preprocessorList>
         </ccTool>
       </folder>
       <item path="src/MouseMainWindow.cpp" ex="false" tool="1" flavor2="8">
         <ccTool flags="0">
-          <incDir>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtCore</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtWidgets</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtDBus</pElem>
-            <pElem>build/Debug/src/generated-sources</pElem>
-            <pElem>src</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtGui</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5</pElem>
-            <pElem>build/Debug/src</pElem>
-          </incDir>
         </ccTool>
       </item>
       <item path="src/cadMouseProGUI.cpp" ex="false" tool="1" flavor2="8">
         <ccTool flags="0">
-          <incDir>
-            <pElem>src</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtCore</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtGui</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtWidgets</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtDBus</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5</pElem>
-            <pElem>build/qt/src</pElem>
-          </incDir>
         </ccTool>
       </item>
     </conf>
--- a/cadMousePro-gui/src/MouseMainWindow.cpp	Fri Aug 30 01:22:12 2019 +0200
+++ b/cadMousePro-gui/src/MouseMainWindow.cpp	Mon Sep 02 00:23:37 2019 +0200
@@ -23,54 +23,87 @@
 MouseMainWindow::MouseMainWindow() {
 	proxy = new InfoGlobalcodeMouseCadMouseProInterface("info.globalcode.mouse.cadMousePro", "/info/globalcode/mouse/cadMousePro", connection, this);
 
-	resize(640, 480);
 	setWindowTitle("cadMousePro");
-	centralwidget = new QWidget(this);
-	formLayout = new QFormLayout(centralwidget);
+
+	initStatusPanel();
+	initConfigurationPanel();
+	initAboutPanel();
+
+	setCentralWidget(tabs);
+	refresh();
+}
+
+void MouseMainWindow::initStatusPanel() {
+	QWidget* panel = new QWidget(this);
+	QFormLayout* layout = new QFormLayout(panel);
 
 	int f = 0;
 
-	formLayout->setWidget(f++, QFormLayout::LabelRole, new QLabel("How does the mouse feel:", centralwidget));
-
 	statusProxy->setEnabled(false);
 	statusUPower->setEnabled(false);
 	statusDevice->setEnabled(false);
 
-	formLayout->setWidget(f++, QFormLayout::FieldRole, statusProxy);
-	formLayout->setWidget(f++, QFormLayout::FieldRole, statusUPower);
-	formLayout->setWidget(f++, QFormLayout::FieldRole, statusDevice);
+	layout->setWidget(f++, QFormLayout::FieldRole, statusProxy);
+	layout->setWidget(f++, QFormLayout::FieldRole, statusUPower);
+	layout->setWidget(f++, QFormLayout::FieldRole, statusDevice);
 
-
-
-	QPushButton* refreshButton = new QPushButton("Refresh", this);
-	formLayout->setWidget(f++, QFormLayout::FieldRole, refreshButton);
+	QPushButton* refreshButton = new QPushButton("Refresh", panel);
+	layout->setWidget(f++, QFormLayout::FieldRole, refreshButton);
 	connect(refreshButton, &QPushButton::clicked, this, &MouseMainWindow::refresh);
 
-
+	tabs->addTab(panel, "Status");
+}
 
-	formLayout->setWidget(f++, QFormLayout::LabelRole, new QLabel("Talk to your mouse:", centralwidget));
+void MouseMainWindow::initConfigurationPanel() {
+	QWidget* panel = new QWidget(this);
+	QFormLayout* layout = new QFormLayout(panel);
+
+	int f = 0;
 
 	configureLiftOffDetection->setChecked(true);
-	formLayout->setWidget(f++, QFormLayout::FieldRole, configureLiftOffDetection);
-	formLayout->setWidget(f++, QFormLayout::FieldRole, configureSmartScrolling);
+	layout->setWidget(f++, QFormLayout::FieldRole, configureLiftOffDetection);
+	layout->setWidget(f++, QFormLayout::FieldRole, configureSmartScrolling);
 	configureFrequency250->setChecked(true);
-	formLayout->setWidget(f++, QFormLayout::FieldRole, configureFrequency125);
-	formLayout->setWidget(f++, QFormLayout::FieldRole, configureFrequency250);
-	formLayout->setWidget(f++, QFormLayout::FieldRole, configureFrequency500);
-	formLayout->setWidget(f++, QFormLayout::FieldRole, configureFrequency1000);
+	layout->setWidget(f++, QFormLayout::FieldRole, configureFrequency125);
+	layout->setWidget(f++, QFormLayout::FieldRole, configureFrequency250);
+	layout->setWidget(f++, QFormLayout::FieldRole, configureFrequency500);
+	layout->setWidget(f++, QFormLayout::FieldRole, configureFrequency1000);
 
-	QPushButton* configureButton = new QPushButton("Configure", this);
+	QPushButton* configureButton = new QPushButton("Configure", panel);
 	configureButton->setToolTip("n.b. current interface is write-only and the controls above just configures the mouse – does not show current configuration");
-	formLayout->setWidget(f++, QFormLayout::FieldRole, configureButton);
+	layout->setWidget(f++, QFormLayout::FieldRole, configureButton);
 	connect(configureButton, &QPushButton::clicked, this, &MouseMainWindow::configure);
 
+	message->setReadOnly(true);
+	layout->setWidget(f++, QFormLayout::FieldRole, new QLabel("Result:", panel));
+	layout->setWidget(f++, QFormLayout::FieldRole, message);
 
-	message->setReadOnly(true);
-	formLayout->setWidget(f++, QFormLayout::LabelRole, new QLabel("Mouse responds:", this));
-	formLayout->setWidget(f++, QFormLayout::FieldRole, message);
+	tabs->addTab(panel, "Configuration");
+}
 
-	setCentralWidget(centralwidget);
-	refresh();
+void MouseMainWindow::initAboutPanel() {
+	QWidget* panel = new QWidget(this);
+	QFormLayout* layout = new QFormLayout(panel);
+	
+	int f = 0;
+	
+	layout->setWidget(f, QFormLayout::LabelRole, new QLabel("Program name:", panel));
+	layout->setWidget(f++, QFormLayout::FieldRole, new QLabel("cadMousePro", panel));
+	
+	layout->setWidget(f, QFormLayout::LabelRole, new QLabel("Description:", panel));
+	layout->setWidget(f++, QFormLayout::FieldRole, new QLabel("configuration tool for 3DConnexion CadMouse Pro Wireless", panel));
+	
+	layout->setWidget(f, QFormLayout::LabelRole, new QLabel("Author:", panel));
+	layout->setWidget(f++, QFormLayout::FieldRole, new QLabel("Ing. František Kučera, Frantovo.cz, GlobalCode.info", panel));
+	
+	layout->setWidget(f, QFormLayout::LabelRole, new QLabel("License:", panel));
+	layout->setWidget(f++, QFormLayout::FieldRole, new QLabel("GNU GPLv3+", panel));
+	
+	layout->setWidget(f, QFormLayout::LabelRole, new QLabel("Contact and support:", panel));
+	layout->setWidget(f++, QFormLayout::FieldRole, new QLabel("https://mouse.globalcode.info/", panel));
+	
+	tabs->addTab(panel, "About");
+	
 }
 
 void MouseMainWindow::refresh() {
@@ -80,13 +113,15 @@
 }
 
 void MouseMainWindow::configure() {
+	message->setText("…");
+	
 	int frequency; // TODO: get value from the group
 	if (configureFrequency125->isChecked()) frequency = 125;
 	else if (configureFrequency250->isChecked()) frequency = 250;
 	else if (configureFrequency500->isChecked()) frequency = 500;
 	else if (configureFrequency1000->isChecked()) frequency = 1000;
 	else frequency = 250;
-	
+
 	auto response = proxy->configure(configureLiftOffDetection->isChecked(), configureSmartScrolling->isChecked(), frequency);
 
 	response.waitForFinished();
--- a/cadMousePro-gui/src/MouseMainWindow.h	Fri Aug 30 01:22:12 2019 +0200
+++ b/cadMousePro-gui/src/MouseMainWindow.h	Mon Sep 02 00:23:37 2019 +0200
@@ -18,6 +18,7 @@
 #pragma once
 
 #include <QMainWindow>
+#include <QTabWidget>
 #include <QFormLayout>
 #include <QCheckBox>
 #include <QRadioButton>
@@ -36,24 +37,27 @@
 	}
 
 private:
-	QWidget* centralwidget;
-	QFormLayout* formLayout;
+	QTabWidget* tabs = new QTabWidget(this);
 	QCheckBox* statusProxy = new QCheckBox("connected to Daemon", this);
 	QCheckBox* statusUPower = new QCheckBox("connected to UPower", this);
 	QCheckBox* statusDevice = new QCheckBox("present", this);
-	
+
 	QCheckBox* configureSmartScrolling = new QCheckBox("smart scrolling (free wheel)", this);
 	QCheckBox* configureLiftOffDetection = new QCheckBox("lift-off detection", this);
 	QRadioButton* configureFrequency125 = new QRadioButton("125 Hz", this);
 	QRadioButton* configureFrequency250 = new QRadioButton("250 Hz", this);
 	QRadioButton* configureFrequency500 = new QRadioButton("500 Hz", this);
 	QRadioButton* configureFrequency1000 = new QRadioButton("1000 Hz", this);
-	
+
 	QLineEdit* message = new QLineEdit(this);
-	
+
 	QDBusConnection connection = QDBusConnection::systemBus();
 	InfoGlobalcodeMouseCadMouseProInterface* proxy;
 
+	void initStatusPanel();
+	void initConfigurationPanel();
+	void initAboutPanel();
+
 private slots:
 	void refresh();
 	void configure();