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
|
/* This file is part of the KDE Project
Copyright (C) 2000 Klaas Freitag <[email protected]>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KSCANOPTSET_H
#define KSCANOPTSET_H
#include <tqobject.h>
#include <tqstring.h>
#include <tqptrlist.h>
#include <tqasciidict.h>
#include "kscanoption.h"
/**
* This is a container class for KScanOption-objects, which contain information
* about single scanner dependant options. It allows you to store a bunch
* of options and accessing them via a iterator.
*
* The class which is inherited from TQAsciiDict does no deep copy of the options
* to store by with the standard method insert.
* @see backupOption to get a deep copy.
*
* Note that the destructor of the KScanOptSet only clears the options created
* by backupOption.
*
* @author Klaas [email protected]
* @version 0.1
*/
class KScanOptSet: public TQAsciiDict<KScanOption>
{
public:
/**
* Constructor to create a new Container. Takes a string as a name, which
* has no special meaning yet ;)
*/
KScanOptSet( const TQCString& );
~KScanOptSet();
/**
* function to store a deep copy of an option. Note that this class is inherited
* from TQAsciiDict and thus does no deep copies. This method does.
* @see insert
*/
bool backupOption( const KScanOption& );
/**
* returns a pointer to a stored option given by name.
*/
KScanOption *get( const TQCString name ) const;
TQCString getValue( const TQCString name ) const;
void backupOptionDict( const TQAsciiDict<KScanOption>& );
/**
* saves a configuration set to the configuration file 'ScanSettings'
* in the default dir config (@see KDir). It uses the group given
* in configName and stores the entire option set in that group.
* additionally, a description is also saved.
*
* @param scannerName : the name of the scanner
* @param configName: The name of the config, e.g. Black and White
* @param descr : A description for the config.
*/
void saveConfig( const TQString&, const TQString&, const TQString&);
/**
* allows to load a configuration. Simple create a optionSet with the
* approbiate name the config was called ( @see saveConfig ) and call
* load for the scanner you want.
* @param scannerName: A scanner's name
*/
bool load( const TQString& scannerName );
TQString getDescription() const;
public slots:
void slSetDescription( const TQString& );
private:
TQCString name;
/* List to collect objects for which memory was allocated and must be freed */
TQPtrList<KScanOption> strayCatsList;
class KScanOptSetPrivate;
KScanOptSetPrivate *d;
TQString description;
};
#endif // KScanOptSet
|