summaryrefslogtreecommitdiffstats
path: root/src/client/connectwindow/connectwindow.cpp
diff options
context:
space:
mode:
authorChristian Klinger2016-05-10 17:30:37 +0200
committerChristian Klinger2016-05-10 17:30:37 +0200
commit93cd9571c534bb48af3707e1dc6c8bab28461df7 (patch)
tree6e50373bf46d27071ea100229ced7f1c244caa12 /src/client/connectwindow/connectwindow.cpp
parentPriorities for rooms. (diff)
downloadpvs2-93cd9571c534bb48af3707e1dc6c8bab28461df7.tar.gz
pvs2-93cd9571c534bb48af3707e1dc6c8bab28461df7.tar.xz
pvs2-93cd9571c534bb48af3707e1dc6c8bab28461df7.zip
first new version of the connect window; needs some polish though.
Diffstat (limited to 'src/client/connectwindow/connectwindow.cpp')
-rw-r--r--src/client/connectwindow/connectwindow.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/client/connectwindow/connectwindow.cpp b/src/client/connectwindow/connectwindow.cpp
index 818cbd2..716dd6e 100644
--- a/src/client/connectwindow/connectwindow.cpp
+++ b/src/client/connectwindow/connectwindow.cpp
@@ -40,7 +40,8 @@ ConnectWindow::ConnectWindow(QWidget *parent) : QWidget(parent)
// Set actions of buttons
connect(_ui->btn_connection, SIGNAL(clicked()), this, SLOT(onBtnConnection()));
connect(_ui->btn_hide, SIGNAL(clicked()), this, SLOT(onBtnHide()));
- connect(_ui->btn_advanced, SIGNAL(clicked()), this, SLOT(onBtnAdvanced()));
+
+ connect(_ui->comboBox_rooms, SIGNAL(currentIndexChanged(int)), this, SLOT(onRoomSelection(int)));
// React on discovery signal
connect(&_serverDiscovery, SIGNAL(serverDetected(QString,quint16,QByteArray,QByteArray,bool)),
@@ -145,6 +146,9 @@ void ConnectWindow::closeEvent(QCloseEvent *e)
void ConnectWindow::doShow()
{
+ /* reset to automatic connect window */
+ _ui->stackedWidget->setCurrentIndex(0);
+ _ui->comboBox_rooms->setCurrentIndex(0);
show();
showNormal();
activateWindow();
@@ -216,6 +220,21 @@ void ConnectWindow::onBtnConnection()
}
}
+/** set the available rooms.
+ * If the list of rooms is empty, switches automatically to the "manual
+ * connection" page */
+void ConnectWindow::setAvailableRooms(QList<Room> m) {
+ if (!m.empty()) {
+ _ui->comboBox_rooms->clear();
+ foreach (Room r, m) {
+ _ui->comboBox_rooms->addItem(r.name, r.mgr);
+ }
+ /* also add a pseudo-room "manual choice" */
+ _ui->comboBox_rooms->addItem(tr("manual connection"), "manual_connection");
+ } else {
+ _ui->stackedWidget->setCurrentIndex(1);
+ }
+}
/***************************************************************************//**
* Handle click on Cancel/Hide Button.
* Just hide the window.
@@ -225,6 +244,16 @@ void ConnectWindow::onBtnHide()
this->hide();
}
+/** check if "manual_connection" is selected, then switch to manual
+ * connection page */
+void ConnectWindow::onRoomSelection(int index) {
+ qDebug() << "onRoomSelection";
+ QString sessionName = _ui->comboBox_rooms->itemData(index).toString();
+ if (sessionName == "manual_connection") {
+ qDebug() << "switch to manual connection";
+ _ui->stackedWidget->setCurrentIndex(1);
+ }
+}
/***************************************************************************//**
* @brief ConnectWindow::onServerDetected