File indexing completed on 2024-12-15 04:54:44

0001 /******************************************************************************
0002  *
0003  *  SPDX-FileCopyrightText: 2008 Szymon Tomasz Stefanek <pragma@kvirc.net>
0004  *
0005  *  SPDX-License-Identifier: GPL-2.0-or-later
0006  *
0007  *******************************************************************************/
0008 
0009 #pragma once
0010 
0011 #include <QTabWidget>
0012 
0013 class QLineEdit;
0014 class KTextEdit;
0015 
0016 namespace MessageList
0017 {
0018 namespace Core
0019 {
0020 class OptionSet;
0021 } // namespace Core
0022 
0023 namespace Utils
0024 {
0025 /**
0026  * The base class for the OptionSet editors. Provides common functionality.
0027  */
0028 class OptionSetEditor : public QTabWidget
0029 {
0030     Q_OBJECT
0031 
0032 public:
0033     explicit OptionSetEditor(QWidget *parent);
0034     ~OptionSetEditor() override;
0035     void setReadOnly(bool readOnly);
0036 
0037 protected:
0038     /**
0039      * Returns the editor for the name of the OptionSet.
0040      * Derived classes are responsible of filling this UI element and reading back data from it.
0041      */
0042     QLineEdit *nameEdit() const;
0043 
0044     /**
0045      * Returns the editor for the description of the OptionSet.
0046      * Derived classes are responsible of filling this UI element and reading back data from it.
0047      */
0048     KTextEdit *descriptionEdit() const;
0049 
0050 protected Q_SLOTS:
0051     /**
0052      * Handles editing of the name field.
0053      * Pure virtual slot. Derived classes must provide an implementation.
0054      */
0055     virtual void slotNameEditTextEdited(const QString &newName) = 0;
0056 
0057 private:
0058     QLineEdit *mNameEdit = nullptr; ///< The editor for the OptionSet name
0059     KTextEdit *mDescriptionEdit = nullptr; ///< The editor for the OptionSet description
0060 };
0061 } // namespace Utils
0062 } // namespace MessageList