File: k3bpluginconfigwidget.h

package info (click to toggle)
k3b 25.12.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 55,820 kB
  • sloc: cpp: 99,202; xml: 375; sh: 84; makefile: 10
file content (92 lines) | stat: -rw-r--r-- 2,558 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
    SPDX-FileCopyrightText: 1998-2008 Sebastian Trueg <trueg@k3b.org>

    SPDX-License-Identifier: GPL-2.0-or-later
*/


#ifndef _K3B_PLUGIN_CONFIG_WIDGET_H_
#define _K3B_PLUGIN_CONFIG_WIDGET_H_

#include "k3b_export.h"

#include <KCModule>
#include <KPluginFactory>

class KConfigGroup;

namespace K3b {
    /**
     * A config widget for a K3b plugin.
     *
     * Most implementation details for KCModules apply.
     *
     * Create a desktop file along the lines of:
     *
     * \code
     * [Desktop Entry]
     * Name=K3b Lame Mp3 Encoder Config Module
     * Type=Service
     * X-KDE-ServiceTypes=KCModule
     * X-KDE-Library=kcm_k3blameencoder
     * X-KDE-ParentComponents=k3blameencoder
     * \endcode
     *
     * X-KDE-ParentComponents is important as it is the only indicator
     * for the plugin system to match the config widget to the plugin.
     *
     * Then implement KCModule::load(), KCModule::save() and KCModule::defaults()
     * to handle the configuration. In these methods you may use k3bcore->config()
     * to store the configuration in the main K3b config object under a specific
     * group.
     */
    class LIBK3B_EXPORT PluginConfigWidget : public KCModule
    {
        Q_OBJECT

    public:
        explicit PluginConfigWidget( QObject* parent, const KPluginMetaData& metaData, const QVariantList& args);
        ~PluginConfigWidget() override;

        // TODO: find a nice way to get the plugin name for the config groups
#if 0
    public Q_SLOTS:
        /**
         * reimplemented from KCModule. Do not change.
         * implement loadConfig instead.
         */
        void defaults();

        /**
         * reimplemented from KCModule. Do not change.
         * implement loadConfig instead.
         */
        void load();

        /**
         * reimplemented from KCModule. Do not change.
         * implement saveConfig instead.
         */
        void save();

    protected:
        /**
         * Load the config. Implement this instead of KCModule::load and
         * KCModule::defaults (the latter case will be handled by loading
         * from an invalid KConfigGroup object.
         *
         * \param config The config group to load the config From
         */
        virtual void loadConfig( const KConfigGroup& config );

        /**
         * Save the config
         */
        virtual void saveConfig( KConfigGroup config );
#endif
    };
}

#define K3B_EXPORT_PLUGIN_CONFIG_WIDGET( libname, classname ) K_PLUGIN_FACTORY(factory, registerPlugin<classname>();)

#endif