refactored the issue with signal connect in corecontroller
This commit is contained in:
parent
254e23be48
commit
071bebfc11
6 changed files with 7 additions and 24 deletions
|
|
@ -120,6 +120,9 @@ void CoreController::initControllers()
|
|||
connect(m_installController.get(), &InstallController::currentContainerUpdated, m_connectionController.get(),
|
||||
&ConnectionController::onCurrentContainerUpdated); // TODO remove this
|
||||
|
||||
connect(m_installController.get(), &InstallController::profileCleared,
|
||||
m_protocolsModel.get(), &ProtocolsModel::updateModel);
|
||||
|
||||
m_importController.reset(new ImportController(m_serversModel, m_containersModel, m_settings));
|
||||
m_engine->rootContext()->setContextProperty("ImportController", m_importController.get());
|
||||
|
||||
|
|
|
|||
|
|
@ -669,6 +669,8 @@ void InstallController::clearCachedProfile(QSharedPointer<ServerController> serv
|
|||
m_clientManagementModel->revokeClient(containerConfig, container, serverCredentials, serverIndex, serverController);
|
||||
|
||||
emit cachedProfileCleared(tr("%1 cached profile cleared").arg(ContainerProps::containerHumanNames().value(container)));
|
||||
QJsonObject updatedConfig = m_settings->containerConfig(serverIndex, container);
|
||||
emit profileCleared(updatedConfig);
|
||||
}
|
||||
|
||||
QRegularExpression InstallController::ipAddressPortRegExp()
|
||||
|
|
|
|||
|
|
@ -83,6 +83,8 @@ signals:
|
|||
|
||||
void noInstalledContainers();
|
||||
|
||||
void profileCleared(const QJsonObject &config);
|
||||
|
||||
private:
|
||||
void installServer(const DockerContainer container, const QMap<DockerContainer, QJsonObject> &installedContainers,
|
||||
const ServerCredentials &serverCredentials, const QSharedPointer<ServerController> &serverController,
|
||||
|
|
|
|||
|
|
@ -68,27 +68,6 @@ QVariant ProtocolsModel::data(const QModelIndex &index, int role) const
|
|||
return QVariant();
|
||||
}
|
||||
|
||||
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());
|
||||
|
|
|
|||
|
|
@ -26,8 +26,6 @@ public:
|
|||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
Q_INVOKABLE void reload();
|
||||
|
||||
public slots:
|
||||
void updateModel(const QJsonObject &content);
|
||||
|
||||
|
|
|
|||
|
|
@ -186,7 +186,6 @@ PageType {
|
|||
|
||||
PageController.showBusyIndicator(true)
|
||||
InstallController.clearCachedProfile()
|
||||
ProtocolsModel.reload()
|
||||
PageController.showBusyIndicator(false)
|
||||
}
|
||||
var noButtonFunction = function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue