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
|
/***************************************************************************
* Copyright (C) 2004 by Antonio Fasolato *
* Antonio.Fasolato@poste.it *
* *
* 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#ifndef AUTOTRACEFORMATS_H
#define AUTOTRACEFORMATS_H
#include <tqobject.h>
#include <tqstringlist.h>
#include <tqprocess.h>
//! Class to read autotrace input and output formats
/** This class executes autotrace to gain informations about the formats it can use
* \author Antonio Fasolato
*/
class AutotraceFormats : public TQObject
{
Q_OBJECT
public:
//! Standard TQObject-like constructor
/** The constructor, nothing fancy
* \param parent The parent of the TQObject
* \param name The name of the TQObject
*/
AutotraceFormats(TQObject *parent = 0, const char *name = 0);
//!Returns the list of supported input formats
/** This class returns the list of formats returned by <code>autotrace -list-input-formats</code>
* \return The supported formats
*/
TQStringList inputFormats();
//!Returns the list of supported output formats
/** This class returns the list of formats returned by <code>autotrace -list-output-formats</code>
* \return The supported formats
*/
TQStringList outputFormats();
//! Function to test the execution of autotrace
/** This functions returns <code>true</code> if the autotrace command could be run succesfully. If it returns
* <code>false</code> autotrace executable can not be found in the environment
* \return <code>true</code> if autotrace ran, <code>false</code> otherways
*/
bool OK();
//! Tests if the class has ended its work
/** This class tests if the autotrace processes ended, thus completing the formats listing
* \return <code>true</code> if the processes has ended, <code>false</code> otherways
*/
bool done();
private:
//! The process to get input formats
TQProcess *inputProcess;
//! The process to get output formats
TQProcess *outputProcess;
//! The list of input formats
TQStringList input;
//! The list of output formats
TQStringList output;
//! <code>true</code> if autotrace could be run
bool allOK;
private slots:
//! Reads from inputProcess stderr
/** Reads, when possible, the output of AutotraceFormats::inputProcess
*/
void inputRead();
//! Reads from outputProcess stderr
/** Reads, when possible, the output of AutotraceFormats::outputProcess
*/
void outputRead();
};
#endif
|