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
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.
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
27 * @short The central repository for user preferences.
29 class Options
: public QObject
{
39 bool _variableBlockSize
;
41 static Options
* _instance
;
46 * Get a reference to the single instance of the Options object.
48 * @return A pointer to the options object.
50 static Options
* instance();
53 * Save the current user preference settings.
58 * Get the default size to use when formatting a tape.
60 * @return The default size in kilobytes of a tape.
62 int getDefaultTapeSize();
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();
73 * Get the full path to the tape device.
75 * @return The tape device path.
77 QString
getTapeDevice();
80 * Get the full path to the tar command.
82 * @return The path to the tar command.
84 QString
getTarCommand();
87 * Get whether to load the tape before attempting to mount it.
89 * @return TRUE if the tape should be loaded.
91 bool getLoadOnMount();
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
);
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();