diff options
author | Ken Moore <ken@ixsystems.com> | 2016-11-07 14:21:08 -0500 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2016-11-07 14:21:08 -0500 |
commit | 1fa6c08c45c07da3d1c0d369d58db31ef8fb9361 (patch) | |
tree | cd9e82fc2de32664da482ecce71c0c0f70ebecf6 /src-qt5/core | |
parent | Fix up the pkg-plist for the new libLumina depreciation. (diff) | |
parent | Merge branch 'master' of github.com:trueos/lumina (diff) | |
download | lumina-1fa6c08c45c07da3d1c0d369d58db31ef8fb9361.tar.gz lumina-1fa6c08c45c07da3d1c0d369d58db31ef8fb9361.tar.bz2 lumina-1fa6c08c45c07da3d1c0d369d58db31ef8fb9361.zip |
Merge branch 'master' of github.com:trueos/lumina
Diffstat (limited to 'src-qt5/core')
61 files changed, 755 insertions, 727 deletions
diff --git a/src-qt5/core/libLumina/colors/Black.qss.colors b/src-qt5/core/colors/Black.qss.colors index b6269188..b6269188 100644 --- a/src-qt5/core/libLumina/colors/Black.qss.colors +++ b/src-qt5/core/colors/Black.qss.colors diff --git a/src-qt5/core/libLumina/colors/Blue-Light.qss.colors b/src-qt5/core/colors/Blue-Light.qss.colors index 5bcb85f6..5bcb85f6 100644 --- a/src-qt5/core/libLumina/colors/Blue-Light.qss.colors +++ b/src-qt5/core/colors/Blue-Light.qss.colors diff --git a/src-qt5/core/libLumina/colors/Grey-Dark.qss.colors b/src-qt5/core/colors/Grey-Dark.qss.colors index 207edd04..207edd04 100644 --- a/src-qt5/core/libLumina/colors/Grey-Dark.qss.colors +++ b/src-qt5/core/colors/Grey-Dark.qss.colors diff --git a/src-qt5/core/libLumina/colors/Lumina-Glass.qss.colors b/src-qt5/core/colors/Lumina-Glass.qss.colors index 89534aaa..89534aaa 100644 --- a/src-qt5/core/libLumina/colors/Lumina-Glass.qss.colors +++ b/src-qt5/core/colors/Lumina-Glass.qss.colors diff --git a/src-qt5/core/libLumina/colors/Lumina-Gold.qss.colors b/src-qt5/core/colors/Lumina-Gold.qss.colors index cfad7069..cfad7069 100644 --- a/src-qt5/core/libLumina/colors/Lumina-Gold.qss.colors +++ b/src-qt5/core/colors/Lumina-Gold.qss.colors diff --git a/src-qt5/core/libLumina/colors/Lumina-Green.qss.colors b/src-qt5/core/colors/Lumina-Green.qss.colors index 99f16acb..99f16acb 100644 --- a/src-qt5/core/libLumina/colors/Lumina-Green.qss.colors +++ b/src-qt5/core/colors/Lumina-Green.qss.colors diff --git a/src-qt5/core/libLumina/colors/Lumina-Purple.qss.colors b/src-qt5/core/colors/Lumina-Purple.qss.colors index f2ba7e05..f2ba7e05 100644 --- a/src-qt5/core/libLumina/colors/Lumina-Purple.qss.colors +++ b/src-qt5/core/colors/Lumina-Purple.qss.colors diff --git a/src-qt5/core/libLumina/colors/Lumina-Red.qss.colors b/src-qt5/core/colors/Lumina-Red.qss.colors index f73bdb75..f73bdb75 100644 --- a/src-qt5/core/libLumina/colors/Lumina-Red.qss.colors +++ b/src-qt5/core/colors/Lumina-Red.qss.colors diff --git a/src-qt5/core/libLumina/colors/PCBSD10-Default.qss.colors b/src-qt5/core/colors/PCBSD10-Default.qss.colors index efcea51d..efcea51d 100644 --- a/src-qt5/core/libLumina/colors/PCBSD10-Default.qss.colors +++ b/src-qt5/core/colors/PCBSD10-Default.qss.colors diff --git a/src-qt5/core/libLumina/colors/Solarized-Dark.qss.colors b/src-qt5/core/colors/Solarized-Dark.qss.colors index d4f0f1c9..d4f0f1c9 100644 --- a/src-qt5/core/libLumina/colors/Solarized-Dark.qss.colors +++ b/src-qt5/core/colors/Solarized-Dark.qss.colors diff --git a/src-qt5/core/libLumina/colors/Solarized-Light.qss.colors b/src-qt5/core/colors/Solarized-Light.qss.colors index fead1915..fead1915 100644 --- a/src-qt5/core/libLumina/colors/Solarized-Light.qss.colors +++ b/src-qt5/core/colors/Solarized-Light.qss.colors diff --git a/src-qt5/core/core.pro b/src-qt5/core/core.pro index a0d0db3e..27aff3a2 100644 --- a/src-qt5/core/core.pro +++ b/src-qt5/core/core.pro @@ -4,23 +4,31 @@ include("../OS-detect.pri") TEMPLATE = subdirs CONFIG += recursive -SUBDIRS+= libLumina \ - lumina-desktop \ +SUBDIRS+= lumina-desktop \ lumina-session \ lumina-open \ lumina-info # lumina-wm-INCOMPLETE \ # lumina-checkpass - -#Make sure to list libLumina as a requirement for the others (for parallellized builds) -lumina-desktop.depends = libLumina -lumina-session.depends = libLumina -lumina-open.depends = libLumina -lumina-info.depends = libLumina - #Also install any special menu scripts scripts.path = $${L_SHAREDIR}/lumina-desktop/menu-scripts scripts.files = menu-scripts/* -INSTALLS+=scripts +#Color themes +colors.path=$${L_SHAREDIR}/lumina-desktop/colors +colors.files=colors/*.qss.colors + +#Theme templates +themes.path=$${L_SHAREDIR}/lumina-desktop/themes/ +themes.files=themes/*.qss.template + +#QtQuick plugins +#quickplugins.path=$${L_SHAREDIR}/lumina-desktop/quickplugins/ +#quickplugins.files=quickplugins/* + +#Mimetype globs +globs.path=$${L_SHAREDIR}/lumina-desktop +globs.files=xtrafiles/globs2 + +INSTALLS+=scripts colors themes globs diff --git a/src-qt5/core/libLumina/LuminaUtils.cpp b/src-qt5/core/libLumina/LDesktopUtils.cpp index 0d808d1d..4f8d94ef 100644 --- a/src-qt5/core/libLumina/LuminaUtils.cpp +++ b/src-qt5/core/libLumina/LDesktopUtils.cpp @@ -1,59 +1,20 @@ //=========================================== // Lumina-DE source code -// Copyright (c) 2013-2015, Ken Moore +// Copyright (c) 2012-2016, Ken Moore // Available under the 3-clause BSD license // See the LICENSE file for full details //=========================================== -#include "LuminaUtils.h" +#include "LDesktopUtils.h" -#include <QString> -#include <QFile> -#include <QStringList> -#include <QObject> -#include <QTextCodec> -#include <QDebug> #include <QDesktopWidget> -#include <QImageReader> -#include <QRegExp> -#include <QFuture> -#include <QtConcurrent> +#include <QApplication> #include <QScreen> -#include <LuminaOS.h> -#include <LuminaThemes.h> -#include <LuminaXDG.h> +#include "LuminaThemes.h" static QStringList fav; -inline QStringList ProcessRun(QString cmd, QStringList args){ - //Assemble outputs - QStringList out; out << "1" << ""; //error code, string output - QProcess proc; - QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); - env.insert("LANG", "C"); - env.insert("LC_MESSAGES", "C"); - proc.setProcessEnvironment(env); - proc.setProcessChannelMode(QProcess::MergedChannels); - if(args.isEmpty()){ - proc.start(cmd, QIODevice::ReadOnly); - }else{ - proc.start(cmd,args ,QIODevice::ReadOnly); - } - QString info; - while(!proc.waitForFinished(1000)){ - if(proc.state() == QProcess::NotRunning){ break; } //somehow missed the finished signal - QString tmp = proc.readAllStandardOutput(); - if(tmp.isEmpty()){ proc.terminate(); } - else{ info.append(tmp); } - } - out[0] = QString::number(proc.exitCode()); - out[1] = info+QString(proc.readAllStandardOutput()); - return out; -} -//============= -// LUtils Functions -//============= -QString LUtils::LuminaDesktopVersion(){ +QString LDesktopUtils::LuminaDesktopVersion(){ QString ver = "1.1.1"; #ifdef GIT_VERSION ver.append( QString(" (Git Revision: %1)").arg(GIT_VERSION) ); @@ -61,394 +22,19 @@ QString LUtils::LuminaDesktopVersion(){ return ver; } -QString LUtils::LuminaDesktopBuildDate(){ +QString LDesktopUtils::LuminaDesktopBuildDate(){ #ifdef BUILD_DATE return BUILD_DATE; #endif return ""; } -int LUtils::runCmd(QString cmd, QStringList args){ - /*QProcess proc; - proc.setProcessChannelMode(QProcess::MergedChannels); - if(args.isEmpty()){ - proc.start(cmd); - }else{ - proc.start(cmd, args); - } - //if(!proc.waitForStarted(30000)){ return 1; } //process never started - max wait of 30 seconds - while(!proc.waitForFinished(300)){ - if(proc.state() == QProcess::NotRunning){ break; } //somehow missed the finished signal - QCoreApplication::processEvents(); - } - int ret = proc.exitCode(); - return ret;*/ - QFuture<QStringList> future = QtConcurrent::run(ProcessRun, cmd, args); - return future.result()[0].toInt(); //turn it back into an integer return code - -} - -QStringList LUtils::getCmdOutput(QString cmd, QStringList args){ - /*QProcess proc; - QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); - env.insert("LANG", "C"); - env.insert("LC_MESSAGES", "C"); - proc.setProcessEnvironment(env); - proc.setProcessChannelMode(QProcess::MergedChannels); - if(args.isEmpty()){ - proc.start(cmd); - }else{ - proc.start(cmd,args); - } - //if(!proc.waitForStarted(30000)){ return QStringList(); } //process never started - max wait of 30 seconds - while(!proc.waitForFinished(300)){ - if(proc.state() == QProcess::NotRunning){ break; } //somehow missed the finished signal - QCoreApplication::processEvents(); - } - QStringList out = QString(proc.readAllStandardOutput()).split("\n"); - return out;*/ - QFuture<QStringList> future = QtConcurrent::run(ProcessRun, cmd, args); - return future.result()[1].split("\n"); //Split the return message into lines -} - -QStringList LUtils::readFile(QString filepath){ - QStringList out; - QFile file(filepath); - if(file.open(QIODevice::Text | QIODevice::ReadOnly)){ - QTextStream in(&file); - while(!in.atEnd()){ - out << in.readLine(); - } - file.close(); - } - return out; -} - -bool LUtils::writeFile(QString filepath, QStringList contents, bool overwrite){ - QFile file(filepath); - if(file.exists() && !overwrite){ return false; } - bool ok = false; - if(contents.isEmpty()){ contents << "\n"; } - if( file.open(QIODevice::WriteOnly | QIODevice::Truncate) ){ - QTextStream out(&file); - out << contents.join("\n"); - if(!contents.last().isEmpty()){ out << "\n"; } //always end with a new line - file.close(); - ok = true; - } - return ok; -} - -bool LUtils::isValidBinary(QString& bin){ - if(!bin.startsWith("/")){ - //Relative path: search for it on the current "PATH" settings - QStringList paths = QString(qgetenv("PATH")).split(":"); - for(int i=0; i<paths.length(); i++){ - if(QFile::exists(paths[i]+"/"+bin)){ bin = paths[i]+"/"+bin; break;} - } - } - //bin should be the full path by now - if(!bin.startsWith("/")){ return false; } - QFileInfo info(bin); - bool good = (info.exists() && info.isExecutable()); - if(good){ bin = info.absoluteFilePath(); } - return good; -} - -QString LUtils::GenerateOpenTerminalExec(QString term, QString dirpath){ - //Check the input terminal application (default/fallback - determined by calling application) - //if(!LUtils::isValidBinary(term)){ - if(term.endsWith(".desktop")){ - //Pull the binary name out of the shortcut - XDGDesktop DF(term); - if(DF.type == XDGDesktop::BAD){ term = "xterm"; } - else{ term= DF.exec.section(" ",0,0); } //only take the binary name - not any other flags - }else{ - term = "xterm"; //fallback - } - //} - //Now create the calling command for the designated terminal - // NOTE: While the "-e" routine is supposed to be universal, many terminals do not properly use it - // so add some special/known terminals here as necessary - QString exec; - qWarning() << " - Reached terminal initialization" << term; - if(term=="mate-terminal" || term=="lxterminal" || term=="gnome-terminal"){ - exec = term+" --working-directory=\""+dirpath+"\""; - }else if(term=="xfce4-terminal"){ - exec = term+" --default-working-directory=\""+dirpath+"\""; - }else if(term=="konsole" || term == "qterminal"){ - exec = term+" --workdir \""+dirpath+"\""; - }else{ - //-e is the parameter for most of the terminal appliction to execute an external command. - //In this case we start a shell in the selected directory - //Need the user's shell first - QString shell = QString(getenv("SHELL")); - if(!LUtils::isValidBinary(shell)){ shell = "/bin/sh"; } //universal fallback for a shell - exec = term + " -e \"cd " + dirpath + " && " + shell + " \" "; - } - qDebug() << exec; - return exec; -} - -QStringList LUtils::listSubDirectories(QString dir, bool recursive){ - //This is a recursive method for returning the full paths of all subdirectories (if recursive flag is enabled) - QDir maindir(dir); - QStringList out; - QStringList subs = maindir.entryList(QDir::NoDotAndDotDot | QDir::Dirs, QDir::Name); - for(int i=0; i<subs.length(); i++){ - out << maindir.absoluteFilePath(subs[i]); - if(recursive){ - out << LUtils::listSubDirectories(maindir.absoluteFilePath(subs[i]), recursive); - } - } - return out; -} - -QString LUtils::PathToAbsolute(QString path){ - //Convert an input path to an absolute path (this does not check existance ot anything) - if(path.startsWith("/")){ return path; } //already an absolute path - if(path.startsWith("~")){ path.replace(0,1,QDir::homePath()); } - if(!path.startsWith("/")){ - //Must be a relative path - if(path.startsWith("./")){ path = path.remove(2); } - path.prepend( QDir::currentPath()+"/"); - } - return path; -} - -QString LUtils::AppToAbsolute(QString path){ - if(path.startsWith("~/")){ path = path.replace("~/", QDir::homePath()+"/" ); } - if(path.startsWith("/") || QFile::exists(path)){ return path; } - if(path.endsWith(".desktop")){ - //Look in the XDG dirs - QStringList dirs = LXDG::systemApplicationDirs(); - for(int i=0; i<dirs.length(); i++){ - if(QFile::exists(dirs[i]+"/"+path)){ return (dirs[i]+"/"+path); } - } - }else{ - //Look on $PATH for the binary - QStringList paths = QString(getenv("PATH")).split(":"); - for(int i=0; i<paths.length(); i++){ - if(QFile::exists(paths[i]+"/"+path)){ return (paths[i]+"/"+path); } - } - } - return path; -} - -QStringList LUtils::imageExtensions(bool wildcards){ - //Note that all the image extensions are lowercase!! - static QStringList imgExtensions; - if(imgExtensions.isEmpty()){ - QList<QByteArray> fmt = QImageReader::supportedImageFormats(); - for(int i=0; i<fmt.length(); i++){ - if(wildcards){ imgExtensions << "*."+QString::fromLocal8Bit(fmt[i]); } - else{ imgExtensions << QString::fromLocal8Bit(fmt[i]); } - } - } - return imgExtensions; -} - - QTranslator* LUtils::LoadTranslation(QApplication *app, QString appname, QString locale, QTranslator *cTrans){ - //Get the current localization - QString langEnc = "UTF-8"; //default value - QString langCode = locale; //provided locale - if(langCode.isEmpty()){ langCode = getenv("LC_ALL"); } - if(langCode.isEmpty()){ langCode = getenv("LANG"); } - if(langCode.isEmpty()){ langCode = "en_US.UTF-8"; } //default to US english - //See if the encoding is included and strip it out as necessary - if(langCode.contains(".")){ - langEnc = langCode.section(".",-1); - langCode = langCode.section(".",0,0); - } - //Now verify the encoding for the locale - if(langCode =="C" || langCode=="POSIX" || langCode.isEmpty()){ - langEnc = "System"; //use the Qt system encoding - } - if(app !=0){ - qDebug() << "Loading Locale:" << appname << langCode << langEnc; - //If an existing translator was provided, remove it first (will be replaced) - if(cTrans!=0){ app->removeTranslator(cTrans); } - //Setup the translator - cTrans = new QTranslator(); - //Use the shortened locale code if specific code does not have a corresponding file - if(!QFile::exists(LOS::LuminaShare()+"i18n/"+appname+"_" + langCode + ".qm") && langCode!="en_US" ){ - langCode.truncate( langCode.indexOf("_") ); - } - QString filename = appname+"_"+langCode+".qm"; - //qDebug() << "FileName:" << filename << "Dir:" << LOS::LuminaShare()+"i18n/"; - if( cTrans->load( filename, LOS::LuminaShare()+"i18n/" ) ){ - app->installTranslator( cTrans ); - }else{ - //Translator could not be loaded for some reason - cTrans = 0; - if(langCode!="en_US"){ - qWarning() << " - Could not load Locale:" << langCode; - } - } - }else{ - //Only going to set the encoding since no application given - qDebug() << "Loading System Encoding:" << langEnc; - } - //Load current encoding for this locale - QTextCodec::setCodecForLocale( QTextCodec::codecForName(langEnc.toUtf8()) ); - return cTrans; -} - -QStringList LUtils::knownLocales(){ - QDir i18n = QDir(LOS::LuminaShare()+"i18n"); - if( !i18n.exists() ){ return QStringList(); } - QStringList files = i18n.entryList(QStringList() << "lumina-desktop_*.qm", QDir::Files, QDir::Name); - if(files.isEmpty()){ return QStringList(); } - //Now strip off the filename and just leave the locale tag - for(int i=0; i<files.length(); i++){ - files[i].chop(3); //remove the ".qm" on the end - files[i] = files[i].section("_",1,50).simplified(); - } - files << "en_US"; //default locale - files.sort(); - return files; -} - -void LUtils::setLocaleEnv(QString lang, QString msg, QString time, QString num,QString money,QString collate, QString ctype){ - //Adjust the current locale environment variables - bool all = false; - if(msg.isEmpty() && time.isEmpty() && num.isEmpty() && money.isEmpty() && collate.isEmpty() && ctype.isEmpty() ){ - if(lang.isEmpty()){ return; } //nothing to do - no changes requested - all = true; //set everything to the "lang" value - } - //If no lang given, but others are given, then use the current setting - if(lang.isEmpty()){ lang = getenv("LC_ALL"); } - if(lang.isEmpty()){ lang = getenv("LANG"); } - if(lang.isEmpty()){ lang = "en_US"; } - //Now go through and set/unset the environment variables - // - LANG & LC_ALL - if(!lang.contains(".")){ lang.append(".UTF-8"); } - setenv("LANG",lang.toUtf8() ,1); //overwrite setting (this is always required as the fallback) - if(all){ setenv("LC_ALL",lang.toUtf8() ,1); } - else{ unsetenv("LC_ALL"); } //make sure the custom settings are used - // - LC_MESSAGES - if(msg.isEmpty()){ unsetenv("LC_MESSAGES"); } - else{ - if(!msg.contains(".")){ msg.append(".UTF-8"); } - setenv("LC_MESSAGES",msg.toUtf8(),1); - } - // - LC_TIME - if(time.isEmpty()){ unsetenv("LC_TIME"); } - else{ - if(!time.contains(".")){ time.append(".UTF-8"); } - setenv("LC_TIME",time.toUtf8(),1); - } - // - LC_NUMERIC - if(num.isEmpty()){ unsetenv("LC_NUMERIC"); } - else{ - if(!num.contains(".")){ num.append(".UTF-8"); } - setenv("LC_NUMERIC",num.toUtf8(),1); - } - // - LC_MONETARY - if(money.isEmpty()){ unsetenv("LC_MONETARY"); } - else{ - if(!money.contains(".")){ money.append(".UTF-8"); } - setenv("LC_MONETARY",money.toUtf8(),1); - } - // - LC_COLLATE - if(collate.isEmpty()){ unsetenv("LC_COLLATE"); } - else{ - if(!collate.contains(".")){ collate.append(".UTF-8"); } - setenv("LC_COLLATE",collate.toUtf8(),1); - } - // - LC_CTYPE - if(ctype.isEmpty()){ unsetenv("LC_CTYPE"); } - else{ - if(!ctype.contains(".")){ ctype.append(".UTF-8"); } - setenv("LC_CTYPE",ctype.toUtf8(),1); - } -} - -QString LUtils::currentLocale(){ - QString curr = getenv("LC_ALL");// = QLocale::system(); - if(curr.isEmpty()){ curr = getenv("LANG"); } - if(curr.isEmpty()){ curr = "en_US"; } - curr = curr.section(".",0,0); //remove any encodings off the end - return curr; -} - -double LUtils::DisplaySizeToBytes(QString num){ - //qDebug() << "Convert Num to Bytes:" << num; - num = num.toLower().simplified(); - num = num.remove(" "); - if(num.isEmpty()){ return 0.0; } - if(num.endsWith("b")){ num.chop(1); } //remove the "bytes" marker (if there is one) - QString lab = "b"; - if(!num[num.size()-1].isNumber()){ - lab = num.right(1); num.chop(1); - } - double N = num.toDouble(); - QStringList labs; labs <<"b"<<"k"<<"m"<<"g"<<"t"<<"p"; //go up to petabytes for now - for(int i=0; i<labs.length(); i++){ - if(lab==labs[i]){ break; }//already at the right units - break out - N = N*1024.0; //Move to the next unit of measurement - } - //qDebug() << " - Done:" << QString::number(N) << lab << num; - return N; -} - -QString LUtils::BytesToDisplaySize(qint64 ibytes){ - static QStringList labs = QStringList(); - if(labs.isEmpty()){ labs << "B" << "K" << "M" << "G" << "T" << "P"; } - //Now get the dominant unit - int c=0; - double bytes = ibytes; //need to keep decimel places for calculations - while(bytes>=1000 && c<labs.length() ){ - bytes = bytes/1024; - c++; - } //labs[c] is the unit - //Bytes are now - //Now format the number (up to 3 digits, not including decimel places) - QString num; - if(bytes>=100){ - //No decimel places - num = QString::number(qRound(bytes)); - }else if(bytes>=10){ - //need 1 decimel place - num = QString::number( (qRound(bytes*10)/10.0) ); - }else if(bytes>=1){ - //need 2 decimel places - num = QString::number( (qRound(bytes*100)/100.0) ); - }else{ - //Fully decimel (3 places) - num = "0."+QString::number(qRound(bytes*1000)); - } - //qDebug() << "Bytes to Human-readable:" << bytes << c << num << labs[c]; - return (num+labs[c]); -} - -QString LUtils::SecondsToDisplay(int secs){ - if(secs < 0){ return "??"; } - QString rem; //remaining - if(secs > 3600){ - int hours = secs/3600; - rem.append( QString::number(hours)+"h "); - secs = secs - (hours*3600); - } - if(secs > 60){ - int min = secs/60; - rem.append( QString::number(min)+"m "); - secs = secs - (min*60); - } - if(secs > 0){ - rem.append( QString::number(secs)+"s"); - }else{ - rem.append( "0s" ); - } - return rem; -} - //Various function for finding valid QtQuick plugins on the system -bool LUtils::validQuickPlugin(QString ID){ - return ( !LUtils::findQuickPluginFile(ID).isEmpty() ); +bool LDesktopUtils::validQuickPlugin(QString ID){ + return ( !LDesktopUtils::findQuickPluginFile(ID).isEmpty() ); } -QString LUtils::findQuickPluginFile(QString ID){ +QString LDesktopUtils::findQuickPluginFile(QString ID){ if(ID.startsWith("quick-")){ ID = ID.section("-",1,50); } //just in case //Give preference to any user-supplied plugins (overwrites for system plugins) QString path = QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/quickplugins/quick-"+ID+".qml"; @@ -458,7 +44,7 @@ QString LUtils::findQuickPluginFile(QString ID){ return ""; //could not be found } -QStringList LUtils::listQuickPlugins(){ +QStringList LDesktopUtils::listQuickPlugins(){ QDir dir(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/quickplugins"); QStringList files = dir.entryList(QStringList() << "quick-*.qml", QDir::Files | QDir::NoDotAndDotDot, QDir::Name); dir.cd(LOS::LuminaShare()+"quickplugins"); @@ -471,7 +57,7 @@ QStringList LUtils::listQuickPlugins(){ return files; } -QStringList LUtils::infoQuickPlugin(QString ID){ //Returns: [Name, Description, Icon] +QStringList LDesktopUtils::infoQuickPlugin(QString ID){ //Returns: [Name, Description, Icon] //qDebug() << "Find Quick Info:" << ID; QString path = findQuickPluginFile(ID); //qDebug() << " - path:" << path; @@ -492,7 +78,7 @@ QStringList LUtils::infoQuickPlugin(QString ID){ //Returns: [Name, Description, return info; } -QStringList LUtils::listFavorites(){ +QStringList LDesktopUtils::listFavorites(){ static QDateTime lastRead; QDateTime cur = QDateTime::currentDateTime(); if(lastRead.isNull() || lastRead<QFileInfo( QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/favorites.list").lastModified()){ @@ -505,22 +91,22 @@ QStringList LUtils::listFavorites(){ return fav; } -bool LUtils::saveFavorites(QStringList list){ +bool LDesktopUtils::saveFavorites(QStringList list){ list.removeDuplicates(); bool ok = LUtils::writeFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/favorites.list", list, true); if(ok){ fav = list; } //also save internally in case of rapid write/read of the file return ok; } -bool LUtils::isFavorite(QString path){ - QStringList fav = LUtils::listFavorites(); +bool LDesktopUtils::isFavorite(QString path){ + QStringList fav = LDesktopUtils::listFavorites(); for(int i=0; i<fav.length(); i++){ if(fav[i].endsWith("::::"+path)){ return true; } } return false; } -bool LUtils::addFavorite(QString path, QString name){ +bool LDesktopUtils::addFavorite(QString path, QString name){ //Generate the type of favorite this is QFileInfo info(path); QString type; @@ -530,30 +116,30 @@ bool LUtils::addFavorite(QString path, QString name){ //Assign a name if none given if(name.isEmpty()){ name = info.fileName(); } //Now add it to the list - QStringList favs = LUtils::listFavorites(); + QStringList favs = LDesktopUtils::listFavorites(); bool found = false; for(int i=0; i<favs.length(); i++){ if(favs[i].endsWith("::::"+path)){ favs[i] = name+"::::"+type+"::::"+path; } } if(!found){ favs << name+"::::"+type+"::::"+path; } - return LUtils::saveFavorites(favs); + return LDesktopUtils::saveFavorites(favs); } -void LUtils::removeFavorite(QString path){ - QStringList fav = LUtils::listFavorites(); +void LDesktopUtils::removeFavorite(QString path){ + QStringList fav = LDesktopUtils::listFavorites(); bool changed = false; for(int i=0; i<fav.length(); i++){ if(fav[i].endsWith("::::"+path)){ fav.removeAt(i); i--; changed=true;} } - if(changed){ LUtils::saveFavorites(fav); } + if(changed){ LDesktopUtils::saveFavorites(fav); } } -void LUtils::upgradeFavorites(int fromoldversionnumber){ +void LDesktopUtils::upgradeFavorites(int fromoldversionnumber){ /*if(fromoldversionnumber <= 8004){ // < pre-0.8.4>, sym-links in the ~/.lumina/favorites dir} //Include 0.8.4-devel versions in this upgrade (need to distinguish b/w devel and release versions later somehow) QDir favdir(QDir::homePath()+"/.lumina/favorites"); QFileInfoList symlinks = favdir.entryInfoList(QDir::Files | QDir::Dirs | QDir::System | QDir::NoDotAndDotDot); - QStringList favfile = LUtils::listFavorites(); //just in case some already exist + QStringList favfile = LDesktopUtils::listFavorites(); //just in case some already exist bool newentry = false; for(int i=0; i<symlinks.length(); i++){ if(!symlinks[i].isSymLink()){ continue; } //not a symlink @@ -570,13 +156,13 @@ void LUtils::upgradeFavorites(int fromoldversionnumber){ newentry = true; } if(newentry){ - LUtils::saveFavorites(favfile); + LDesktopUtils::saveFavorites(favfile); } }*/ //end check for version <= 0.8.4 } -void LUtils::LoadSystemDefaults(bool skipOS){ +void LDesktopUtils::LoadSystemDefaults(bool skipOS){ //Will create the Lumina configuration files based on the current system template (if any) qDebug() << "Loading System Defaults"; QStringList sysDefaults; @@ -605,7 +191,7 @@ void LUtils::LoadSystemDefaults(bool skipOS){ QStringList tmp = sysDefaults.filter("session_"); if(tmp.isEmpty()){ tmp = sysDefaults.filter("session."); }//for backwards compat sesset << "[General]"; //everything is in this section - sesset << "DesktopVersion="+LUtils::LuminaDesktopVersion(); + sesset << "DesktopVersion="+LDesktopUtils::LuminaDesktopVersion(); for(int i=0; i<tmp.length(); i++){ if(tmp[i].startsWith("#") || !tmp[i].contains("=") ){ continue; } QString var = tmp[i].section("=",0,0).toLower().simplified(); @@ -616,7 +202,7 @@ void LUtils::LoadSystemDefaults(bool skipOS){ if(var.contains(".")){ var.replace(".","_"); } //Now parse the variable and put the value in the proper file - if(var.contains("_default_")){ val = AppToAbsolute(val); } //got an application/binary + if(var.contains("_default_")){ val = LUtils::AppToAbsolute(val); } //got an application/binary //Special handling for values which need to exist first if(var.endsWith("_ifexists") ){ var = var.remove("_ifexists"); //remove this flag from the variable @@ -670,7 +256,7 @@ void LUtils::LoadSystemDefaults(bool skipOS){ //Change in 0.8.5 - use "_" instead of "." within variables names - need backwards compat for a little while if(var.contains(".")){ var.replace(".","_"); } //Now parse the variable and put the value in the proper file - val = AppToAbsolute(val); + val = LUtils::AppToAbsolute(val); //Special handling for values which need to exist first if(var.endsWith("_ifexists") ){ var = var.remove("_ifexists"); //remove this flag from the variable @@ -766,10 +352,10 @@ void LUtils::LoadSystemDefaults(bool skipOS){ if(var.contains(".")){ var.replace(".","_"); } //Now parse the variable and put the value in the proper file qDebug() << "Favorite entry:" << var << val; - val = AppToAbsolute(val); //turn any relative files into absolute - if(var=="favorites_add_ifexists" && QFile::exists(val)){ qDebug() << " - Exists/Adding:"; LUtils::addFavorite(val); } - else if(var=="favorites_add"){ qDebug() << " - Adding:"; LUtils::addFavorite(val); } - else if(var=="favorites_remove"){ qDebug() << " - Removing:"; LUtils::removeFavorite(val); } + val = LUtils::AppToAbsolute(val); //turn any relative files into absolute + if(var=="favorites_add_ifexists" && QFile::exists(val)){ qDebug() << " - Exists/Adding:"; LDesktopUtils::addFavorite(val); } + else if(var=="favorites_add"){ qDebug() << " - Adding:"; LDesktopUtils::addFavorite(val); } + else if(var=="favorites_remove"){ qDebug() << " - Removing:"; LDesktopUtils::removeFavorite(val); } } // -- QUICKLAUNCH -- @@ -783,7 +369,7 @@ void LUtils::LoadSystemDefaults(bool skipOS){ //Change in 0.8.5 - use "_" instead of "." within variables names - need backwards compat for a little while if(var.contains(".")){ var.replace(".","_"); } //Now parse the variable and put the value in the proper file - val = AppToAbsolute(val); //turn any relative files into absolute + val = LUtils::AppToAbsolute(val); //turn any relative files into absolute if(var=="quicklaunch_add_ifexists" && QFile::exists(val)){ quickL << val; } else if(var=="quicklaunch_add"){ quickL << val; } } @@ -876,12 +462,12 @@ void LUtils::LoadSystemDefaults(bool skipOS){ } -bool LUtils::checkUserFiles(QString lastversion){ +bool LDesktopUtils::checkUserFiles(QString lastversion){ //internal version conversion examples: // [1.0.0 -> 1000000], [1.2.3 -> 1002003], [0.6.1 -> 6001] //returns true if something changed - int oldversion = LUtils::VersionStringToNumber(lastversion); - int nversion = LUtils::VersionStringToNumber(QApplication::applicationVersion()); + int oldversion = LDesktopUtils::VersionStringToNumber(lastversion); + int nversion = LDesktopUtils::VersionStringToNumber(QApplication::applicationVersion()); bool newversion = ( oldversion < nversion ); //increasing version number bool newrelease = ( lastversion.contains("-devel", Qt::CaseInsensitive) && QApplication::applicationVersion().contains("-release", Qt::CaseInsensitive) ); //Moving from devel to release @@ -892,11 +478,11 @@ bool LUtils::checkUserFiles(QString lastversion){ if(!QFile::exists(dset) || oldversion < 5000){ if( oldversion < 100000 && nversion>=100000 ){ system("rm -rf ~/.lumina"); qDebug() << "Current desktop settings obsolete: Re-implementing defaults"; } else{ firstrun = true; } - LUtils::LoadSystemDefaults(); + LDesktopUtils::LoadSystemDefaults(); } //Convert the favorites framework as necessary (change occured with 0.8.4) if(newversion || newrelease){ - LUtils::upgradeFavorites(oldversion); + LDesktopUtils::upgradeFavorites(oldversion); } //Convert from the old desktop numbering system to the new one (change occured with 1.0.1) if(oldversion<=1000001){ @@ -949,7 +535,7 @@ bool LUtils::checkUserFiles(QString lastversion){ return (firstrun || newversion || newrelease); } -int LUtils::VersionStringToNumber(QString version){ +int LDesktopUtils::VersionStringToNumber(QString version){ version = version.section("-",0,0); //trim any extra labels off the end int maj, mid, min; //major/middle/minor version numbers (<Major>.<Middle>.<Minor>) maj = mid = min = 0; @@ -962,102 +548,3 @@ int LUtils::VersionStringToNumber(QString version){ //NOTE: This format allows numbers to be anywhere from 0->999 without conflict return (maj*1000000 + mid*1000 + min); } - -// ======================= -// RESIZEMENU CLASS -// ======================= -/*ResizeMenu::ResizeMenu(QWidget *parent) : QMenu(parent){ - this->setContentsMargins(1,1,1,1); - this->setMouseTracking(true); - resizeSide = NONE; - cAct = new QWidgetAction(this); - contents = 0; - connect(this, SIGNAL(aboutToShow()), this, SLOT(clearFlags()) ); - connect(this, SIGNAL(aboutToHide()), this, SLOT(clearFlags()) ); - connect(cAct, SIGNAL(hovered()), this, SLOT(clearFlags()) ); -} - -ResizeMenu::~ResizeMenu(){ - -} - -void ResizeMenu::setContents(QWidget *con){ - this->clear(); - cAct->setDefaultWidget(con); - this->addAction(cAct); - contents = con; //save for later - contents->setCursor(Qt::ArrowCursor); -} - -void ResizeMenu::mouseMoveEvent(QMouseEvent *ev){ - QRect geom = this->geometry(); - //Note: The exact position does not matter as much as the size - // since the window will be moved again the next time it is shown - // The "-2" in the sizing below accounts for the menu margins - QPoint gpos = this->mapToGlobal(ev->pos()); - bool handled = false; - switch(resizeSide){ - case TOP: - if(gpos.y() >= geom.bottom()-1){ break; } - geom.setTop(gpos.y()); - this->setGeometry(geom); - if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2));} - handled = true; - break; - case BOTTOM: - if(gpos.y() <= geom.top()+1){ break; } - geom.setBottom( gpos.y()); - this->setGeometry(geom); - if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2));} - handled = true; - break; - case LEFT: - if(gpos.x() >= geom.right()-1){ break; } - geom.setLeft(gpos.x()); - this->setGeometry(geom); - if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2));} - handled = true; - break; - case RIGHT: - if(gpos.x() <= geom.left()+1){ break; } - geom.setRight(gpos.x()); - this->setGeometry(geom); - if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2));} - handled = true; - break; - default: //NONE - //qDebug() << " - Mouse At:" << ev->pos(); - //Just adjust the mouse cursor which is shown - if(ev->pos().x()<=1 && ev->pos().x() >= -1){ this->setCursor(Qt::SizeHorCursor); } - else if(ev->pos().x() >= this->width()-1 && ev->pos().x() <= this->width()+1){ this->setCursor(Qt::SizeHorCursor); } - else if(ev->pos().y()<=1 && ev->pos().y() >= -1){ this->setCursor(Qt::SizeVerCursor); } - else if(ev->pos().y() >= this->height()-1 && ev->pos().y() <= this->height()+1){ this->setCursor(Qt::SizeVerCursor); } - else{ this->setCursor(Qt::ArrowCursor); } - } - if(!handled){ QMenu::mouseMoveEvent(ev); } //do normal processing as well -} - -void ResizeMenu::mousePressEvent(QMouseEvent *ev){ - bool used = false; - if(ev->buttons().testFlag(Qt::LeftButton) && resizeSide==NONE){ - //qDebug() << "Mouse Press Event:" << ev->pos() << resizeSide; - if(ev->pos().x()<=1 && ev->pos().x() >= -1){resizeSide = LEFT; used = true;} - else if(ev->pos().x() >= this->width()-1 && ev->pos().x() <= this->width()+1){ resizeSide = RIGHT; used = true;} - else if(ev->pos().y()<=1 && ev->pos().y() >= -1){ resizeSide = TOP; used = true; } - else if(ev->pos().y() >= this->height()-1 && ev->pos().y() <= this->height()+1){ resizeSide = BOTTOM; used = true; } - } - if(used){ ev->accept(); this->grabMouse(); } - else{ QMenu::mousePressEvent(ev); } //do normal processing -} - -void ResizeMenu::mouseReleaseEvent(QMouseEvent *ev){ - this->releaseMouse(); - if(ev->button() == Qt::LeftButton && resizeSide!=NONE ){ - //qDebug() << "Mouse Release Event:" << ev->pos() << resizeSide; - resizeSide = NONE; - emit MenuResized(contents->size()); - ev->accept(); - }else{ - QMenu::mouseReleaseEvent(ev); //do normal processing - } -}*/ diff --git a/src-qt5/core/libLumina/LDesktopUtils.h b/src-qt5/core/libLumina/LDesktopUtils.h new file mode 100644 index 00000000..dbad8757 --- /dev/null +++ b/src-qt5/core/libLumina/LDesktopUtils.h @@ -0,0 +1,49 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2012-2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_LIBRARY_DESKTOP_UTILS_H +#define _LUMINA_LIBRARY_DESKTOP_UTILS_H + +#include <QString> +#include <QStringList> +#include <QFile> +#include <QDir> +#include <QDateTime> + +//Other classes needed +#include <LUtils.h> +#include <LuminaXDG.h> +#include <LuminaOS.h> + +class LDesktopUtils{ +public: + //Get the current version/build of the Lumina desktop + static QString LuminaDesktopVersion(); + static QString LuminaDesktopBuildDate(); + + //Various function for finding valid QtQuick plugins on the system + static bool validQuickPlugin(QString ID); + static QString findQuickPluginFile(QString ID); + static QStringList listQuickPlugins(); //List of valid ID's + static QStringList infoQuickPlugin(QString ID); //Returns: [Name, Description, Icon] + + //Various functions for the favorites sub-system + // Formatting Note: "<name>::::[dir/app/<mimetype>]::::<path>" + // the <name> field might not be used for "app" flagged entries + static QStringList listFavorites(); + static bool saveFavorites(QStringList); + static bool isFavorite(QString path); + static bool addFavorite(QString path, QString name = ""); + static void removeFavorite(QString path); + static void upgradeFavorites(int fromoldversionnumber); + + //Load the default setup for the system + static void LoadSystemDefaults(bool skipOS = false); + static bool checkUserFiles(QString lastversion); //returns true if something changed + static int VersionStringToNumber(QString version); //convert the lumina version string to a number for comparisons +}; + +#endif diff --git a/src-qt5/core/libLumina/LDesktopUtils.pri b/src-qt5/core/libLumina/LDesktopUtils.pri new file mode 100644 index 00000000..80bbcfa8 --- /dev/null +++ b/src-qt5/core/libLumina/LDesktopUtils.pri @@ -0,0 +1,7 @@ +SOURCES *= $${PWD}/LDesktopUtils.cpp +HEADERS *= $${PWD}/LDesktopUtils.h + +INCLUDEPATH *= ${PWD} + +#Now the other dependendies of it +include(LUtils.pri) diff --git a/src-qt5/core/libLumina/LUtils.cpp b/src-qt5/core/libLumina/LUtils.cpp new file mode 100644 index 00000000..78831231 --- /dev/null +++ b/src-qt5/core/libLumina/LUtils.cpp @@ -0,0 +1,436 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2013-2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "LUtils.h" + +#include "LuminaOS.h" +#include "LuminaXDG.h" + +#include <QApplication> +#include <QtConcurrent> + +inline QStringList ProcessRun(QString cmd, QStringList args){ + //Assemble outputs + QStringList out; out << "1" << ""; //error code, string output + QProcess proc; + QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + env.insert("LANG", "C"); + env.insert("LC_MESSAGES", "C"); + proc.setProcessEnvironment(env); + proc.setProcessChannelMode(QProcess::MergedChannels); + if(args.isEmpty()){ + proc.start(cmd, QIODevice::ReadOnly); + }else{ + proc.start(cmd,args ,QIODevice::ReadOnly); + } + QString info; + while(!proc.waitForFinished(1000)){ + if(proc.state() == QProcess::NotRunning){ break; } //somehow missed the finished signal + QString tmp = proc.readAllStandardOutput(); + if(tmp.isEmpty()){ proc.terminate(); } + else{ info.append(tmp); } + } + out[0] = QString::number(proc.exitCode()); + out[1] = info+QString(proc.readAllStandardOutput()); + return out; +} +//============= +// LUtils Functions +//============= +int LUtils::runCmd(QString cmd, QStringList args){ + /*QProcess proc; + proc.setProcessChannelMode(QProcess::MergedChannels); + if(args.isEmpty()){ + proc.start(cmd); + }else{ + proc.start(cmd, args); + } + //if(!proc.waitForStarted(30000)){ return 1; } //process never started - max wait of 30 seconds + while(!proc.waitForFinished(300)){ + if(proc.state() == QProcess::NotRunning){ break; } //somehow missed the finished signal + QCoreApplication::processEvents(); + } + int ret = proc.exitCode(); + return ret;*/ + QFuture<QStringList> future = QtConcurrent::run(ProcessRun, cmd, args); + return future.result()[0].toInt(); //turn it back into an integer return code + +} + +QStringList LUtils::getCmdOutput(QString cmd, QStringList args){ + /*QProcess proc; + QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + env.insert("LANG", "C"); + env.insert("LC_MESSAGES", "C"); + proc.setProcessEnvironment(env); + proc.setProcessChannelMode(QProcess::MergedChannels); + if(args.isEmpty()){ + proc.start(cmd); + }else{ + proc.start(cmd,args); + } + //if(!proc.waitForStarted(30000)){ return QStringList(); } //process never started - max wait of 30 seconds + while(!proc.waitForFinished(300)){ + if(proc.state() == QProcess::NotRunning){ break; } //somehow missed the finished signal + QCoreApplication::processEvents(); + } + QStringList out = QString(proc.readAllStandardOutput()).split("\n"); + return out;*/ + QFuture<QStringList> future = QtConcurrent::run(ProcessRun, cmd, args); + return future.result()[1].split("\n"); //Split the return message into lines +} + +QStringList LUtils::readFile(QString filepath){ + QStringList out; + QFile file(filepath); + if(file.open(QIODevice::Text | QIODevice::ReadOnly)){ + QTextStream in(&file); + while(!in.atEnd()){ + out << in.readLine(); + } + file.close(); + } + return out; +} + +bool LUtils::writeFile(QString filepath, QStringList contents, bool overwrite){ + QFile file(filepath); + if(file.exists() && !overwrite){ return false; } + bool ok = false; + if(contents.isEmpty()){ contents << "\n"; } + if( file.open(QIODevice::WriteOnly | QIODevice::Truncate) ){ + QTextStream out(&file); + out << contents.join("\n"); + if(!contents.last().isEmpty()){ out << "\n"; } //always end with a new line + file.close(); + ok = true; + } + return ok; +} + +bool LUtils::isValidBinary(QString& bin){ + if(!bin.startsWith("/")){ + //Relative path: search for it on the current "PATH" settings + QStringList paths = QString(qgetenv("PATH")).split(":"); + for(int i=0; i<paths.length(); i++){ + if(QFile::exists(paths[i]+"/"+bin)){ bin = paths[i]+"/"+bin; break;} + } + } + //bin should be the full path by now + if(!bin.startsWith("/")){ return false; } + QFileInfo info(bin); + bool good = (info.exists() && info.isExecutable()); + if(good){ bin = info.absoluteFilePath(); } + return good; +} + +QStringList LUtils::systemApplicationDirs(){ + //Returns a list of all the directories where *.desktop files can be found + QStringList appDirs = QString(getenv("XDG_DATA_HOME")).split(":"); + appDirs << QString(getenv("XDG_DATA_DIRS")).split(":"); + if(appDirs.isEmpty()){ appDirs << "/usr/local/share" << "/usr/share" << LOS::AppPrefix()+"/share" << LOS::SysPrefix()+"/share" << L_SHAREDIR; } + appDirs.removeDuplicates(); + //Now create a valid list + QStringList out; + for(int i=0; i<appDirs.length(); i++){ + if( QFile::exists(appDirs[i]+"/applications") ){ + out << appDirs[i]+"/applications"; + //Also check any subdirs within this directory + // (looking at you KDE - stick to the standards!!) + out << LUtils::listSubDirectories(appDirs[i]+"/applications"); + } + } + //qDebug() << "System Application Dirs:" << out; + return out; +} + +QString LUtils::GenerateOpenTerminalExec(QString term, QString dirpath){ + //Check the input terminal application (default/fallback - determined by calling application) + //if(!LUtils::isValidBinary(term)){ + if(term.endsWith(".desktop")){ + //Pull the binary name out of the shortcut + XDGDesktop DF(term); + if(DF.type == XDGDesktop::BAD){ term = "xterm"; } + else{ term= DF.exec.section(" ",0,0); } //only take the binary name - not any other flags + }else{ + term = "xterm"; //fallback + } + //} + //Now create the calling command for the designated terminal + // NOTE: While the "-e" routine is supposed to be universal, many terminals do not properly use it + // so add some special/known terminals here as necessary + QString exec; + qWarning() << " - Reached terminal initialization" << term; + if(term=="mate-terminal" || term=="lxterminal" || term=="gnome-terminal"){ + exec = term+" --working-directory=\""+dirpath+"\""; + }else if(term=="xfce4-terminal"){ + exec = term+" --default-working-directory=\""+dirpath+"\""; + }else if(term=="konsole" || term == "qterminal"){ + exec = term+" --workdir \""+dirpath+"\""; + }else{ + //-e is the parameter for most of the terminal appliction to execute an external command. + //In this case we start a shell in the selected directory + //Need the user's shell first + QString shell = QString(getenv("SHELL")); + if(!LUtils::isValidBinary(shell)){ shell = "/bin/sh"; } //universal fallback for a shell + exec = term + " -e \"cd " + dirpath + " && " + shell + " \" "; + } + qDebug() << exec; + return exec; +} + +QStringList LUtils::listSubDirectories(QString dir, bool recursive){ + //This is a recursive method for returning the full paths of all subdirectories (if recursive flag is enabled) + QDir maindir(dir); + QStringList out; + QStringList subs = maindir.entryList(QDir::NoDotAndDotDot | QDir::Dirs, QDir::Name); + for(int i=0; i<subs.length(); i++){ + out << maindir.absoluteFilePath(subs[i]); + if(recursive){ + out << LUtils::listSubDirectories(maindir.absoluteFilePath(subs[i]), recursive); + } + } + return out; +} + +QString LUtils::PathToAbsolute(QString path){ + //Convert an input path to an absolute path (this does not check existance ot anything) + if(path.startsWith("/")){ return path; } //already an absolute path + if(path.startsWith("~")){ path.replace(0,1,QDir::homePath()); } + if(!path.startsWith("/")){ + //Must be a relative path + if(path.startsWith("./")){ path = path.remove(2); } + path.prepend( QDir::currentPath()+"/"); + } + return path; +} + +QString LUtils::AppToAbsolute(QString path){ + if(path.startsWith("~/")){ path = path.replace("~/", QDir::homePath()+"/" ); } + if(path.startsWith("/") || QFile::exists(path)){ return path; } + if(path.endsWith(".desktop")){ + //Look in the XDG dirs + QStringList dirs = systemApplicationDirs(); + for(int i=0; i<dirs.length(); i++){ + if(QFile::exists(dirs[i]+"/"+path)){ return (dirs[i]+"/"+path); } + } + }else{ + //Look on $PATH for the binary + QStringList paths = QString(getenv("PATH")).split(":"); + for(int i=0; i<paths.length(); i++){ + if(QFile::exists(paths[i]+"/"+path)){ return (paths[i]+"/"+path); } + } + } + return path; +} + +QStringList LUtils::imageExtensions(bool wildcards){ + //Note that all the image extensions are lowercase!! + static QStringList imgExtensions; + if(imgExtensions.isEmpty()){ + QList<QByteArray> fmt = QImageReader::supportedImageFormats(); + for(int i=0; i<fmt.length(); i++){ + if(wildcards){ imgExtensions << "*."+QString::fromLocal8Bit(fmt[i]); } + else{ imgExtensions << QString::fromLocal8Bit(fmt[i]); } + } + } + return imgExtensions; +} + + QTranslator* LUtils::LoadTranslation(QApplication *app, QString appname, QString locale, QTranslator *cTrans){ + //Get the current localization + QString langEnc = "UTF-8"; //default value + QString langCode = locale; //provided locale + if(langCode.isEmpty()){ langCode = getenv("LC_ALL"); } + if(langCode.isEmpty()){ langCode = getenv("LANG"); } + if(langCode.isEmpty()){ langCode = "en_US.UTF-8"; } //default to US english + //See if the encoding is included and strip it out as necessary + if(langCode.contains(".")){ + langEnc = langCode.section(".",-1); + langCode = langCode.section(".",0,0); + } + //Now verify the encoding for the locale + if(langCode =="C" || langCode=="POSIX" || langCode.isEmpty()){ + langEnc = "System"; //use the Qt system encoding + } + if(app !=0){ + qDebug() << "Loading Locale:" << appname << langCode << langEnc; + //If an existing translator was provided, remove it first (will be replaced) + if(cTrans!=0){ app->removeTranslator(cTrans); } + //Setup the translator + cTrans = new QTranslator(); + //Use the shortened locale code if specific code does not have a corresponding file + if(!QFile::exists(LOS::LuminaShare()+"i18n/"+appname+"_" + langCode + ".qm") && langCode!="en_US" ){ + langCode.truncate( langCode.indexOf("_") ); + } + QString filename = appname+"_"+langCode+".qm"; + //qDebug() << "FileName:" << filename << "Dir:" << LOS::LuminaShare()+"i18n/"; + if( cTrans->load( filename, LOS::LuminaShare()+"i18n/" ) ){ + app->installTranslator( cTrans ); + }else{ + //Translator could not be loaded for some reason + cTrans = 0; + if(langCode!="en_US"){ + qWarning() << " - Could not load Locale:" << langCode; + } + } + }else{ + //Only going to set the encoding since no application given + qDebug() << "Loading System Encoding:" << langEnc; + } + //Load current encoding for this locale + QTextCodec::setCodecForLocale( QTextCodec::codecForName(langEnc.toUtf8()) ); + return cTrans; +} + +QStringList LUtils::knownLocales(){ + QDir i18n = QDir(LOS::LuminaShare()+"i18n"); + if( !i18n.exists() ){ return QStringList(); } + QStringList files = i18n.entryList(QStringList() << "lumina-desktop_*.qm", QDir::Files, QDir::Name); + if(files.isEmpty()){ return QStringList(); } + //Now strip off the filename and just leave the locale tag + for(int i=0; i<files.length(); i++){ + files[i].chop(3); //remove the ".qm" on the end + files[i] = files[i].section("_",1,50).simplified(); + } + files << "en_US"; //default locale + files.sort(); + return files; +} + +void LUtils::setLocaleEnv(QString lang, QString msg, QString time, QString num,QString money,QString collate, QString ctype){ + //Adjust the current locale environment variables + bool all = false; + if(msg.isEmpty() && time.isEmpty() && num.isEmpty() && money.isEmpty() && collate.isEmpty() && ctype.isEmpty() ){ + if(lang.isEmpty()){ return; } //nothing to do - no changes requested + all = true; //set everything to the "lang" value + } + //If no lang given, but others are given, then use the current setting + if(lang.isEmpty()){ lang = getenv("LC_ALL"); } + if(lang.isEmpty()){ lang = getenv("LANG"); } + if(lang.isEmpty()){ lang = "en_US"; } + //Now go through and set/unset the environment variables + // - LANG & LC_ALL + if(!lang.contains(".")){ lang.append(".UTF-8"); } + setenv("LANG",lang.toUtf8() ,1); //overwrite setting (this is always required as the fallback) + if(all){ setenv("LC_ALL",lang.toUtf8() ,1); } + else{ unsetenv("LC_ALL"); } //make sure the custom settings are used + // - LC_MESSAGES + if(msg.isEmpty()){ unsetenv("LC_MESSAGES"); } + else{ + if(!msg.contains(".")){ msg.append(".UTF-8"); } + setenv("LC_MESSAGES",msg.toUtf8(),1); + } + // - LC_TIME + if(time.isEmpty()){ unsetenv("LC_TIME"); } + else{ + if(!time.contains(".")){ time.append(".UTF-8"); } + setenv("LC_TIME",time.toUtf8(),1); + } + // - LC_NUMERIC + if(num.isEmpty()){ unsetenv("LC_NUMERIC"); } + else{ + if(!num.contains(".")){ num.append(".UTF-8"); } + setenv("LC_NUMERIC",num.toUtf8(),1); + } + // - LC_MONETARY + if(money.isEmpty()){ unsetenv("LC_MONETARY"); } + else{ + if(!money.contains(".")){ money.append(".UTF-8"); } + setenv("LC_MONETARY",money.toUtf8(),1); + } + // - LC_COLLATE + if(collate.isEmpty()){ unsetenv("LC_COLLATE"); } + else{ + if(!collate.contains(".")){ collate.append(".UTF-8"); } + setenv("LC_COLLATE",collate.toUtf8(),1); + } + // - LC_CTYPE + if(ctype.isEmpty()){ unsetenv("LC_CTYPE"); } + else{ + if(!ctype.contains(".")){ ctype.append(".UTF-8"); } + setenv("LC_CTYPE",ctype.toUtf8(),1); + } +} + +QString LUtils::currentLocale(){ + QString curr = getenv("LC_ALL");// = QLocale::system(); + if(curr.isEmpty()){ curr = getenv("LANG"); } + if(curr.isEmpty()){ curr = "en_US"; } + curr = curr.section(".",0,0); //remove any encodings off the end + return curr; +} + +double LUtils::DisplaySizeToBytes(QString num){ + //qDebug() << "Convert Num to Bytes:" << num; + num = num.toLower().simplified(); + num = num.remove(" "); + if(num.isEmpty()){ return 0.0; } + if(num.endsWith("b")){ num.chop(1); } //remove the "bytes" marker (if there is one) + QString lab = "b"; + if(!num[num.size()-1].isNumber()){ + lab = num.right(1); num.chop(1); + } + double N = num.toDouble(); + QStringList labs; labs <<"b"<<"k"<<"m"<<"g"<<"t"<<"p"; //go up to petabytes for now + for(int i=0; i<labs.length(); i++){ + if(lab==labs[i]){ break; }//already at the right units - break out + N = N*1024.0; //Move to the next unit of measurement + } + //qDebug() << " - Done:" << QString::number(N) << lab << num; + return N; +} + +QString LUtils::BytesToDisplaySize(qint64 ibytes){ + static QStringList labs = QStringList(); + if(labs.isEmpty()){ labs << "B" << "K" << "M" << "G" << "T" << "P"; } + //Now get the dominant unit + int c=0; + double bytes = ibytes; //need to keep decimel places for calculations + while(bytes>=1000 && c<labs.length() ){ + bytes = bytes/1024; + c++; + } //labs[c] is the unit + //Bytes are now + //Now format the number (up to 3 digits, not including decimel places) + QString num; + if(bytes>=100){ + //No decimel places + num = QString::number(qRound(bytes)); + }else if(bytes>=10){ + //need 1 decimel place + num = QString::number( (qRound(bytes*10)/10.0) ); + }else if(bytes>=1){ + //need 2 decimel places + num = QString::number( (qRound(bytes*100)/100.0) ); + }else{ + //Fully decimel (3 places) + num = "0."+QString::number(qRound(bytes*1000)); + } + //qDebug() << "Bytes to Human-readable:" << bytes << c << num << labs[c]; + return (num+labs[c]); +} + +QString LUtils::SecondsToDisplay(int secs){ + if(secs < 0){ return "??"; } + QString rem; //remaining + if(secs > 3600){ + int hours = secs/3600; + rem.append( QString::number(hours)+"h "); + secs = secs - (hours*3600); + } + if(secs > 60){ + int min = secs/60; + rem.append( QString::number(min)+"m "); + secs = secs - (min*60); + } + if(secs > 0){ + rem.append( QString::number(secs)+"s"); + }else{ + rem.append( "0s" ); + } + return rem; +} diff --git a/src-qt5/core/libLumina/LuminaUtils.h b/src-qt5/core/libLumina/LUtils.h index 4a0a19af..459fca60 100644 --- a/src-qt5/core/libLumina/LuminaUtils.h +++ b/src-qt5/core/libLumina/LUtils.h @@ -1,6 +1,6 @@ //=========================================== // Lumina-DE source code -// Copyright (c) 2012-2015, Ken Moore +// Copyright (c) 2012-2016, Ken Moore // Available under the 3-clause BSD license // See the LICENSE file for full details //=========================================== @@ -10,6 +10,7 @@ #include <QCoreApplication> #include <QProcess> #include <QTextStream> +#include <QTextCodec> #include <QFile> #include <QDir> #include <QString> @@ -18,17 +19,15 @@ #include <QFileInfo> #include <QObject> #include <QTranslator> -//#include <QApplication> -#include <QMenu> -#include <QMouseEvent> -#include <QSize> -#include <QWidgetAction> +#include <QDebug> +#include <QDesktopWidget> +#include <QImageReader> +#include <QRegExp> +#include <QFuture> +#include <QScreen> class LUtils{ public: - //Get the current version/build of the Lumina desktop - static QString LuminaDesktopVersion(); - static QString LuminaDesktopBuildDate(); //Run an external command and return the exit code static int runCmd(QString cmd, QStringList args = QStringList()); @@ -47,6 +46,9 @@ public: return isValidBinary(bins); //overload for a "junk" binary variable input } + //Return all the dirs on the system which contain .desktop files + static QStringList systemApplicationDirs(); + //Create the exec string to open a terminal in a particular directory static QString GenerateOpenTerminalExec(QString term, QString dirpath); @@ -72,60 +74,5 @@ public: static QString BytesToDisplaySize(qint64 bytes); //convert into a readable size (like 50M or 50KB) static QString SecondsToDisplay(int secs); //convert into a readable time - - //Various function for finding valid QtQuick plugins on the system - static bool validQuickPlugin(QString ID); - static QString findQuickPluginFile(QString ID); - static QStringList listQuickPlugins(); //List of valid ID's - static QStringList infoQuickPlugin(QString ID); //Returns: [Name, Description, Icon] - - //Various functions for the favorites sub-system - // Formatting Note: "<name>::::[dir/app/<mimetype>]::::<path>" - // the <name> field might not be used for "app" flagged entries - static QStringList listFavorites(); - static bool saveFavorites(QStringList); - static bool isFavorite(QString path); - static bool addFavorite(QString path, QString name = ""); - static void removeFavorite(QString path); - static void upgradeFavorites(int fromoldversionnumber); - - //Load the default setup for the system - static void LoadSystemDefaults(bool skipOS = false); - static bool checkUserFiles(QString lastversion); //returns true if something changed - static int VersionStringToNumber(QString version); //convert the lumina version string to a number for comparisons - }; - -//Special subclass for a menu which the user can grab the edges and resize as necessary -// Note: Make sure that you don't set 0pixel contents margins on this menu -// - it needs at least 1 pixel margins for the user to be able to grab it -/*class ResizeMenu : public QMenu{ - Q_OBJECT -public: - ResizeMenu(QWidget *parent = 0); - virtual ~ResizeMenu(); - - void setContents(QWidget *con); - -private: - enum SideFlag{NONE, TOP, BOTTOM, LEFT, RIGHT}; - SideFlag resizeSide; - QWidget *contents; - QWidgetAction *cAct; - -private slots: - void clearFlags(){ - resizeSide=NONE; - } - -protected: - virtual void mouseMoveEvent(QMouseEvent *ev); - virtual void mousePressEvent(QMouseEvent *ev); - virtual void mouseReleaseEvent(QMouseEvent *ev); - -signals: - void MenuResized(QSize); //Emitted when the menu is manually resized by the user - -};*/ - #endif diff --git a/src-qt5/core/libLumina/LUtils.pri b/src-qt5/core/libLumina/LUtils.pri new file mode 100644 index 00000000..d5941a41 --- /dev/null +++ b/src-qt5/core/libLumina/LUtils.pri @@ -0,0 +1,34 @@ +#since this is the most common of the include files - make sure it only gets added once +!contains( HEADERS, $${PWD}/LUtils.h ){ + +include("$${PWD}/../../OS-detect.pri") + +QT *= concurrent + +#Setup any special defines (qmake -> C++) +GIT_VERSION=$$system(git describe --always) +!isEmpty(GIT_VERSION){ + DEFINES += GIT_VERSION='"\\\"$${GIT_VERSION}\\\""' +} +#Note: Saving the build date will break reproducible builds (time stamp always different) +# Disable this by default, but leave it possible to re-enable this as needed by user +#DEFINES += BUILD_DATE='"\\\"$$system(date)\\\""' + +#LuminaOS files +HEADERS *= $${PWD}/LuminaOS.h +# LuminaOS support functions (or fall back to generic one) +exists($${PWD}/LuminaOS-$${LINUX_DISTRO}.cpp){ + SOURCES *= $${PWD}/LuminaOS-$${LINUX_DISTRO}.cpp +}else:exists($${PWD}/LuminaOS-$${OS}.cpp){ + SOURCES *= $${PWD}/LuminaOS-$${OS}.cpp +}else{ + SOURCES *= $${PWD}/LuminaOS-template.cpp +} + +#LUtils Files +SOURCES *= $${PWD}/LUtils.cpp +HEADERS *= $${PWD}/LUtils.h + +INCLUDEPATH *= ${PWD} + +} diff --git a/src-qt5/core/libLumina/LuminaOS.h b/src-qt5/core/libLumina/LuminaOS.h index 50d6baec..96a587a8 100644 --- a/src-qt5/core/libLumina/LuminaOS.h +++ b/src-qt5/core/libLumina/LuminaOS.h @@ -1,6 +1,6 @@ //=========================================== // Lumina-DE source code -// Copyright (c) 2014-15, Ken Moore +// Copyright (c) 2014-16, Ken Moore // Available under the 3-clause BSD license // See the LICENSE file for full details //=========================================== @@ -18,7 +18,7 @@ #include <QDir> #include <QObject> -#include "LuminaUtils.h" +#include "LUtils.h" class LOS{ public: diff --git a/src-qt5/core/libLumina/LuminaSingleApplication.h b/src-qt5/core/libLumina/LuminaSingleApplication.h index 725d8e40..bacf5640 100644 --- a/src-qt5/core/libLumina/LuminaSingleApplication.h +++ b/src-qt5/core/libLumina/LuminaSingleApplication.h @@ -25,7 +25,7 @@ #include <QLockFile> #include <QApplication> -#include <LuminaUtils.h> +#include <LUtils.h> //NOTE: This application type will automatically load the proper translation file(s) // if the application name is set properly diff --git a/src-qt5/core/libLumina/LuminaSingleApplication.pri b/src-qt5/core/libLumina/LuminaSingleApplication.pri new file mode 100644 index 00000000..88ab7726 --- /dev/null +++ b/src-qt5/core/libLumina/LuminaSingleApplication.pri @@ -0,0 +1,12 @@ +include("$${PWD}/../../OS-detect.pri") + +QT *= network x11extras + +#LUtils Files +SOURCES *= $${PWD}/LuminaSingleApplication.cpp +HEADERS *= $${PWD}/LuminaSingleApplication.h + +INCLUDEPATH *= ${PWD} + +#include LUtils and LuminaOS +include(LUtils.pri) diff --git a/src-qt5/core/libLumina/LuminaThemes.cpp b/src-qt5/core/libLumina/LuminaThemes.cpp index 03dfb771..70cd221d 100644 --- a/src-qt5/core/libLumina/LuminaThemes.cpp +++ b/src-qt5/core/libLumina/LuminaThemes.cpp @@ -6,7 +6,7 @@ //=========================================== #include "LuminaThemes.h" -#include "LuminaUtils.h" +#include "LUtils.h" #include "LuminaOS.h" #include <QIcon> #include <QFont> diff --git a/src-qt5/core/libLumina/LuminaThemes.pri b/src-qt5/core/libLumina/LuminaThemes.pri new file mode 100644 index 00000000..0fe35b79 --- /dev/null +++ b/src-qt5/core/libLumina/LuminaThemes.pri @@ -0,0 +1,10 @@ +include("$${PWD}/../../OS-detect.pri") + +#LUtils Files +SOURCES *= $${PWD}/LuminaThemes.cpp +HEADERS *= $${PWD}/LuminaThemes.h + +INCLUDEPATH *= ${PWD} + +#include LUtils and LuminaOS +include(LUtils.pri) diff --git a/src-qt5/core/libLumina/LuminaX11.pri b/src-qt5/core/libLumina/LuminaX11.pri new file mode 100644 index 00000000..0e472dd4 --- /dev/null +++ b/src-qt5/core/libLumina/LuminaX11.pri @@ -0,0 +1,13 @@ + +QT *= x11extras + +LIBS *= -lc -lxcb -lxcb-ewmh -lxcb-icccm -lxcb-image -lxcb-composite -lxcb-damage -lxcb-util -lXdamage + +#LUtils Files +SOURCES *= $${PWD}/LuminaX11.cpp +HEADERS *= $${PWD}/LuminaX11.h + +INCLUDEPATH *= ${PWD} + +#include LUtils and LuminaOS +include(LUtils.pri) diff --git a/src-qt5/core/libLumina/LuminaXDG.cpp b/src-qt5/core/libLumina/LuminaXDG.cpp index b0d2edd9..d6342269 100644 --- a/src-qt5/core/libLumina/LuminaXDG.cpp +++ b/src-qt5/core/libLumina/LuminaXDG.cpp @@ -6,7 +6,7 @@ //=========================================== #include "LuminaXDG.h" #include "LuminaOS.h" -#include "LuminaUtils.h" +#include "LUtils.h" #include <QObject> #include <QTimer> #include <QMediaPlayer> diff --git a/src-qt5/core/libLumina/LuminaXDG.pri b/src-qt5/core/libLumina/LuminaXDG.pri new file mode 100644 index 00000000..6f3a2b7c --- /dev/null +++ b/src-qt5/core/libLumina/LuminaXDG.pri @@ -0,0 +1,10 @@ +QT *= multimedia svg + +#LUtils Files +SOURCES *= $${PWD}/LuminaXDG.cpp +HEADERS *= $${PWD}/LuminaXDG.h + +INCLUDEPATH *= ${PWD} + +#include LUtils and LuminaOS +include(LUtils.pri) diff --git a/src-qt5/core/libLumina/libLumina.pro b/src-qt5/core/libLumina/libLumina.pro index 2786b875..a7dc160a 100644 --- a/src-qt5/core/libLumina/libLumina.pro +++ b/src-qt5/core/libLumina/libLumina.pro @@ -1,57 +1,57 @@ -include("$${PWD}/../../OS-detect.pri") +#include("$${PWD}/../../OS-detect.pri") -QT += core network widgets x11extras multimedia concurrent svg +#QT += core network widgets x11extras multimedia concurrent svg -define +#define #Setup any special defines (qmake -> C++) -GIT_VERSION=$$system(git describe --always) -!isEmpty(GIT_VERSION){ - DEFINES += GIT_VERSION='"\\\"$${GIT_VERSION}\\\""' -} -DEFINES += BUILD_DATE='"\\\"$$system(date)\\\""' +#GIT_VERSION=$$system(git describe --always) +#!isEmpty(GIT_VERSION){ +# DEFINES += GIT_VERSION='"\\\"$${GIT_VERSION}\\\""' +#} +#DEFINES += BUILD_DATE='"\\\"$$system(date)\\\""' -TARGET=LuminaUtils +#TARGET=LuminaUtils -target.path = $${L_LIBDIR} +#target.path = $${L_LIBDIR} -DESTDIR= $$_PRO_FILE_PWD_/ +#DESTDIR= $$_PRO_FILE_PWD_/ -TEMPLATE = lib -LANGUAGE = C++ -VERSION = 1 +#TEMPLATE = lib +#LANGUAGE = C++ +#VERSION = 1 -HEADERS += LuminaXDG.h \ - LuminaUtils.h \ - LuminaX11.h \ - LuminaThemes.h \ - LuminaOS.h \ - LuminaSingleApplication.h +#HEADERS += LuminaXDG.h \ +# LuminaUtils.h \ +# LuminaX11.h \ +# LuminaThemes.h \ +# LuminaOS.h \ +# LuminaSingleApplication.h -SOURCES += LuminaXDG.cpp \ - LuminaUtils.cpp \ - LuminaX11.cpp \ - LuminaThemes.cpp \ - LuminaSingleApplication.cpp +#SOURCES += LuminaXDG.cpp \ +# LuminaUtils.cpp \ +# LuminaX11.cpp \ +# LuminaThemes.cpp \ +# LuminaSingleApplication.cpp # Also load the OS template as available for # LuminaOS support functions (or fall back to generic one) -exists($${PWD}/LuminaOS-$${LINUX_DISTRO}.cpp){ - SOURCES += LuminaOS-$${LINUX_DISTRO}.cpp -}else:exists($${PWD}/LuminaOS-$${OS}.cpp){ - SOURCES += LuminaOS-$${OS}.cpp -}else{ - SOURCES += LuminaOS-template.cpp -} - -LIBS += -lc -lxcb -lxcb-ewmh -lxcb-icccm -lxcb-image -lxcb-composite -lxcb-damage -lxcb-util -lXdamage - -include.path=$${L_INCLUDEDIR} -include.files=LuminaXDG.h \ - LuminaUtils.h \ - LuminaX11.h \ - LuminaThemes.h \ - LuminaOS.h \ - LuminaSingleApplication.h +#exists($${PWD}/LuminaOS-$${LINUX_DISTRO}.cpp){ +# SOURCES += LuminaOS-$${LINUX_DISTRO}.cpp +#}else:exists($${PWD}/LuminaOS-$${OS}.cpp){ +# SOURCES += LuminaOS-$${OS}.cpp +#}else{ +# SOURCES += LuminaOS-template.cpp +#} + +#LIBS += -lc -lxcb -lxcb-ewmh -lxcb-icccm -lxcb-image -lxcb-composite -lxcb-damage -lxcb-util -lXdamage + +#include.path=$${L_INCLUDEDIR} +#include.files=LuminaXDG.h \ +# LuminaUtils.h \ +# LuminaX11.h \ +# LuminaThemes.h \ +# LuminaOS.h \ +# LuminaSingleApplication.h colors.path=$${L_SHAREDIR}/lumina-desktop/colors colors.files=colors/*.qss.colors @@ -65,4 +65,4 @@ themes.files=themes/*.qss.template globs.path=$${L_SHAREDIR}/lumina-desktop globs.files=xtrafiles/globs2 -INSTALLS += target include colors themes globs +INSTALLS += colors themes globs diff --git a/src-qt5/core/lumina-desktop/Globals.h b/src-qt5/core/lumina-desktop/Globals.h index 479fe4ad..14dfd93f 100644 --- a/src-qt5/core/lumina-desktop/Globals.h +++ b/src-qt5/core/lumina-desktop/Globals.h @@ -7,7 +7,8 @@ #ifndef _LUMINA_DESKTOP_GLOBALS_H #define _LUMINA_DESKTOP_GLOBALS_H -#include <LuminaUtils.h> +#include <LUtils.h> +#include <LDesktopUtils.h> //#include "../global.h" #include <unistd.h> diff --git a/src-qt5/core/lumina-desktop/JsonMenu.h b/src-qt5/core/lumina-desktop/JsonMenu.h index 87377a73..5a6b2237 100644 --- a/src-qt5/core/lumina-desktop/JsonMenu.h +++ b/src-qt5/core/lumina-desktop/JsonMenu.h @@ -16,7 +16,7 @@ #include <QJsonObject> #include <QJsonArray> -#include <LuminaUtils.h> +#include <LUtils.h> #include <LuminaXDG.h> #include "LSession.h" diff --git a/src-qt5/core/lumina-desktop/LSession.cpp b/src-qt5/core/lumina-desktop/LSession.cpp index 87f270ea..f383c163 100644 --- a/src-qt5/core/lumina-desktop/LSession.cpp +++ b/src-qt5/core/lumina-desktop/LSession.cpp @@ -15,7 +15,7 @@ //LibLumina X11 class #include <LuminaX11.h> -#include <LuminaUtils.h> +#include <LUtils.h> #include <unistd.h> //for usleep() usage @@ -29,7 +29,7 @@ LSession::LSession(int &argc, char ** argv) : LSingleApplication(argc, argv, "lu if(this->isPrimaryProcess()){ connect(this, SIGNAL(InputsAvailable(QStringList)), this, SLOT(NewCommunication(QStringList)) ); this->setApplicationName("Lumina Desktop Environment"); - this->setApplicationVersion( LUtils::LuminaDesktopVersion() ); + this->setApplicationVersion( LDesktopUtils::LuminaDesktopVersion() ); this->setOrganizationName("LuminaDesktopEnvironment"); this->setQuitOnLastWindowClosed(false); //since the LDesktop's are not necessarily "window"s //Enabled a few of the simple effects by default @@ -372,7 +372,7 @@ void LSession::checkUserFiles(){ //internal version conversion examples: // [1.0.0 -> 1000000], [1.2.3 -> 1002003], [0.6.1 -> 6001] QString OVS = sessionsettings->value("DesktopVersion","0").toString(); //Old Version String - bool changed = LUtils::checkUserFiles(OVS); + bool changed = LDesktopUtils::checkUserFiles(OVS); if(changed){ //Save the current version of the session to the settings file (for next time) sessionsettings->setValue("DesktopVersion", this->applicationVersion()); diff --git a/src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp b/src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp index 435a57c2..a2549acf 100644 --- a/src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp +++ b/src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp @@ -2,7 +2,7 @@ #include <LuminaXDG.h> #include "LSession.h" -#include <LuminaUtils.h> +#include <LUtils.h> #include <QDir> #include <QFileDialog> #include <QInputDialog> diff --git a/src-qt5/core/lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h b/src-qt5/core/lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h index 4ba74133..d6039ac0 100644 --- a/src-qt5/core/lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h +++ b/src-qt5/core/lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h @@ -13,7 +13,7 @@ #include <QVBoxLayout> #include "../LDPlugin.h" -#include <LuminaUtils.h> +#include <LUtils.h> class QuickDPlugin : public LDPlugin{ Q_OBJECT diff --git a/src-qt5/core/lumina-desktop/desktop-plugins/rssreader/RSSFeedPlugin.cpp b/src-qt5/core/lumina-desktop/desktop-plugins/rssreader/RSSFeedPlugin.cpp index 23c1ca01..8dc58e0a 100644 --- a/src-qt5/core/lumina-desktop/desktop-plugins/rssreader/RSSFeedPlugin.cpp +++ b/src-qt5/core/lumina-desktop/desktop-plugins/rssreader/RSSFeedPlugin.cpp @@ -9,7 +9,7 @@ #include <LuminaXDG.h> #include "LSession.h" -#include <LuminaUtils.h> +#include <LUtils.h> #include <QDir> #include <QFileDialog> #include <QInputDialog> diff --git a/src-qt5/core/lumina-desktop/lumina-desktop.pro b/src-qt5/core/lumina-desktop/lumina-desktop.pro index effa0508..4b725288 100644 --- a/src-qt5/core/lumina-desktop/lumina-desktop.pro +++ b/src-qt5/core/lumina-desktop/lumina-desktop.pro @@ -4,16 +4,23 @@ QT += core gui network greaterThan(QT_MAJOR_VERSION, 4): QT += widgets x11extras multimedia concurrent svg + TARGET = lumina-desktop target.path = $${L_BINDIR} +#include all the special classes from the Lumina tree +include(../libLumina/ResizeMenu.pri) +include(../libLumina/LDesktopUtils.pri) #includes LUtils and LOS +include(../libLumina/LuminaXDG.pri) +include(../libLumina/LuminaX11.pri) +include(../libLumina/LuminaSingleApplication.pri) +include(../libLumina/LuminaThemes.pri) -LIBS += -lLuminaUtils -lxcb -lxcb-damage -DEPENDPATH += ../libLumina +#LIBS += -lLuminaUtils -lxcb -lxcb-damage +#DEPENDPATH += ../libLumina TEMPLATE = app - SOURCES += main.cpp \ WMProcess.cpp \ LXcbEventFilter.cpp \ @@ -53,8 +60,6 @@ HEADERS += Globals.h \ FORMS += SystemWindow.ui \ BootSplash.ui -#include all the special classes from the Lumina tree -include(../libLumina/ResizeMenu.pri) #Now include all the files for the various plugins include(panel-plugins/panel-plugins.pri) diff --git a/src-qt5/core/lumina-desktop/main.cpp b/src-qt5/core/lumina-desktop/main.cpp index 35561073..b42a3816 100644 --- a/src-qt5/core/lumina-desktop/main.cpp +++ b/src-qt5/core/lumina-desktop/main.cpp @@ -22,7 +22,8 @@ #include <LuminaXDG.h> //from libLuminaUtils #include <LuminaThemes.h> #include <LuminaOS.h> -#include <LuminaUtils.h> +#include <LUtils.h> +#include <LDesktopUtils.h> #define DEBUG 0 @@ -58,7 +59,7 @@ int main(int argc, char ** argv) { if (argc > 1) { if (QString(argv[1]) == QString("--version")){ - qDebug() << LUtils::LuminaDesktopVersion(); + qDebug() << LDesktopUtils::LuminaDesktopVersion(); return 0; } } diff --git a/src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.h b/src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.h index 3d31faad..29562d5d 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.h +++ b/src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.h @@ -12,7 +12,7 @@ #include <QString> #include <QLabel> -#include <LuminaUtils.h> +#include <LUtils.h> #include <LuminaXDG.h> #include <LuminaOS.h> diff --git a/src-qt5/core/lumina-desktop/panel-plugins/battery/NOTES b/src-qt5/core/lumina-desktop/panel-plugins/battery/NOTES index 3ea07778..3d93267e 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/battery/NOTES +++ b/src-qt5/core/lumina-desktop/panel-plugins/battery/NOTES @@ -22,7 +22,7 @@ apm -l apm -t Zeigt die verbleibende Zeit in Sekunden -Aufruf Systemfunktionen: LuminaUtils.h +Aufruf Systemfunktionen: LUtils.h mit der Methode: QStringList LUtils::getCmdOutput(QString cmd, QStringList args) diff --git a/src-qt5/core/lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp b/src-qt5/core/lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp index 9903d4fd..90d942de 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp @@ -102,7 +102,7 @@ void LDeskBarPlugin::filechanged(QString file){ } void LDeskBarPlugin::updateFiles(){ QFileInfoList homefiles = LSession::handle()->DesktopFiles(); - QStringList favitems = LUtils::listFavorites(); + QStringList favitems = LDesktopUtils::listFavorites(); //Remember for format for favorites: <name>::::[app/dir/<mimetype>]::::<full path> for(int i=0; i<homefiles.length(); i++){ if( !favitems.filter(homefiles[i].canonicalFilePath()).isEmpty() ){ continue; } //duplicate entry diff --git a/src-qt5/core/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.h b/src-qt5/core/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.h index 851d9e35..af9250b7 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.h +++ b/src-qt5/core/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.h @@ -14,7 +14,7 @@ #include <QMenu> #include <QToolButton> -#include <LuminaUtils.h> +#include <LUtils.h> #include <LuminaXDG.h> #include <LuminaX11.h> diff --git a/src-qt5/core/lumina-desktop/panel-plugins/quickcontainer/QuickPPlugin.h b/src-qt5/core/lumina-desktop/panel-plugins/quickcontainer/QuickPPlugin.h index e160c2b3..6f61c4d5 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/quickcontainer/QuickPPlugin.h +++ b/src-qt5/core/lumina-desktop/panel-plugins/quickcontainer/QuickPPlugin.h @@ -13,7 +13,7 @@ #include <QVBoxLayout> #include "../LPPlugin.h" -#include <LuminaUtils.h> +#include <LUtils.h> #include <QDebug> class QuickPPlugin : public LPPlugin{ diff --git a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/ItemWidget.cpp b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/ItemWidget.cpp index 15b9c72c..ea074a59 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/ItemWidget.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/ItemWidget.cpp @@ -5,7 +5,7 @@ // See the LICENSE file for full details //=========================================== #include "ItemWidget.h" -#include <LuminaUtils.h> +#include <LUtils.h> #include <QMenu> #include "../../LSession.h" @@ -73,7 +73,7 @@ ItemWidget::ItemWidget(QWidget *parent, QString itemPath, QString type, bool gob icon->setWhatsThis(itemPath); if(!goback){ this->setWhatsThis(name->text()); } isDirectory = (type=="dir"); //save this for later - if(LUtils::isFavorite(itemPath)){ + if(LDesktopUtils::isFavorite(itemPath)){ linkPath = itemPath; isShortcut=true; }else if( inHome ){//|| itemPath.section("/",0,-2)==QDir::homePath()+"/Desktop" ){ @@ -93,7 +93,7 @@ ItemWidget::ItemWidget(QWidget *parent, XDGDesktop *item) : QFrame(parent){ createWidget(); if(item==0){ gooditem = false; return; } isDirectory = false; - if(LUtils::isFavorite(item->filePath)){ + if(LDesktopUtils::isFavorite(item->filePath)){ linkPath = item->filePath; isShortcut=true; }else if( item->filePath.section("/",0,-2)==QDir::homePath()+"/Desktop" ){ @@ -177,7 +177,7 @@ void ItemWidget::setupContextMenu(){ contextMenu->addAction( LXDG::findIcon("preferences-desktop-icons",""), tr("Pin to Desktop"), this, SLOT(PinToDesktop()) ); } //Favorite Item - if( LUtils::isFavorite(icon->whatsThis()) ){ //Favorite Item - can always remove this + if( LDesktopUtils::isFavorite(icon->whatsThis()) ){ //Favorite Item - can always remove this contextMenu->addAction( LXDG::findIcon("edit-delete",""), tr("Remove from Favorites"), this, SLOT(RemoveFavorite()) ); }else{ //This file does not have a shortcut yet -- allow the user to add it @@ -242,13 +242,13 @@ void ItemWidget::PinToDesktop(){ } void ItemWidget::RemoveFavorite(){ - LUtils::removeFavorite(icon->whatsThis()); + LDesktopUtils::removeFavorite(icon->whatsThis()); linkPath.clear(); emit RemovedShortcut(); } void ItemWidget::AddFavorite(){ - if( LUtils::addFavorite(icon->whatsThis()) ){ + if( LDesktopUtils::addFavorite(icon->whatsThis()) ){ linkPath = icon->whatsThis(); emit NewShortcut(); } diff --git a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp index 0a396464..f44add77 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp @@ -8,7 +8,7 @@ #include "../../LSession.h" #include <LuminaXDG.h> -#include <LuminaUtils.h> //This contains the "ResizeMenu" class +#include <LUtils.h> //This contains the "ResizeMenu" class LStartButtonPlugin::LStartButtonPlugin(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){ button = new QToolButton(this); diff --git a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.h b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.h index 22742bc5..d46bb1be 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.h +++ b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.h @@ -24,7 +24,7 @@ // libLumina includes #include <LuminaXDG.h> -#include <LuminaUtils.h> +#include <LUtils.h> #include <ResizeMenu.h> #include "StartMenu.h" diff --git a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp index bfac46c0..260215ec 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp @@ -411,7 +411,7 @@ void StartMenu::UpdateApps(){ void StartMenu::UpdateFavs(){ //SYNTAX NOTE: (per-line) "<name>::::[dir/app/<mimetype>]::::<path>" - QStringList newfavs = LUtils::listFavorites(); + QStringList newfavs = LDesktopUtils::listFavorites(); if(favs == newfavs){ return; } //nothing to do - same as before favs = newfavs; ClearScrollArea(ui->scroll_favs); diff --git a/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp b/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp index a1dfe956..8d7dab7a 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp @@ -5,7 +5,8 @@ // See the LICENSE file for full details //=========================================== #include "UserItemWidget.h" -#include <LuminaUtils.h> +#include <LUtils.h> +#include <LDesktopUtils.h> #include <QMenu> #define TEXTCUTOFF 165 @@ -50,7 +51,7 @@ UserItemWidget::UserItemWidget(QWidget *parent, QString itemPath, QString type, icon->setWhatsThis(itemPath); if(!goback){ this->setWhatsThis(name->text()); } isDirectory = (type=="dir"); //save this for later - if(LUtils::isFavorite(itemPath)){ + if(LDesktopUtils::isFavorite(itemPath)){ linkPath = itemPath; isShortcut=true; }else if( inHome ){//|| itemPath.section("/",0,-2)==QDir::homePath()+"/Desktop" ){ @@ -66,7 +67,7 @@ UserItemWidget::UserItemWidget(QWidget *parent, XDGDesktop *item) : QFrame(paren if(item==0){ return; } createWidget(); isDirectory = false; - if(LUtils::isFavorite(item->filePath)){ + if(LDesktopUtils::isFavorite(item->filePath)){ linkPath = item->filePath; isShortcut=true; }else if( item->filePath.section("/",0,-2)==QDir::homePath()+"/Desktop" ){ @@ -171,7 +172,7 @@ void UserItemWidget::setupActions(XDGDesktop *app){ void UserItemWidget::buttonClicked(){ button->setVisible(false); if(button->whatsThis()=="add"){ - LUtils::addFavorite(icon->whatsThis()); + LDesktopUtils::addFavorite(icon->whatsThis()); //QFile::link(icon->whatsThis(), QDir::homePath()+"/.lumina/favorites/"+icon->whatsThis().section("/",-1) ); emit NewShortcut(); }else if(button->whatsThis()=="remove"){ @@ -184,7 +185,7 @@ void UserItemWidget::buttonClicked(){ } //Don't emit the RemovedShortcut signal here - the automatic ~/Desktop watcher will see the change when finished }else{ - LUtils::removeFavorite(icon->whatsThis()); //This is a favorite + LDesktopUtils::removeFavorite(icon->whatsThis()); //This is a favorite emit RemovedShortcut(); } } diff --git a/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp b/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp index fb58c7f6..a0ba8996 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp @@ -221,7 +221,7 @@ void UserWidget::updateFavItems(bool newfilter){ if(updatingfavs){ return; } updatingfavs = true; //qDebug() << "Updating User Favorite Items"; - QStringList newfavs = LUtils::listFavorites(); + QStringList newfavs = LDesktopUtils::listFavorites(); //qDebug() << "Favorites:" << newfavs; if(lastHomeUpdate.isNull() || (QFileInfo(QDir::homePath()+"/Desktop").lastModified() > lastHomeUpdate) || newfavs!=favs ){ favs = newfavs; diff --git a/src-qt5/core/lumina-info/MainUI.cpp b/src-qt5/core/lumina-info/MainUI.cpp index 98a4c160..7e6a3630 100644 --- a/src-qt5/core/lumina-info/MainUI.cpp +++ b/src-qt5/core/lumina-info/MainUI.cpp @@ -8,7 +8,8 @@ #include "ui_MainUI.h" #include <LuminaOS.h> -#include <LuminaUtils.h> +#include <LDesktopUtils.h> +#include <LUtils.h> #include <LuminaXDG.h> #include <QPixmap> @@ -38,7 +39,7 @@ void MainUI::updateUI(){ ui->tool_website->setIcon( LXDG::findIcon("go-home","")); connect(ui->push_close, SIGNAL(clicked()), this, SLOT(close()) ); //General Tab - ui->label_version->setText( LUtils::LuminaDesktopVersion() ); + ui->label_version->setText( LDesktopUtils::LuminaDesktopVersion() ); ui->label_OS->setText( LOS::OSName() ); connect(ui->tool_aboutQt, SIGNAL(clicked()), this, SLOT(showQtInfo()) ); //License Tab diff --git a/src-qt5/core/lumina-info/lumina-info.pro b/src-qt5/core/lumina-info/lumina-info.pro index 9ced275b..3ba1f527 100644 --- a/src-qt5/core/lumina-info/lumina-info.pro +++ b/src-qt5/core/lumina-info/lumina-info.pro @@ -8,6 +8,12 @@ target.path = $${L_BINDIR} TEMPLATE = app +#include all the special classes from the Lumina tree +include(../libLumina/LDesktopUtils.pri) #includes LUtils +include(../libLumina/LuminaXDG.pri) +include(../libLumina/LuminaSingleApplication.pri) +include(../libLumina/LuminaThemes.pri) + SOURCES += main.cpp \ MainUI.cpp @@ -17,9 +23,9 @@ FORMS += MainUI.ui RESOURCES+= lumina-info.qrc -LIBS += -lLuminaUtils +#LIBS += -lLuminaUtils -DEPENDPATH += ../libLumina +#DEPENDPATH += ../libLumina TRANSLATIONS = i18n/lumina-info_af.ts \ i18n/lumina-info_ar.ts \ diff --git a/src-qt5/core/lumina-info/main.cpp b/src-qt5/core/lumina-info/main.cpp index 8fe6a183..e30911c5 100644 --- a/src-qt5/core/lumina-info/main.cpp +++ b/src-qt5/core/lumina-info/main.cpp @@ -6,7 +6,7 @@ #include "MainUI.h" #include <LuminaOS.h> #include <LuminaThemes.h> -#include <LuminaUtils.h> +#include <LUtils.h> #include <LuminaSingleApplication.h> int main(int argc, char ** argv) diff --git a/src-qt5/core/lumina-open/LFileDialog.h b/src-qt5/core/lumina-open/LFileDialog.h index 95e117fa..b81cde05 100644 --- a/src-qt5/core/lumina-open/LFileDialog.h +++ b/src-qt5/core/lumina-open/LFileDialog.h @@ -22,7 +22,7 @@ #include <QAction> #include <LuminaXDG.h> //From libLuminaUtils -#include <LuminaUtils.h> +#include <LUtils.h> namespace Ui{ class LFileDialog; diff --git a/src-qt5/core/lumina-open/lumina-open.pro b/src-qt5/core/lumina-open/lumina-open.pro index 3240b2d3..96d879bd 100644 --- a/src-qt5/core/lumina-open/lumina-open.pro +++ b/src-qt5/core/lumina-open/lumina-open.pro @@ -9,6 +9,9 @@ target.path = $${L_BINDIR} TEMPLATE = app +include(../libLumina/LuminaXDG.pri) +include(../libLumina/LuminaThemes.pri) + SOURCES += main.cpp \ LFileDialog.cpp @@ -18,10 +21,6 @@ FORMS += LFileDialog.ui RESOURCES+= lumina-open.qrc -LIBS += -lLuminaUtils - -DEPENDPATH += ../libLumina - TRANSLATIONS = i18n/lumina-open_af.ts \ i18n/lumina-open_ar.ts \ diff --git a/src-qt5/core/lumina-open/main.cpp b/src-qt5/core/lumina-open/main.cpp index b411394c..279f7c1b 100644 --- a/src-qt5/core/lumina-open/main.cpp +++ b/src-qt5/core/lumina-open/main.cpp @@ -25,7 +25,7 @@ #include "LFileDialog.h" #include <LuminaXDG.h> -#include <LuminaUtils.h> +#include <LUtils.h> #include <LuminaOS.h> #include <LuminaThemes.h> diff --git a/src-qt5/core/lumina-session/lumina-session.pro b/src-qt5/core/lumina-session/lumina-session.pro index 91a5f891..dc697a34 100644 --- a/src-qt5/core/lumina-session/lumina-session.pro +++ b/src-qt5/core/lumina-session/lumina-session.pro @@ -6,9 +6,9 @@ QT = core widgets TARGET = start-lumina-desktop target.path = $${L_BINDIR} - -LIBS += -lLuminaUtils -DEPENDPATH += ../libLumina +include(../libLumina/LDesktopUtils.pri) +include(../libLumina/LuminaXDG.pri) +include(../libLumina/LuminaThemes.pri) SOURCES += main.cpp \ session.cpp diff --git a/src-qt5/core/lumina-session/main.cpp b/src-qt5/core/lumina-session/main.cpp index 77e553d4..73af45f9 100644 --- a/src-qt5/core/lumina-session/main.cpp +++ b/src-qt5/core/lumina-session/main.cpp @@ -10,7 +10,8 @@ #include <QString> #include "session.h" -#include <LuminaUtils.h> +#include <LUtils.h> +#include <LDesktopUtils.h> #include <LuminaOS.h> #include <LuminaThemes.h> #include <LuminaXDG.h> @@ -21,7 +22,7 @@ int main(int argc, char ** argv) { if (argc > 1) { if (QString(argv[1]) == QString("--version")){ - qDebug() << LUtils::LuminaDesktopVersion(); + qDebug() << LDesktopUtils::LuminaDesktopVersion(); return 0; } } diff --git a/src-qt5/core/lumina-session/session.cpp b/src-qt5/core/lumina-session/session.cpp index c689c9a3..10953f12 100644 --- a/src-qt5/core/lumina-session/session.cpp +++ b/src-qt5/core/lumina-session/session.cpp @@ -13,7 +13,7 @@ #include <QSettings> #include <QDir> -#include <LuminaUtils.h> +#include <LUtils.h> #include <LuminaOS.h> void LSession::stopall(){ diff --git a/src-qt5/core/menu-scripts/ls.json.sh b/src-qt5/core/menu-scripts/ls.json.sh index 43b0ead6..754a10d4 100755 --- a/src-qt5/core/menu-scripts/ls.json.sh +++ b/src-qt5/core/menu-scripts/ls.json.sh @@ -1,6 +1,6 @@ #!/bin/sh DIR=${1} -if [ "$1" == "" ] ; then +if [ "$1" = "" ] ; then DIR=`pwd` fi diff --git a/src-qt5/core/libLumina/quickplugins/quick-sample.qml b/src-qt5/core/quickplugins/quick-sample.qml index 18b10d77..18b10d77 100644 --- a/src-qt5/core/libLumina/quickplugins/quick-sample.qml +++ b/src-qt5/core/quickplugins/quick-sample.qml diff --git a/src-qt5/core/libLumina/themes/Glass.qss.template b/src-qt5/core/themes/Glass.qss.template index d594d25e..d594d25e 100644 --- a/src-qt5/core/libLumina/themes/Glass.qss.template +++ b/src-qt5/core/themes/Glass.qss.template diff --git a/src-qt5/core/libLumina/themes/Lumina-default.qss.template b/src-qt5/core/themes/Lumina-default.qss.template index 9f03d4ae..9f03d4ae 100644 --- a/src-qt5/core/libLumina/themes/Lumina-default.qss.template +++ b/src-qt5/core/themes/Lumina-default.qss.template diff --git a/src-qt5/core/libLumina/themes/None.qss.template b/src-qt5/core/themes/None.qss.template index 7d923b1e..7d923b1e 100644 --- a/src-qt5/core/libLumina/themes/None.qss.template +++ b/src-qt5/core/themes/None.qss.template diff --git a/src-qt5/core/libLumina/xtrafiles/globs2 b/src-qt5/core/xtrafiles/globs2 index 0a783316..0a783316 100644 --- a/src-qt5/core/libLumina/xtrafiles/globs2 +++ b/src-qt5/core/xtrafiles/globs2 |