Fix crash if key bindings specified in profile cannot be found. Improve
[personal-kdebase.git] / apps / konsole / src / HistorySizeDialog.h
blob8c82a47def2a25e0c791b58e2745fa881f0e9760
1 /*
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
17 02110-1301 USA.
20 #ifndef HISTORYSIZEDIALOG_H
21 #define HISTORYSIZEDIALOG_H
23 // KDE
24 #include <KDialog>
26 class QAbstractButton;
27 class QSpinBox;
29 namespace Konsole
32 /**
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
38 Q_OBJECT
40 public:
41 /**
42 * Construct a new history size dialog.
44 HistorySizeDialog( QWidget* parent );
46 /** Specifies the type of history scroll */
47 enum HistoryMode
49 /**
50 * No history. Lines of output are lost
51 * as soon as they are scrolled off-screen.
52 */
53 NoHistory,
54 /**
55 * A history which stores up to a fixed number of lines
56 * in memory.
58 FixedSizeHistory,
59 /**
60 * An 'unlimited' history which stores lines of output in
61 * a file on disk.
63 UnlimitedHistory
67 /** Specifies the history mode. */
68 void setMode( HistoryMode mode );
69 /** Returns the history mode chosen by the user. */
70 HistoryMode mode() const;
71 /**
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);
80 /**
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;
89 /**
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;
98 signals:
99 /**
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
105 * FixedSizeHistory
107 void optionsChanged(int mode , int lineCount);
109 private slots:
110 // changes the mode and line count back to the defaults
111 // specified with setDefaultMode() and setDefaultLineCount()
112 void useDefaults();
114 // fires the optionsChanged() signal with the current mode
115 // and line count as arguments
116 void emitOptionsChanged();
118 private:
119 QAbstractButton* _noHistoryButton;
120 QAbstractButton* _fixedHistoryButton;
121 QAbstractButton* _unlimitedHistoryButton;
122 QSpinBox* _lineCountBox;
124 HistoryMode _defaultMode;
125 int _defaultLineCount;
130 #endif // HISTORYSIZEDIALOG_H