refactored reload function in protolocolsModel
This commit is contained in:
parent
bbb5a19700
commit
254e23be48
2 changed files with 15 additions and 15 deletions
|
|
@ -71,10 +71,24 @@ QVariant ProtocolsModel::data(const QModelIndex &index, int role) const
|
|||
void ProtocolsModel::reload()
|
||||
{
|
||||
beginResetModel();
|
||||
|
||||
QJsonObject config = getConfig();
|
||||
|
||||
QStringList keys = m_content.keys();
|
||||
if (keys.size() == 1) {
|
||||
QString protocolKey = keys.first();
|
||||
|
||||
if (config.contains(protocolKey)) {
|
||||
QJsonObject protocolConfig = config.value(protocolKey).toObject();
|
||||
protocolConfig.remove(config_key::last_config);
|
||||
config[protocolKey] = protocolConfig;
|
||||
}
|
||||
}
|
||||
|
||||
updateModel(config);
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
|
||||
void ProtocolsModel::updateModel(const QJsonObject &content)
|
||||
{
|
||||
m_container = ContainerProps::containerFromString(content.value(config_key::container).toString());
|
||||
|
|
|
|||
|
|
@ -24,20 +24,6 @@ PageType {
|
|||
ColumnLayout {
|
||||
id: header
|
||||
|
||||
/*Connections {
|
||||
target: InstallController
|
||||
function onCachedProfileCleared(message) {
|
||||
console.log("СИГНАЛ cachedProfileCleared СРАБОТАЛ:", message)
|
||||
//ProtocolsModel.updateModel(ProtocolsModel.getConfig())
|
||||
ProtocolsModel.clear()
|
||||
console.log("isClientProtocolExists =", ProtocolsModel.get(0).isClientProtocolExists)
|
||||
/*PageController.goToPage(PageEnum.PageMainSettings)
|
||||
Qt.callLater(function() {
|
||||
PageController.goToPage(PageEnum.PageSettingsServerProtocol)
|
||||
})
|
||||
}
|
||||
}*/
|
||||
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue