5
* Copyright (C) 2010 David Hubner <hubnerd@ntlworld.com>
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25
K_PLUGIN_FACTORY(devInfoModuleFactory, registerPlugin<InfoSumPlugin>();)
26
K_EXPORT_PLUGIN(devInfoModuleFactory("kcm_infosummary"))
28
InfoSumPlugin::InfoSumPlugin(QWidget *parent, const QVariantList &) :
29
KCModule(devInfoModuleFactory::componentData(), parent)
32
const KAboutData *about =
33
new KAboutData(I18N_NOOP("kcm_infosummary"), 0, ki18n("Hardware Summary Information"),
34
"0.10", KLocalizedString(), KAboutData::License_GPL,
35
ki18n("(c) 2010 David Hubner"));
41
InfoSumPlugin::~InfoSumPlugin()
45
void InfoSumPlugin::createDisplay()
47
m_layout = new QVBoxLayout(this);
48
m_layout->setAlignment(Qt::AlignTop);
49
m_layout->setSpacing(10);
53
//createMemBox(); // Awaiting Mem class from kdereview
55
m_layout->addStretch();
58
void InfoSumPlugin::createOsBox()
60
DefaultBoxWidget *osWidget = new DefaultBoxWidget();
61
osWidget->setIcon(KIcon("kde"));
62
osWidget->setLabelTitles(i18n("OS Version"),i18n("KDE SC Version"), i18n("Hostname"));
64
OsDepInfo *osInfo = new OsDepInfo();
66
osWidget->setLabelOne(osInfo->osVersion());
67
osWidget->setLabelTwo(QString(KDE_VERSION_STRING));
68
osWidget->setLabelThree(osInfo->hostName());
69
osWidget->setWhatsThis(i18nc("OS whats this","This shows information about your Operating System"));
71
m_layout->addWidget(osWidget);
76
void InfoSumPlugin::createCpuBox()
78
const QList<Solid::Device> list = Solid::Device::listFromType(Solid::DeviceInterface::Processor);
80
foreach(const Solid::Device &dev, list)
82
const Solid::Processor *prodev = dev.as<const Solid::Processor>();
85
DefaultBoxWidget *cpuWidget = new DefaultBoxWidget();
86
cpuWidget->setLabelTitles(i18n("Processor"), i18n("Processor Number"), i18n("Processor Max Speed"));
87
cpuWidget->setIcon(KIcon("cpu"));
89
cpuWidget->setLabelOne(dev.product());
90
cpuWidget->setLabelTwo(QString::number(prodev->number()));
91
cpuWidget->setLabelThree(QString::number(prodev->maxSpeed()));
92
cpuWidget->setWhatsThis(i18nc("CPU whats this","This shows information about a specific CPU in your computer"));
94
m_layout->addWidget(cpuWidget);
98
void InfoSumPlugin::createMemBox()
100
ProgressBoxWidget *memWidget = new ProgressBoxWidget();
102
memWidget->setIcon(KIcon("memory"));
103
memWidget->setLabelTitles(i18n("Memory Amount"),i18n("Memory Used/Free"));
104
m_layout->addWidget(memWidget);
107
void InfoSumPlugin::createHdBox()
109
const Solid::Predicate stoPred =
110
Solid::Predicate(Solid::DeviceInterface::StorageDrive,"driveType", "HardDisk",Solid::Predicate::Equals);
111
const QList<Solid::Device> list = Solid::Device::listFromQuery(stoPred, QString());
113
foreach(const Solid::Device &dev, list)
115
const Solid::StorageDrive *stodev = dev.as<const Solid::StorageDrive>();
118
DefaultBoxWidget *stoWidget = new DefaultBoxWidget();
119
stoWidget->setIcon(KIcon("drive-harddisk"));
121
stoWidget->setLabelTitles(i18n("Drive Title"),i18n("Storage Size"),i18n("Bus"));
122
stoWidget->setLabelOne(dev.product());
123
stoWidget->setLabelTwo(KGlobal::locale()->formatByteSize(stodev->size()));
126
switch(stodev->bus())
128
case Solid::StorageDrive::Ide:
129
bus = i18n("IDE"); break;
130
case Solid::StorageDrive::Usb:
131
bus = i18n("USB"); break;
132
case Solid::StorageDrive::Ieee1394:
133
bus = i18n("IEEE1394"); break;
134
case Solid::StorageDrive::Scsi:
135
bus = i18n("SCSI"); break;
136
case Solid::StorageDrive::Sata:
137
bus = i18n("SATA"); break;
138
case Solid::StorageDrive::Platform:
139
bus = i18n("Platform"); break;
141
bus = i18nc("Unknown device","Unknown");
144
stoWidget->setLabelThree(bus);
145
stoWidget->setWhatsThis(i18nc("Hard Drive Whats This","This shows information about a specific hard drive in your computer"));
147
m_layout->addWidget(stoWidget);