From d731985427420c462d845b4279b14238e5527cae Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 4 Oct 2017 09:51:31 -0400 Subject: Finish up the auto archive/extract within lumina-archiver (with JT) --- src-qt5/desktop-utils/lumina-archiver/MainUI.cpp | 75 +++++++++++++++--------- 1 file changed, 47 insertions(+), 28 deletions(-) (limited to 'src-qt5/desktop-utils/lumina-archiver/MainUI.cpp') diff --git a/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp b/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp index 9d220824..215fc64e 100644 --- a/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp @@ -20,7 +20,11 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ ui->setupUi(this); - auto_extract_close = false; + delayClose = new QTimer(this); + delayClose->setInterval(500); + delayClose->setSingleShot(true); + connect(delayClose, SIGNAL(timeout()), this, SLOT(close()) ); + QString title = tr("Archive Manager"); if( getuid()==0){ title.append(" ("+tr("Admin Mode")+")"); } this->setWindowTitle(title); @@ -70,33 +74,34 @@ MainUI::~MainUI(){ } void MainUI::LoadArguments(QStringList args){ - bool burnIMG = false; - bool autoExtract = false; - //bool autoArchive = false; + int action = -1; // 0: burnIMG, 1: autoExtract, 2: autoArchive + QStringList files; for(int i=0; ilabel_progress->setText(tr("Opening Archive...")); - if(autoExtract){ - connect(BACKEND, SIGNAL(FileLoaded()), this, SLOT(autoextractFiles()) ); - connect(BACKEND, SIGNAL(ExtractSuccessful()), this, SLOT(close()) ); - } - BACKEND->loadFile(args[i]); - ui->actionUSB_Image->setEnabled(args[i].simplified().endsWith(".img")); - if(burnIMG){ BurnImgToUSB(); } //Go ahead and launch the burn dialog right away - break; + if(args[i].startsWith("--") ){ + if(action>=0){ break; } + else if(args[i]=="--burn-img"){ action = 0; continue; } + else if(args[i]=="--ax"){ action = 1; continue; } + else if(args[i]=="--aa"){ action = 2; continue; } + }else{ + files << args[i]; } - //if(autoArchive){ - //get rest of arguments - //for(int i=1; ilabel_progress->setText(tr("Opening Archive...")); + if(action==1){ + connect(BACKEND, SIGNAL(FileLoaded()), this, SLOT(autoextractFiles()) ); + connect(BACKEND, SIGNAL(ExtractSuccessful()), delayClose, SLOT(start()) ); + }else if(action==2){ + aaFileList.clear(); + for(int j=1; jloadFile(files[0]); + ui->actionUSB_Image->setEnabled(files[0].simplified().endsWith(".img")); + if(action==0){ BurnImgToUSB(); } //Go ahead and launch the burn dialog right away + } void MainUI::loadIcons(){ @@ -258,13 +263,27 @@ void MainUI::autoextractFiles(){ disconnect(BACKEND, SIGNAL(FileLoaded()), this, SLOT(autoextractFiles()) ); QString dir = BACKEND->currentFile().section("/",0,-2); //parent directory of the archive if(dir.isEmpty()){ return; } + QDir tmp(dir); + QString name = BACKEND->currentFile().section("/",-1).section(".",0,0); + if(QFile::exists(dir+"/"+name)){ + int num = 1; + while( QFile::exists(dir+"/"+name+"_"+QString::number(num))){ num++; } + name = name+"_"+QString::number(num); + } + if(tmp.mkdir(name) ){ + dir.append("/"+name); //created sub directory + } ui->label_progress->setText(tr("Extracting...")); BACKEND->startExtract(dir, true); } -/* -void MainUI::autoArchiveFiles(aaFileList){ -*/ + +void MainUI::autoArchiveFiles(){ + qDebug() << "Auto Archive Files:" << aaFileList; + ui->label_progress->setText(tr("Adding Items...")); + BACKEND->startAdd(aaFileList); +} + void MainUI::extractSelection(){ if(ui->tree_contents->currentItem()==0){ return; } //nothing selected -- cgit From 067a5f38cafc5789af47df06c687f0ddf79219f7 Mon Sep 17 00:00:00 2001 From: q5sys Date: Tue, 24 Oct 2017 20:40:30 -0400 Subject: add extraction method for custom path --- src-qt5/desktop-utils/lumina-archiver/MainUI.cpp | 51 ++++++++++++++++-------- 1 file changed, 35 insertions(+), 16 deletions(-) (limited to 'src-qt5/desktop-utils/lumina-archiver/MainUI.cpp') diff --git a/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp b/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp index 215fc64e..20534569 100644 --- a/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp @@ -82,6 +82,7 @@ void MainUI::LoadArguments(QStringList args){ else if(args[i]=="--burn-img"){ action = 0; continue; } else if(args[i]=="--ax"){ action = 1; continue; } else if(args[i]=="--aa"){ action = 2; continue; } + else if(args[i]=="--sx"){ action = 3; continue; } }else{ files << args[i]; } @@ -90,6 +91,7 @@ void MainUI::LoadArguments(QStringList args){ //Now go through and do any actions as needed ui->label_progress->setText(tr("Opening Archive...")); if(action==1){ + qDebug() << "blah"; connect(BACKEND, SIGNAL(FileLoaded()), this, SLOT(autoextractFiles()) ); connect(BACKEND, SIGNAL(ExtractSuccessful()), delayClose, SLOT(start()) ); }else if(action==2){ @@ -97,6 +99,18 @@ void MainUI::LoadArguments(QStringList args){ for(int j=1; jloadFile(files[0]); ui->actionUSB_Image->setEnabled(files[0].simplified().endsWith(".img")); @@ -260,23 +274,29 @@ void MainUI::extractFiles(){ } void MainUI::autoextractFiles(){ - disconnect(BACKEND, SIGNAL(FileLoaded()), this, SLOT(autoextractFiles()) ); - QString dir = BACKEND->currentFile().section("/",0,-2); //parent directory of the archive - if(dir.isEmpty()){ return; } - QDir tmp(dir); - QString name = BACKEND->currentFile().section("/",-1).section(".",0,0); - if(QFile::exists(dir+"/"+name)){ - int num = 1; - while( QFile::exists(dir+"/"+name+"_"+QString::number(num))){ num++; } - name = name+"_"+QString::number(num); - } - if(tmp.mkdir(name) ){ - dir.append("/"+name); //created sub directory - } - ui->label_progress->setText(tr("Extracting...")); - BACKEND->startExtract(dir, true); + disconnect(BACKEND, SIGNAL(FileLoaded()), this, SLOT(autoextractFiles()) ); + QString dir = BACKEND->currentFile().section("/",0,-2); //parent directory of the archive + if(dir.isEmpty()){ return; } + QDir tmp(dir); + QString name = BACKEND->currentFile().section("/",-1).section(".",0,0); + if(QFile::exists(dir+"/"+name)){ + int num = 1; + while( QFile::exists(dir+"/"+name+"_"+QString::number(num))){ num++; } + name = name+"_"+QString::number(num); + } + if(tmp.mkdir(name) ){ + dir.append("/"+name); //created sub directory } + ui->label_progress->setText(tr("Extracting...")); + BACKEND->startExtract(dir, true); +} +void MainUI::simpleExtractFiles(){ + disconnect(BACKEND, SIGNAL(FileLoaded()), this, SLOT(autoextractFiles()) ); + QString dir = sxPath; + ui->label_progress->setText(tr("Extracting...")); + BACKEND->startExtract(dir, true); +} void MainUI::autoArchiveFiles(){ qDebug() << "Auto Archive Files:" << aaFileList; @@ -284,7 +304,6 @@ void MainUI::autoArchiveFiles(){ BACKEND->startAdd(aaFileList); } - void MainUI::extractSelection(){ if(ui->tree_contents->currentItem()==0){ return; } //nothing selected QList sel = ui->tree_contents->selectedItems(); -- cgit From e72b4cfb324f8c8bb5aebc9382f2344c6ccb6705 Mon Sep 17 00:00:00 2001 From: q5sys Date: Wed, 25 Oct 2017 09:25:44 -0400 Subject: fixed handling of initial arguments --- src-qt5/desktop-utils/lumina-archiver/MainUI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src-qt5/desktop-utils/lumina-archiver/MainUI.cpp') diff --git a/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp b/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp index 20534569..c4b35474 100644 --- a/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp @@ -101,7 +101,7 @@ void MainUI::LoadArguments(QStringList args){ connect(BACKEND, SIGNAL(ArchivalSuccessful()), delayClose, SLOT(start()) ); }else if(action==3){ sxList.clear(); - for(int j=1; j Date: Wed, 1 Nov 2017 12:47:54 -0400 Subject: Quick cleanup of input parsing in lumina-archiver. --- src-qt5/desktop-utils/lumina-archiver/MainUI.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src-qt5/desktop-utils/lumina-archiver/MainUI.cpp') diff --git a/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp b/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp index c4b35474..79c023dc 100644 --- a/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp @@ -91,24 +91,18 @@ void MainUI::LoadArguments(QStringList args){ //Now go through and do any actions as needed ui->label_progress->setText(tr("Opening Archive...")); if(action==1){ - qDebug() << "blah"; + //qDebug() << "blah"; connect(BACKEND, SIGNAL(FileLoaded()), this, SLOT(autoextractFiles()) ); connect(BACKEND, SIGNAL(ExtractSuccessful()), delayClose, SLOT(start()) ); }else if(action==2){ aaFileList.clear(); for(int j=1; j