cadMousePro-gui/src/MouseMainWindow.h
author František Kučera <franta-hg@frantovo.cz>
Wed, 23 Oct 2019 22:43:29 +0200
branchv_0
changeset 26 fff8e9a86e85
parent 21 642f32f76c9d
child 29 361687fe303a
permissions -rw-r--r--
fix license version: GNU GPLv3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
/**
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
 * cadMousePro
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
 * Copyright © 2019 František Kučera (Frantovo.cz, GlobalCode.info)
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
 *
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
26
fff8e9a86e85 fix license version: GNU GPLv3
František Kučera <franta-hg@frantovo.cz>
parents: 21
diff changeset
     7
 * the Free Software Foundation, version 3 of the License.
15
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
 *
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
 * GNU General Public License for more details.
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
 *
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
 */
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
#pragma once
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
#include <QMainWindow>
17
d37c6dd9aa20 tabs: Status, Configuration, About
František Kučera <franta-hg@frantovo.cz>
parents: 16
diff changeset
    20
#include <QTabWidget>
16
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    21
#include <QFormLayout>
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    22
#include <QCheckBox>
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    23
#include <QRadioButton>
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    24
#include <QButtonGroup>
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    25
#include <QLineEdit>
20
cfb5f62ea048 display the USB device name
František Kučera <franta-hg@frantovo.cz>
parents: 18
diff changeset
    26
#include <QLabel>
21
642f32f76c9d display the battery charge level (from UPower)
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    27
#include <QProgressBar>
16
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    28
#include <QtDBus/QDBusConnection>
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    29
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    30
#include "generated-sources/Proxy.h"
21
642f32f76c9d display the battery charge level (from UPower)
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    31
#include "generated-sources/UPowerProxy.h"
15
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
class MouseMainWindow : public QMainWindow {
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
	Q_OBJECT
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    35
public:
16
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    36
	MouseMainWindow();
15
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    38
	virtual ~MouseMainWindow() {
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
	}
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
16
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    41
private:
17
d37c6dd9aa20 tabs: Status, Configuration, About
František Kučera <franta-hg@frantovo.cz>
parents: 16
diff changeset
    42
	QTabWidget* tabs = new QTabWidget(this);
16
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    43
	QCheckBox* statusProxy = new QCheckBox("connected to Daemon", this);
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    44
	QCheckBox* statusUPower = new QCheckBox("connected to UPower", this);
18
7323a89c15e9 clickable links in About panel
František Kučera <franta-hg@frantovo.cz>
parents: 17
diff changeset
    45
	QCheckBox* statusDevice = new QCheckBox("mouse found", this);
20
cfb5f62ea048 display the USB device name
František Kučera <franta-hg@frantovo.cz>
parents: 18
diff changeset
    46
	QLabel* statusName = new QLabel(this);
21
642f32f76c9d display the battery charge level (from UPower)
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    47
	QProgressBar* statusBattery = new QProgressBar(this);
17
d37c6dd9aa20 tabs: Status, Configuration, About
František Kučera <franta-hg@frantovo.cz>
parents: 16
diff changeset
    48
16
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    49
	QCheckBox* configureSmartScrolling = new QCheckBox("smart scrolling (free wheel)", this);
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    50
	QCheckBox* configureLiftOffDetection = new QCheckBox("lift-off detection", this);
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    51
	QRadioButton* configureFrequency125 = new QRadioButton("125 Hz", this);
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    52
	QRadioButton* configureFrequency250 = new QRadioButton("250 Hz", this);
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    53
	QRadioButton* configureFrequency500 = new QRadioButton("500 Hz", this);
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    54
	QRadioButton* configureFrequency1000 = new QRadioButton("1000 Hz", this);
17
d37c6dd9aa20 tabs: Status, Configuration, About
František Kučera <franta-hg@frantovo.cz>
parents: 16
diff changeset
    55
16
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    56
	QLineEdit* message = new QLineEdit(this);
17
d37c6dd9aa20 tabs: Status, Configuration, About
František Kučera <franta-hg@frantovo.cz>
parents: 16
diff changeset
    57
16
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    58
	QDBusConnection connection = QDBusConnection::systemBus();
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    59
	InfoGlobalcodeMouseCadMouseProInterface* proxy;
21
642f32f76c9d display the battery charge level (from UPower)
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    60
	OrgFreedesktopUPowerInterface* upowerProxy;
16
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    61
17
d37c6dd9aa20 tabs: Status, Configuration, About
František Kučera <franta-hg@frantovo.cz>
parents: 16
diff changeset
    62
	void initStatusPanel();
d37c6dd9aa20 tabs: Status, Configuration, About
František Kučera <franta-hg@frantovo.cz>
parents: 16
diff changeset
    63
	void initConfigurationPanel();
d37c6dd9aa20 tabs: Status, Configuration, About
František Kučera <franta-hg@frantovo.cz>
parents: 16
diff changeset
    64
	void initAboutPanel();
18
7323a89c15e9 clickable links in About panel
František Kučera <franta-hg@frantovo.cz>
parents: 17
diff changeset
    65
	
7323a89c15e9 clickable links in About panel
František Kučera <franta-hg@frantovo.cz>
parents: 17
diff changeset
    66
	void appendAboutLine(QFormLayout* layout, const QString& label, const QString& value, QWidget* parent);
21
642f32f76c9d display the battery charge level (from UPower)
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    67
	
642f32f76c9d display the battery charge level (from UPower)
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    68
	int getBatteryLevel();
17
d37c6dd9aa20 tabs: Status, Configuration, About
František Kučera <franta-hg@frantovo.cz>
parents: 16
diff changeset
    69
16
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    70
private slots:
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    71
	void refresh();
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    72
	void configure();
15
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    73
};