File indexing completed on 2024-04-28 05:50:54

0001 /*
0002     SPDX-FileCopyrightText: 2007-2008 Robert Knight <robertknight@gmail.com>
0003     SPDX-FileCopyrightText: 2012 Jekyll Wu <adaptee@gmail.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef HISTORYSIZEWIDGET_H
0009 #define HISTORYSIZEWIDGET_H
0010 
0011 // Qt
0012 #include <QWidget>
0013 
0014 // Konsole
0015 #include "Enumeration.h"
0016 
0017 class QAbstractButton;
0018 
0019 namespace Ui
0020 {
0021 class HistorySizeWidget;
0022 }
0023 
0024 namespace Konsole
0025 {
0026 /**
0027  * A widget for controlling history related options
0028  */
0029 class HistorySizeWidget : public QWidget
0030 {
0031     Q_OBJECT
0032 
0033 public:
0034     explicit HistorySizeWidget(QWidget *parent);
0035     ~HistorySizeWidget() override;
0036 
0037     /** Specifies the history mode. */
0038     void setMode(Enum::HistoryModeEnum aMode);
0039 
0040     /** Returns the history mode chosen by the user. */
0041     Enum::HistoryModeEnum mode() const;
0042 
0043     /** Sets the number of lines for the fixed size history mode. */
0044     void setLineCount(int lines);
0045 
0046     /**
0047      * Returns the number of lines of history to remember.
0048      * This is only valid when mode() == FixedSizeHistory,
0049      * and returns 0 otherwise.
0050      */
0051     int lineCount() const;
0052 
0053     /**
0054      * Return height which should be set on the widget's label
0055      * to align with the first widget's item
0056      */
0057     int preferredLabelHeight();
0058 
0059 Q_SIGNALS:
0060     /** Emitted when the history mode is changed. */
0061     void historyModeChanged(Enum::HistoryModeEnum);
0062 
0063     /** Emitted when the history size is changed. */
0064     void historySizeChanged(int);
0065 
0066 private Q_SLOTS:
0067     void buttonClicked(QAbstractButton *);
0068 
0069 private:
0070     Ui::HistorySizeWidget *_ui;
0071 
0072     // 1000 lines was the default in the KDE3 series
0073     static const int DefaultLineCount = 1000;
0074 };
0075 }
0076 
0077 #endif // HISTORYSIZEWIDGET_H