Fixed issue 487

This commit is contained in:
Nick Bolton 2010-06-02 20:19:23 +00:00
parent a2bd73b8bf
commit 476903c47b
3 changed files with 31 additions and 27 deletions

View File

@ -33,14 +33,14 @@
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout">
<item row="4" column="1">
<item row="6" column="3">
<widget class="QPushButton" name="m_pButtonToggleStart">
<property name="text">
<string>&amp;Start</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<item row="1" column="0" colspan="4">
<widget class="QGroupBox" name="m_pGroupServer">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -133,20 +133,7 @@
</layout>
</widget>
</item>
<item row="4" column="0">
<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>
<item row="3" column="0" colspan="2">
<item row="3" column="0" colspan="4">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -159,7 +146,7 @@
</property>
</spacer>
</item>
<item row="2" column="0" colspan="2">
<item row="2" column="0" colspan="4">
<widget class="QGroupBox" name="m_pGroupClient">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -190,6 +177,26 @@
</layout>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="m_pStatusLabel">
<property name="text">
<string>Ready</string>
</property>
</widget>
</item>
<item row="6" column="2">
<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>
</widget>
<action name="m_pActionAbout">

View File

@ -44,7 +44,6 @@ MainWindow::MainWindow(QWidget* parent) :
m_ServerConfig(&m_Settings, 5, 3),
m_pTempConfigFile(NULL),
m_pLogDialog(new LogDialog(this, synergyProcess())),
m_pLabelStatusBar(NULL),
m_pTrayIcon(NULL),
m_pTrayIconMenu(NULL)
{
@ -52,7 +51,6 @@ MainWindow::MainWindow(QWidget* parent) :
createTrayIcon();
createMenuBar();
createStatusBar();
loadSettings();
initConnections();
@ -66,6 +64,11 @@ MainWindow::~MainWindow()
saveSettings();
}
void MainWindow::setStatus(const QString &status)
{
m_pStatusLabel->setText(status);
}
void MainWindow::createTrayIcon()
{
#if !defined(Q_OS_MAC)
@ -123,12 +126,6 @@ void MainWindow::createMenuBar()
setMenuBar(menubar);
}
void MainWindow::createStatusBar()
{
m_pLabelStatusBar = new QLabel(tr("Synergy is not running."));
statusBar()->addPermanentWidget(m_pLabelStatusBar);
}
void MainWindow::loadSettings()
{
// gui
@ -383,7 +380,7 @@ void MainWindow::setSynergyState(qSynergyState state)
m_pGroupServer->setEnabled(state == synergyDisconnected);
m_pActionStartSynergy->setEnabled(state == synergyDisconnected);
m_pActionStopSynergy->setEnabled(state == synergyConnected);
m_pLabelStatusBar->setText(state == synergyConnected ? QString(tr("Synergy %1 is running.")).arg(synergyType() == synergyServer ? tr("server") : tr("client")) : tr("Synergy is not running."));
setStatus(state == synergyConnected ? QString(tr("Synergy %1 is running.")).arg(synergyType() == synergyServer ? tr("server") : tr("client")) : tr("Synergy is not running."));
setIcon(state);
m_SynergyState = state;
}

View File

@ -86,6 +86,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
bool checkForApp(int which, QString& app);
bool clientArgs(QStringList& args, QString& app);
bool serverArgs(QStringList& args, QString& app);
void setStatus(const QString& status);
private:
QSettings m_Settings;
@ -96,7 +97,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
QTemporaryFile* m_pTempConfigFile;
LogDialog* m_pLogDialog;
QLabel* m_pLabelStatusBar;
QSystemTrayIcon* m_pTrayIcon;
QMenu* m_pTrayIconMenu;
};