moved ips and screen name to main screen, and cleaned up the about screen.

This commit is contained in:
Nick Bolton 2012-07-28 20:41:40 +00:00
parent d635be9432
commit dbfb00b21c
5 changed files with 347 additions and 320 deletions

View File

@ -13,7 +13,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>450</width> <width>450</width>
<height>255</height> <height>200</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -25,13 +25,13 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>450</width> <width>450</width>
<height>250</height> <height>200</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>450</width> <width>502</width>
<height>255</height> <height>200</height>
</size> </size>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -60,100 +60,25 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0" colspan="2"> <item row="1" column="0" colspan="2">
<widget class="Line" name="line"> <widget class="QLabel" name="label_3">
<property name="orientation"> <property name="sizePolicy">
<enum>Qt::Horizontal</enum> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;p&gt;
Keyboard and mouse sharing sharing application.&lt;br /&gt;&lt;br /&gt;
Copyright © 2001-2012 Chris Schoeneman, Nick Bolton, Volker Lanz, Sorin Sbarnea.&lt;br /&gt;&lt;br /&gt;
Synergy is based on CosmoSynergy by Richard Lee and Adam Feder.&lt;br /&gt;
The Synergy GUI is based on QSynergy by Volker Lanz.
&lt;/p&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0" colspan="2"> <item row="8" column="0">
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Version:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="m_pLabelSynergyVersion">
<property name="text">
<string>-</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Hostname:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="m_pLabelHostname">
<property name="text">
<string>-</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>IP-Address:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="m_pLabelIPAddress">
<property name="text">
<string>-</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="6" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>78</height>
</size>
</property>
</spacer>
</item>
<item row="7" column="0">
<spacer> <spacer>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -166,25 +91,55 @@ p, li { white-space: pre-wrap; }
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="7" column="1"> <item row="8" column="1">
<widget class="QPushButton" name="buttonOk"> <widget class="QPushButton" name="buttonOk">
<property name="text"> <property name="text">
<string>&amp;Ok</string> <string>&amp;Ok</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0" rowspan="2" colspan="2"> <item row="4" column="0" colspan="2">
<widget class="QLabel" name="label_3"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="text"> <item>
<string>&lt;p&gt;The Synergy GUI is based on QSynergy by Volker Lanz&lt;br/&gt; <widget class="QLabel" name="label">
&lt;br/&gt; <property name="sizePolicy">
Copyright © 2008 Volker Lanz (vl@fidra.de)&lt;br/&gt; <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
Copyright © 2010 Chris Schoeneman, Nick Bolton, Sorin Sbarnea&lt;/p&gt;</string> <horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Version:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_pLabelSynergyVersion">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Unknown</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property> </property>
<property name="wordWrap"> <property name="sizeHint" stdset="0">
<bool>true</bool> <size>
<width>20</width>
<height>78</height>
</size>
</property> </property>
</widget> </spacer>
</item> </item>
</layout> </layout>
</widget> </widget>

View File

