KTextEditor

configpage.h
1/*
2 SPDX-FileCopyrightText: 2001-2014 Christoph Cullmann <cullmann@kde.org>
3 SPDX-FileCopyrightText: 2005-2014 Dominik Haumann <dhaumann@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef KTEXTEDITOR_CONFIGPAGE_H
9#define KTEXTEDITOR_CONFIGPAGE_H
10
11#include <ktexteditor_export.h>
12
13#include <QWidget>
14
15namespace KTextEditor
16{
17/**
18 * \class ConfigPage configpage.h <KTextEditor/ConfigPage>
19 *
20 * \brief Config page interface for the Editor and Plugin%s.
21 *
22 * \section configpage_intro Introduction
23 *
24 * The class ConfigPage represents a config page.
25 * The config pages are usually embedded into a dialog that shows
26 * buttons like \e Defaults, \e Reset and \e Apply. If one of the buttons is
27 * clicked and the config page sent the signal changed() beforehand the
28 * Editor will call the corresponding slot, either defaults(), reset() or
29 * apply().
30 *
31 * To obtain a useful navigation information for displaying to a user see name(),
32 * fullName() and icon() functions.
33 *
34 * \section configpage_config Saving and Loading Config Data
35 *
36 * Saving and loading the configuration data can either be achieved by using
37 * the host application's KSharedConfig::openConfig() object, or by using an
38 * own configuration file.
39 *
40 * \see KTextEditor::Editor, KTextEditor::Plugin
41 * \author Christoph Cullmann <cullmann@kde.org>
42 */
43class KTEXTEDITOR_EXPORT ConfigPage : public QWidget
44{
45 Q_OBJECT
46
47public:
48 /**
49 * Constructor.
50 *
51 * Create a new config page with \p parent.
52 * \param parent parent widget
53 */
54 ConfigPage(QWidget *parent);
55 /**
56 * Virtual destructor.
57 */
58 ~ConfigPage() override;
59
60 /**
61 * Get a readable name for the config page. The name should be translated.
62 * \return name of given page index
63 * \see fullName(), icon()
64 */
65 virtual QString name() const = 0;
66
67 /**
68 * Get a readable full name for the config page. The name
69 * should be translated.
70 *
71 * Example: If the name is "Filetypes", the full name could be
72 * "Filetype Specific Settings". For "Shortcuts" the full name would be
73 * something like "Shortcut Configuration".
74 * \return full name of given page index, default implementation returns name()
75 * \see name(), icon()
76 */
77 virtual QString fullName() const;
78
79 /**
80 * Get an icon for the config page.
81 * \return icon for the given page index
82 * \see name(), fullName()
83 */
84 virtual QIcon icon() const;
85
86public Q_SLOTS:
87 /**
88 * This slot is called whenever the button \e Apply or \e OK was clicked.
89 * Apply the changed settings made in the config page now.
90 */
91 virtual void apply() = 0;
92
93 /**
94 * This slot is called whenever the button \e Reset was clicked.
95 * Reset the config page settings to the initial state.
96 */
97 virtual void reset() = 0;
98
99 /**
100 * Sets default options
101 * This slot is called whenever the button \e Defaults was clicked.
102 * Set the config page settings to the default values.
103 */
104 virtual void defaults() = 0;
105
106Q_SIGNALS:
107 /**
108 * Emit this signal whenever a config option changed.
109 */
110 void changed();
111
112private:
113 class ConfigPagePrivate *const d;
114};
115
116}
117
118#endif
Config page interface for the Editor and Plugins.
Definition configpage.h:44
void changed()
Emit this signal whenever a config option changed.
virtual void apply()=0
This slot is called whenever the button Apply or OK was clicked.
virtual void reset()=0
This slot is called whenever the button Reset was clicked.
virtual QString name() const =0
Get a readable name for the config page.
virtual void defaults()=0
Sets default options This slot is called whenever the button Defaults was clicked.
~ConfigPage() override
Virtual destructor.
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 14 2024 11:57:25 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.