summaryrefslogtreecommitdiffstats
path: root/src/client/connectwindow/connectwindow.cpp
diff options
context:
space:
mode:
authorChristian Klinger2016-05-13 10:05:55 +0200
committerChristian Klinger2016-05-13 10:05:55 +0200
commit42020947105bde8543f4a2b5f87a6bd5b575cb50 (patch)
treeb100a4afecbde6fdbcc32c14d8544539349b9c81 /src/client/connectwindow/connectwindow.cpp
parentrename hide->cancel (diff)
downloadpvs2-42020947105bde8543f4a2b5f87a6bd5b575cb50.tar.gz
pvs2-42020947105bde8543f4a2b5f87a6bd5b575cb50.tar.xz
pvs2-42020947105bde8543f4a2b5f87a6bd5b575cb50.zip
connect/disconnect events are working (again).
Diffstat (limited to 'src/client/connectwindow/connectwindow.cpp')
-rw-r--r--src/client/connectwindow/connectwindow.cpp63
1 files changed, 33 insertions, 30 deletions
diff --git a/src/client/connectwindow/connectwindow.cpp b/src/client/connectwindow/connectwindow.cpp
index acb9e09..578bfa7 100644
--- a/src/client/connectwindow/connectwindow.cpp
+++ b/src/client/connectwindow/connectwindow.cpp
@@ -194,6 +194,34 @@ void ConnectWindow::connectToSession(const QByteArray sessionName, QString mgrIP
* Slots
*/
+
+
+void ConnectWindow::DoConnect() {
+ qDebug() << "DoConnect()";
+ // Connect (scan for session)
+ // qDebug() << _ui->lineEditName->text().toUtf8();
+ int index = _ui->comboBox_rooms->currentIndex();
+ QString selectedMgrIP =_ui->comboBox_rooms->itemData(index).toString();
+
+ if (selectedMgrIP == "manual_connection") {
+ qDebug() << "connect to sessionName by manual connection";
+ QByteArray sessionName = _ui->lineEditName->text().toUtf8();
+ connectToSession(sessionName, "");
+ } else {
+ qDebug() << "connect to mgrIP (through room selection) " << selectedMgrIP;
+ connectToSession("", selectedMgrIP);
+ }
+}
+
+void ConnectWindow::DoDisconnect() {
+ qDebug() << "DoDisconnect()";
+ _tryReconnect = false;
+ // Stop or disconnect
+ emit disconnect();
+ _state = Idle;
+}
+
+
/***************************************************************************//**
* Handle click on Connect/Disconnect button.
* If already connected --> Stop/disconnect.
@@ -210,30 +238,12 @@ void ConnectWindow::onBtnConnection()
if (_serverDiscovery.isActive())
_serverDiscovery.stop();
- if (_state != Idle)
- {
- _tryReconnect = false;
- // Stop or disconnect
- emit disconnect();
- _state = Idle;
- this->updateUserInterface();
- }
- else
- {
- // Connect (scan for session)
- // qDebug() << _ui->lineEditName->text().toUtf8();
- int index = _ui->comboBox_rooms->currentIndex();
- QString selectedMgrIP =_ui->comboBox_rooms->itemData(index).toString();
-
- if (selectedMgrIP == "manual_connection") {
- qDebug() << "connect to sessionName by manual connection";
- QByteArray sessionName = _ui->lineEditName->text().toUtf8();
- connectToSession(sessionName, "");
- } else {
- qDebug() << "connect to mgrIP (through room selection) " << selectedMgrIP;
- connectToSession("", selectedMgrIP);
- }
+ if (_state != Idle) {
+ DoDisconnect();
+ } else {
+ DoConnect();
}
+ this->updateUserInterface();
}
/** set the available rooms.
@@ -350,10 +360,3 @@ void ConnectWindow::onConnectionDisconnected()
connectToSession(_currentSession, _currentIp);
}
}
-void ConnectWindow::onBtnAdvanced() {
- if (_ui->stackedWidget->currentIndex()== 1) {
- _ui->stackedWidget->setCurrentIndex(0);
- } else {
- _ui->stackedWidget->setCurrentIndex(1);
- }
-}