SVN_SILENT made messages (.desktop file)
[kdeadmin.git] / kdat / Options.h
blob4f65795e856dee5d186bf8646dd081606973a1c6
1 // KDat - a tar-based DAT archiver
2 // Copyright (C) 1998-2000 Sean Vyain, svyain@mail.tds.net
3 // Copyright (C) 2001-2002 Lawrence Widman, kdat@cardiothink.com
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 #ifndef _Options_h_
20 #define _Options_h_
22 #include <qobject.h>
24 class KConfig;
26 /**
27 * @short The central repository for user preferences.
29 class Options : public QObject {
30 Q_OBJECT
31 KConfig* _config;
32 int _defaultTapeSize;
33 int _tapeBlockSize;
34 QString _tapeDevice;
35 QString _tarCommand;
36 bool _loadOnMount;
37 bool _lockOnMount;
38 bool _ejectOnUnmount;
39 bool _variableBlockSize;
41 static Options* _instance;
43 Options();
44 public:
45 /**
46 * Get a reference to the single instance of the Options object.
48 * @return A pointer to the options object.
50 static Options* instance();
52 /**
53 * Save the current user preference settings.
55 void sync();
57 /**
58 * Get the default size to use when formatting a tape.
60 * @return The default size in kilobytes of a tape.
62 int getDefaultTapeSize();
64 /**
65 * The size of a tape block can be different from the size of a tar block.
66 * Tar blocks are always 512 bytes long. Be careful!
68 * @return the size in bytes of a single tape block
70 int getTapeBlockSize();
72 /**
73 * Get the full path to the tape device.
75 * @return The tape device path.
77 QString getTapeDevice();
79 /**
80 * Get the full path to the tar command.
82 * @return The path to the tar command.
84 QString getTarCommand();
86 /**
87 * Get whether to load the tape before attempting to mount it.
89 * @return TRUE if the tape should be loaded.
91 bool getLoadOnMount();
93 /**
94 * Get whether to lock the tape drive when a tape is mounted.
96 * @return TRUE if the tape drive should be locked, otherwise FALSE.
98 bool getLockOnMount();
101 * Get whether to automatically eject the tape when it is unmounted.
103 * @return TRUE if the tape should be ejected, otherwise FALSE.
105 bool getEjectOnUnmount();
108 * Get whether the tape drive supports variable block sizes.
110 * @return TRUE if the tape drive can handle the MTSETBLK command.
112 bool getVariableBlockSize();
115 * Set the default size for new tapes.
117 * @param kbytes The size in kilobytes.
119 void setDefaultTapeSize( int kbytes );
122 * Set the size of tape block.
124 * @param bytes The size in bytes of one tape block.
126 void setTapeBlockSize( int bytes );
129 * Set the path to the tape device.
131 * @param str The full path to the tape device.
133 void setTapeDevice( const QString & str );
136 * Set the path to the tar command.
138 * @param str The full path to the tar command.
140 void setTarCommand( const QString & str );
143 * Set whether to load the tape before attempting to mount it.
145 * @param b TRUE if the tape should be loaded.
147 void setLoadOnMount( bool b );
150 * Set whether to lock the tape drive whenever a tape is mounted.
152 * @param b TRUE means lock the drive, FALSE means don't.
154 void setLockOnMount( bool b );
157 * Set whether to eject the tape drive whenever a tape is unmounted.
159 * @param b TRUE means eject the tape, FALSE means don't.
161 void setEjectOnUnmount( bool b );
164 * Set whether the tape drive can support variable block sizes.
166 * @param b TRUE means the tape drive understands MTSETBLK.
168 void setVariableBlockSize( bool b );
169 signals:
171 * Emitted when the default tape size changes.
173 void sigDefaultTapeSize();
176 * Emitted when the tape block size changes.
178 void sigTapeBlockSize();
181 * Emitted when the path to the tape device changes.
183 void sigTapeDevice();
186 * Emitted when the path to the tar command changes.
188 void sigTarCommand();
191 * Emitted when the load on mount feature is enabled/disabled.
193 void sigLoadOnMount();
196 * Emitted when the lock on mount feature is enabled/disabled.
198 void sigLockOnMount();
201 * Emitted when the eject on umount feature is enabled/disabled.
203 void sigEjectOnUnmount();
206 * Emitted when the variable block size feature is enabled/disabled.
208 void sigVariableBlockSize();
211 #endif