Skip to content

Commit

Permalink
Refs #95. Revised app closing paths and fixed possible issues
Browse files Browse the repository at this point in the history
  • Loading branch information
SBriere committed Oct 9, 2024
1 parent 0dd1335 commit dd66a77
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
13 changes: 11 additions & 2 deletions client/src/ClientApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,18 @@ ClientApp::~ClientApp()
delete m_loginDiag;

if (m_comMan){
m_comMan->disconnectFromServer();
//m_comMan->disconnect();
//m_comMan->disconnectFromServer();
//m_comMan->deleteLater();
delete m_comMan;
}

if (m_mainWindow){
delete m_mainWindow;
}
if (m_mainKitWindow)
delete m_mainKitWindow;

}

ComManager *ClientApp::getComManager()
Expand Down Expand Up @@ -124,6 +131,7 @@ void ClientApp::showLogin()
#ifndef OPENTERA_WEBASSEMBLY
m_loginDiag = new WebLoginDialog(&m_config);
connect(m_loginDiag, &WebLoginDialog::loginSuccess, this, &ClientApp::onLoginSuccess, Qt::QueuedConnection);
connect(m_loginDiag, &WebLoginDialog::finished, this, &ClientApp::loginQuitRequested);
#else
m_loginDiag = new LoginDialog();
connect(m_loginDiag, &LoginDialog::loginRequest, this, &ClientApp::loginRequested);
Expand Down Expand Up @@ -297,7 +305,7 @@ void ClientApp::loginRequested(QString username, QString password, QString serve
void ClientApp::logoutRequested()
{
m_comMan->disconnectFromServer();
showLogin();
//showLogin();
}

void ClientApp::on_loginResult(bool logged, QString log_msg)
Expand Down Expand Up @@ -355,6 +363,7 @@ void ClientApp::on_serverDisconnected()
{
LOG_DEBUG("Disconnected from server.", "ClientApp::on_serverDisconnected");
showLogin();

}

void ClientApp::on_serverError(QAbstractSocket::SocketError error, QString error_str)
Expand Down
4 changes: 3 additions & 1 deletion client/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,7 @@ int main(int argc, char* argv[])
//QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::JavascriptEnabled, true);
//QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, true);

return app.exec();
int rval = app.exec();
qDebug() << "Bye!";
return rval;
}
4 changes: 3 additions & 1 deletion client/src/main/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ void MainWindow::showDashboard(const bool &show)
}

if (!m_dashboard){
m_dashboard = new DashboardWidget(m_comManager, ui->projNavigator->getCurrentSiteId());
m_dashboard = new DashboardWidget(m_comManager, ui->projNavigator->getCurrentSiteId(), this);
connect(m_dashboard, &DashboardWidget::dataDisplayRequest, this, &MainWindow::dataDisplayRequested);
ui->wdgMainTop->layout()->addWidget(m_dashboard);
}else{
Expand Down Expand Up @@ -1058,6 +1058,8 @@ void MainWindow::closeEvent(QCloseEvent *event)
}
}
#endif
m_comManager->disconnect();
//QApplication::quit();
event->accept();
}

Expand Down

0 comments on commit dd66a77

Please sign in to comment.