diff options
Diffstat (limited to 'src-qt5/core-utils')
6 files changed, 602 insertions, 6 deletions
diff --git a/src-qt5/core-utils/lumina-config/pages/getPage.h b/src-qt5/core-utils/lumina-config/pages/getPage.h index b209bb20..c7b5b076 100644 --- a/src-qt5/core-utils/lumina-config/pages/getPage.h +++ b/src-qt5/core-utils/lumina-config/pages/getPage.h @@ -39,6 +39,7 @@ static QList<PAGEINFO> KnownPages(){ list << PageInfo("session-locale", QObject::tr("Localization"), QObject::tr("Locale Settings"), "preferences-desktop-locale",QObject::tr("Change the default locale settings for this user"), "user", QStringList(), QStringList() << "user"<<"locale"<<"language"<<"translations"); list << PageInfo("session-options", QObject::tr("General Options"), QObject::tr("User Settings"), "configure",QObject::tr("Change basic user settings such as time/date formats"), "user", QStringList(), QStringList() << "user"<<"settings"<<"time"<<"date"<<"icon"<<"reset"<<"numlock"<<"clock"); list << PageInfo("input-devices", QObject::tr("Input Device Settings"), QObject::tr("Input Device Settings"), "preferences-desktop-peripherals",QObject::tr("Adjust keyboard and mouse devices"), "user", QStringList(), QStringList() << "user"<<"speed"<<"accel"<<"mouse" << "keyboard"); + // list << PageInfo("mouse-settings", QObject::tr("TrueOS Mouse Settings"), QObject::tr("TrueOS Mouse Settings"), "preferences-desktop-mouse",QObject::tr("Adjust mouse devices"), "user", QStringList(), QStringList() << "user"<<"speed"<<"accel"<<"mouse"); //Now sort the items according to the translated name QStringList names; for(int i=0; i<list.length(); i++){ names << list[i].name; } @@ -67,6 +68,7 @@ static QList<PAGEINFO> KnownPages(){ #include "page_session_options.h" #include "page_compton.h" #include "page_mouse.h" +// #include "page_mouse_trueos.h" static PageWidget* GetNewPage(QString id, QWidget *parent){ //Find the page that matches this "id" @@ -84,6 +86,7 @@ static PageWidget* GetNewPage(QString id, QWidget *parent){ else if(id=="session-options"){ page = new page_session_options(parent); } else if(id=="compton"){ page = new page_compton(parent); } else if(id=="input-devices"){ page = new page_mouse(parent); } + // else if(id=="mouse-settings"){ page = new page_mouse_trueos(parent); } //Return the main control_panel page as the fallback/default if(page==0){ id.clear(); page = new page_main(parent); } page->setWhatsThis(id); diff --git a/src-qt5/core-utils/lumina-config/pages/page_mouse.h b/src-qt5/core-utils/lumina-config/pages/page_mouse.h index 00487910..5409a9c2 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_mouse.h +++ b/src-qt5/core-utils/lumina-config/pages/page_mouse.h @@ -13,14 +13,14 @@ #include <QTreeWidgetItem> namespace Ui{ - class page_mouse; + class page_mouse; }; class page_mouse : public PageWidget{ Q_OBJECT public: - page_mouse(QWidget *parent); - ~page_mouse(); + page_mouse(QWidget *parent); + ~page_mouse(); public slots: void SaveSettings(); @@ -28,7 +28,7 @@ public slots: void updateIcons(); private: - Ui::page_mouse *ui; + Ui::page_mouse *ui; QList<LInputDevice*> devices; void generateUI(); diff --git a/src-qt5/core-utils/lumina-config/pages/page_mouse_trueos.cpp b/src-qt5/core-utils/lumina-config/pages/page_mouse_trueos.cpp new file mode 100644 index 00000000..60bc2872 --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_mouse_trueos.cpp @@ -0,0 +1,110 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "page_mouse_trueos.h" +#include "ui_page_mouse_trueos.h" +#include "getPage.h" + +#include <QDebug> +#include <QProcess> + + +//========== +// PUBLIC +//========== +page_mouse_trueos::page_mouse_trueos(QWidget *parent) : PageWidget(parent), ui(new Ui::page_mouse_trueos()){ + ui->setupUi(this); + QString program = "/usr/sbin/moused"; + + ui->slider_mouseAcceleration->setRange(1,200); + ui->slider_mouseAcceleration->setValue(100); + connect( ui->slider_mouseAcceleration, SIGNAL(valueChanged(int)), this, SLOT(setValue(double))); + realAccelValue = ( ui->slider_mouseAcceleration->value() / divisor); + realAccelValueString = QString::number(ui->slider_mouseAcceleration->value() / divisor, 'f', 2); + + ui->slider_doubleClickThreshold->setRange(1,1000); + ui->slider_doubleClickThreshold->setValue(500); + connect( ui->slider_doubleClickThreshold, SIGNAL(valueChanged(int)), this, SLOT(setValue(double))); + realDoubleClickValue = (ui->slider_doubleClickThreshold->value()); + realDoubleClickValueString = QString::number(ui->slider_doubleClickThreshold->value()); + + ui->combobox_resolutionBox->setCurrentIndex(1); + connect(ui->combobox_resolutionBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(setMouseResolution()) ); + + connect(ui->checkBoxHandedness, SIGNAL(toggled(bool)), this, SLOT(swapHandedness()) ); + connect(ui->checkBoxTerminateDrift, SIGNAL(toggled(bool)), this, SLOT(terminateDrift()) ); + + connect( ui->button_apply, SIGNAL(clicked()), this, SLOT(updateMoused())); +} + +page_mouse_trueos::~page_mouse_trueos(){ +} + +//================ +// PUBLIC SLOTS +//================ +void page_mouse_trueos::SaveSettings(){ + + emit HasPendingChanges(false); +} + +void page_mouse_trueos::LoadSettings(int){ + emit HasPendingChanges(false); + emit ChangePageTitle( tr("Mouse Settings") ); +} + +//================= +// PRIVATE +//================= + +void page_mouse_trueos::swapHandedness(){ + if(ui->checkBoxHandedness->isChecked()){ + handString = "-m 1=3 -m 3=1"; + } + else{ + handString = "-m 1=1 -m 3=3"; + } +} + +void page_mouse_trueos::setMouseResolution(){ + resolutionValue = ui->combobox_resolutionBox->itemText(ui->combobox_resolutionBox->currentIndex()); + resString = "-r " + resolutionValue; +} + +void page_mouse_trueos::setMouseAcceleration(){ + realAccelValue = ( ui->slider_mouseAcceleration->value() / divisor); + realAccelValueString = QString::number( ui->slider_mouseAcceleration->value() / divisor, 'f', 2); + accelString = "-a " + realAccelValueString; +} + +void page_mouse_trueos::setDoubleClickThreshold(){ + realDoubleClickValueString = QString::number( ui->slider_doubleClickThreshold->value()); + dclickString = "-C " + realDoubleClickValueString; +} + +void page_mouse_trueos::terminateDrift(){ + if(ui->checkBoxTerminateDrift->isChecked()){ + driftString = "-T 4[,500[,4000]]"; + } + else{ + driftString = ""; + } +} + +void page_mouse_trueos::updateMoused(){ + setMouseAcceleration(); setDoubleClickThreshold(); + qDebug() << "handString" << handString; + qDebug() << "resString" << resString; + qDebug() << "accelString" << accelString; + qDebug() << "dclickString" << dclickString; + qDebug() << "driftstring" << driftString; + deviceString = "-p /dev/sysmouse"; + mousedargs << deviceString << handString << resString << accelString << dclickString << driftString; + qDebug() << "mousedargs" << mousedargs; + QProcess *moused = new QProcess(this); + moused->start(program, mousedargs); +} + diff --git a/src-qt5/core-utils/lumina-config/pages/page_mouse_trueos.h b/src-qt5/core-utils/lumina-config/pages/page_mouse_trueos.h new file mode 100644 index 00000000..ff643747 --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_mouse_trueos.h @@ -0,0 +1,53 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_CONFIG_PAGE_MOUSE_TRUEOS_H +#define _LUMINA_CONFIG_PAGE_MOUSE_TRUEOS_H +#include "../globals.h" +#include "PageWidget.h" + +#include <LInputDevice.h> +#include <QTreeWidgetItem> + +namespace Ui{ + class page_mouse_trueos; +}; + +class page_mouse_trueos : public PageWidget{ + Q_OBJECT +public: + page_mouse_trueos(QWidget *parent); + ~page_mouse_trueos(); + const double divisor = 100; + double realAccelValue; + QString realAccelValueString; + double realDoubleClickValue; + QString realDoubleClickValueString; + QString resolutionValue; + QString handString; + QString resString; + QString dclickString; + QString driftString; + QString accelString; + QString program; + QStringList mousedargs; + QString deviceString; + +public slots: + void SaveSettings(); + void LoadSettings(int screennum); +// void updateIcons(); + void swapHandedness(); + void setMouseResolution(); + void setMouseAcceleration(); + void setDoubleClickThreshold(); + void terminateDrift(); + void updateMoused(); + +private: + Ui::page_mouse_trueos *ui; +}; +#endif diff --git a/src-qt5/core-utils/lumina-config/pages/page_mouse_trueos.ui b/src-qt5/core-utils/lumina-config/pages/page_mouse_trueos.ui new file mode 100644 index 00000000..6a974d4c --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_mouse_trueos.ui @@ -0,0 +1,427 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>page_mouse_trueos</class> + <widget class="QWidget" name="page_mouse_trueos"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>427</width> + <height>417</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <item> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string>Mouse Acceleration</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string>( default = 1)</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="1" column="1"> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>0</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_4"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="label_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>1</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_5"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="label_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>2</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QSlider" name="slider_mouseAcceleration"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximum"> + <number>200</number> + </property> + <property name="singleStep"> + <number>20</number> + </property> + <property name="pageStep"> + <number>20</number> + </property> + <property name="value"> + <number>100</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="invertedAppearance"> + <bool>false</bool> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksAbove</enum> + </property> + <property name="tickInterval"> + <number>20</number> + </property> + </widget> + </item> + </layout> + </item> + <item row="2" column="1"> + <widget class="Line" name="line"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item row="3" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout_6"> + <item> + <widget class="QLabel" name="label_9"> + <property name="text"> + <string>Double Click Threshold</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="label_10"> + <property name="text"> + <string>(default = 500)</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="4" column="1"> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QLabel" name="label_4"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>1ms</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_6"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="label_5"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>500ms</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_7"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string>1s</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QSlider" name="slider_doubleClickThreshold"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximum"> + <number>1000</number> + </property> + <property name="singleStep"> + <number>25</number> + </property> + <property name="pageStep"> + <number>25</number> + </property> + <property name="value"> + <number>500</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksAbove</enum> + </property> + <property name="tickInterval"> + <number>100</number> + </property> + </widget> + </item> + </layout> + </item> + <item row="5" column="1"> + <widget class="Line" name="line_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item row="6" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLabel" name="label_resolutionBox"> + <property name="text"> + <string>Resolution</string> + </property> + <property name="buddy"> + <cstring>combobox_resolutionBox</cstring> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="combobox_resolutionBox"> + <item> + <property name="text"> + <string>low</string> + </property> + </item> + <item> + <property name="text"> + <string>medium-low</string> + </property> + </item> + <item> + <property name="text"> + <string>medium-high</string> + </property> + </item> + <item> + <property name="text"> + <string>high</string> + </property> + </item> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QCheckBox" name="checkBoxTerminateDrift"> + <property name="text"> + <string>Terminate Drift</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="checkBoxHandedness"> + <property name="text"> + <string>Switch Handedness</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_7"> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="button_apply"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Apply</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/src-qt5/core-utils/lumina-config/pages/pages.pri b/src-qt5/core-utils/lumina-config/pages/pages.pri index b36ca7ba..56a3fcd5 100644 --- a/src-qt5/core-utils/lumina-config/pages/pages.pri +++ b/src-qt5/core-utils/lumina-config/pages/pages.pri @@ -14,7 +14,8 @@ HEADERS += $${PWD}/getPage.h \ $${PWD}/page_session_locale.h \ $${PWD}/page_session_options.h \ $${PWD}/page_compton.h \ - $${PWD}/page_mouse.h + $${PWD}/page_mouse.h +// $$PWD/page_mouse_trueos.h SOURCES += $${PWD}/page_main.cpp \ @@ -30,7 +31,8 @@ SOURCES += $${PWD}/page_main.cpp \ $${PWD}/page_session_locale.cpp \ $${PWD}/page_session_options.cpp \ $${PWD}/page_compton.cpp \ - $${PWD}/page_mouse.cpp + $${PWD}/page_mouse.cpp +// $$PWD/page_mouse_trueos.cpp FORMS += $${PWD}/page_main.ui \ @@ -47,3 +49,4 @@ FORMS += $${PWD}/page_main.ui \ $${PWD}/page_session_options.ui \ $${PWD}/page_compton.ui \ $${PWD}/page_mouse.ui +// $$PWD/page_mouse_trueos.ui |