Commit 8209b9d9 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Device: Add method to access formated output



Add a method to access strings with device information for use in
e.g. the tooltip of the target selector.

Change-Id: Icd3b0e68c0e6a88ff78e32e2f1c1450869dd59d9
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent 4a1a61fd
......@@ -36,6 +36,8 @@
#include <coreplugin/id.h>
#include <utils/qtcassert.h>
#include <QCoreApplication>
#include <QString>
#include <QUuid>
......@@ -197,6 +199,22 @@ void IDevice::setDisplayName(const QString &name)
d->displayName = name;
}
IDevice::DeviceInfo IDevice::deviceInformation() const
{
DeviceInfo result;
if (availability() == DeviceUnavailable)
//: Title of the connectivity state information in a tool tip
result << IDevice::DeviceInfoItem(QCoreApplication::translate("ProjectExplorer::IDevice", "Device"),
//: Device is not connected
QCoreApplication::translate("ProjectExplorer::IDevice", "not connected"));
else if (availability() == DeviceAvailable)
//: Title of the connectivity state information in a tool tip
result << IDevice::DeviceInfoItem(QCoreApplication::translate("ProjectExplorer::IDevice", "Device"),
//: Device is not connected
QCoreApplication::translate("ProjectExplorer::IDevice", "connected"));
return result;
}
QString IDevice::type() const
{
return d->type;
......
......@@ -63,6 +63,18 @@ public:
QString displayName() const;
void setDisplayName(const QString &name);
// Provide some information on the device suitable for formated
// output, e.g. in tool tips. Get a list of name value pairs.
class DeviceInfoItem {
public:
DeviceInfoItem(const QString &k, const QString &v) : key(k), value(v) { }
QString key;
QString value;
};
typedef QList<DeviceInfoItem> DeviceInfo;
virtual DeviceInfo deviceInformation() const;
QString type() const;
bool isAutoDetected() const;
Core::Id id() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment