File: Packer.h

package info (click to toggle)
bsc 2.27-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,640 kB
  • ctags: 2,610
  • sloc: cpp: 14,100; perl: 114; makefile: 46
file content (171 lines) | stat: -rw-r--r-- 4,953 bytes parent folder | download | duplicates (2)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/********************************************************************
 * Copyright (C) 2005, 2006 Piotr Pszczolkowski
 *-------------------------------------------------------------------
 * This file is part of BSCommander (Beesoft Commander).
 *
 * BsC 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.
 *
 * BsC is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with BSCommander; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *******************************************************************/
#ifndef INCLUDED_PACKER_H
#define INCLUDED_PACKER_H

/*------- include files:
-------------------------------------------------------------------*/
#ifndef INCLUDED_VIEWTABLE_H
#include "ViewTable.h"
#endif // INCLUDED_VIEWTABLE_H

#ifndef INCLUDED_QDIALOG_H
#include <qdialog.h>
#define INCLUDED_QDIALOG_H
#endif // INCLUDED_QDIALOG_H

#ifndef INCLUDED_QFILE_H
#include <qfile.h>
#define INCLUDED_QFILE_H
#endif // INCLUDED_QFILE_H

#ifndef INCLUDED_QFILEINFO_H
#include <qfileinfo.h>
#define INCLUDED_QFILEINFO_H
#endif // INCLUDED_QFILEINFO_H

#ifndef INCLUDED_QFONTMETRICS_H
#include <qfontmetrics.h>
#define INCLUDED_QFONTMETRICS_H
#endif // INCLUDED_QFONTMETRICS_H

#ifndef INCLUDED_VECTOR
#include <vector>
#define INCLUDED_VECTOR
#endif // INCLUDED_VECTOR

/*------- forward declarations:
-------------------------------------------------------------------*/
class InfoField;
class QPushButton;
class QProgressBar;
class QCheckBox;
class QProcess;
class QGroupBox;
class QRadioButton;
class QButtonGroup;
class QFrame;
class QGridLayout;
class QLabel;
class QHBoxLayout;
class QVBoxLayout;
class QComboBox;

/*------- class declaration:
-------------------------------------------------------------------*/
class Packer : public QDialog
{
	Q_OBJECT

// ******* TYPES *******
private:
	typedef enum {
		TAR = 0,
		GZIP,
		BZIP2,
		ZIP
	} CompressType;

// ******* CONSTRUCTION *******
public:
	Packer( QWidget* const parent, const ViewTable::SelectedItems&, const QString& );
	~Packer();
private:
	Packer( const Packer& );
	Packer& operator=( const Packer& );

// ******* MEMBERS *******
private:
	static const QString Caption;
	static const QString InfoTitel;
	static const QString SrcLabel;
	static const QString DstLabel;
	static const QString CompressLabel;
	static const QString RemoveLabel;
	static const QString InputCaption;
	static const QString InputPrompt;
	static const QString Gzip;
	static const QString Bzip2;
	static const QString Zip;
	static const QString TarExt;
	static const QString GzipExt;
	static const QString Bzip2Ext;
	static const QString ZipExt;
	
	//....................................
	const ViewTable::SelectedItems& d_items;
	const QString                   d_dst_dir;
	//....................................
	QGroupBox*    const d_info_gb;
	QFrame*       const d_info_frm;
	QGridLayout*  const d_info_gl;
	QLabel*       const d_info_src_lb;
	InfoField*    const d_info_src_fld;
	QLabel*       const d_info_dst_lb;
	InfoField*    const d_info_dst_fld;
	//....................................
	QHBoxLayout*  const d_button_layout;	
	QCheckBox*    const d_compress_cb;
	QCheckBox*    const d_remove_cb;
	QPushButton*  const d_run_btn;
	QPushButton*  const d_exit_btn;
	//....................................
	QButtonGroup* const d_compress_grp;
	QRadioButton* const d_gz_rb;
	QRadioButton* const d_bz2_rb;
	QRadioButton* const d_zip_rb;
	QComboBox*    const d_level_cbox;
	//....................................
	QVBoxLayout*  const d_main_layout;
	QString             d_pack_fname;
	QString             d_pack_fpath;
	bool                d_paused;
	bool                d_started;
	bool                d_stopped;
	QFontMetrics        d_fm;
	unsigned int        d_idx;
	QProcess*           d_process;
	CompressType        d_compress_type;

// ******* METHODS *******
private:
	void     polish          ();
	void     display         ( const QString& );
	void     display_dst     ();
	void		show            ();
	QString  path2display    ();
	void     process         ();
	void     end_process     ();
	void     pack            ();
	void     remove_ext      ( QString& ); 
private slots:
	void     break_work       ();
	void     run              ();
	void		message          ();
	void		error            ();
	void		finish           ();
	void     compress_selected();
	void     type_changed     ( bool );
	void     reject           ();
signals:
	void     start            ();
};

#endif // INCLUDED_PACKER_H