summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gui/client/connect.ui135
-rw-r--r--src/client/connectwindow/connectwindow.cpp37
-rw-r--r--src/client/connectwindow/connectwindow.h2
3 files changed, 83 insertions, 91 deletions
diff --git a/gui/client/connect.ui b/gui/client/connect.ui
index b5c8340..39649e2 100644
--- a/gui/client/connect.ui
+++ b/gui/client/connect.ui
@@ -10,7 +10,7 @@
<x>0</x>
<y>0</y>
<width>512</width>
- <height>150</height>
+ <height>233</height>
</rect>
</property>
<property name="minimumSize">
@@ -32,98 +32,59 @@
<number>0</number>
</property>
<widget class="QWidget" name="page0">
- <layout class="QFormLayout" name="formLayout_2">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
<property name="margin">
<number>0</number>
</property>
- <item row="0" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Auto-Connect is available.</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Room: </string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QComboBox" name="comboBox_rooms"/>
- </item>
- <item row="1" column="0">
- <spacer name="verticalSpacer_3">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="4" column="0">
- <spacer name="verticalSpacer_4">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="page">
- <layout class="QFormLayout" name="formLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Manually connect with session name</string>
- </property>
+ <item>
+ <widget class="QGroupBox" name="box_auto">
+ <property name="title">
+ <string>Connection</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Connect to</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="comboBox_rooms"/>
+ </item>
+ </layout>
</widget>
</item>
- <item row="1" column="0">
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="4" column="0">
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="3" column="0" colspan="2">
- <widget class="QLineEdit" name="lineEditName"/>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Session Name</string>
+ <item>
+ <widget class="QGroupBox" name="box_manual">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
+ <property name="title">
+ <string>Manual Connection</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Session Name</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="lineEditName">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
</widget>
</item>
</layout>
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
diff --git a/src/client/connectwindow/connectwindow.h b/src/client/connectwindow/connectwindow.h
index bdd564a..a94f6d9 100644
--- a/src/client/connectwindow/connectwindow.h
+++ b/src/client/connectwindow/connectwindow.h
@@ -93,6 +93,8 @@ protected slots:
// void onUdpReadyRead();
void onServerDetected(const QString& host, const quint16 port, const QByteArray& sessionName, const QByteArray& certHash, bool autoConnect);
+ void onComboBox_keyPressed(QKeyEvent* e);
+
signals:
void disconnect();
void connected(ServerConnection* connection);