[go: up one dir, main page]

File: tools.h

package info (click to toggle)
showimg 0.9.5-1.3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 21,468 kB
  • ctags: 13,090
  • sloc: ansic: 65,847; cpp: 57,096; sh: 12,726; perl: 2,715; yacc: 2,307; makefile: 549; lex: 286
file content (128 lines) | stat: -rw-r--r-- 3,859 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
/***************************************************************************
                          tools.h  -  description
                             -------------------
    begin                : Jan 22 2005
    copyright            : (C) 2005 by Richard Groult
    email                : rgroult@jalix.org
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 *   This program 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 this program; if not, write to the Free Software           *
 *   Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301   *
 *   USA.                                                                  *
 *                                                                         *
 *   For license exceptions see LICENSE.EXC file, attached with the source *
 *   code.                                                                 *
 *                                                                         *
 ***************************************************************************/

#ifndef TOOLS_H
#define TOOLS_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <qobject.h>
#include <qimage.h>

class ImageSimilarityData;
class MainWindow;
class FormatConversion;
class RenameSeries;

class QFile;

class KAction;
class KActionCollection;
class KConfig;
class KProcess;
class KScanDialog;

class Tools : public QObject
{
	Q_OBJECT

public:
	Tools(MainWindow *mw );
	virtual ~Tools();

	void initActions(KActionCollection *actionCollection);

	void readConfig(KConfig *config);
	void writeConfig(KConfig *config);

	QString getConvertPath();
	void setConvertPath(const QString& path);

	QString getJpegtranPath();
	void setJpegtranPath(const QString& path);

	static bool saveAs(const QImage* image, const QString& oldPath, const QString& newPath);

public slots:
	void slotScanImage();

	void toolsRotateLeft();
	void toolsRotateRight();

	void renameSeries();

	void compareAlmost();
	void compareFast ();

	void convert();

private slots:
	void slotScanned(const QImage& img, int);
	void slotEndConvert(KProcess *proc);

private:
	MainWindow *mw;

	FormatConversion *formatConver;
	RenameSeries *m_renameS;

	QString m_convertPath, m_jpegtranPath;

#ifndef SHOWIMG_NO_SCAN_IMAGE
	KScanDialog *m_scanDialog;
#endif

KAction
			*aRenameSeries,
			*aToolsRotateLeft, *aToolsRotateRight,
			*aCompareFast,*aCompareAlmost,*aConvert
#ifndef SHOWIMG_NO_SCAN_IMAGE
			,*aScan
#endif
			;

private:
	char getRed(QImage* im, int x, int y);
	char getGreen(QImage* im, int x, int y);
	char getBlue(QImage* im, int x, int y);

	bool equals (QFile *f1, QFile *f2);


	ImageSimilarityData* image_sim_fill_data(const QString& filename);
	float image_sim_compare(ImageSimilarityData *a, ImageSimilarityData *b);
	float image_sim_compare_fast(ImageSimilarityData *a, ImageSimilarityData *b, float min);


};

#endif /* TOOLS_H */