Show server list when 2 or more servers detected

This commit is contained in:
Xinyu Hou 2014-11-18 15:29:31 +00:00
parent 66a1ffa5f5
commit 2aec1223ae
2 changed files with 26 additions and 14 deletions

View File

@ -220,6 +220,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<widget class="QLabel" name="m_pLabelScreenName">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="m_pLabelServerName"> <widget class="QLabel" name="m_pLabelServerName">
<property name="text"> <property name="text">
@ -233,13 +240,6 @@
<item row="2" column="1"> <item row="2" column="1">
<widget class="QLineEdit" name="m_pLineEditHostname"/> <widget class="QLineEdit" name="m_pLineEditHostname"/>
</item> </item>
<item row="0" column="1">
<widget class="QLabel" name="m_pLabelScreenName">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="3" column="0"> <item row="3" column="0">
<widget class="QCheckBox" name="m_pCheckBoxAutoConnect"> <widget class="QCheckBox" name="m_pCheckBoxAutoConnect">
<property name="text"> <property name="text">
@ -247,16 +247,22 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="3" column="1">
<widget class="QLabel" name="m_pLabelServerList"> <widget class="QComboBox" name="m_pComboServerList">
<property name="text"> <property name="sizePolicy">
<string>Server list:</string> <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1">
<widget class="QComboBox" name="m_pComboServerList"/>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -117,6 +117,8 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
} }
m_pCheckBoxAutoConnect->setChecked(appConfig.autoConnect()); m_pCheckBoxAutoConnect->setChecked(appConfig.autoConnect());
m_pComboServerList->hide();
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
@ -823,6 +825,10 @@ void MainWindow::serverDetected(const QString name)
// Note: the first added item triggers startSynergy // Note: the first added item triggers startSynergy
m_pComboServerList->addItem(name); m_pComboServerList->addItem(name);
} }
if (m_pComboServerList->count() > 1) {
m_pComboServerList->show();
}
} }
void MainWindow::on_m_pGroupClient_toggled(bool on) void MainWindow::on_m_pGroupClient_toggled(bool on)