4 * Copyright (c) 1999 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
6 * Requires the Qt widget libraries, available at no cost at
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.
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.
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.
27 #include <kcomponentdata.h>
28 #include <KPluginFactory>
29 #include <KPluginLoader>
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" */
35 class KInfoModulesFactory
: public KPluginFactory
38 KInfoModulesFactory(const char *componentName
);
39 static KComponentData
componentData();
42 static KPluginFactory
*s_instance
;
44 KPluginFactory
*KInfoModulesFactory::s_instance
= 0;
46 #define CREATE_FACTORY(type, name) \
47 class K##type##InfoWidget : public KInfoListWidget \
50 K##type##InfoWidget(QWidget *parent, const QVariantList &) \
51 : KInfoListWidget(KInfoModulesFactory::componentData(), \
52 name, parent, GetInfo_##type) \
57 #ifdef INFO_CPU_AVAILABLE
58 CREATE_FACTORY(CPU
, i18n("Processor(s)"))
60 #ifdef INFO_IRQ_AVAILABLE
61 CREATE_FACTORY(IRQ
, i18n("Interrupt"))
63 #ifdef INFO_PCI_AVAILABLE
64 CREATE_FACTORY(PCI
, i18n("PCI"))
66 #ifdef INFO_DMA_AVAILABLE
67 CREATE_FACTORY(DMA
, i18n("DMA-Channel"))
69 #ifdef INFO_IOPORTS_AVAILABLE
70 CREATE_FACTORY(IO_Ports
, i18n("I/O-Port"))
72 #ifdef INFO_SOUND_AVAILABLE
73 CREATE_FACTORY(Sound
, i18n("Soundcard"))
75 #ifdef INFO_SCSI_AVAILABLE
76 CREATE_FACTORY(SCSI
, i18n("SCSI"))
78 #ifdef INFO_DEVICES_AVAILABLE
79 CREATE_FACTORY(Devices
, i18n("Devices"))
81 #ifdef INFO_PARTITIONS_AVAILABLE
82 CREATE_FACTORY(Partitions
, i18n("Partitions"))
84 #ifdef INFO_XSERVER_AVAILABLE
85 CREATE_FACTORY(XServer_and_Video
, i18n("X-Server"))
87 #ifdef INFO_OPENGL_AVAILABLE
88 CREATE_FACTORY(OpenGL
, i18n("OpenGL"))
91 KInfoModulesFactory::KInfoModulesFactory(const char *componentName
)
92 : KPluginFactory(componentName
)
95 registerPlugin
<KMemoryWidget
>("memory");
96 #ifdef INFO_CPU_AVAILABLE
97 registerPlugin
<KCPUInfoWidget
>("cpu");
99 #ifdef INFO_IRQ_AVAILABLE
100 registerPlugin
<KIRQInfoWidget
>("irq");
102 #ifdef INFO_PCI_AVAILABLE
103 registerPlugin
<KPCIInfoWidget
>("pci");
105 #ifdef INFO_DMA_AVAILABLE
106 registerPlugin
<KDMAInfoWidget
>("dma");
108 #ifdef INFO_IOPORTS_AVAILABLE
109 registerPlugin
<KIO_PortsInfoWidget
>("ioports");
111 #ifdef INFO_SOUND_AVAILABLE
112 registerPlugin
<KSoundInfoWidget
>("sound");
114 #ifdef INFO_SCSI_AVAILABLE
115 registerPlugin
<KSCSIInfoWidget
>("scsi");
117 #ifdef INFO_DEVICES_AVAILABLE
118 registerPlugin
<KDevicesInfoWidget
>("devices");
120 #ifdef INFO_PARTITIONS_AVAILABLE
121 registerPlugin
<KPartitionsInfoWidget
>("partitions");
123 #ifdef INFO_XSERVER_AVAILABLE
124 registerPlugin
<KXServer_and_VideoInfoWidget
>("xserver");
126 #ifdef INFO_OPENGL_AVAILABLE
127 registerPlugin
<KOpenGLInfoWidget
>("opengl");
131 KComponentData
KInfoModulesFactory::componentData()
133 Q_ASSERT(s_instance
);
134 return s_instance
->componentData();
137 K_EXPORT_PLUGIN(KInfoModulesFactory("kcminfo"))