| 35 | ClientToolModel::~ClientToolModel() = default; |
| 36 | |
| 37 | QVariant ClientToolModel::data(const QModelIndex &index, int role) const |
| 38 | { |
| 39 | if (!index.isValid()) |
| 40 | return QVariant(); |
| 41 | |
| 42 | const ToolInfo tool = m_toolManager->tools().at(index.row()); |
| 43 | switch (role) { |
| 44 | case Qt::DisplayRole: |
| 45 | return tool.name(); |
| 46 | case ToolModelRole::ToolId: |
| 47 | return tool.id(); |
| 48 | case ToolModelRole::ToolWidget: |
| 49 | return QVariant::fromValue(m_toolManager->widgetForIndex(index.row())); |
| 50 | case Qt::ToolTipRole: |
| 51 | if (!tool.remotingSupported() && Endpoint::instance()->isRemoteClient()) |
| 52 | return tr("This tool does not work in out-of-process mode."); |
| 53 | return QVariant(); |
| 54 | case ToolModelRole::ToolEnabled: |
| 55 | return tool.isEnabled(); |
| 56 | case ToolModelRole::ToolHasUi: |
| 57 | return tool.hasUi(); |
| 58 | case ToolModelRole::ToolFeedbackId: { |
| 59 | auto id = tool.id().toLower(); |
| 60 | if (id.startsWith(QLatin1String("gammaray_"))) |
| 61 | id = id.mid(9); |
| 62 | else if (id.startsWith(QLatin1String("gammaray::"))) |
| 63 | id = id.mid(10); |
| 64 | return id; |
| 65 | } |
| 66 | } |
| 67 | return QVariant(); |
| 68 | } |
| 69 | |
| 70 | void ClientToolModel::toolEnabled(int toolIndex) |
| 71 | { |
nothing calls this directly
no test coverage detected