refactored the issue with signal connect in corecontroller

This commit is contained in:
Mitternacht822 2025-07-03 21:06:36 +04:00
parent 254e23be48
commit 071bebfc11
6 changed files with 7 additions and 24 deletions

View file

@ -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());

View file

@ -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()

View file

@ -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,

View file

@ -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());

View file

@ -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);

View file

@ -186,7 +186,6 @@ PageType {
PageController.showBusyIndicator(true)
InstallController.clearCachedProfile()
ProtocolsModel.reload()
PageController.showBusyIndicator(false)
}
var noButtonFunction = function() {