diff options
author | q5sys <jt@obs-sec.com> | 2017-06-04 19:52:57 -0400 |
---|---|---|
committer | q5sys <jt@obs-sec.com> | 2017-06-04 19:52:57 -0400 |
commit | edabbff4b43a1ba40a07f03756f2caa1e65233f4 (patch) | |
tree | c5fe95defc1175df6a84b8002567a5b0d8c4f954 /src-qt5/desktop-utils/lumina-archiver/MainUI.cpp | |
parent | Make sure that the no-pianobar setup section stops when it is finished - don'... (diff) | |
download | lumina-edabbff4b43a1ba40a07f03756f2caa1e65233f4.tar.gz lumina-edabbff4b43a1ba40a07f03756f2caa1e65233f4.tar.bz2 lumina-edabbff4b43a1ba40a07f03756f2caa1e65233f4.zip |
more work on autoextract functionality
Diffstat (limited to 'src-qt5/desktop-utils/lumina-archiver/MainUI.cpp')
-rw-r--r-- | src-qt5/desktop-utils/lumina-archiver/MainUI.cpp | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp b/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp index ab2b4651..e365ef54 100644 --- a/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp @@ -16,6 +16,8 @@ #include <unistd.h> +#include <QDebug> + MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ ui->setupUi(this); QString title = tr("Archive Manager"); @@ -68,17 +70,35 @@ MainUI::~MainUI(){ void MainUI::LoadArguments(QStringList args){ bool burnIMG = false; + bool autoExtract = false; for(int i=0; i<args.length(); i++){ if(args[i]=="--burn-img"){ burnIMG = true; continue; } -/* - if(args[i]=="--ax"){i++; QString archivefile = args[i]; + if(args[i]=="--ax"){ autoExtract = true; i++; QFileInfo filename(args[i]); QDir filedir = filename.canonicalPath(); QString newdir = filename.completeBaseName(); filedir.mkpath(newdir); - BACKEND->startExtract(newdir, true, archivefile); - qApp->exit();} -*/ + dir = newdir; + qDebug() << "MAINUI - archivefile = " << args[i]; + qDebug() << "MAINUI - filedir = " << filedir; + qDebug() << "MAINUI - newdir = " << newdir; + qDebug() << "MAINUI - dir = " << dir; + BACKEND->loadFile(args[i]); + qDebug () << "MAINUI - File should have loaded"; + //add in a delay in case i'm hitting a race condition + QTime waitTime= QTime::currentTime().addSecs(2); + while (QTime::currentTime() < waitTime) + QCoreApplication::processEvents(QEventLoop::AllEvents, 100); + //things should have settled, now trigger extraction + if(autoExtract){ + ui->label_progress->setText(tr("Extracting...")); + autoextractFiles(); + qDebug () << "MAINUI - Extraction should have started"; + } + //now quit + QCoreApplication::quit(); + return; + } if(QFile::exists(args[i])){ ui->label_progress->setText(tr("Opening Archive...")); BACKEND->loadFile(args[i]); @@ -245,6 +265,19 @@ void MainUI::extractFiles(){ BACKEND->startExtract(dir, true); } +void MainUI::autoextractFiles(){ +// QString dir = QFileDialog::getExistingDirectory(this, tr("Extract Into Directory"), QDir::homePath() ); +// if(dir.isEmpty()){ return; } + //add in a delay in case i'm hitting a race condition + qDebug() << "void MainUI::autoextractFiles() has started"; + QTime waitTime= QTime::currentTime().addSecs(2); + while (QTime::currentTime() < waitTime) + QCoreApplication::processEvents(QEventLoop::AllEvents, 100); + ui->label_progress->setText(tr("Extracting...")); + BACKEND->startExtract(dir, true); +// QApplication::quit(); + } + void MainUI::extractSelection(){ if(ui->tree_contents->currentItem()==0){ return; } //nothing selected QList<QTreeWidgetItem*> sel = ui->tree_contents->selectedItems(); |