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

@ -1,210 +1,165 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AboutDialogBase</class>
<widget class="QDialog" name="AboutDialogBase">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>450</width>
<height>255</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>450</width>
<height>250</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>450</width>
<height>255</height>
</size>
</property>
<property name="windowTitle">
<string>About Synergy</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QGridLayout">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:16px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:x-large; font-weight:600;&quot;&gt;&lt;span style=&quot; font-size:x-large;&quot;&gt;Synergy&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<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>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>131</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="7" column="1">
<widget class="QPushButton" name="buttonOk">
<property name="text">
<string>&amp;Ok</string>
</property>
</widget>
</item>
<item row="1" column="0" rowspan="2" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>&lt;p&gt;The Synergy GUI is based on QSynergy by Volker Lanz&lt;br/&gt;
&lt;br/&gt;
Copyright © 2008 Volker Lanz (vl@fidra.de)&lt;br/&gt;
Copyright © 2010 Chris Schoeneman, Nick Bolton, Sorin Sbarnea&lt;/p&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonOk</sender>
<signal>clicked()</signal>
<receiver>AboutDialogBase</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>315</x>
<y>374</y>
</hint>
<hint type="destinationlabel">
<x>301</x>
<y>3</y>
</hint>
</hints>
</connection>
</connections>
</ui>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AboutDialogBase</class>
<widget class="QDialog" name="AboutDialogBase">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>450</width>
<height>200</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>450</width>
<height>200</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>502</width>
<height>200</height>
</size>
</property>
<property name="windowTitle">
<string>About Synergy</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QGridLayout">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:16px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:x-large; font-weight:600;&quot;&gt;&lt;span style=&quot; font-size:x-large;&quot;&gt;Synergy&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<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>
</widget>
</item>
<item row="8" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>131</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="8" column="1">
<widget class="QPushButton" name="buttonOk">
<property name="text">
<string>&amp;Ok</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<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 name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>78</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonOk</sender>
<signal>clicked()</signal>
<receiver>AboutDialogBase</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>315</x>
<y>374</y>
</hint>
<hint type="destinationlabel">
<x>301</x>
<y>3</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -27,99 +27,6 @@
</property>
<widget class="QWidget" name="centralwidget">
<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">
<widget class="QGroupBox" name="m_pGroupClient">
<property name="sizePolicy">
@ -137,18 +44,35 @@
<property name="checked">
<bool>true</bool>
</property>
<layout class="QGridLayout">
<layout class="QFormLayout" name="formLayout_3">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<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">
<property name="text">
<string>&amp;Server IP or hostname:</string>
<string>&amp;Server IP:</string>
</property>
<property name="buddy">
<cstring>m_pLineEditHostname</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<item row="1" column="1">
<widget class="QLineEdit" name="m_pLineEditHostname"/>
</item>
</layout>
@ -251,6 +175,120 @@
</property>
</widget>
</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>
</widget>
<action name="m_pActionAbout">

View File

@ -21,17 +21,6 @@
#include <QtGui>
#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) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
Ui::AboutDialogBase()
@ -40,7 +29,4 @@ AboutDialog::AboutDialog(QWidget* parent, const QString& synergyApp) :
m_versionChecker.setApp(synergyApp);
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_pUpdateLabel->hide();
m_versionChecker.setApp(appPath(appConfig.synergycName()));
m_pLabelScreenName->setText(getScreenName());
m_pLabelIpAddresses->setText(getIPAddresses());
m_SetupWizard = new SetupWizard(*this, false);
connect(m_SetupWizard, SIGNAL(finished(int)), this, SLOT(wizardFinished()));
@ -667,6 +669,50 @@ void MainWindow::setVisible(bool visible)
#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()
{
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 onModeChanged(bool firstRun, bool forceServiceApply);
void updateStateFromLogLine(const QString& line);
QString getIPAddresses();
QString getScreenName();
private:
QSettings& m_Settings;