5
* Copyright (C) 2009 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.
23
#include "soldevicetypes.h"
25
#include <kcapacitybar.h>
28
SolProcessorDevice::SolProcessorDevice(QTreeWidgetItem *parent, const Solid::Device &device) :
29
SolDevice(parent, device)
31
deviceTypeHolder = Solid::DeviceInterface::Processor;
32
setDefaultDeviceText();
35
SolProcessorDevice::SolProcessorDevice(const Solid::DeviceInterface::Type &type) :
38
deviceTypeHolder = Solid::DeviceInterface::Processor;
40
setDeviceIcon(KIcon("cpu"));
41
setDeviceText(i18n("Processors"));
42
setDefaultListing(type);
45
void SolProcessorDevice::setDefaultListing(const Solid::DeviceInterface::Type &type)
47
createDeviceChildren<SolProcessorDevice>(this,QString(),type);
50
void SolProcessorDevice::setDefaultDeviceText()
52
const Solid::Processor *prodev = interface<const Solid::Processor>();
55
setText(0,i18n("Processor %1", QString::number(prodev->number())));
58
QVListLayout *SolProcessorDevice::infoPanelLayout()
61
const Solid::Processor *prodev = interface<const Solid::Processor>();
63
if(!prodev) return NULL;
64
deviceInfoLayout = new QVListLayout();
66
QStringList extensions;
67
const Solid::Processor::InstructionSets insSets = prodev->instructionSets();
69
if (insSets & Solid::Processor::IntelMmx) extensions << i18n("Intel MMX");
70
if (insSets & Solid::Processor::IntelSse) extensions << i18n("Intel SSE");
71
if (insSets & Solid::Processor::IntelSse2) extensions << i18n("Intel SSE2");
72
if (insSets & Solid::Processor::IntelSse3) extensions << i18n("Intel SSE3");
73
if (insSets & Solid::Processor::IntelSse4) extensions << i18n("Intel SSE4");
74
if (insSets & Solid::Processor::Amd3DNow) extensions << i18n("AMD 3DNow");
75
if (insSets & Solid::Processor::AltiVec) extensions << i18n("ATI IVEC");
76
if(extensions.isEmpty()) extensions << i18n("None");
78
labels << i18n("Processor Number: ")
79
<< InfoPanel::friendlyString(QString::number(prodev->number()))
80
<< i18n("Max Speed: ")
81
<< InfoPanel::friendlyString(QString::number(prodev->maxSpeed()))
82
<< i18n("Supported Instruction Sets: ")
83
<< extensions.join("\n");
85
deviceInfoLayout->applyQListToLayout(labels);
86
return deviceInfoLayout;
91
SolStorageDevice::SolStorageDevice(QTreeWidgetItem *parent, const Solid::Device &device, const storageChildren &c) :
92
SolDevice(parent, device)
94
deviceTypeHolder = Solid::DeviceInterface::StorageDrive;
95
setDefaultDeviceText();
97
if(c == CREATECHILDREN)
99
createDeviceChildren<SolVolumeDevice>(this,device.udi(),Solid::DeviceInterface::StorageVolume);
103
SolStorageDevice::SolStorageDevice(const Solid::DeviceInterface::Type &type) :
106
deviceTypeHolder = Solid::DeviceInterface::StorageDrive;
108
setDeviceIcon(KIcon("drive-harddisk"));
109
setDeviceText(i18n("Storage Drives"));
110
setDefaultListing(type);
113
void SolStorageDevice::setDefaultListing(const Solid::DeviceInterface::Type &type)
115
createDeviceChildren<SolStorageDevice>(this,QString(),type);
118
void SolStorageDevice::setDefaultDeviceText()
120
const Solid::StorageDrive *stodev = interface<const Solid::StorageDrive>();
124
switch (stodev->driveType())
126
case Solid::StorageDrive::HardDisk:
127
storageType = i18n("Hard Disk Drive"); break;
128
case Solid::StorageDrive::CompactFlash:
129
storageType = i18n("Compact Flash Reader"); break;
130
case Solid::StorageDrive::SmartMedia:
131
storageType = i18n("Smart Media Reader"); break;
132
case Solid::StorageDrive::SdMmc:
133
storageType = i18n("SD/MMC Reader"); break;
134
case Solid::StorageDrive::CdromDrive:
135
storageType = i18n("Optical Drive"); break;
136
case Solid::StorageDrive::MemoryStick:
137
storageType = i18n("Memory Stick Reader"); break;
138
case Solid::StorageDrive::Xd:
139
storageType = i18n("xD Reader"); break;
141
storageType = i18n("Unknown Drive");
144
QString deviceText = storageType;
145
setDeviceText(deviceText);
148
QVListLayout *SolStorageDevice::infoPanelLayout()
151
const Solid::StorageDrive *stodev = interface<const Solid::StorageDrive>();
153
if(!stodev) return NULL;
154
deviceInfoLayout = new QVListLayout();
157
switch(stodev->bus())
159
case Solid::StorageDrive::Ide:
160
bus = i18n("IDE"); break;
161
case Solid::StorageDrive::Usb:
162
bus = i18n("USB"); break;
163
case Solid::StorageDrive::Ieee1394:
164
bus = i18n("IEEE1394"); break;
165
case Solid::StorageDrive::Scsi:
166
bus = i18n("SCSI"); break;
167
case Solid::StorageDrive::Sata:
168
bus = i18n("SATA"); break;
169
case Solid::StorageDrive::Platform:
170
bus = i18n("Platform"); break;
172
bus = i18n("Unknown");
175
labels << i18n("Bus: ")
177
<< i18n("Hotpluggable?")
178
<< InfoPanel::convertTf(stodev->isHotpluggable())
179
<< i18n("Removable?")
180
<< InfoPanel::convertTf(stodev->isRemovable());
182
deviceInfoLayout->applyQListToLayout(labels);
183
return deviceInfoLayout;
188
SolNetworkDevice::SolNetworkDevice(QTreeWidgetItem *parent, const Solid::Device &device) :
189
SolDevice(parent, device)
191
deviceTypeHolder = Solid::DeviceInterface::NetworkInterface;
193
setDefaultDeviceText();
194
setDefaultDeviceIcon();
197
SolNetworkDevice::SolNetworkDevice(const Solid::DeviceInterface::Type &type) :
200
deviceTypeHolder = Solid::DeviceInterface::NetworkInterface;
202
setDeviceIcon(KIcon("network-wired"));
203
setDeviceText(i18n("Network Interfaces"));
204
setDefaultListing(type);
207
void SolNetworkDevice::setDefaultListing(const Solid::DeviceInterface::Type &type)
209
createDeviceChildren<SolNetworkDevice>(this,QString(),type);
212
void SolNetworkDevice::setDefaultDeviceText()
214
QString actTog = i18n("Connected");
215
const Solid::NetworkInterface *netdev = interface<const Solid::NetworkInterface>();
218
QString deviceText = netdev->ifaceName()
220
+ (netdev->isWireless() ? i18n("Wireless") : i18n("Wired"))
223
setDeviceText(deviceText);
226
void SolNetworkDevice::setDefaultDeviceIcon()
228
const Solid::NetworkInterface *netdev = interface<const Solid::NetworkInterface>();
231
if(netdev->isWireless() == true)
233
setDeviceIcon(KIcon("network-wireless"));
235
setDeviceIcon(KIcon("network-wired"));
239
QVListLayout *SolNetworkDevice::infoPanelLayout()
242
const Solid::NetworkInterface *netdev = interface<const Solid::NetworkInterface>();
244
if(!netdev) return NULL;
245
deviceInfoLayout = new QVListLayout();
247
labels << i18n("Hardware Address: ")
248
<< InfoPanel::friendlyString(netdev->hwAddress())
250
<< InfoPanel::convertTf(netdev->isWireless());
252
deviceInfoLayout->applyQListToLayout(labels);
253
return deviceInfoLayout;
256
void SolNetworkDevice::refreshName()
258
setDefaultDeviceText();
263
SolVolumeDevice::SolVolumeDevice(QTreeWidgetItem *parent, const Solid::Device &device) :
264
SolDevice(parent, device)
266
deviceTypeHolder = Solid::DeviceInterface::StorageVolume;
269
SolVolumeDevice::SolVolumeDevice(const Solid::DeviceInterface::Type &type) :
272
deviceTypeHolder = Solid::DeviceInterface::StorageVolume;
274
setDefaultListing(type);
277
void SolVolumeDevice::setDefaultListing(const Solid::DeviceInterface::Type &type)
279
createDeviceChildren<SolVolumeDevice>(this,QString(),type);
282
QVListLayout *SolVolumeDevice::infoPanelLayout()
285
KCapacityBar *usageBar = NULL;
287
const Solid::StorageVolume *voldev = interface<const Solid::StorageVolume>();
288
const Solid::StorageAccess *accdev = interface<const Solid::StorageAccess>();
290
if(!voldev) return NULL;
291
deviceInfoLayout = new QVListLayout();
294
switch(voldev->usage())
296
case Solid::StorageVolume::Unused:
297
usage = i18n("Unused"); break;
298
case Solid::StorageVolume::FileSystem:
299
usage = i18n("File System"); break;
300
case Solid::StorageVolume::PartitionTable:
301
usage = i18n("Partition Table"); break;
302
case Solid::StorageVolume::Raid:
303
usage = i18n("Raid"); break;
304
case Solid::StorageVolume::Encrypted:
305
usage = i18n("Encrypted"); break;
307
usage = i18n("Unknown");
310
labels << i18n("File System Type: ")
311
<< InfoPanel::friendlyString(voldev->fsType())
313
<< InfoPanel::friendlyString(voldev->label(),i18n("Not Set"))
314
<< i18n("Volume Usage: ")
317
<< InfoPanel::friendlyString(voldev->uuid());
322
<< i18n("Mounted At: ")
323
<< InfoPanel::friendlyString(accdev->filePath(),i18n("Not Mounted"));
325
if(!accdev->filePath().isEmpty())
327
KDiskFreeSpaceInfo mountSpaceInfo = KDiskFreeSpaceInfo::freeSpaceInfo(accdev->filePath());
329
labels << i18n("Volume Space:");
331
usageBar = new KCapacityBar();
332
usageBar->setValue(static_cast<int>((mountSpaceInfo.used() * 100) / mountSpaceInfo.size()));
334
i18nc("Available space out of total partition size (percent used)",
335
"%1 free of %2 (%3% used)",
336
KGlobal::locale()->formatByteSize(mountSpaceInfo.available()),
337
KGlobal::locale()->formatByteSize(mountSpaceInfo.size()),
343
deviceInfoLayout->applyQListToLayout(labels);
344
if(usageBar) deviceInfoLayout->addWidget(usageBar);
346
return deviceInfoLayout;
351
SolAudioDevice::SolAudioDevice(QTreeWidgetItem *parent, const Solid::Device &device) :
352
SolDevice(parent, device)
354
deviceTypeHolder = Solid::DeviceInterface::AudioInterface;
357
SolAudioDevice::SolAudioDevice(const Solid::DeviceInterface::Type &type) :
360
deviceTypeHolder = Solid::DeviceInterface::AudioInterface;
362
setDeviceIcon(KIcon("audio-card"));
363
setDeviceText(i18n("Audio Interfaces"));
364
setDefaultListing(type);
367
void SolAudioDevice::setDefaultListing(const Solid::DeviceInterface::Type &type)
370
alsaSubItem = NULL; ossSubItem = NULL;
376
void SolAudioDevice::listAlsa()
378
const Solid::Predicate alsaPred =
379
Solid::Predicate(Solid::DeviceInterface::AudioInterface,"driver", "Alsa",Solid::Predicate::Equals);
380
const QList<Solid::Device> list = Solid::Device::listFromQuery(alsaPred, QString());
382
if(list.count() <= 0) return;
384
createSubItems(ALSA);
385
foreach(const Solid::Device &dev, list) addItem(dev);
388
void SolAudioDevice::listOss()
390
const Solid::Predicate ossPred =
391
Solid::Predicate(Solid::DeviceInterface::AudioInterface,"driver", "OpenSoundSystem",Solid::Predicate::Equals);
392
const QList<Solid::Device> list = Solid::Device::listFromQuery(ossPred, QString());
394
if(list.count() <= 0) return;
397
foreach(const Solid::Device &dev, list) addItem(dev);
400
void SolAudioDevice::createSubItems(const SubMenus &menus)
404
alsaSubItem = new SolDevice(this);
405
alsaSubItem->setDeviceIcon(KIcon("audio-card"));
406
alsaSubItem->setText(0,i18n("Alsa Interfaces"));
408
ossSubItem = new SolDevice(this);
409
ossSubItem->setDeviceIcon(KIcon("audio-card"));
410
ossSubItem->setText(0,i18n("Open Sound System Interfaces"));
414
void SolAudioDevice::addItem(Solid::Device dev)
416
const Solid::AudioInterface *auddev = interface<const Solid::AudioInterface>(dev);
419
switch(auddev->driver())
421
case Solid::AudioInterface::Alsa:
422
if(!alsaSubItem) createSubItems(ALSA);
423
new SolAudioDevice(alsaSubItem,dev);
425
case Solid::AudioInterface::OpenSoundSystem:
426
if(!ossSubItem) createSubItems(OSS);
427
new SolAudioDevice(ossSubItem,dev);
430
new SolAudioDevice(this,dev);
434
QVListLayout *SolAudioDevice::infoPanelLayout()
437
const Solid::AudioInterface *auddev = interface<const Solid::AudioInterface>();
439
if(!auddev) return NULL;
440
deviceInfoLayout = new QVListLayout();
443
switch(auddev->deviceType())
445
case Solid::AudioInterface::AudioControl:
446
AiType = i18n("Control"); break;
447
case Solid::AudioInterface::AudioInput:
448
AiType = i18n("Input"); break;
449
case Solid::AudioInterface::AudioOutput:
450
AiType = i18n("Output"); break;
452
AiType = i18n("Unknown");
456
switch(auddev->soundcardType())
458
case Solid::AudioInterface::InternalSoundcard:
459
ScType = i18n("Internal Soundcard"); break;
460
case Solid::AudioInterface::UsbSoundcard:
461
ScType = i18n("USB Soundcard"); break;
462
case Solid::AudioInterface::FirewireSoundcard:
463
ScType = i18n("Firewire Soundcard"); break;
464
case Solid::AudioInterface::Headset:
465
ScType = i18n("Headset"); break;
466
case Solid::AudioInterface::Modem:
467
ScType = i18n("Modem"); break;
469
ScType = i18n("Unknown");
472
labels << i18n("Audio Interface Type: ")
474
<< i18n("Soundcard Type: ")
477
deviceInfoLayout->applyQListToLayout(labels);
478
return deviceInfoLayout;
483
SolButtonDevice::SolButtonDevice(QTreeWidgetItem *parent, const Solid::Device &device) :
484
SolDevice(parent, device)
486
deviceTypeHolder = Solid::DeviceInterface::Button;
488
setDefaultDeviceIcon();
491
SolButtonDevice::SolButtonDevice(const Solid::DeviceInterface::Type &type) :
494
deviceTypeHolder = Solid::DeviceInterface::Button;
496
setDeviceIcon(KIcon("insert-button"));
497
setDeviceText(i18n("Device Buttons"));
498
setDefaultListing(type);
501
void SolButtonDevice::setDefaultListing(const Solid::DeviceInterface::Type &type)
503
createDeviceChildren<SolButtonDevice>(this,QString(),type);
506
void SolButtonDevice::setDefaultDeviceIcon()
508
setDeviceIcon(KIcon("insert-button"));
511
QVListLayout *SolButtonDevice::infoPanelLayout()
514
const Solid::Button *butdev = interface<const Solid::Button>();
516
if(!butdev) return NULL;
517
deviceInfoLayout = new QVListLayout();
520
switch(butdev->type())
522
case Solid::Button::LidButton:
523
type = i18n("Lid Button"); break;
524
case Solid::Button::PowerButton:
525
type = i18n("Power Button"); break;
526
case Solid::Button::SleepButton:
527
type = i18n("Sleep Button"); break;
528
case Solid::Button::TabletButton:
529
type = i18n("Tablet Button"); break;
531
type = i18n("Unknown Button");
534
labels << i18n("Button type: ")
536
<< i18n("Has State?")
537
<< InfoPanel::convertTf(butdev->hasState());
539
deviceInfoLayout->applyQListToLayout(labels);
540
return deviceInfoLayout;
545
SolMediaPlayerDevice::SolMediaPlayerDevice(QTreeWidgetItem *parent, const Solid::Device &device) :
546
SolDevice(parent, device)
548
deviceTypeHolder = Solid::DeviceInterface::PortableMediaPlayer;
551
SolMediaPlayerDevice::SolMediaPlayerDevice(const Solid::DeviceInterface::Type &type) :
554
deviceTypeHolder = Solid::DeviceInterface::PortableMediaPlayer;
556
setDeviceIcon(KIcon("multimedia-player"));
557
setDeviceText(i18n("Multimedia Players"));
558
setDefaultListing(type);
561
void SolMediaPlayerDevice::setDefaultListing(const Solid::DeviceInterface::Type &type)
563
createDeviceChildren<SolMediaPlayerDevice>(this,QString(),type);
566
QVListLayout *SolMediaPlayerDevice::infoPanelLayout()
569
const Solid::PortableMediaPlayer *mpdev = interface<const Solid::PortableMediaPlayer>();
571
if(!mpdev) return NULL;
572
deviceInfoLayout = new QVListLayout();
574
labels << i18n("Supported Drivers: ")
575
<< mpdev->supportedDrivers()
576
<< i18n("Supported Protocols: ")
577
<< mpdev->supportedProtocols();
579
deviceInfoLayout->applyQListToLayout(labels);
580
return deviceInfoLayout;
585
SolCameraDevice::SolCameraDevice(QTreeWidgetItem *parent, const Solid::Device &device) :
586
SolDevice(parent, device)
588
deviceTypeHolder = Solid::DeviceInterface::Camera;
591
SolCameraDevice::SolCameraDevice(const Solid::DeviceInterface::Type &type) :
594
deviceTypeHolder = Solid::DeviceInterface::Camera;
596
setDeviceIcon(KIcon("camera-web"));
597
setDeviceText(i18n("Cameras"));
598
setDefaultListing(type);
601
void SolCameraDevice::setDefaultListing(const Solid::DeviceInterface::Type &type)
603
createDeviceChildren<SolCameraDevice>(this,QString(),type);
606
QVListLayout *SolCameraDevice::infoPanelLayout()
609
const Solid::Camera *camdev = interface<const Solid::Camera>();
611
if(!camdev) return NULL;
612
deviceInfoLayout = new QVListLayout();
614
labels << i18n("Supported Drivers: ")
615
<< camdev->supportedDrivers()
616
<< i18n("Supported Protocols: ")
617
<< camdev->supportedProtocols();
619
deviceInfoLayout->applyQListToLayout(labels);
620
return deviceInfoLayout;
625
SolBatteryDevice::SolBatteryDevice(QTreeWidgetItem *parent, const Solid::Device &device) :
626
SolDevice(parent, device)
628
deviceTypeHolder = Solid::DeviceInterface::Battery;
631
SolBatteryDevice::SolBatteryDevice(const Solid::DeviceInterface::Type &type) :
634
deviceTypeHolder = Solid::DeviceInterface::Battery;
636
setDeviceIcon(KIcon("battery"));
637
setDeviceText(i18n("Batteries"));
638
setDefaultListing(type);
641
void SolBatteryDevice::setDefaultListing(const Solid::DeviceInterface::Type &type)
643
createDeviceChildren<SolBatteryDevice>(this,QString(),type);
646
QVListLayout *SolBatteryDevice::infoPanelLayout()
649
const Solid::Battery *batdev = interface<const Solid::Battery>();
651
if(!batdev) return NULL;
652
deviceInfoLayout = new QVListLayout();
655
switch(batdev->type())
657
case Solid::Battery::PdaBattery:
658
type = i18n("PDA"); break;
659
case Solid::Battery::UpsBattery:
660
type = i18n("UPS"); break;
661
case Solid::Battery::MouseBattery:
662
type = i18n("Mouse"); break;
663
case Solid::Battery::PrimaryBattery:
664
type = i18n("Primary"); break;
665
case Solid::Battery::KeyboardBattery:
666
type = i18n("Keyboard"); break;
667
case Solid::Battery::KeyboardMouseBattery:
668
type = i18n("Keyboard + Mouse"); break;
669
case Solid::Battery::CameraBattery:
670
type = i18n("Camera"); break;
672
type = i18n("Unknown");
676
switch(batdev->type())
678
case Solid::Battery::Charging:
679
state = i18n("Charging"); break;
680
case Solid::Battery::Discharging:
681
state = i18n("Discharging"); break;
683
state = i18n("No Charge");
686
labels << i18n("Battery Type: ")
688
<< i18n("Charge Status: ")
691
deviceInfoLayout->applyQListToLayout(labels);
692
return deviceInfoLayout;
697
SolAcAdapterDevice::SolAcAdapterDevice(QTreeWidgetItem *parent, const Solid::Device &device) :
698
SolDevice(parent, device)
700
deviceTypeHolder = Solid::DeviceInterface::AcAdapter;
703
SolAcAdapterDevice::SolAcAdapterDevice(const Solid::DeviceInterface::Type &type) :
706
deviceTypeHolder = Solid::DeviceInterface::AcAdapter;
708
setDeviceIcon(KIcon("kde"));
709
setDeviceText(i18n("AC Adapters"));
710
setDefaultListing(type);
713
void SolAcAdapterDevice::setDefaultListing(const Solid::DeviceInterface::Type &type)
715
createDeviceChildren<SolAcAdapterDevice>(this,QString(),type);
718
QVListLayout *SolAcAdapterDevice::infoPanelLayout()
721
const Solid::AcAdapter *acdev = interface<const Solid::AcAdapter>();
723
if(!acdev) return NULL;
724
deviceInfoLayout = new QVListLayout();
726
labels << i18n("Is plugged in?")
727
<< InfoPanel::convertTf(acdev->isPlugged());
729
deviceInfoLayout->applyQListToLayout(labels);
730
return deviceInfoLayout;
735
SolDvbDevice::SolDvbDevice(QTreeWidgetItem *parent, const Solid::Device &device) :
736
SolDevice(parent, device)
738
deviceTypeHolder = Solid::DeviceInterface::DvbInterface;
741
SolDvbDevice::SolDvbDevice(const Solid::DeviceInterface::Type &type) :
744
deviceTypeHolder = Solid::DeviceInterface::DvbInterface;
746
setDeviceIcon(KIcon("kde"));
747
setDeviceText(i18n("Digital Video Broadcasting Devices"));
748
setDefaultListing(type);
751
void SolDvbDevice::setDefaultListing(const Solid::DeviceInterface::Type &type)
753
createDeviceChildren<SolDvbDevice>(this,QString(),type);
756
QVListLayout *SolDvbDevice::infoPanelLayout()
759
const Solid::DvbInterface *dvbdev = interface<const Solid::DvbInterface>();
761
if(!dvbdev) return NULL;
762
deviceInfoLayout = new QVListLayout();
765
switch(dvbdev->deviceType())
767
case Solid::DvbInterface::DvbAudio:
768
type = i18n("Audio"); break;
769
case Solid::DvbInterface::DvbCa:
770
type = i18n("Conditional access system"); break;
771
case Solid::DvbInterface::DvbDemux:
772
type = i18n("Demux"); break;
773
case Solid::DvbInterface::DvbDvr:
774
type = i18n("Digital video recorder"); break;
775
case Solid::DvbInterface::DvbFrontend:
776
type = i18n("Front end"); break;
777
case Solid::DvbInterface::DvbNet:
778
type = i18n("Network"); break;
779
case Solid::DvbInterface::DvbOsd:
780
type = i18n("On-Screen display"); break;
781
case Solid::DvbInterface::DvbSec:
782
type = i18n("Security and content protection"); break;
783
case Solid::DvbInterface::DvbVideo:
784
type = i18n("Video"); break;
785
case Solid::DvbInterface::DvbUnknown:
787
type = i18n("Unknown");
790
labels << i18n("Device Type: ")
793
deviceInfoLayout->applyQListToLayout(labels);
794
return deviceInfoLayout;
799
SolSerialDevice::SolSerialDevice(QTreeWidgetItem *parent, const Solid::Device &device) :
800
SolDevice(parent, device)
802
deviceTypeHolder = Solid::DeviceInterface::SerialInterface;
805
SolSerialDevice::SolSerialDevice(const Solid::DeviceInterface::Type &type) :
808
deviceTypeHolder = Solid::DeviceInterface::SerialInterface;
810
setDeviceIcon(KIcon("printer"));
811
setDeviceText(i18n("Serial Devices"));
812
setDefaultListing(type);
815
void SolSerialDevice::setDefaultListing(const Solid::DeviceInterface::Type &type)
817
createDeviceChildren<SolSerialDevice>(this,QString(),type);
820
QVListLayout *SolSerialDevice::infoPanelLayout()
823
const Solid::SerialInterface *serdev = interface<const Solid::SerialInterface>();
825
if(!serdev) return NULL;
826
deviceInfoLayout = new QVListLayout();
829
switch(serdev->serialType())
831
case Solid::SerialInterface::Platform:
832
type = i18n("Platform"); break;
833
case Solid::SerialInterface::Usb:
834
type = i18n("USB"); break;
836
type = i18n("Unknown");
839
QString port = i18n("Unknown");
840
if(serdev->port() != -1) port = QString::number(serdev->port());
842
labels << i18n("Serial Type: ")
847
deviceInfoLayout->applyQListToLayout(labels);
848
return deviceInfoLayout;
853
SolSmartCardDevice::SolSmartCardDevice(QTreeWidgetItem *parent, const Solid::Device &device) :
854
SolDevice(parent, device)
856
deviceTypeHolder = Solid::DeviceInterface::SmartCardReader;
859
SolSmartCardDevice::SolSmartCardDevice(const Solid::DeviceInterface::Type &type) :
862
deviceTypeHolder = Solid::DeviceInterface::SmartCardReader;
864
setDeviceIcon(KIcon("kde"));
865
setDeviceText(i18n("Smart Card Devices"));
866
setDefaultListing(type);
869
void SolSmartCardDevice::setDefaultListing(const Solid::DeviceInterface::Type &type)
871
createDeviceChildren<SolSmartCardDevice>(this,QString(),type);
874
QVListLayout *SolSmartCardDevice::infoPanelLayout()
877
const Solid::SmartCardReader *scdev = interface<const Solid::SmartCardReader>();
879
if(!scdev) return NULL;
880
deviceInfoLayout = new QVListLayout();
883
switch(scdev->readerType())
885
case Solid::SmartCardReader::CardReader:
886
type = i18n("Card Reader"); break;
887
case Solid::SmartCardReader::CryptoToken:
888
type = i18n("Crypto Token"); break;
890
type = i18n("Unknown");
893
labels << i18n("Smart Card Type: ")
896
deviceInfoLayout->applyQListToLayout(labels);
897
return deviceInfoLayout;
902
SolVideoDevice::SolVideoDevice(QTreeWidgetItem *parent, const Solid::Device &device) :
903
SolDevice(parent, device)
905
deviceTypeHolder = Solid::DeviceInterface::Video;
908
SolVideoDevice::SolVideoDevice(const Solid::DeviceInterface::Type &type) :
911
deviceTypeHolder = Solid::DeviceInterface::Video;
913
setDeviceIcon(KIcon("video-display"));
914
setDeviceText(i18n("Video Devices"));
915
setDefaultListing(type);
918
void SolVideoDevice::setDefaultListing(const Solid::DeviceInterface::Type &type)
920
createDeviceChildren<SolVideoDevice>(this,QString(),type);
923
QVListLayout *SolVideoDevice::infoPanelLayout()
926
const Solid::Video *viddev = interface<const Solid::Video>();
928
if(!viddev) return NULL;
929
deviceInfoLayout = new QVListLayout();
931
labels << i18n("Supported Drivers: ")
932
<< viddev->supportedDrivers()
933
<< i18n("Supported Protocols: ")
934
<< viddev->supportedProtocols();
936
deviceInfoLayout->applyQListToLayout(labels);
937
return deviceInfoLayout;