Merge
This commit is contained in:
parent
87349de8e3
commit
1698161945
|
@ -7,71 +7,13 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>372</width>
|
<width>372</width>
|
||||||
<height>325</height>
|
<height>350</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Settings</string>
|
<string>Settings</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout">
|
<layout class="QGridLayout">
|
||||||
<item row="0" column="0" colspan="2">
|
|
||||||
<widget class="QGroupBox" name="m_pGroupBox_2">
|
|
||||||
<property name="title">
|
|
||||||
<string>&Programs</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="m_pLabel_17">
|
|
||||||
<property name="whatsThis">
|
|
||||||
<string>This is the synergy client program, usually called synergyc or synergyc.exe.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>&Client:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>m_pLineEditSynergyc</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLineEdit" name="m_pLineEditSynergyc"/>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QPushButton" name="m_pButtonBrowseSynergyc">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Browse...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="m_pLabel_18">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="whatsThis">
|
|
||||||
<string>This is the synergy server program, usually called synergys or synergys.exe.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>S&erver:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>m_pLineEditSynergys</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLineEdit" name="m_pLineEditSynergys"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QPushButton" name="m_pButtonBrowseSynergys">
|
|
||||||
<property name="text">
|
|
||||||
<string>Bro&wse...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0" colspan="2">
|
<item row="1" column="0" colspan="2">
|
||||||
<widget class="QGroupBox" name="m_pGroupBox_3">
|
<widget class="QGroupBox" name="m_pGroupBox_3">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
@ -213,8 +155,90 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="0" colspan="2">
|
||||||
|
<widget class="QGroupBox" name="m_pGroupBox_2">
|
||||||
|
<property name="title">
|
||||||
|
<string>&Programs</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout">
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="m_pLabel_17">
|
||||||
|
<property name="whatsThis">
|
||||||
|
<string>This is the synergy client program, usually called synergyc or synergyc.exe.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Client:</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>m_pLineEditSynergyc</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QLineEdit" name="m_pLineEditSynergyc"/>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="2">
|
||||||
|
<widget class="QPushButton" name="m_pButtonBrowseSynergyc">
|
||||||
|
<property name="text">
|
||||||
|
<string>&Browse...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="m_pLabel_18">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="whatsThis">
|
||||||
|
<string>This is the synergy server program, usually called synergys or synergys.exe.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>S&erver:</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>m_pLineEditSynergys</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QLineEdit" name="m_pLineEditSynergys"/>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="2">
|
||||||
|
<widget class="QPushButton" name="m_pButtonBrowseSynergys">
|
||||||
|
<property name="text">
|
||||||
|
<string>Bro&wse...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" rowspan="2" colspan="3">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="m_pCheckBoxAutoDetectPaths">
|
||||||
|
<property name="text">
|
||||||
|
<string>Auto detect program paths</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>m_pCheckBoxAutoDetectPaths</tabstop>
|
||||||
|
<tabstop>m_pLineEditSynergyc</tabstop>
|
||||||
|
<tabstop>m_pButtonBrowseSynergyc</tabstop>
|
||||||
|
<tabstop>m_pLineEditSynergys</tabstop>
|
||||||
|
<tabstop>m_pButtonBrowseSynergys</tabstop>
|
||||||
|
<tabstop>m_pLineEditScreenName</tabstop>
|
||||||
|
<tabstop>m_pSpinBoxPort</tabstop>
|
||||||
|
<tabstop>m_pLineEditInterface</tabstop>
|
||||||
|
<tabstop>m_pCheckBoxAutoConnect</tabstop>
|
||||||
|
<tabstop>m_pComboLogLevel</tabstop>
|
||||||
|
<tabstop>buttonBox</tabstop>
|
||||||
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
|
@ -224,8 +248,8 @@
|
||||||
<slot>accept()</slot>
|
<slot>accept()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>257</x>
|
<x>266</x>
|
||||||
<y>380</y>
|
<y>340</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>157</x>
|
<x>157</x>
|
||||||
|
@ -240,8 +264,8 @@
|
||||||
<slot>reject()</slot>
|
<slot>reject()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>325</x>
|
<x>334</x>
|
||||||
<y>380</y>
|
<y>340</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>286</x>
|
<x>286</x>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
const char AppConfig::m_SynergysName[] = "synergys.exe";
|
const char AppConfig::m_SynergysName[] = "synergys.exe";
|
||||||
const char AppConfig::m_SynergycName[] = "synergyc.exe";
|
const char AppConfig::m_SynergycName[] = "synergyc.exe";
|
||||||
const char AppConfig::m_SynergyProgramDir[] = "./";
|
const char AppConfig::m_SynergyProgramDir[] = "bin/";
|
||||||
#else
|
#else
|
||||||
const char AppConfig::m_SynergysName[] = "synergys";
|
const char AppConfig::m_SynergysName[] = "synergys";
|
||||||
const char AppConfig::m_SynergycName[] = "synergyc";
|
const char AppConfig::m_SynergycName[] = "synergyc";
|
||||||
|
@ -43,6 +43,7 @@ void AppConfig::loadSettings()
|
||||||
m_Port = settings().value("port", 24800).toInt();
|
m_Port = settings().value("port", 24800).toInt();
|
||||||
m_Interface = settings().value("interface").toString();
|
m_Interface = settings().value("interface").toString();
|
||||||
m_LogLevel = settings().value("logLevelIndex", 0).toInt();
|
m_LogLevel = settings().value("logLevelIndex", 0).toInt();
|
||||||
|
m_AutoDetectPaths = settings().value("autoDetectPaths", true).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppConfig::saveSettings()
|
void AppConfig::saveSettings()
|
||||||
|
@ -54,5 +55,6 @@ void AppConfig::saveSettings()
|
||||||
settings().setValue("port", m_Port);
|
settings().setValue("port", m_Port);
|
||||||
settings().setValue("interface", m_Interface);
|
settings().setValue("interface", m_Interface);
|
||||||
settings().setValue("logLevelIndex", m_LogLevel);
|
settings().setValue("logLevelIndex", m_LogLevel);
|
||||||
|
settings().setValue("autoDetectPaths", m_AutoDetectPaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ class AppConfig
|
||||||
int port() const { return m_Port; }
|
int port() const { return m_Port; }
|
||||||
const QString& interface() const { return m_Interface; }
|
const QString& interface() const { return m_Interface; }
|
||||||
int logLevel() const { return m_LogLevel; }
|
int logLevel() const { return m_LogLevel; }
|
||||||
|
bool autoDetectPaths() const { return m_AutoDetectPaths; }
|
||||||
|
|
||||||
QString synergysName() const { return m_SynergysName; }
|
QString synergysName() const { return m_SynergysName; }
|
||||||
QString synergycName() const { return m_SynergycName; }
|
QString synergycName() const { return m_SynergycName; }
|
||||||
|
@ -38,6 +39,7 @@ class AppConfig
|
||||||
void setPort(int i) { m_Port = i; }
|
void setPort(int i) { m_Port = i; }
|
||||||
void setInterface(const QString& s) { m_Interface = s; }
|
void setInterface(const QString& s) { m_Interface = s; }
|
||||||
void setLogLevel(int i) { m_LogLevel = i; }
|
void setLogLevel(int i) { m_LogLevel = i; }
|
||||||
|
void setAutoDetectPaths(bool b) { m_AutoDetectPaths = b; }
|
||||||
|
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
|
@ -51,6 +53,7 @@ class AppConfig
|
||||||
int m_Port;
|
int m_Port;
|
||||||
QString m_Interface;
|
QString m_Interface;
|
||||||
int m_LogLevel;
|
int m_LogLevel;
|
||||||
|
bool m_AutoDetectPaths;
|
||||||
|
|
||||||
static const char m_SynergysName[];
|
static const char m_SynergysName[];
|
||||||
static const char m_SynergycName[];
|
static const char m_SynergycName[];
|
||||||
|
|
|
@ -236,9 +236,39 @@ void MainWindow::startSynergy()
|
||||||
setSynergyState(synergyConnected);
|
setSynergyState(synergyConnected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MainWindow::detectPath(const QString& name, QString& path)
|
||||||
|
{
|
||||||
|
// look in current working dir and default dir
|
||||||
|
QStringList searchDirs;
|
||||||
|
searchDirs.append("./");
|
||||||
|
searchDirs.append(appConfig().synergyProgramDir());
|
||||||
|
|
||||||
|
// use the first valid path we find
|
||||||
|
for (int i = 0; i < searchDirs.length(); i++)
|
||||||
|
{
|
||||||
|
QFile f(searchDirs[i] + name);
|
||||||
|
if (f.exists())
|
||||||
|
{
|
||||||
|
path = f.fileName();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// nothing found!
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool MainWindow::clientArgs(QStringList& args, QString& app)
|
bool MainWindow::clientArgs(QStringList& args, QString& app)
|
||||||
{
|
{
|
||||||
app = appConfig().synergyc();
|
if (appConfig().autoDetectPaths())
|
||||||
|
{
|
||||||
|
// actually returns bool, but ignore for now
|
||||||
|
detectPath(appConfig().synergycName(), app);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
app = appConfig().synergyc();
|
||||||
|
}
|
||||||
|
|
||||||
if (!QFile::exists(app))
|
if (!QFile::exists(app))
|
||||||
{
|
{
|
||||||
|
@ -266,7 +296,15 @@ bool MainWindow::clientArgs(QStringList& args, QString& app)
|
||||||
|
|
||||||
bool MainWindow::serverArgs(QStringList& args, QString& app)
|
bool MainWindow::serverArgs(QStringList& args, QString& app)
|
||||||
{
|
{
|
||||||
app = appConfig().synergys();
|
if (appConfig().autoDetectPaths())
|
||||||
|
{
|
||||||
|
// actually returns bool, but ignore for now
|
||||||
|
detectPath(appConfig().synergysName(), app);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
app = appConfig().synergys();
|
||||||
|
}
|
||||||
|
|
||||||
if (!QFile::exists(app))
|
if (!QFile::exists(app))
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,6 +87,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||||
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);
|
void setStatus(const QString& status);
|
||||||
|
bool detectPath(const QString& name, QString& path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSettings m_Settings;
|
QSettings m_Settings;
|
||||||
|
|
|
@ -19,6 +19,7 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
|
||||||
m_pSpinBoxPort->setValue(appConfig().port());
|
m_pSpinBoxPort->setValue(appConfig().port());
|
||||||
m_pLineEditInterface->setText(appConfig().interface());
|
m_pLineEditInterface->setText(appConfig().interface());
|
||||||
m_pComboLogLevel->setCurrentIndex(appConfig().logLevel());
|
m_pComboLogLevel->setCurrentIndex(appConfig().logLevel());
|
||||||
|
m_pCheckBoxAutoDetectPaths->setChecked(appConfig().autoDetectPaths());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SettingsDialog::browseForSynergyc(QWidget* parent, const QString& programDir, const QString& synergycName)
|
QString SettingsDialog::browseForSynergyc(QWidget* parent, const QString& programDir, const QString& synergycName)
|
||||||
|
@ -56,6 +57,15 @@ bool SettingsDialog::on_m_pButtonBrowseSynergyc_clicked()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::on_m_pCheckBoxAutoDetectPaths_stateChanged(int i)
|
||||||
|
{
|
||||||
|
bool unchecked = i == 0;
|
||||||
|
m_pLineEditSynergyc->setEnabled(unchecked);
|
||||||
|
m_pLineEditSynergys->setEnabled(unchecked);
|
||||||
|
m_pButtonBrowseSynergyc->setEnabled(unchecked);
|
||||||
|
m_pButtonBrowseSynergys->setEnabled(unchecked);
|
||||||
|
}
|
||||||
|
|
||||||
void SettingsDialog::accept()
|
void SettingsDialog::accept()
|
||||||
{
|
{
|
||||||
appConfig().setAutoConnect(m_pCheckBoxAutoConnect->isChecked());
|
appConfig().setAutoConnect(m_pCheckBoxAutoConnect->isChecked());
|
||||||
|
@ -65,6 +75,7 @@ void SettingsDialog::accept()
|
||||||
appConfig().setPort(m_pSpinBoxPort->value());
|
appConfig().setPort(m_pSpinBoxPort->value());
|
||||||
appConfig().setInterface(m_pLineEditInterface->text());
|
appConfig().setInterface(m_pLineEditInterface->text());
|
||||||
appConfig().setLogLevel(m_pComboLogLevel->currentIndex());
|
appConfig().setLogLevel(m_pComboLogLevel->currentIndex());
|
||||||
|
appConfig().setAutoDetectPaths(m_pCheckBoxAutoDetectPaths->isChecked());
|
||||||
|
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ class SettingsDialog : public QDialog, public Ui::SettingsDialogBase
|
||||||
protected slots:
|
protected slots:
|
||||||
bool on_m_pButtonBrowseSynergys_clicked();
|
bool on_m_pButtonBrowseSynergys_clicked();
|
||||||
bool on_m_pButtonBrowseSynergyc_clicked();
|
bool on_m_pButtonBrowseSynergyc_clicked();
|
||||||
|
void on_m_pCheckBoxAutoDetectPaths_stateChanged(int i);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void accept();
|
void accept();
|
||||||
|
|
Loading…
Reference in New Issue