add more spacing
[personal-kdebase.git] / apps / kinfocenter / info / main.cpp
blobfd02260a7be173f724dc6630f85d00f71f25771d
1 /*
2 * main.cpp
4 * Copyright (c) 1999 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
6 * Requires the Qt widget libraries, available at no cost at
7 * http://www.troll.no/
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" */
30 #include "info.h"
32 #include "os_current.h"
34 class KInfoModulesFactory : public KPluginFactory
36 public:
37 KInfoModulesFactory(const char *componentName);
38 static KComponentData componentData();
40 private:
41 static KPluginFactory *s_instance;
43 KPluginFactory *KInfoModulesFactory::s_instance = 0;
45 #define CREATE_FACTORY(type, name) \
46 class K##type##InfoWidget : public KInfoListWidget \
47 { \
48 public: \
49 K##type##InfoWidget(QWidget *parent, const QVariantList &) \
50 : KInfoListWidget(KInfoModulesFactory::componentData(), \
51 name, parent, GetInfo_##type) \
52 { \
53 } \
54 }; \
56 #ifdef INFO_CPU_AVAILABLE
57 CREATE_FACTORY(CPU, i18n("Processor(s)"))
58 #endif
59 #ifdef INFO_IRQ_AVAILABLE
60 CREATE_FACTORY(IRQ, i18n("Interrupt"))
61 #endif
62 #ifdef INFO_IOPORTS_AVAILABLE
63 CREATE_FACTORY(IO_Ports, i18n("I/O-Port"))
64 #endif
65 #ifdef INFO_SOUND_AVAILABLE
66 CREATE_FACTORY(Sound, i18n("Soundcard"))
67 #endif
68 #ifdef INFO_SCSI_AVAILABLE
69 CREATE_FACTORY(SCSI, i18n("SCSI"))
70 #endif
71 #ifdef INFO_DMA_AVAILABLE
72 CREATE_FACTORY(DMA, i18n("DMA-Channel"))
73 #endif
74 #ifdef INFO_DEVICES_AVAILABLE
75 CREATE_FACTORY(Devices, i18n("Devices"))
76 #endif
77 #ifdef INFO_XSERVER_AVAILABLE
78 CREATE_FACTORY(XServer_and_Video, i18n("X-Server"))
79 #endif
81 KInfoModulesFactory::KInfoModulesFactory(const char *componentName)
82 : KPluginFactory(componentName)
84 s_instance = this;
86 #ifdef INFO_CPU_AVAILABLE
87 registerPlugin<KCPUInfoWidget>("cpu");
88 #endif
89 #ifdef INFO_IRQ_AVAILABLE
90 registerPlugin<KIRQInfoWidget>("irq");
91 #endif
92 #ifdef INFO_IOPORTS_AVAILABLE
93 registerPlugin<KIO_PortsInfoWidget>("ioports");
94 #endif
95 #ifdef INFO_SOUND_AVAILABLE
96 registerPlugin<KSoundInfoWidget>("sound");
97 #endif
98 #ifdef INFO_SCSI_AVAILABLE
99 registerPlugin<KSCSIInfoWidget>("scsi");
100 #endif
101 #ifdef INFO_DMA_AVAILABLE
102 registerPlugin<KDMAInfoWidget>("dma");
103 #endif
104 #ifdef INFO_DEVICES_AVAILABLE
105 registerPlugin<KDevicesInfoWidget>("devices");
106 #endif
107 #ifdef INFO_XSERVER_AVAILABLE
108 registerPlugin<KXServer_and_VideoInfoWidget>("xserver");
109 #endif
112 KComponentData KInfoModulesFactory::componentData()
114 Q_ASSERT(s_instance);
115 return s_instance->componentData();
118 K_EXPORT_PLUGIN(KInfoModulesFactory("kcminfo"))