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

View File

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

View File

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