decoder list: added protocol column
Dieser Commit ist enthalten in:
Ursprung
5fb957660b
Commit
f71ac69011
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This file is part of the traintastic source code.
|
||||
*
|
||||
* Copyright (C) 2022 Reinder Feenstra
|
||||
* Copyright (C) 2022-2023 Reinder Feenstra
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -32,12 +32,14 @@ enum class DecoderListColumn
|
||||
Name = 1 << 1,
|
||||
Interface = 1 << 2,
|
||||
Address = 1 << 3,
|
||||
Protocol = 1 << 4,
|
||||
};
|
||||
|
||||
constexpr std::array<DecoderListColumn, 4> decoderListColumnValues = {
|
||||
constexpr std::array<DecoderListColumn, 5> decoderListColumnValues = {
|
||||
DecoderListColumn::Id,
|
||||
DecoderListColumn::Name,
|
||||
DecoderListColumn::Interface,
|
||||
DecoderListColumn::Protocol,
|
||||
DecoderListColumn::Address,
|
||||
};
|
||||
|
||||
|
||||
@ -38,6 +38,9 @@ static std::string_view displayName(DecoderListColumn column)
|
||||
case DecoderListColumn::Interface:
|
||||
return DisplayName::Hardware::interface;
|
||||
|
||||
case DecoderListColumn::Protocol:
|
||||
return "decoder:protocol";
|
||||
|
||||
case DecoderListColumn::Address:
|
||||
return DisplayName::Hardware::address;
|
||||
}
|
||||
@ -51,6 +54,7 @@ bool DecoderListTableModel::isListedProperty(std::string_view name)
|
||||
name == "id" ||
|
||||
name == "name" ||
|
||||
name == "interface" ||
|
||||
name == "protocol" ||
|
||||
name == "address";
|
||||
}
|
||||
|
||||
@ -96,8 +100,16 @@ std::string DecoderListTableModel::getText(uint32_t column, uint32_t row) const
|
||||
}
|
||||
return "";
|
||||
|
||||
case DecoderListColumn::Protocol:
|
||||
if(const auto* it = EnumValues<DecoderProtocol>::value.find(decoder.protocol); it != EnumValues<DecoderProtocol>::value.end())
|
||||
return std::string("$").append(EnumName<DecoderProtocol>::value).append(":").append(it->second).append("$");
|
||||
break;
|
||||
|
||||
case DecoderListColumn::Address:
|
||||
return decoder.address.toString();
|
||||
if(hasAddress(decoder.protocol.value()))
|
||||
return decoder.address.toString();
|
||||
else
|
||||
return {};
|
||||
|
||||
default:
|
||||
assert(false);
|
||||
@ -118,6 +130,8 @@ void DecoderListTableModel::propertyChanged(BaseProperty& property, uint32_t row
|
||||
changed(row, DecoderListColumn::Name);
|
||||
else if(name == "interface")
|
||||
changed(row, DecoderListColumn::Interface);
|
||||
else if(name == "protocol")
|
||||
changed(row, DecoderListColumn::Protocol);
|
||||
else if(name == "address")
|
||||
changed(row, DecoderListColumn::Address);
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
#include "../../world/world.hpp"
|
||||
#include "../../world/worldloader.hpp"
|
||||
|
||||
constexpr auto decoderListColumns = DecoderListColumn::Id | DecoderListColumn::Name | DecoderListColumn::Address;
|
||||
constexpr auto decoderListColumns = DecoderListColumn::Id | DecoderListColumn::Name | DecoderListColumn::Protocol | DecoderListColumn::Address;
|
||||
constexpr auto inputListColumns = InputListColumn::Id | InputListColumn::Name | InputListColumn::Channel | InputListColumn::Address;
|
||||
constexpr auto outputListColumns = OutputListColumn::Id | OutputListColumn::Name | OutputListColumn::Channel | OutputListColumn::Address;
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
#include "../../utils/displayname.hpp"
|
||||
#include "../../utils/inrange.hpp"
|
||||
|
||||
constexpr auto decoderListColumns = DecoderListColumn::Id | DecoderListColumn::Name | DecoderListColumn::Address;
|
||||
constexpr auto decoderListColumns = DecoderListColumn::Id | DecoderListColumn::Name | DecoderListColumn::Protocol | DecoderListColumn::Address;
|
||||
constexpr auto inputListColumns = InputListColumn::Id | InputListColumn::Name | InputListColumn::Address;
|
||||
constexpr auto outputListColumns = OutputListColumn::Id | OutputListColumn::Name | OutputListColumn::Channel | OutputListColumn::Address;
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
#include "../../utils/inrange.hpp"
|
||||
#include "../../world/world.hpp"
|
||||
|
||||
constexpr auto decoderListColumns = DecoderListColumn::Id | DecoderListColumn::Name | DecoderListColumn::Address;
|
||||
constexpr auto decoderListColumns = DecoderListColumn::Id | DecoderListColumn::Name | DecoderListColumn::Protocol | DecoderListColumn::Address;
|
||||
constexpr auto inputListColumns = InputListColumn::Id | InputListColumn::Name | InputListColumn::Channel | InputListColumn::Address;
|
||||
constexpr auto outputListColumns = OutputListColumn::Id | OutputListColumn::Name | OutputListColumn::Address;
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@
|
||||
|
||||
using nlohmann::json;
|
||||
|
||||
constexpr auto decoderListColumns = DecoderListColumn::Id | DecoderListColumn::Name | DecoderListColumn::Interface | DecoderListColumn::Address;
|
||||
constexpr auto decoderListColumns = DecoderListColumn::Id | DecoderListColumn::Name | DecoderListColumn::Interface | DecoderListColumn::Protocol | DecoderListColumn::Address;
|
||||
constexpr auto inputListColumns = InputListColumn::Id | InputListColumn::Name | InputListColumn::Interface | InputListColumn::Channel | InputListColumn::Address;
|
||||
constexpr auto outputListColumns = OutputListColumn::Id | OutputListColumn::Name | OutputListColumn::Interface | OutputListColumn::Channel | OutputListColumn::Address;
|
||||
constexpr auto identificationListColumns = IdentificationListColumn::Id | IdentificationListColumn::Name | IdentificationListColumn::Interface /*| IdentificationListColumn::Channel*/ | IdentificationListColumn::Address;
|
||||
|
||||
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren