Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/appproject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1792,6 +1792,10 @@ void AppProject::loadProject(const QString& filename)
bool isForm = true;
if (xml.name() == QLatin1String("FormDataView")) {
kind = ProjectFormKind::Data;
// Version 1.x multi-view project
} else if (xml.name() == QLatin1String("FormModSim")) {
kind = ProjectFormKind::Data;
_mainWindow->setViewMode(viewMode = QMdiArea::SubWindowView);
} else if (xml.name() == QLatin1String("FormTrafficView")) {
kind = ProjectFormKind::Traffic;
} else if (xml.name() == QLatin1String("FormScriptView")) {
Expand Down Expand Up @@ -1943,6 +1947,14 @@ void AppProject::loadProject(const QString& filename)
}
}
}
// Version 1.x single view project
else if (xml.name() == QLatin1String("FormModSim")) {
_mainWindow->setViewMode(viewMode = QMdiArea::SubWindowView);
if (const auto frm = createMdiChild(ProjectFormKind::Data)) {
loadXmlOfForm(frm, xml);
frm->show();
}
}
else {
xml.skipCurrentElement();
}
Expand Down
20 changes: 10 additions & 10 deletions src/controls/outputtypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,17 +229,17 @@ inline QXmlStreamReader& operator>>(QXmlStreamReader& in, AddressColorMap& map)
if (in.name() == QLatin1String("Color")) {
const auto attributes = in.attributes();
bool ok;
const auto device_id = static_cast<quint8>(attributes.value("DeviceId").toUShort(&ok));
auto device_id = static_cast<quint8>(attributes.value("DeviceId").toUShort(&ok));
if (!ok)
device_id = 0; // use current view device id
auto type = static_cast<QModbusDataUnit::RegisterType>(attributes.value("Type").toInt(&ok));
if (!ok)
type = QModbusDataUnit::RegisterType::Invalid; // use current view type
const auto address = attributes.value("Address").toUShort(&ok);
if (ok) {
const auto type = static_cast<QModbusDataUnit::RegisterType>(attributes.value("Type").toInt(&ok));
if (ok) {
const auto address = attributes.value("Address").toUShort(&ok);
if (ok) {
const auto value = attributes.value("Value").toString();
if (!value.isEmpty())
map.insert({ device_id, type, address }, value);
}
}
const auto value = attributes.value("Value").toString();
if (!value.isEmpty())
map.insert({ device_id, type, address }, value);
}
}
in.skipCurrentElement();
Expand Down
4 changes: 3 additions & 1 deletion src/displaydefinition.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,9 @@ inline QXmlStreamWriter& operator <<(QXmlStreamWriter& xml, const ScriptViewDefi
///
inline QXmlStreamReader& operator >>(QXmlStreamReader& xml, DataViewDefinitions& dd)
{
if (xml.isStartElement() && xml.name() == QLatin1String("DataViewDefinitions")) {
if (xml.isStartElement() && (xml.name() == QLatin1String("DataViewDefinitions") ||
// Version 1.x definitions
xml.name() == QLatin1String("DisplayDefinition"))) {
const QXmlStreamAttributes attributes = xml.attributes();

if (attributes.hasAttribute("FormName")) {
Expand Down
Loading
Loading