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.
24 #include <kcomponentdata.h>
25 #include <KPluginFactory>
26 #include <KPluginLoader>
28 /* we have to include the info.cpp-file, to get the DEFINES about possible properties.
29 example: we need the "define INFO_CPU_AVAILABLE" */
32 #include "os_current.h"
34 class KInfoModulesFactory
: public KPluginFactory
37 KInfoModulesFactory(const char *componentName
);
38 static KComponentData
componentData();
41 static KPluginFactory
*s_instance
;
43 KPluginFactory
*KInfoModulesFactory::s_instance
= 0;
45 #define CREATE_FACTORY(type, name) \
46 class K##type##InfoWidget : public KInfoListWidget \
49 K##type##InfoWidget(QWidget *parent, const QVariantList &) \
50 : KInfoListWidget(KInfoModulesFactory::componentData(), \
51 name, parent, GetInfo_##type) \
56 #ifdef INFO_CPU_AVAILABLE
57 CREATE_FACTORY(CPU
, i18n("Processor(s)"))
59 #ifdef INFO_IRQ_AVAILABLE
60 CREATE_FACTORY(IRQ
, i18n("Interrupt"))
62 #ifdef INFO_IOPORTS_AVAILABLE
63 CREATE_FACTORY(IO_Ports
, i18n("I/O-Port"))
65 #ifdef INFO_SOUND_AVAILABLE
66 CREATE_FACTORY(Sound
, i18n("Soundcard"))
68 #ifdef INFO_SCSI_AVAILABLE
69 CREATE_FACTORY(SCSI
, i18n("SCSI"))
71 #ifdef INFO_DMA_AVAILABLE
72 CREATE_FACTORY(DMA
, i18n("DMA-Channel"))
74 #ifdef INFO_DEVICES_AVAILABLE
75 CREATE_FACTORY(Devices
, i18n("Devices"))
77 #ifdef INFO_XSERVER_AVAILABLE
78 CREATE_FACTORY(XServer_and_Video
, i18n("X-Server"))
81 KInfoModulesFactory::KInfoModulesFactory(const char *componentName
)
82 : KPluginFactory(componentName
)
86 #ifdef INFO_CPU_AVAILABLE
87 registerPlugin
<KCPUInfoWidget
>("cpu");
89 #ifdef INFO_IRQ_AVAILABLE
90 registerPlugin
<KIRQInfoWidget
>("irq");
92 #ifdef INFO_IOPORTS_AVAILABLE
93 registerPlugin
<KIO_PortsInfoWidget
>("ioports");
95 #ifdef INFO_SOUND_AVAILABLE
96 registerPlugin
<KSoundInfoWidget
>("sound");
98 #ifdef INFO_SCSI_AVAILABLE
99 registerPlugin
<KSCSIInfoWidget
>("scsi");
101 #ifdef INFO_DMA_AVAILABLE
102 registerPlugin
<KDMAInfoWidget
>("dma");
104 #ifdef INFO_DEVICES_AVAILABLE
105 registerPlugin
<KDevicesInfoWidget
>("devices");
107 #ifdef INFO_XSERVER_AVAILABLE
108 registerPlugin
<KXServer_and_VideoInfoWidget
>("xserver");
112 KComponentData
KInfoModulesFactory::componentData()
114 Q_ASSERT(s_instance
);
115 return s_instance
->componentData();
118 K_EXPORT_PLUGIN(KInfoModulesFactory("kcminfo"))