aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libLumina/LuminaUtils.cpp48
-rw-r--r--libLumina/libLumina.pro2
-rw-r--r--lumina-fileinfo/MainUI.cpp2
-rw-r--r--lumina-fileinfo/MainUI.ui5
4 files changed, 42 insertions, 15 deletions
diff --git a/libLumina/LuminaUtils.cpp b/libLumina/LuminaUtils.cpp
index 7b13adb9..4bcc548a 100644
--- a/libLumina/LuminaUtils.cpp
+++ b/libLumina/LuminaUtils.cpp
@@ -15,39 +15,65 @@
#include <QDesktopWidget>
#include <QImageReader>
#include <QRegExp>
+#include <QFuture>
+#include <QtConcurrent>
#include <LuminaOS.h>
#include <LuminaThemes.h>
#include <LuminaXDG.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);
+ }else{
+ proc.start(cmd,args);
+ }
+ while(!proc.waitForFinished(500)){
+ if(proc.state() == QProcess::NotRunning){ break; } //somehow missed the finished signal
+ }
+ out[0] = QString::number(proc.exitCode());
+ out[1] = QString(proc.readAllStandardOutput());
+ return out;
+}
//=============
// LUtils Functions
//=============
QString LUtils::LuminaDesktopVersion(){
- return "0.8.7-Release";
+ return "0.8.8-devel";
}
int LUtils::runCmd(QString cmd, QStringList args){
- QProcess proc;
+ /*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
+ //if(!proc.waitForStarted(30000)){ return 1; } //process never started - max wait of 30 seconds
while(!proc.waitForFinished(300)){
- if(proc.state() != QProcess::Running){ break; } //somehow missed the finished signal
+ if(proc.state() == QProcess::NotRunning){ break; } //somehow missed the finished signal
QCoreApplication::processEvents();
}
int ret = proc.exitCode();
- return ret;
+ 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;
+ /*QProcess proc;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("LANG", "C");
env.insert("LC_MESSAGES", "C");
@@ -58,13 +84,15 @@ QStringList LUtils::getCmdOutput(QString cmd, QStringList args){
}else{
proc.start(cmd,args);
}
- if(!proc.waitForStarted(30000)){ return QStringList(); } //process never started - max wait of 30 seconds
- while(!proc.waitForFinished(500)){
- if(proc.state() != QProcess::Running){ break; } //somehow missed the finished signal
+ //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;
+ 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){
diff --git a/libLumina/libLumina.pro b/libLumina/libLumina.pro
index 6fe81676..0a29325e 100644
--- a/libLumina/libLumina.pro
+++ b/libLumina/libLumina.pro
@@ -1,6 +1,6 @@
QT += core network
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets x11extras multimedia
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets x11extras multimedia concurrent
TARGET=LuminaUtils
diff --git a/lumina-fileinfo/MainUI.cpp b/lumina-fileinfo/MainUI.cpp
index 481574e0..a2c30ebd 100644
--- a/lumina-fileinfo/MainUI.cpp
+++ b/lumina-fileinfo/MainUI.cpp
@@ -116,6 +116,8 @@ void MainUI::LoadFile(QString path, QString type){
//Setup the tab
if(type.isEmpty()){ ui->tabWidget->setCurrentIndex(0); }
else if(ui->tabWidget->count()>1){ ui->tabWidget->setCurrentIndex(1); }
+ //Hide the tab bar (the autoHideTabBar setting was not added until Qt 5.4)
+ if(ui->tabWidget->count() < 2){ ui->tabWidget->tabBar()->hide(); }
}
void MainUI::UpdateIcons(){
diff --git a/lumina-fileinfo/MainUI.ui b/lumina-fileinfo/MainUI.ui
index def8bf70..cf74a6e1 100644
--- a/lumina-fileinfo/MainUI.ui
+++ b/lumina-fileinfo/MainUI.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>349</width>
- <height>327</height>
+ <height>354</height>
</rect>
</property>
<property name="windowTitle">
@@ -19,9 +19,6 @@
<property name="currentIndex">
<number>0</number>
</property>
- <property name="tabBarAutoHide">
- <bool>true</bool>
- </property>
<widget class="QWidget" name="tab_file">
<attribute name="title">
<string>File Information</string>
bgstack15