@ -27,99 +27,6 @@
</property> </property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
<layout class="QGridLayout"> <layout class="QGridLayout">
<item row="1" column="0" colspan="12">
<widget class="QGroupBox" name="m_pGroupServer">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>&amp;Server (share this computer's mouse and keyboard):</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QRadioButton" name="m_pRadioExternalConfig">
<property name="text">
<string>Use existing configuration:</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="m_pLabelConfigurationFile">
<property name="text">
<string>&amp;Configuration file:</string>
</property>
<property name="buddy">
<cstring>m_pLineEditConfigFile</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="m_pLineEditConfigFile">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_pButtonBrowseConfigFile">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>&amp;Browse...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QRadioButton" name="m_pRadioInternalConfig">
<property name="text">
<string>Configure interactively:</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QPushButton" name="m_pButtonConfigureServer">
<property name="text">
<string>&amp;Configure Server...</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="12"> <item row="2" column="0" colspan="12">
<widget class="QGroupBox" name="m_pGroupClient"> <widget class="QGroupBox" name="m_pGroupClient">
<property name="sizePolicy"> <property name="sizePolicy">
@ -137,18 +44,35 @@
<property name="checked"> <property name="checked">
<bool>true</bool> <bool>true</bool>
</property> </property>
<layout class="QGridLayout"> <layout class="QFormLayout" name="formLayout_3">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Screen name:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="m_pLabelScreenName">
<property name="text">
<string>Unknown</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="m_pLabelServerName"> <widget class="QLabel" name="m_pLabelServerName">
<property name="text"> <property name="text">
<string>&amp;Server IP or hostname:</string> <string>&amp;Server IP:</string>
</property> </property>
<property name="buddy"> <property name="buddy">
<cstring>m_pLineEditHostname</cstring> <cstring>m_pLineEditHostname</cstring>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="1" column="1">
<widget class="QLineEdit" name="m_pLineEditHostname"/> <widget class="QLineEdit" name="m_pLineEditHostname"/>
</item> </item>
</layout> </layout>
@ -251,6 +175,120 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="12">
<widget class="QGroupBox" name="m_pGroupServer">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>&amp;Server (share this computer's mouse and keyboard):</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<layout class="QVBoxLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>IP addresses:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="m_pLabelIpAddresses">
<property name="text">
<string>Unknown</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QRadioButton" name="m_pRadioInternalConfig">
<property name="text">
<string>Configure interactively:</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QPushButton" name="m_pButtonConfigureServer">
<property name="text">
<string>&amp;Configure Server...</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QRadioButton" name="m_pRadioExternalConfig">
<property name="text">
<string>Use existing configuration:</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="m_pLabelConfigurationFile">
<property name="text">
<string>&amp;Configuration file:</string>
</property>
<property name="buddy">
<cstring>m_pLineEditConfigFile</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="m_pLineEditConfigFile">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_pButtonBrowseConfigFile">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>&amp;Browse...</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<action name="m_pActionAbout"> <action name="m_pActionAbout">

View File

@ -21,17 +21,6 @@
#include <QtGui> #include <QtGui>
#include <QtNetwork> #include <QtNetwork>
static QString getIPAddress()
{
QList<QHostAddress> addresses = QNetworkInterface::allAddresses();
for (int i = 0; i < addresses.size(); i++)
if (addresses[i].protocol() == QAbstractSocket::IPv4Protocol && addresses[i] != QHostAddress(QHostAddress::LocalHost))
return addresses[i].toString();
return "Unknown";
}
AboutDialog::AboutDialog(QWidget* parent, const QString& synergyApp) : AboutDialog::AboutDialog(QWidget* parent, const QString& synergyApp) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
Ui::AboutDialogBase() Ui::AboutDialogBase()
@ -40,7 +29,4 @@ AboutDialog::AboutDialog(QWidget* parent, const QString& synergyApp) :
m_versionChecker.setApp(synergyApp); m_versionChecker.setApp(synergyApp);
m_pLabelSynergyVersion->setText(m_versionChecker.getVersion()); m_pLabelSynergyVersion->setText(m_versionChecker.getVersion());
m_pLabelHostname->setText(QHostInfo::localHostName());
m_pLabelIPAddress->setText(getIPAddress());
} }

View File

@ -77,6 +77,8 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
m_pUpdateIcon->hide(); m_pUpdateIcon->hide();
m_pUpdateLabel->hide(); m_pUpdateLabel->hide();
m_versionChecker.setApp(appPath(appConfig.synergycName())); m_versionChecker.setApp(appPath(appConfig.synergycName()));
m_pLabelScreenName->setText(getScreenName());
m_pLabelIpAddresses->setText(getIPAddresses());
m_SetupWizard = new SetupWizard(*this, false); m_SetupWizard = new SetupWizard(*this, false);
connect(m_SetupWizard, SIGNAL(finished(int)), this, SLOT(wizardFinished())); connect(m_SetupWizard, SIGNAL(finished(int)), this, SLOT(wizardFinished()));
@ -667,6 +669,50 @@ void MainWindow::setVisible(bool visible)
#endif #endif
} }
QString MainWindow::getIPAddresses()
{
QList<QHostAddress> addresses = QNetworkInterface::allAddresses();
bool hinted = false;
QString result;
for (int i = 0; i < addresses.size(); i++) {
if (addresses[i].protocol() == QAbstractSocket::IPv4Protocol &&
addresses[i] != QHostAddress(QHostAddress::LocalHost)) {
QString address = addresses[i].toString();
QString format = "%1, ";
// usually 192.168.x.x is a useful ip for the user, so indicate
// this by making it bold.
if (!hinted && address.startsWith("192.168")) {
hinted = true;
format = "<b>%1</b>, ";
}
result += format.arg(address);
}
}
if (result == "") {
return "Unknown";
}
// remove trailing comma.
result.chop(2);
return result;
}
QString MainWindow::getScreenName()
{
if (appConfig().screenName() == "") {
return QHostInfo::localHostName();
}
else {
return appConfig().screenName();
}
}
bool MainWindow::on_m_pButtonBrowseConfigFile_clicked() bool MainWindow::on_m_pButtonBrowseConfigFile_clicked()
{ {
QString fileName = QFileDialog::getOpenFileName(this, tr("Browse for a synergys config file"), QString(), synergyConfigFilter); QString fileName = QFileDialog::getOpenFileName(this, tr("Browse for a synergys config file"), QString(), synergyConfigFilter);

View File

@ -136,6 +136,8 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
void sendIpcMessage(qIpcMessageType type, const char* buffer, bool showErrors); void sendIpcMessage(qIpcMessageType type, const char* buffer, bool showErrors);
void onModeChanged(bool firstRun, bool forceServiceApply); void onModeChanged(bool firstRun, bool forceServiceApply);
void updateStateFromLogLine(const QString& line); void updateStateFromLogLine(const QString& line);
QString getIPAddresses();
QString getScreenName();
private: private:
QSettings& m_Settings; QSettings& m_Settings;