~ubuntu-branches/ubuntu/gutsy/kdebase-workspace/gutsy

« back to all changes in this revision

Viewing changes to kcontrol/infocenter/info/main.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2007-09-05 20:45:14 UTC
  • Revision ID: james.westby@ubuntu.com-20070905204514-632hhspl0nvrc84i
Tags: upstream-3.93.0
ImportĀ upstreamĀ versionĀ 3.93.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * main.cpp
 
3
 *
 
4
 * Copyright (c) 1999 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
 
5
 *
 
6
 * Requires the Qt widget libraries, available at no cost at
 
7
 * http://www.troll.no/
 
8
 *
 
9
 *  This program is free software; you can redistribute it and/or modify
 
10
 *  it under the terms of the GNU General Public License as published by
 
11
 *  the Free Software Foundation; either version 2 of the License, or
 
12
 *  (at your option) any later version.
 
13
 *
 
14
 *  This program is distributed in the hope that it will be useful,
 
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
 *  GNU General Public License for more details.
 
18
 *
 
19
 *  You should have received a copy of the GNU General Public License
 
20
 *  along with this program; if not, write to the Free Software
 
21
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
22
 */
 
23
 
 
24
 
 
25
 
 
26
#include "memory.h"
 
27
#include <kcomponentdata.h>
 
28
#include <KPluginFactory>
 
29
#include <KPluginLoader>
 
30
 
 
31
/* we have to include the info.cpp-file, to get the DEFINES about possible properties.
 
32
   example: we need the "define INFO_CPU_AVAILABLE" */
 
33
#include "info.cpp"
 
34
 
 
35
class KInfoModulesFactory : public KPluginFactory
 
36
{
 
37
    public:
 
38
        KInfoModulesFactory(const char *componentName);
 
39
        static KComponentData componentData();
 
40
 
 
41
    private:
 
42
        static KPluginFactory *s_instance;
 
43
};
 
44
KPluginFactory *KInfoModulesFactory::s_instance = 0;
 
45
 
 
46
#define CREATE_FACTORY(type, name) \
 
47
class K##type##InfoWidget : public KInfoListWidget \
 
48
{ \
 
49
    public: \
 
50
        K##type##InfoWidget(QWidget *parent, const QVariantList &) \
 
51
            : KInfoListWidget(KInfoModulesFactory::componentData(), \
 
52
                    name, parent, GetInfo_##type) \
 
53
        { \
 
54
        } \
 
55
}; \
 
56
 
 
57
#ifdef INFO_CPU_AVAILABLE
 
58
CREATE_FACTORY(CPU, i18n("Processor(s)"))
 
59
#endif
 
60
#ifdef INFO_IRQ_AVAILABLE
 
61
CREATE_FACTORY(IRQ, i18n("Interrupt"))
 
62
#endif
 
63
#ifdef INFO_PCI_AVAILABLE
 
64
CREATE_FACTORY(PCI, i18n("PCI"))
 
65
#endif
 
66
#ifdef INFO_DMA_AVAILABLE
 
67
CREATE_FACTORY(DMA, i18n("DMA-Channel"))
 
68
#endif
 
69
#ifdef INFO_IOPORTS_AVAILABLE
 
70
CREATE_FACTORY(IO_Ports, i18n("I/O-Port"))
 
71
#endif
 
72
#ifdef INFO_SOUND_AVAILABLE
 
73
CREATE_FACTORY(Sound, i18n("Soundcard"))
 
74
#endif
 
75
#ifdef INFO_SCSI_AVAILABLE
 
76
CREATE_FACTORY(SCSI, i18n("SCSI"))
 
77
#endif
 
78
#ifdef INFO_DEVICES_AVAILABLE
 
79
CREATE_FACTORY(Devices, i18n("Devices"))
 
80
#endif
 
81
#ifdef INFO_PARTITIONS_AVAILABLE
 
82
CREATE_FACTORY(Partitions, i18n("Partitions"))
 
83
#endif
 
84
#ifdef INFO_XSERVER_AVAILABLE
 
85
CREATE_FACTORY(XServer_and_Video, i18n("X-Server"))
 
86
#endif
 
87
#ifdef INFO_OPENGL_AVAILABLE
 
88
CREATE_FACTORY(OpenGL, i18n("OpenGL"))
 
89
#endif
 
90
 
 
91
KInfoModulesFactory::KInfoModulesFactory(const char *componentName)
 
92
    : KPluginFactory(componentName)
 
93
{
 
94
    s_instance = this;
 
95
    registerPlugin<KMemoryWidget>("memory");
 
96
#ifdef INFO_CPU_AVAILABLE
 
97
    registerPlugin<KCPUInfoWidget>("cpu");
 
98
#endif
 
99
#ifdef INFO_IRQ_AVAILABLE
 
100
    registerPlugin<KIRQInfoWidget>("irq");
 
101
#endif
 
102
#ifdef INFO_PCI_AVAILABLE
 
103
    registerPlugin<KPCIInfoWidget>("pci");
 
104
#endif
 
105
#ifdef INFO_DMA_AVAILABLE
 
106
    registerPlugin<KDMAInfoWidget>("dma");
 
107
#endif
 
108
#ifdef INFO_IOPORTS_AVAILABLE
 
109
    registerPlugin<KIO_PortsInfoWidget>("ioports");
 
110
#endif
 
111
#ifdef INFO_SOUND_AVAILABLE
 
112
    registerPlugin<KSoundInfoWidget>("sound");
 
113
#endif
 
114
#ifdef INFO_SCSI_AVAILABLE
 
115
    registerPlugin<KSCSIInfoWidget>("scsi");
 
116
#endif
 
117
#ifdef INFO_DEVICES_AVAILABLE
 
118
    registerPlugin<KDevicesInfoWidget>("devices");
 
119
#endif
 
120
#ifdef INFO_PARTITIONS_AVAILABLE
 
121
    registerPlugin<KPartitionsInfoWidget>("partitions");
 
122
#endif
 
123
#ifdef INFO_XSERVER_AVAILABLE
 
124
    registerPlugin<KXServer_and_VideoInfoWidget>("xserver");
 
125
#endif
 
126
#ifdef INFO_OPENGL_AVAILABLE
 
127
    registerPlugin<KOpenGLInfoWidget>("opengl");
 
128
#endif
 
129
}
 
130
 
 
131
KComponentData KInfoModulesFactory::componentData()
 
132
{
 
133
    Q_ASSERT(s_instance);
 
134
    return s_instance->componentData();
 
135
}
 
136
 
 
137
K_EXPORT_PLUGIN(KInfoModulesFactory("kcminfo"))