summaryrefslogtreecommitdiffstats
path: root/src/client/connectwindow/connectwindow.cpp
diff options
context:
space:
mode:
authorChristian Klinger2016-05-12 14:13:01 +0200
committerChristian Klinger2016-05-12 14:13:01 +0200
commit6e0ae9c6a9f83bde0ee58a537fdb376878e3e46d (patch)
tree2e2e5b9a4b3c9fb1adef01d76914dfc1073c82fb /src/client/connectwindow/connectwindow.cpp
parentfirst new version of the connect window; needs some polish though. (diff)
downloadpvs2-6e0ae9c6a9f83bde0ee58a537fdb376878e3e46d.tar.gz
pvs2-6e0ae9c6a9f83bde0ee58a537fdb376878e3e46d.tar.xz
pvs2-6e0ae9c6a9f83bde0ee58a537fdb376878e3e46d.zip
polished the connect window.
Diffstat (limited to 'src/client/connectwindow/connectwindow.cpp')
-rw-r--r--src/client/connectwindow/connectwindow.cpp37
1 files changed, 33 insertions, 4 deletions
diff --git a/src/client/connectwindow/connectwindow.cpp b/src/client/connectwindow/connectwindow.cpp
index 716dd6e..9bd8d12 100644
--- a/src/client/connectwindow/connectwindow.cpp
+++ b/src/client/connectwindow/connectwindow.cpp
@@ -47,6 +47,12 @@ ConnectWindow::ConnectWindow(QWidget *parent) : QWidget(parent)
connect(&_serverDiscovery, SIGNAL(serverDetected(QString,quint16,QByteArray,QByteArray,bool)),
this, SLOT(onServerDetected(QString,quint16,QByteArray,QByteArray,bool)));
+ /* finally the most requested feature: connect on press of the enter key */
+ connect(_ui->lineEditName, SIGNAL(returnPressed()),_ui->btn_connection, SIGNAL(clicked()));
+
+ /* by default don't show the manual connection box */
+ _ui->box_manual->setVisible(false);
+
this->updateUserInterface();
}
@@ -216,7 +222,17 @@ void ConnectWindow::onBtnConnection()
{
// Connect (scan for session)
// qDebug() << _ui->lineEditName->text().toUtf8();
- connectToSession(_ui->lineEditName->text().toUtf8(), NULL);
+ 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);
+ }
}
}
@@ -227,10 +243,10 @@ 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);
+ _ui->comboBox_rooms->addItem(tr("Room ") + r.name, r.mgr);
}
/* also add a pseudo-room "manual choice" */
- _ui->comboBox_rooms->addItem(tr("manual connection"), "manual_connection");
+ _ui->comboBox_rooms->addItem(tr("Session Name..."), "manual_connection");
} else {
_ui->stackedWidget->setCurrentIndex(1);
}
@@ -251,7 +267,12 @@ void ConnectWindow::onRoomSelection(int index) {
QString sessionName = _ui->comboBox_rooms->itemData(index).toString();
if (sessionName == "manual_connection") {
qDebug() << "switch to manual connection";
- _ui->stackedWidget->setCurrentIndex(1);
+ _ui->box_manual->setVisible(true);
+ //this->setSize(QSize(300,200));
+ this->resize(300, 200);
+ } else {
+ _ui->box_manual->setVisible(false);
+ this->resize(300, 140);
}
}
@@ -300,6 +321,14 @@ void ConnectWindow::onConnectionStateChange(ConnectWindow::ConnectionState state
}
}
+void ConnectWindow::onComboBox_keyPressed(QKeyEvent* e) {
+ qDebug() << "key released";
+ if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return ) {
+ qDebug() << "enter pressed";
+ }
+
+}
+
/***************************************************************************//**
* If connection is closed set _connection = NULL.
* @param connection