diff options
author | Weblate <noreply@weblate.org> | 2017-09-20 13:42:32 +0000 |
---|---|---|
committer | Weblate <noreply@weblate.org> | 2017-09-20 13:42:32 +0000 |
commit | a4fd58c9aae62207b131a13cc13187970495bdb5 (patch) | |
tree | cdabc3a0816c41f6f2a6f5191f3e38f698595c13 /src-qt5/core/libLumina/LUtils.cpp | |
parent | Translated using Weblate (Lithuanian) (diff) | |
parent | Streamline a bit more of the new Lumina2 window embed functionality. (diff) | |
download | lumina-a4fd58c9aae62207b131a13cc13187970495bdb5.tar.gz lumina-a4fd58c9aae62207b131a13cc13187970495bdb5.tar.bz2 lumina-a4fd58c9aae62207b131a13cc13187970495bdb5.zip |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src-qt5/core/libLumina/LUtils.cpp')
-rw-r--r-- | src-qt5/core/libLumina/LUtils.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src-qt5/core/libLumina/LUtils.cpp b/src-qt5/core/libLumina/LUtils.cpp index fa0173dc..491778ca 100644 --- a/src-qt5/core/libLumina/LUtils.cpp +++ b/src-qt5/core/libLumina/LUtils.cpp @@ -26,7 +26,7 @@ inline QStringList ProcessRun(QString cmd, QStringList args){ if(args.isEmpty()){ proc.start(cmd, QIODevice::ReadOnly); }else{ - proc.start(cmd,args ,QIODevice::ReadOnly); + proc.start(cmd,args ,QIODevice::ReadOnly); } QString info; while(!proc.waitForFinished(1000)){ @@ -37,7 +37,7 @@ inline QStringList ProcessRun(QString cmd, QStringList args){ } out[0] = QString::number(proc.exitCode()); out[1] = info+QString(proc.readAllStandardOutput()); - return out; + return out; } //============= // LUtils Functions @@ -59,7 +59,6 @@ int LUtils::runCmd(QString cmd, QStringList args){ 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){ @@ -72,7 +71,7 @@ QStringList LUtils::getCmdOutput(QString cmd, QStringList args){ if(args.isEmpty()){ proc.start(cmd); }else{ - proc.start(cmd,args); + proc.start(cmd,args); } //if(!proc.waitForStarted(30000)){ return QStringList(); } //process never started - max wait of 30 seconds while(!proc.waitForFinished(300)){ @@ -118,7 +117,7 @@ bool LUtils::isValidBinary(QString& bin){ //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;} + if(QFile::exists(paths[i]+"/"+bin)){ bin = paths[i]+"/"+bin; break;} } } //bin should be the full path by now @@ -150,7 +149,7 @@ QSettings* LUtils::openSettings(QString org, QString name, QObject *parent){ }else{ return (new QSettings(filepath, QSettings::IniFormat, parent)); } - + } QStringList LUtils::systemApplicationDirs(){ @@ -164,7 +163,7 @@ QStringList LUtils::systemApplicationDirs(){ 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 + //Also check any subdirs within this directory // (looking at you KDE - stick to the standards!!) out << LUtils::listSubDirectories(appDirs[i]+"/applications"); } @@ -197,7 +196,7 @@ QString LUtils::GenerateOpenTerminalExec(QString term, QString 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. + //-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")); @@ -253,12 +252,18 @@ QString LUtils::AppToAbsolute(QString path){ return path; } +QStringList LUtils::videoExtensions() { + static QStringList vidExtensions; + vidExtensions << "avi" << "mkv" << "mp4" << "mov" << "webm" << "wmv"; + return vidExtensions; +} + 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++){ + for(int i=0; i<fmt.length(); i++){ if(wildcards){ imgExtensions << "*."+QString::fromLocal8Bit(fmt[i]); } else{ imgExtensions << QString::fromLocal8Bit(fmt[i]); } } @@ -308,7 +313,7 @@ QStringList LUtils::imageExtensions(bool wildcards){ qDebug() << "Loading System Encoding:" << langEnc; } //Load current encoding for this locale - QTextCodec::setCodecForLocale( QTextCodec::codecForName(langEnc.toUtf8()) ); + QTextCodec::setCodecForLocale( QTextCodec::codecForName(langEnc.toUtf8()) ); return cTrans; } @@ -379,7 +384,7 @@ void LUtils::setLocaleEnv(QString lang, QString msg, QString time, QString num,Q else{ if(!ctype.contains(".")){ ctype.append(".UTF-8"); } setenv("LC_CTYPE",ctype.toUtf8(),1); - } + } } QString LUtils::currentLocale(){ |