diff options
author | Ken Moore <ken@ixsystems.com> | 2016-12-14 15:07:58 -0500 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2016-12-14 15:07:58 -0500 |
commit | bc39ecd8531ed8dda20a2b6a91da25a496f6b1b6 (patch) | |
tree | ed3532d98d7113b39c2cba6b2e8e557c191806ea /src-qt5 | |
parent | Add some more PTY work on the terminal. (diff) | |
parent | Merge pull request #321 from q5sys/master (diff) | |
download | lumina-bc39ecd8531ed8dda20a2b6a91da25a496f6b1b6.tar.gz lumina-bc39ecd8531ed8dda20a2b6a91da25a496f6b1b6.tar.bz2 lumina-bc39ecd8531ed8dda20a2b6a91da25a496f6b1b6.zip |
Merge branch 'master' of github.com:trueos/lumina
Diffstat (limited to 'src-qt5')
9 files changed, 703 insertions, 11 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.cpp b/src-qt5/core-utils/lumina-config/pages/page_mouse.cpp index 8f5c0c23..bda90ad4 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_mouse.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_mouse.cpp @@ -50,7 +50,7 @@ void page_mouse::SaveSettings(){ void page_mouse::LoadSettings(int){ emit HasPendingChanges(false); - emit ChangePageTitle( tr("Mouse Settings") ); + emit ChangePageTitle( tr("Input Device Settings") ); } @@ -151,7 +151,7 @@ void page_mouse::populateDeviceItemValue(QTreeWidget *tree, QTreeWidgetItem *it, tree->setItemWidget(it, 1, box); connect(box, SIGNAL(valueChanged(double)), this, SLOT(valueChanged()) ); - }else if(value.canConvert<QList<QVariant>>()){ + }else if(value.canConvert< QList<QVariant> >()){ //Not Modifiable - just use the label in the item QList<QVariant> list = value.toList(); QStringList txtList; 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/page_theme.cpp b/src-qt5/core-utils/lumina-config/pages/page_theme.cpp index 0d946e81..52579ec2 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_theme.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_theme.cpp @@ -117,7 +117,7 @@ ui->combo_session_themefile->clear(); index = ui->combo_qt5_theme->findData("internal_custom"); } if(index>=0){ ui->combo_qt5_theme->setCurrentIndex(index); } - + checkQt5Theme(); //update item visibility QApplication::processEvents(); loading = false; } diff --git a/src-qt5/core-utils/lumina-config/pages/pages.pri b/src-qt5/core-utils/lumina-config/pages/pages.pri index b36ca7ba..02319976 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 diff --git a/src-qt5/core/lumina-desktop/BootSplash.cpp b/src-qt5/core/lumina-desktop/BootSplash.cpp index 5674eaff..1a648973 100644 --- a/src-qt5/core/lumina-desktop/BootSplash.cpp +++ b/src-qt5/core/lumina-desktop/BootSplash.cpp @@ -16,8 +16,24 @@ BootSplash::BootSplash() : QWidget(0, Qt::SplashScreen | Qt::X11BypassWindowMana } void BootSplash::generateTipOfTheDay(){ - int index = qrand()%7; //Make sure this number matches the length of the case below (max value +1) + //Try to find a system-defined message of the day for lumina + QStringList dirs; dirs << LOS::AppPrefix()+"/etc/" << LOS::SysPrefix()+"/etc/" << L_ETCDIR+"/"; + QString sysMOTD = "lumina-motd"; + for(int i=0; i<dirs.length(); i++){ + if(QFile::exists(dirs[i]+sysMOTD)){ sysMOTD.prepend(dirs[i]); break; } + } + QString tip; + if(sysMOTD.contains("/") && LUtils::isValidBinary(sysMOTD)){ + //is binary - run it to generate text + tip = LUtils::getCmdOutput(sysMOTD).join("\n"); + + }else if(QFile::exists(sysMOTD)){ + //text file - read it to generate text + tip = LUtils::readFile(sysMOTD).join("\n"); + + }else{ + int index = qrand()%46; //Make sure this number matches the length of the case below (max value +1) switch(index){ case 0: tip = tr("This desktop is powered by coffee, coffee, and more coffee."); break; @@ -33,7 +49,87 @@ void BootSplash::generateTipOfTheDay(){ tip = tr("This desktop is generously sponsored by iXsystems")+"\n\nwww.ixsystems.com"; break; case 6: tip = "\""+tr("I have never been hurt by what I have not said")+"\"\n\n- Calvin Coolidge -"; break; - } + case 7: + tip = "\""+tr("Gotta have more cowbell!")+"\"\n\n- Christopher Walken (SNL) -"; break; + case 8: + tip = "\""+tr("Everything has its beauty but not everyone sees it.")+"\"\n\n- Confucius -"; break; + case 9: + tip = "\""+tr("Before God we are all equally wise - and equally foolish.")+"\"\n\n- Albert Einstein -"; break; + case 10: + tip = "\""+tr("We cannot do everything at once, but we can do something at once.")+"\"\n\n- Calvin Coolidge -"; break; + case 11: + tip = "\""+tr("One with the law is a majority.")+"\"\n\n- Calvin Coolidge -"; break; + case 12: + tip = "\""+tr("Don't expect to build up the weak by pulling down the strong.")+"\"\n\n- Calvin Coolidge -"; break; + case 13: + tip = "\""+tr("You can't know too much, but you can say too much.")+"\"\n\n- Calvin Coolidge -"; break; + case 14: + tip = "\""+tr("Duty is not collective; it is personal.")+"\"\n\n- Calvin Coolidge -"; break; + case 15: + tip = "\""+tr("Any society that would give up a little liberty to gain a little security will deserve neither and lose both.")+"\"\n\n- Benjamin Franklin -"; break; + case 16: + tip = "\""+tr("Never trust a computer you can’t throw out a window.")+"\"\n\n- Steve Wozniak -"; break; + case 17: + tip = "\""+tr("Study the past if you would define the future.")+"\"\n\n- Confucius -"; break; + case 18: + tip = "\""+tr("The way to get started is to quit talking and begin doing.")+"\"\n\n- Walt Disney -"; break; + case 19: + tip = "\""+tr("Ask and it will be given to you; search, and you will find; knock and the door will be opened for you.")+"\"\n\n- Jesus Christ -"; break; + case 20: + tip = "\""+tr("Start where you are. Use what you have. Do what you can.")+"\"\n\n- Arthur Ashe -"; break; + case 21: + tip = "\""+tr("A person who never made a mistake never tried anything new.")+"\"\n\n- Albert Einstein -"; break; + case 22: + tip = "\""+tr("It does not matter how slowly you go as long as you do not stop.")+"\"\n\n- Confucius -"; break; + case 23: + tip = "\""+tr("Do what you can, where you are, with what you have.")+"\"\n\n- Theodore Roosevelt -"; break; + case 24: + tip = "\""+tr("Remember no one can make you feel inferior without your consent.")+"\"\n\n- Eleanor Roosevelt -"; break; + case 25: + tip = "\""+tr("It’s not the years in your life that count. It’s the life in your years.")+"\"\n\n- Abraham Lincoln -"; break; + case 26: + tip = "\""+tr("Either write something worth reading or do something worth writing.")+"\"\n\n- Benjamin Franklin -"; break; + case 27: + tip = "\""+tr("The only way to do great work is to love what you do.")+"\"\n\n- Steve Jobs -"; break; + case 28: + tip = "\""+tr("Political correctness is tyranny with manners.")+"\"\n\n- Charlton Heston -"; break; + case 29: + tip = "\""+tr("Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.")+"\"\n\n- Albert Einstein -"; break; + case 30: + tip = "\""+tr("I find that the harder I work, the more luck I seem to have.")+"\"\n\n- Thomas Jefferson -"; break; + case 31: + tip = "\""+tr("Do, or do not. There is no 'try'.")+"\"\n\n- Yoda -"; break; + case 32: + tip = "\""+tr("A mathematician is a device for turning coffee into theorems.")+"\"\n\n- Paul Erdos -"; break; + case 33: + tip = "\""+tr("Good people do not need laws to tell them to act responsibly, while bad people will find a way around the laws.")+"\"\n\n- Plato -"; break; + case 34: + tip = "\""+tr("Black holes are where God divided by zero.")+"\"\n\n- Steven Wright -"; break; + case 35: + tip = "\""+tr("It's kind of fun to do the impossible.")+"\"\n\n- Walt Disney -"; break; + case 36: + tip = "\""+tr("Knowledge speaks, but wisdom listens.")+"\"\n\n- Jimi Hendrix -"; break; + case 37: + tip = "\""+tr("A witty saying proves nothing.")+"\"\n\n- Voltaire -"; break; + case 38: + tip = "\""+tr("Success usually comes to those who are too busy to be looking for it.")+"\"\n\n- Henry David Thoreau -"; break; + case 39: + tip = "\""+tr("Well-timed silence hath more eloquence than speech.")+"\"\n\n- Martin Fraquhar Tupper -"; break; + case 40: + tip = "\""+tr("I have never let my schooling interfere with my education.")+"\"\n\n- Mark Twain -"; break; + case 41: + tip = "\""+tr("The best way to predict the future is to invent it.")+"\"\n\n- Alan Kay -"; break; + case 42: + tip = "\""+tr("Well done is better than well said.")+"\"\n\n- Benjamin Franklin -"; break; + case 43: + tip = "\""+tr("Sometimes it is not enough that we do our best; we must do what is required.")+"\"\n\n- Sir Winston Churchill -"; break; + case 44: + tip = "\""+tr("The truth is more important than the facts.")+"\"\n\n- Frank Lloyd Wright -"; break; + case 45: + tip = "\""+tr("Better to remain silent and be thought a fool than to speak out and remove all doubt.")+"\"\n\n- Abraham Lincoln -"; break; + } //end of switch for tips + + } //end of fallback tip generation ui->label_welcome->setText( tip); } |