2 Copyright 2007-2008 by Robert Knight <robertknight@gmail.com>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 #ifndef HISTORYSIZEDIALOG_H
21 #define HISTORYSIZEDIALOG_H
26 class QAbstractButton
;
33 * A dialog which allows the user to select the number of lines of output
34 * which are remembered for a session.
36 class HistorySizeDialog
: public KDialog
42 * Construct a new history size dialog.
44 HistorySizeDialog( QWidget
* parent
);
46 /** Specifies the type of history scroll */
50 * No history. Lines of output are lost
51 * as soon as they are scrolled off-screen.
55 * A history which stores up to a fixed number of lines
60 * An 'unlimited' history which stores lines of output in
67 /** Specifies the history mode. */
68 void setMode( HistoryMode mode
);
69 /** Returns the history mode chosen by the user. */
70 HistoryMode
mode() const;
72 * Returns the number of lines of history to remember.
73 * This is only valid when mode() == FixedSizeHistory,
74 * and returns 0 otherwise.
76 int lineCount() const;
77 /** Sets the number of lines for the fixed size history mode. */
78 void setLineCount(int lines
);
81 * Sets the default history mode. When the user clicks on the "Defaults" button,
82 * this mode will be used.
84 void setDefaultMode( HistoryMode mode
);
86 /** Returns the default mode, as set with setDefaultMode() */
87 HistoryMode
defaultMode() const;
90 * Sets the default line count. When the user clicks on the "Defaults" button,
91 * the line count will be set to this number.
93 void setDefaultLineCount( int count
);
95 /** Returns the default line count, as set with setDefaultLineCount() */
96 int defaultLineCount() const;
100 * Emitted when the user changes the scroll-back mode or line count and
101 * accepts the change by pressing the OK button
103 * @param mode The current history mode. This is a value from the HistoryMode enum.
104 * @param lineCount The current line count. This is only applicable if mode is
107 void optionsChanged(int mode
, int lineCount
);
110 // changes the mode and line count back to the defaults
111 // specified with setDefaultMode() and setDefaultLineCount()
114 // fires the optionsChanged() signal with the current mode
115 // and line count as arguments
116 void emitOptionsChanged();
119 QAbstractButton
* _noHistoryButton
;
120 QAbstractButton
* _fixedHistoryButton
;
121 QAbstractButton
* _unlimitedHistoryButton
;
122 QSpinBox
* _lineCountBox
;
124 HistoryMode _defaultMode
;
125 int _defaultLineCount
;
130 #endif // HISTORYSIZEDIALOG_H