aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-archiver/TarBackend.h
blob: 11c61319b02e6ecf19e7e0aff5aa1b80be757cc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//===========================================
//  Lumina-DE source code
//  Copyright (c) 2016, Ken Moore
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================
#ifndef _LUMINA_ARCHIVER_TAR_BACKEND_H
#define _LUMINA_ARCHIVER_TAR_BACKEND_H

#include <QProcess>
#include <QString>
#include <QStringList>

class Backend : public QObject{
	Q_OBJECT
public:
	Backend(QObject *parent = 0);
	~Backend();

	void loadFile(QString path);
	bool canModify(); //run on the current file

	//Listing routines
	QString currentFile();
	bool isWorking(); //is this currently still making changes?	

	//Contents listing
	QStringList heirarchy(); //returns all the file paths within the archive
	double size(QString file);
	double csize(QString file);
	bool isDir(QString file);

	//Modification routines
	void startAdd(QStringList paths);
	void startRemove(QStringList paths);
	void startExtract(QString path, bool overwrite); //path to dir
	
public slots:

private:
	QProcess PROC;

	QString filepath, tmpfilepath;
	QStringList flags;
	QHash<QString, QStringList> contents; //<filepath, [attributes, size, compressed size]

	bool LIST, STARTING;
	void parseLines(QStringList lines);

private slots:
	void startList();
	void procFinished(int retcode, QProcess::ExitStatus);
	void processData();

signals:
	void FileLoaded();
	void ProcessStarting();
	void ProgressUpdate(int, QString); //percentage, text
	void ProcessFinished();
};

#endif
bgstack15