use DisplayName namespace everywhere for setting displayname attribute
Dieser Commit ist enthalten in:
Ursprung
42a958d3f8
Commit
5694305ab8
@ -26,6 +26,7 @@
|
||||
#include "../world/world.hpp"
|
||||
#include "../world/worldloader.hpp"
|
||||
#include "../core/attributes.hpp"
|
||||
#include "../utils/displayname.hpp"
|
||||
|
||||
Board::Board(const std::weak_ptr<World>& world, std::string_view _id) :
|
||||
IdObject(world, _id),
|
||||
@ -98,7 +99,7 @@ Board::Board(const std::weak_ptr<World>& world, std::string_view _id) :
|
||||
const bool editable = w && contains(w->state.value(), WorldState::Edit);
|
||||
const bool stopped = w && !contains(w->state.value(), WorldState::Run);
|
||||
|
||||
Attributes::addDisplayName(name, "object:name");
|
||||
Attributes::addDisplayName(name, DisplayName::Object::name);
|
||||
Attributes::addEnabled(name, editable);
|
||||
m_interfaceItems.add(name);
|
||||
m_interfaceItems.add(left);
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
#include "blockrailtile.hpp"
|
||||
#include "../../../world/world.hpp"
|
||||
#include "../../../core/attributes.hpp"
|
||||
#include "../../../utils/displayname.hpp"
|
||||
|
||||
BlockRailTile::BlockRailTile(const std::weak_ptr<World>& world, std::string_view _id) :
|
||||
RailTile(world, _id, TileId::RailBlock),
|
||||
@ -39,7 +40,7 @@ BlockRailTile::BlockRailTile(const std::weak_ptr<World>& world, std::string_view
|
||||
const bool editable = w && contains(w->state.value(), WorldState::Edit);
|
||||
|
||||
Attributes::addEnabled(name, editable);
|
||||
Attributes::addDisplayName(name, "object:name");
|
||||
Attributes::addDisplayName(name, DisplayName::Object::name);
|
||||
m_interfaceItems.add(name);
|
||||
m_interfaceItems.add(inputMap);
|
||||
Attributes::addValues(state, blockStateValues);
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
#include "../../../world/world.hpp"
|
||||
#include "../../../core/attributes.hpp"
|
||||
#include "../../../utils/sensor.hpp"
|
||||
#include "../../../utils/displayname.hpp"
|
||||
|
||||
SensorRailTile::SensorRailTile(const std::weak_ptr<World>& world, std::string_view _id) :
|
||||
StraightRailTile(world, _id, TileId::RailSensor),
|
||||
@ -64,7 +65,7 @@ SensorRailTile::SensorRailTile(const std::weak_ptr<World>& world, std::string_vi
|
||||
const bool editable = w && contains(w->state.value(), WorldState::Edit);
|
||||
|
||||
Attributes::addEnabled(name, editable);
|
||||
Attributes::addDisplayName(name, "object:name");
|
||||
Attributes::addDisplayName(name, DisplayName::Object::name);
|
||||
m_interfaceItems.add(name);
|
||||
Attributes::addEnabled(input, editable);
|
||||
Attributes::addObjectList(input, w->inputs);
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
#include "signalrailtile.hpp"
|
||||
#include "../../../../core/attributes.hpp"
|
||||
#include "../../../../world/getworld.hpp"
|
||||
#include "../../../../utils/displayname.hpp"
|
||||
|
||||
SignalRailTile::SignalRailTile(const std::weak_ptr<World>& world, std::string_view _id, TileId tileId) :
|
||||
StraightRailTile(world, _id, tileId),
|
||||
@ -38,7 +39,7 @@ SignalRailTile::SignalRailTile(const std::weak_ptr<World>& world, std::string_vi
|
||||
auto w = world.lock();
|
||||
const bool editable = w && contains(w->state.value(), WorldState::Edit);
|
||||
|
||||
Attributes::addDisplayName(name, "object:name");
|
||||
Attributes::addDisplayName(name, DisplayName::Object::name);
|
||||
Attributes::addEnabled(name, editable);
|
||||
m_interfaceItems.add(name);
|
||||
Attributes::addObjectEditor(aspect, false);
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
#include "turnoutrailtile.hpp"
|
||||
#include "../../../../core/attributes.hpp"
|
||||
#include "../../../../world/world.hpp"
|
||||
#include "../../../../utils/displayname.hpp"
|
||||
|
||||
TurnoutRailTile::TurnoutRailTile(const std::weak_ptr<World>& world, std::string_view _id, TileId tileId) :
|
||||
RailTile(world, _id, tileId),
|
||||
@ -38,7 +39,7 @@ TurnoutRailTile::TurnoutRailTile(const std::weak_ptr<World>& world, std::string_
|
||||
auto w = world.lock();
|
||||
const bool editable = w && contains(w->state.value(), WorldState::Edit);
|
||||
|
||||
Attributes::addDisplayName(name, "object:name");
|
||||
Attributes::addDisplayName(name, DisplayName::Object::name);
|
||||
Attributes::addEnabled(name, editable);
|
||||
m_interfaceItems.add(name);
|
||||
Attributes::addObjectEditor(position, false);
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
#include "console.hpp"
|
||||
#include "../world/getworld.hpp"
|
||||
#include "attributes.hpp"
|
||||
#include "../utils/displayname.hpp"
|
||||
|
||||
IdObject::IdObject(const std::weak_ptr<World>& world, std::string_view _id) :
|
||||
Object{},
|
||||
@ -49,7 +50,7 @@ IdObject::IdObject(const std::weak_ptr<World>& world, std::string_view _id) :
|
||||
auto w = world.lock();
|
||||
const bool editable = w && contains(w->state.value(), WorldState::Edit);
|
||||
|
||||
Attributes::addDisplayName(id, "object:id");
|
||||
Attributes::addDisplayName(id, DisplayName::Object::id);
|
||||
Attributes::addEnabled(id, editable);
|
||||
m_interfaceItems.add(id);
|
||||
}
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
#include "../decoder/decoder.hpp"
|
||||
#include "../decoder/decoderlist.hpp"
|
||||
#include "../../core/attributes.hpp"
|
||||
#include "../../utils/displayname.hpp"
|
||||
|
||||
CommandStation::CommandStation(const std::weak_ptr<World>& world, std::string_view _id) :
|
||||
IdObject(world, _id),
|
||||
@ -60,7 +61,7 @@ CommandStation::CommandStation(const std::weak_ptr<World>& world, std::string_vi
|
||||
auto w = world.lock();
|
||||
const bool editable = w && contains(w->state.value(), WorldState::Edit);
|
||||
|
||||
Attributes::addDisplayName(name, "object:name");
|
||||
Attributes::addDisplayName(name, DisplayName::Object::name);
|
||||
Attributes::addEnabled(name, editable);
|
||||
m_interfaceItems.add(name);
|
||||
|
||||
@ -78,7 +79,7 @@ CommandStation::CommandStation(const std::weak_ptr<World>& world, std::string_vi
|
||||
|
||||
m_interfaceItems.add(controllers);
|
||||
|
||||
Attributes::addDisplayName(notes, "object:notes");
|
||||
Attributes::addDisplayName(notes, DisplayName::Object::notes);
|
||||
m_interfaceItems.add(notes);
|
||||
}
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
#include "../commandstation/commandstation.hpp"
|
||||
#include "../../world/getworld.hpp"
|
||||
#include "../../core/attributes.hpp"
|
||||
#include "../../utils/displayname.hpp"
|
||||
|
||||
Controller::Controller(const std::weak_ptr<World>& _world, std::string_view _id) :
|
||||
IdObject(_world, _id),
|
||||
@ -51,13 +52,13 @@ Controller::Controller(const std::weak_ptr<World>& _world, std::string_view _id)
|
||||
auto world = _world.lock();
|
||||
const bool editable = world && contains(world->state.value(), WorldState::Edit);
|
||||
|
||||
Attributes::addDisplayName(name, "object:name");
|
||||
Attributes::addDisplayName(name, DisplayName::Object::name);
|
||||
m_interfaceItems.add(name);
|
||||
Attributes::addEnabled(commandStation, editable);
|
||||
Attributes::addObjectList(commandStation, world->commandStations);
|
||||
m_interfaceItems.add(commandStation);
|
||||
m_interfaceItems.add(active);
|
||||
Attributes::addDisplayName(notes, "object:notes");
|
||||
Attributes::addDisplayName(notes, DisplayName::Object::notes);
|
||||
m_interfaceItems.add(notes);
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This file is part of the traintastic source code.
|
||||
*
|
||||
* Copyright (C) 2019-2020 Reinder Feenstra
|
||||
* Copyright (C) 2019-2021 Reinder Feenstra
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -29,6 +29,7 @@
|
||||
#include "../../world/world.hpp"
|
||||
#include "../commandstation/commandstation.hpp"
|
||||
#include "../../core/attributes.hpp"
|
||||
#include "../../utils/displayname.hpp"
|
||||
|
||||
//constexpr uint16_t addressDCCMin = 1;
|
||||
constexpr uint16_t addressDCCShortMax = 127;
|
||||
@ -111,7 +112,7 @@ Decoder::Decoder(const std::weak_ptr<World>& world, std::string_view _id) :
|
||||
|
||||
// const bool editable = w && contains(w->state.value(), WorldState::Edit) && speedStep == 0;
|
||||
|
||||
Attributes::addDisplayName(name, "object:name");
|
||||
Attributes::addDisplayName(name, DisplayName::Object::name);
|
||||
Attributes::addEnabled(name, false);
|
||||
m_interfaceItems.add(name);
|
||||
Attributes::addEnabled(commandStation, false);
|
||||
@ -131,7 +132,7 @@ Decoder::Decoder(const std::weak_ptr<World>& world, std::string_view _id) :
|
||||
m_interfaceItems.add(speedSteps);
|
||||
m_interfaceItems.add(speedStep);
|
||||
m_interfaceItems.add(functions);
|
||||
Attributes::addDisplayName(notes, "object:notes");
|
||||
Attributes::addDisplayName(notes, DisplayName::Object::notes);
|
||||
m_interfaceItems.add(notes);
|
||||
|
||||
updateEditable();
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
#include "decoderchangeflags.hpp"
|
||||
#include "../../world/world.hpp"
|
||||
#include "../../core/attributes.hpp"
|
||||
#include "../../utils/displayname.hpp"
|
||||
|
||||
const std::shared_ptr<DecoderFunction> DecoderFunction::null;
|
||||
|
||||
@ -54,7 +55,7 @@ DecoderFunction::DecoderFunction(Decoder& decoder, std::string_view _id) :
|
||||
|
||||
Attributes::addEnabled(number, editable);
|
||||
m_interfaceItems.add(number);
|
||||
Attributes::addDisplayName(name, "object:name");
|
||||
Attributes::addDisplayName(name, DisplayName::Object::name);
|
||||
Attributes::addEnabled(name, editable);
|
||||
m_interfaceItems.add(name);
|
||||
Attributes::addEnabled(type, editable);
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
#include "../../world/world.hpp"
|
||||
#include "list/inputlisttablemodel.hpp"
|
||||
#include "../../core/attributes.hpp"
|
||||
#include "../../utils/displayname.hpp"
|
||||
|
||||
Input::Input(const std::weak_ptr<World> world, std::string_view _id) :
|
||||
IdObject(world, _id),
|
||||
@ -33,7 +34,7 @@ Input::Input(const std::weak_ptr<World> world, std::string_view _id) :
|
||||
auto w = world.lock();
|
||||
const bool editable = w && contains(w->state.value(), WorldState::Edit);
|
||||
|
||||
Attributes::addDisplayName(name, "object:name");
|
||||
Attributes::addDisplayName(name, DisplayName::Object::name);
|
||||
Attributes::addEnabled(name, editable);
|
||||
m_interfaceItems.add(name);
|
||||
Attributes::addObjectEditor(value, false);
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
#include "../../world/world.hpp"
|
||||
#include "list/outputlisttablemodel.hpp"
|
||||
#include "../../core/attributes.hpp"
|
||||
#include "../../utils/displayname.hpp"
|
||||
|
||||
Output::Output(const std::weak_ptr<World> world, std::string_view _id) :
|
||||
IdObject(world, _id),
|
||||
@ -41,7 +42,7 @@ Output::Output(const std::weak_ptr<World> world, std::string_view _id) :
|
||||
auto w = world.lock();
|
||||
const bool editable = w && contains(w->state.value(), WorldState::Edit);
|
||||
|
||||
Attributes::addDisplayName(name, "object:name");
|
||||
Attributes::addDisplayName(name, DisplayName::Object::name);
|
||||
Attributes::addEnabled(name, editable);
|
||||
m_interfaceItems.add(name);
|
||||
Attributes::addObjectEditor(value, false);
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
#include "../core/attributes.hpp"
|
||||
#include "../world/worldloader.hpp"
|
||||
#include "../world/worldsaver.hpp"
|
||||
#include "../utils/displayname.hpp"
|
||||
|
||||
namespace Lua {
|
||||
|
||||
@ -64,6 +65,7 @@ Script::Script(const std::weak_ptr<World>& world, std::string_view _id) :
|
||||
stopSandbox();
|
||||
}}
|
||||
{
|
||||
Attributes::addDisplayName(name, DisplayName::Object::name);
|
||||
Attributes::addEnabled(name, false);
|
||||
m_interfaceItems.add(name);
|
||||
Attributes::addValues(state, LuaScriptStateValues);
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This file is part of the traintastic source code.
|
||||
*
|
||||
* Copyright (C) 2019-2020 Reinder Feenstra
|
||||
* Copyright (C) 2019-2021 Reinder Feenstra
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -24,6 +24,7 @@
|
||||
#include "../world/world.hpp"
|
||||
#include "trainlisttablemodel.hpp"
|
||||
#include "../core/attributes.hpp"
|
||||
#include "../utils/displayname.hpp"
|
||||
|
||||
Train::Train(const std::weak_ptr<World>& world, std::string_view _id) :
|
||||
IdObject(world, _id),
|
||||
@ -42,7 +43,7 @@ Train::Train(const std::weak_ptr<World>& world, std::string_view _id) :
|
||||
auto w = world.lock();
|
||||
const bool editable = w && contains(w->state.value(), WorldState::Edit);
|
||||
|
||||
Attributes::addDisplayName(name, "object:name");
|
||||
Attributes::addDisplayName(name, DisplayName::Object::name);
|
||||
Attributes::addEnabled(name, editable);
|
||||
m_interfaceItems.add(name);
|
||||
m_interfaceItems.add(lob);
|
||||
@ -57,7 +58,7 @@ Train::Train(const std::weak_ptr<World>& world, std::string_view _id) :
|
||||
m_interfaceItems.add(throttleSpeed);
|
||||
m_interfaceItems.add(weight);
|
||||
m_interfaceItems.add(vehicles);
|
||||
Attributes::addDisplayName(notes, "object:notes");
|
||||
Attributes::addDisplayName(notes, DisplayName::Object::notes);
|
||||
m_interfaceItems.add(notes);
|
||||
}
|
||||
|
||||
|
||||
@ -31,6 +31,7 @@ namespace DisplayName
|
||||
{
|
||||
constexpr std::string_view id = "object:id";
|
||||
constexpr std::string_view name = "object:name";
|
||||
constexpr std::string_view notes = "object:notes";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This file is part of the traintastic source code.
|
||||
*
|
||||
* Copyright (C) 2019-2020 Reinder Feenstra
|
||||
* Copyright (C) 2019-2021 Reinder Feenstra
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -23,6 +23,7 @@
|
||||
#include "vehicle.hpp"
|
||||
#include "../world/world.hpp"
|
||||
#include "../core/attributes.hpp"
|
||||
#include "../utils/displayname.hpp"
|
||||
|
||||
Vehicle::Vehicle(const std::weak_ptr<World>& world, std::string_view _id) :
|
||||
IdObject(world, _id),
|
||||
@ -32,10 +33,10 @@ Vehicle::Vehicle(const std::weak_ptr<World>& world, std::string_view _id) :
|
||||
auto w = world.lock();
|
||||
const bool editable = w && contains(w->state.value(), WorldState::Edit);
|
||||
|
||||
Attributes::addDisplayName(name, "object:name");
|
||||
Attributes::addDisplayName(name, DisplayName::Object::name);
|
||||
Attributes::addEnabled(name, editable);
|
||||
m_interfaceItems.add(name);
|
||||
Attributes::addDisplayName(notes, "object:notes");
|
||||
Attributes::addDisplayName(notes, DisplayName::Object::notes);
|
||||
m_interfaceItems.add(notes);
|
||||
}
|
||||
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
#include "../core/objectlisttablemodel.hpp"
|
||||
#include "../core/attributes.hpp"
|
||||
#include "../core/abstractvectorproperty.hpp"
|
||||
#include "../utils/displayname.hpp"
|
||||
|
||||
using nlohmann::json;
|
||||
|
||||
@ -187,7 +188,7 @@ World::World(Private) :
|
||||
m_filename = Traintastic::instance->worldDir() / to_string(m_uuid) / filename;
|
||||
m_filenameState = Traintastic::instance->worldDir() / to_string(m_uuid) / filenameState;
|
||||
|
||||
Attributes::addDisplayName(name, "object:name");
|
||||
Attributes::addDisplayName(name, DisplayName::Object::name);
|
||||
m_interfaceItems.add(name);
|
||||
Attributes::addEnabled(scale, false);
|
||||
Attributes::addValues(scale, WorldScaleValues);
|
||||
|
||||
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren