cadMousePro-gui/src/MouseMainWindow.cpp
branchv_0
changeset 18 7323a89c15e9
parent 17 d37c6dd9aa20
child 20 cfb5f62ea048
--- 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;