clickable links in About panel v_0 v0.2
authorFrantišek Kučera <franta-hg@frantovo.cz>
Tue, 03 Sep 2019 00:43:12 +0200
branchv_0
changeset 18 7323a89c15e9
parent 17 d37c6dd9aa20
child 19 048a7d391e05
clickable links in About panel
cadMousePro-gui/src/MouseMainWindow.cpp
cadMousePro-gui/src/MouseMainWindow.h
--- a/cadMousePro-gui/src/MouseMainWindow.cpp	Mon Sep 02 00:23:37 2019 +0200
+++ b/cadMousePro-gui/src/MouseMainWindow.cpp	Tue Sep 03 00:43:12 2019 +0200
@@ -81,29 +81,28 @@
 	tabs->addTab(panel, "Configuration");
 }
 
+void MouseMainWindow::appendAboutLine(QFormLayout* layout, const QString& label, const QString& value, QWidget* parent) {
+	QLabel* labelWidget = new QLabel(label, parent);
+	QLabel* textWidget = new QLabel(value, parent);
+	
+	textWidget->setTextInteractionFlags(Qt::TextInteractionFlag::TextSelectableByMouse | Qt::TextInteractionFlag::TextBrowserInteraction);
+	textWidget->setOpenExternalLinks(true);
+	
+	layout->addRow(labelWidget, textWidget);
+}
+
 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));
-	
+
+	appendAboutLine(layout, "Program name:", "cadMousePro", panel);
+	appendAboutLine(layout, "Description:", "configuration tool for 3DConnexion CadMouse Pro Wireless", panel);
+	appendAboutLine(layout, "Author:", "Ing. František Kučera (Frantovo.cz, GlobalCode.info)", panel);
+	appendAboutLine(layout, "License:", "<a href='https://www.gnu.org/licenses/gpl-3.0.html'>GNU GPLv3+</a>", panel);
+	appendAboutLine(layout, "Contact and support:", "<a href='https://mouse.globalcode.info/'>https://mouse.globalcode.info/</a>", panel);
+	appendAboutLine(layout, "BTC:", "bc1qmt3qgzcf3a0f0tvnm70zjr0vhlchfyrjtnleqm", panel);
+
 	tabs->addTab(panel, "About");
-	
 }
 
 void MouseMainWindow::refresh() {
@@ -114,7 +113,7 @@
 
 void MouseMainWindow::configure() {
 	message->setText("…");
-	
+
 	int frequency; // TODO: get value from the group
 	if (configureFrequency125->isChecked()) frequency = 125;
 	else if (configureFrequency250->isChecked()) frequency = 250;
--- a/cadMousePro-gui/src/MouseMainWindow.h	Mon Sep 02 00:23:37 2019 +0200
+++ b/cadMousePro-gui/src/MouseMainWindow.h	Tue Sep 03 00:43:12 2019 +0200
@@ -40,7 +40,7 @@
 	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* statusDevice = new QCheckBox("mouse found", this);
 
 	QCheckBox* configureSmartScrolling = new QCheckBox("smart scrolling (free wheel)", this);
 	QCheckBox* configureLiftOffDetection = new QCheckBox("lift-off detection", this);
@@ -57,6 +57,8 @@
 	void initStatusPanel();
 	void initConfigurationPanel();
 	void initAboutPanel();
+	
+	void appendAboutLine(QFormLayout* layout, const QString& label, const QString& value, QWidget* parent);
 
 private slots:
 	void refresh();