From f7b894621578f5b54b3da9a3291586cee503c2d9 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 1 Dec 2016 10:33:19 -0500 Subject: Get rid of the "fortune" usage, and replace it with a built-in system of tips for Lumina itself (avoids strange stuff from fortune, and ensures information which is at least semi-useful for the user). --- src-qt5/core/lumina-desktop/BootSplash.cpp | 28 +++++++++++++++++++++++----- src-qt5/core/lumina-desktop/BootSplash.h | 4 +++- src-qt5/core/lumina-desktop/LSession.cpp | 8 +++++--- 3 files changed, 31 insertions(+), 9 deletions(-) (limited to 'src-qt5') diff --git a/src-qt5/core/lumina-desktop/BootSplash.cpp b/src-qt5/core/lumina-desktop/BootSplash.cpp index f7981670..f6c4c5fa 100644 --- a/src-qt5/core/lumina-desktop/BootSplash.cpp +++ b/src-qt5/core/lumina-desktop/BootSplash.cpp @@ -11,14 +11,32 @@ BootSplash::BootSplash() : QWidget(0, Qt::SplashScreen | Qt::X11BypassWindowMana //Center the window on the primary screen QPoint ctr = QApplication::desktop()->screenGeometry().center(); this->move( ctr.x()-(this->width()/2), ctr.y()-(this->height()/2) ); - if(LUtils::isValidBinary("fortune")){ - QString random = LUtils::getCmdOutput("fortune -s").join("\n").simplified(); - if(random.endsWith("\n")){ random.chop(1); } - ui->label_welcome->setText( "\""+random+"\"" ); - } + generateTipOfTheDay(); ui->label_version->setText( QString(tr("Version %1")).arg(LDesktopUtils::LuminaDesktopVersion()) ); } +void BootSplash::generateTipOfTheDay(){ + int index = qrand()%5; //Make sure this number matches the length of the case below (max value +1) + QString tip = "This desktop is generously sponsored by iXsystems\nwww.ixsystems.com"; //fallback message (just in case) + switch(index){ + case 0: + tip = tr("This desktop is powered by coffee, coffee, and more coffee."); break; + case 1: + tip = tr("Keep up with desktop news!")+"\n\nwww.lumina-desktop.org"; break; + case 2: + tip = tr("There is a full handbook of information about the desktop available online.")+"\n\nwww.lumina-desktop.org/handbook"; break; + case 3: + tip = tr("Want to change the interface? Everything is customizable in the desktop configuration!"); break; + case 4: + tip = tr("Lumina can easily reproduce the interface from most other desktop environments."); break; + case 5: + tip = tr(""); break; + case 6: + tip = tr(""); break; + } + ui->label_welcome->setText( "\""+tip+"\"" ); +} + void BootSplash::showScreen(QString loading){ //update icon, text, and progress QString txt, icon; int per = 0; diff --git a/src-qt5/core/lumina-desktop/BootSplash.h b/src-qt5/core/lumina-desktop/BootSplash.h index f5bf97a8..f9812ff4 100644 --- a/src-qt5/core/lumina-desktop/BootSplash.h +++ b/src-qt5/core/lumina-desktop/BootSplash.h @@ -18,6 +18,8 @@ class BootSplash : public QWidget{ private: Ui::BootSplash *ui; + void generateTipOfTheDay(); + public: BootSplash(); ~BootSplash(){} @@ -26,4 +28,4 @@ public: void showText(QString txt); //will only update the text, not the icon/progress }; -#endif \ No newline at end of file +#endif diff --git a/src-qt5/core/lumina-desktop/LSession.cpp b/src-qt5/core/lumina-desktop/LSession.cpp index 289d7ede..27b40aa3 100644 --- a/src-qt5/core/lumina-desktop/LSession.cpp +++ b/src-qt5/core/lumina-desktop/LSession.cpp @@ -81,14 +81,16 @@ LSession::~LSession(){ } void LSession::setupSession(){ + //Seed random number generator (if needed) + qsrand( QTime::currentTime().msec() ); + BootSplash splash; splash.showScreen("init"); qDebug() << "Initializing Session"; if(QFile::exists("/tmp/.luminastopping")){ QFile::remove("/tmp/.luminastopping"); } QTime* timer = 0; - if(DEBUG){ timer = new QTime(); timer->start(); qDebug() << " - Init srand:" << timer->elapsed();} - //Seed random number generator (if needed) - qsrand( QTime::currentTime().msec() ); + //if(DEBUG){ timer = new QTime(); timer->start(); qDebug() << " - Init srand:" << timer->elapsed();} + //Setup the QSettings default paths splash.showScreen("settings"); if(DEBUG){ qDebug() << " - Init QSettings:" << timer->elapsed();} -- cgit