diff options
author | Darrell Anderson <humanreadable@yahoo.com> | 2012-04-06 20:03:56 -0500 |
---|---|---|
committer | Darrell Anderson <humanreadable@yahoo.com> | 2012-04-06 20:03:56 -0500 |
commit | 364c969affe63fcc5ed2aadbea44b2c88f9f6a38 (patch) | |
tree | d710c6fcfbc11c3349c28037e7da16fa6f524e60 /tdecore/tdehardwaredevices.h | |
parent | 8c03e13c8520bae51c9a2c8dfbf4864ef6dc824f (diff) | |
parent | 61531c281ba5d4792481a75eed2e01619e66f4f8 (diff) | |
download | tdelibs-364c969affe63fcc5ed2aadbea44b2c88f9f6a38.tar.gz tdelibs-364c969affe63fcc5ed2aadbea44b2c88f9f6a38.zip |
Merge branch 'master' of http://scm.trinitydesktop.org/scm/git/tdelibs
Diffstat (limited to 'tdecore/tdehardwaredevices.h')
-rw-r--r-- | tdecore/tdehardwaredevices.h | 177 |
1 files changed, 173 insertions, 4 deletions
diff --git a/tdecore/tdehardwaredevices.h b/tdecore/tdehardwaredevices.h index bab5bd064..f284a7d0c 100644 --- a/tdecore/tdehardwaredevices.h +++ b/tdecore/tdehardwaredevices.h @@ -23,6 +23,7 @@ #include <tqstring.h> #include <tqptrlist.h> #include <tqstringlist.h> +#include "kiconloader.h" #include "tdelibs_export.h" // udev includes @@ -38,15 +39,19 @@ * @author Timothy Pearson */ -// Keep readGenericDeviceTypeFromString() in tdehardwaredevices.cpp in sync with this enum +// Keep readGenericDeviceTypeFromString(), getFriendlyDeviceTypeStringFromType(), and getDeviceTypeIconFromType() in tdehardwaredevices.cpp in sync with this enum namespace TDEGenericDeviceType { enum TDEGenericDeviceType { Root, CPU, GPU, RAM, + Bus, + I2C, + MDIO, Mainboard, Disk, + SCSI, StorageController, Mouse, Keyboard, @@ -55,19 +60,29 @@ enum TDEGenericDeviceType { Printer, Scanner, Sound, + VideoCapture, IEEE1394, Camera, TextIO, + Serial, + Parallel, Peripheral, Battery, Power, + Dock, ThermalSensor, ThermalControl, + Bridge, + Platform, + PNP, OtherACPI, OtherUSB, + OtherMultimedia, OtherPeripheral, OtherSensor, - Other + OtherVirtual, + Other, + Last = Other }; }; @@ -203,6 +218,14 @@ class TDECORE_EXPORT TDEGenericDevice void setVendorModel(TQString vm); /** + * @return a TQString with a friendly name + * + * While TDE tries very hard to generate and return a friendly name for this device, + * sometimes the best it will be able to do is "Unknown Device [xxxx:yyyy]" + */ + virtual TQString friendlyName(); + + /** * @return a TQString with the device bus name, if any */ TQString &deviceBus(); @@ -271,6 +294,71 @@ class TDECORE_EXPORT TDEGenericDevice TQString &modelID(); /** + * @param a TQString with the model ID, if any + */ + void setModelID(TQString id); + + /** + * @return a TQString with the subvendor ID, if any + */ + TQString &subVendorID(); + + /** + * @param a TQString with the subvendor ID, if any + */ + void setSubVendorID(TQString id); + + /** + * @return a TQString with the submodel ID, if any + */ + TQString &subModelID(); + + /** + * @param a TQString with the submodel ID, if any + */ + void setSubModelID(TQString id); + + /** + * @return a TQString with the PCI device class, if any + */ + TQString &PCIClass(); + + /** + * @param a TQString with the PCI device class, if any + */ + void setPCIClass(TQString cl); + + /** + * @return a TQString with the module alias string, if any + */ + TQString &moduleAlias(); + + /** + * @param a TQString with the module alias string, if any + */ + void setModuleAlias(TQString ma); + + /** + * @return a TQString with the device driver, if any + */ + TQString &deviceDriver(); + + /** + * @param a TQString with the device driver, if any + */ + void setDeviceDriver(TQString dr); + + /** + * @return a TQString with the subsystem type, if any + */ + TQString &subsystem(); + + /** + * @param a TQString with the subsystem type, if any + */ + void setSubsystem(TQString ss); + + /** * @param a TDEGenericDevice* with the parent device, if any */ void setParentDevice(TDEGenericDevice* pd); @@ -281,9 +369,21 @@ class TDECORE_EXPORT TDEGenericDevice TDEGenericDevice* parentDevice(); /** - * @param a TQString with the model ID, if any + * @return a TQString containing the friendly type name */ - void setModelID(TQString id); + virtual TQString friendlyDeviceType(); + + /** + * @return a TQString containing the device bus ID, if any + */ + TQString busID(); + + /** + * Get an icon for this device + * @param size a KIcon::StdSizes structure specifying the desired icon size + * @return a TQPixmap containing the icon for the specified type + */ + virtual TQPixmap icon(KIcon::StdSizes size); private: TDEGenericDeviceType::TDEGenericDeviceType m_deviceType; @@ -296,6 +396,13 @@ class TDECORE_EXPORT TDEGenericDevice TQString m_uniqueID; TQString m_vendorID; TQString m_modelID; + TQString m_subvendorID; + TQString m_submodelID; + TQString m_pciClass; + TQString m_modAlias; + TQString m_deviceDriver; + TQString m_subsystem; + TQString m_friendlyName; bool m_blacklistedForUpdate; TDEGenericDevice* m_parentDevice; @@ -470,6 +577,29 @@ class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice */ TQString deviceFriendlySize(); + /** + * Get an icon for this device + * @param size a KIcon::StdSizes structure specifying the desired icon size + * @return a TQPixmap containing the icon for the specified type + * + * This method overrides TDEGenericDevice::icon(KIcon::StdSizes size) + */ + TQPixmap icon(KIcon::StdSizes size); + + /** + * @return a TQString with a friendly name + * + * This method overrides TDEGenericDevice::friendlyName() + */ + TQString friendlyName(); + + /** + * @return a TQString containing the friendly type name + * + * This method overrides TDEGenericDevice::friendlyDeviceType() + */ + TQString friendlyDeviceType(); + private: TDEDiskDeviceType::TDEDiskDeviceType m_diskType; TDEDiskDeviceStatus::TDEDiskDeviceStatus m_diskStatus; @@ -484,6 +614,7 @@ class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice }; typedef TQPtrList<TDEGenericDevice> TDEGenericHardwareList; +typedef TQMap<TQString, TQString> TDEDeviceIDMap; class TQSocketNotifier; @@ -545,6 +676,41 @@ class TDECORE_EXPORT TDEHardwareDevices : public TQObject */ TDEStorageDevice* findDiskByUID(TQString uid); + /** + * Look up the device in the system PCI database + * @param vendorid a TQString containing the vendor ID in hexadecimal + * @param modelid a TQString containing the model ID in hexadecimal + * @param subvendorid a TQString containing the subvendor ID in hexadecimal + * @param submodelid a TQString containing the submodel ID in hexadecimal + * @return a TQString containing the device name, if found + */ + TQString findPCIDeviceName(TQString vendorid, TQString modelid, TQString subvendorid, TQString submodelid); + + /** + * Look up the device in the system USB database + * @param vendorid a TQString containing the vendor ID in hexadecimal + * @param modelid a TQString containing the model ID in hexadecimal + * @param subvendorid a TQString containing the subvendor ID in hexadecimal + * @param submodelid a TQString containing the submodel ID in hexadecimal + * @return a TQString containing the device name, if found + */ + TQString findUSBDeviceName(TQString vendorid, TQString modelid, TQString subvendorid, TQString submodelid); + + /** + * Get a friendly string describing a device type + * @param query a TDEGenericDeviceType::TDEGenericDeviceType specifying a device type + * @return a TQString containing the friendly type name + */ + TQString getFriendlyDeviceTypeStringFromType(TDEGenericDeviceType::TDEGenericDeviceType query); + + /** + * Get an icon for a device type + * @param query a TDEGenericDeviceType::TDEGenericDeviceType specifying a device type + * @param size a KIcon::StdSizes structure specifying the desired icon size + * @return a TQPixmap containing the icon for the specified type + */ + TQPixmap getDeviceTypeIconFromType(TDEGenericDeviceType::TDEGenericDeviceType query, KIcon::StdSizes size); + signals: void hardwareAdded(TDEGenericDevice*); void hardwareRemoved(TDEGenericDevice*); @@ -578,6 +744,9 @@ class TDECORE_EXPORT TDEHardwareDevices : public TQObject TQStringList m_mountTable; + TDEDeviceIDMap* pci_id_map; + TDEDeviceIDMap* usb_id_map; + friend class TDEGenericDevice; friend class TDEStorageDevice; }; |