summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2010-05-14 14:52:56 +0200
committerArno <am@disconnect.de>2010-05-14 14:52:56 +0200
commit8557681bb922613603eae641e88746eaa16914a4 (patch)
tree2b025d0d67a8c262991cc6d9f081b840ae8b0b7c
parent8a324c06caff00947b7d9a8b0b0b977073500c80 (diff)
downloadSheMov-8557681bb922613603eae641e88746eaa16914a4.tar.gz
SheMov-8557681bb922613603eae641e88746eaa16914a4.tar.bz2
SheMov-8557681bb922613603eae641e88746eaa16914a4.zip
Cleanup archive extraction
Removed the code for archive extraction. Never used it, never liked it and really never worked properly.
-rw-r--r--extractordialog.cpp101
-rw-r--r--extractordialog.h40
-rw-r--r--filesystemwidget.cpp21
-rw-r--r--filesystemwidget.h2
-rw-r--r--shemov.cpp29
-rw-r--r--shemov.h3
-rw-r--r--shemov.pro2
7 files changed, 0 insertions, 198 deletions
diff --git a/extractordialog.cpp b/extractordialog.cpp
deleted file mode 100644
index 984c1d8..0000000
--- a/extractordialog.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version
- 2 of the License, or (at your option) any later version.
-*/
-
-#include <QTextEdit>
-#include <QProcess>
-#include <QPushButton>
-#include <QVBoxLayout>
-#include <QSettings>
-#include <QFileInfo>
-#include <QByteArray>
-#include <QFont>
-#include <QRegExp>
-#include <QApplication>
-
-#include "extractordialog.h"
-
-ExtractorDialog::ExtractorDialog(const QString &archive, const QString &extractTo, QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f), mArchive(archive), mExtractTo(extractTo){
- QVBoxLayout *mainLayout = new QVBoxLayout;
- mOutput = new QTextEdit;
- mOutput->setReadOnly(true);
- mOutput->setFont(QFont("Courier new", 10));
- mCancelClose = new QPushButton(tr("Close"));
- connect(mCancelClose, SIGNAL(clicked()), this, SLOT(accept()));
- mainLayout->addWidget(mOutput);
- mainLayout->addWidget(mCancelClose);
- setLayout(mainLayout);
-
- mExtractor = new QProcess(this);
-
- QString wTitle = QString(tr("%1 - extracting from %2")).arg(qApp->applicationName()).arg(archive);
- setWindowTitle(wTitle);
- setMinimumWidth(500);
-
- start();
-}
-
-void ExtractorDialog::extractionFinished(){
- mCancelClose->disconnect(SIGNAL(clicked()));
- connect(mCancelClose, SIGNAL(clicked()), this, SLOT(accept()));
- mCancelClose->setText(tr("Close"));
- setWindowTitle(tr("Extraction finished"));
- mOutput->append(tr("\nFinished.\n"));
-}
-
-void ExtractorDialog::killProcess(){
- mExtractor->kill();
- setClose();
-}
-
-void ExtractorDialog::writeOutput(){
- if(mExtractor->canReadLine()){
- mOutput->append(mExtractor->readLine());
- }
-}
-
-void ExtractorDialog::start(){
- QSettings s;
- QString exe = s.value("paths/archiver").toString();
- if(exe.isEmpty()){
- mOutput->append(tr("No archive program configured!"));
- return;
- }
- QFileInfo info(exe);
- if(!info.exists() || !info.isExecutable()){
- QString msg = QString(tr("Unable to call %1")).arg(exe);
- mOutput->append(msg);
- return;
- }
- QStringList args = s.value("paths/archiverargs").toStringList();
- args << mArchive;
- mExtractor = new QProcess(this);
- mExtractor->setWorkingDirectory(mExtractTo);
- mExtractor->setReadChannel(QProcess::StandardOutput);
- QString startmessage = QString("Starting %1 %2\n").arg(exe).arg(args.join(" "));
- mOutput->append(startmessage);
- mExtractor->start(exe, args);
- if(!mExtractor->waitForStarted()){
- mOutput->append(tr("Failed to start extraction!\n"));
- return;
- }
- connect(mExtractor, SIGNAL(readyRead()), this, SLOT(writeOutput()));
- connect(mExtractor, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(extractionFinished()));
- setCancel();
-}
-
-void ExtractorDialog::setClose(){
- mCancelClose->disconnect(SIGNAL(clicked()));
- connect(mCancelClose, SIGNAL(clicked()), this, SLOT(accept()));
- mCancelClose->setText(tr("Close"));
-}
-
-void ExtractorDialog::setCancel(){
- mCancelClose->disconnect(SIGNAL(clicked()));
- connect(mCancelClose, SIGNAL(clicked()), this, SLOT(killProcess()));
- mCancelClose->setText(tr("Cancel"));
-}
-
diff --git a/extractordialog.h b/extractordialog.h
deleted file mode 100644
index b5033fd..0000000
--- a/extractordialog.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version
- 2 of the License, or (at your option) any later version.
-*/
-
-#ifndef EXTRACTORDIALOG_H
-#define EXTRACTORDIALOG_H
-
-#include <QDialog>
-#include <QProcess>
-
-class QTextEdit;
-class QPushButton;
-
-class ExtractorDialog : public QDialog {
- Q_OBJECT
- public:
- ExtractorDialog(const QString &archive, const QString &extractTo, QWidget *parent = 0, Qt::WindowFlags f = 0);
- ~ExtractorDialog() {};
-
- private slots:
- void killProcess();
- void writeOutput();
- void extractionFinished();
-
- private:
- void start();
- void setClose();
- void setCancel();
- QString mArchive;
- QString mExtractTo;
- QPushButton *mCancelClose;
- QTextEdit *mOutput;
- QProcess *mExtractor;
-};
-
-#endif
-
diff --git a/filesystemwidget.cpp b/filesystemwidget.cpp
index 29a8e6e..8e27928 100644
--- a/filesystemwidget.cpp
+++ b/filesystemwidget.cpp
@@ -29,7 +29,6 @@
#include "filesystemfileproxy.h"
#include "helper.h"
#include "messagedialog.h"
-#include "extractordialog.h"
#include "archiveeditdialog.h"
FilesystemWidget::FilesystemWidget(QWidget *parent) : QWidget(parent) {
@@ -326,21 +325,6 @@ void FilesystemWidget::setTemplate(){
emit newTemplate(mTemplate);
}
-void FilesystemWidget::extract(const QString &destDir){
- QModelIndex idx = mFileView->currentIndex();
- if(idx.column() != 0){
- idx = mFileView->model()->index(idx.row(), 0);
- }
- QSortFilterProxyModel *proxy = static_cast<QSortFilterProxyModel*>(mFileView->model());
- QModelIndex real = proxy->mapToSource(idx);
- QFileInfo info = mModel->fileInfo(real);
- if(info.isDir()){
- return;
- }
- ExtractorDialog dlg(info.absoluteFilePath(), destDir, this);
- dlg.exec();
-}
-
void FilesystemWidget::archiveFiles(){
QModelIndexList selected = fileView()->selectionModel()->selectedRows();
if(selected.isEmpty()){
@@ -358,11 +342,6 @@ void FilesystemWidget::archiveFiles(){
mAEDialog->activateWindow();
}
-/*void FilesystemWidget::refreshDir(const QString &dir){
- QModelIndex idx = mModel->index(dir);
- mModel->refresh(idx);
-}*/
-
void FilesystemWidget::playSelected(const QString &player){
QStringList files = selectedFiles();
if(files.isEmpty()){
diff --git a/filesystemwidget.h b/filesystemwidget.h
index 5badd0a..ccd5123 100644
--- a/filesystemwidget.h
+++ b/filesystemwidget.h
@@ -51,9 +51,7 @@ class FilesystemWidget : public QWidget {
void renameFile();
void renameCover(const QString &infix);
void setTemplate();
- void extract(const QString &destDir);
void archiveFiles();
- //void refreshDir(const QString &dir);
void playSelected(const QString &player = QString());
void readSettings();
void writeSettings();
diff --git a/shemov.cpp b/shemov.cpp
index 503a2bc..0817180 100644
--- a/shemov.cpp
+++ b/shemov.cpp
@@ -160,7 +160,6 @@ void SheMov::setTemplate(const QString &newTemplate){
void SheMov::configure(){
ConfigurationDialog dlg(this);
dlg.exec();
- createExtractMenu();
createOpenWithMenuFS();
createOpenWithMenuAV();
}
@@ -319,12 +318,6 @@ void SheMov::createActions(){
mRenameCoverCA->setData("RenameMenu");
connect(mRenameMapper, SIGNAL(mapped(const QString &)), mFSWidget, SLOT(renameCover(const QString &)));
- //Edit menu extract submenu
- mExtractMapper = new QSignalMapper(this);
- connect(mExtractMapper, SIGNAL(mapped(const QString &)), mFSWidget, SLOT(extract(const QString &)));
- mExtractMenu = new QMenu(tr("E&xtract to..."), this);
- createExtractMenu();
-
//Edit menu (archive)
mPlaySelectedAVA = new QAction(tr("Play selected movies..."), this);
connect(mPlaySelectedAVA, SIGNAL(triggered()), mAVWidget, SLOT(playSelected()));
@@ -389,8 +382,6 @@ void SheMov::createMenus(){
mRenameMenuA->setMenu(mRenameMenu);
mEditFSMenu->addAction(mRenameMenuA);
mEditFSMenu->addSeparator();
- mEditFSMenu->addMenu(mExtractMenu);
- mEditFSMenu->addSeparator();
mEditFSMenu->addAction(mConfigA);
mEditArchiveMenu = new QMenu(tr("&Edit archive"), this);
@@ -520,26 +511,6 @@ void SheMov::createOpenWithMenuAV(){
}
}
-void SheMov::createExtractMenu(){
- foreach(QAction *a, mExtractToA){
- mFSWidget->fileView()->removeAction(a);
- delete a;
- }
- mExtractToA.clear();
- mExtractMenu->clear();
- QSettings s;
- QStringList locations = s.value("paths/extractpaths").toStringList();
- foreach(QString p, locations){
- QAction *a = new QAction(p, this);
- a->setData("ExtractMenu");
- mFSWidget->fileView()->addAction(a);
- mExtractMenu->addAction(a);
- mExtractMapper->setMapping(a, p);
- connect(a, SIGNAL(triggered()), mExtractMapper, SLOT(map()));
- mExtractToA << a;
- }
-}
-
void SheMov::writeSettings(){
QSettings s;
s.setValue("windows/mainpos", pos());
diff --git a/shemov.h b/shemov.h
index 5d6dc46..0b64093 100644
--- a/shemov.h
+++ b/shemov.h
@@ -53,7 +53,6 @@ class SheMov : public QMainWindow {
void createMenus();
void createOpenWithMenuFS();
void createOpenWithMenuAV();
- void createExtractMenu();
void writeSettings();
void readSettings();
@@ -95,7 +94,6 @@ class SheMov : public QMainWindow {
QAction *mOpenWithMenuFSA;
QAction *mOpenWithMenuAVA;
QAction *mRenameMenuA;
- QList<QAction*> mExtractToA;
QActionGroup *mOpenWithGroupFS;
QActionGroup *mOpenWithGroupAV;
//EndActions
@@ -105,7 +103,6 @@ class SheMov : public QMainWindow {
QSignalMapper *mOpenWithMapperFS;
QSignalMapper *mOpenWithMapperAV;
- QMenu *mExtractMenu;
QMenu *mEditFSMenu;
QMenu *mEditArchiveMenu;
QMenu *mOpenWithMenuFS;
diff --git a/shemov.pro b/shemov.pro
index 1201dbd..6be5091 100644
--- a/shemov.pro
+++ b/shemov.pro
@@ -19,7 +19,6 @@ SOURCES = main.cpp \
shemoviconprovider.cpp \
messagedialog.cpp \
configurationdialog.cpp \
- extractordialog.cpp \
archiveeditdialog.cpp \
listeditor.cpp \
covereditor.cpp \
@@ -55,7 +54,6 @@ HEADERS = listitem.h \
shemoviconprovider.h \
messagedialog.h \
configurationdialog.h \
- extractordialog.h \
archiveeditdialog.h \
listeditor.h \
covereditor.h \