This commit is contained in:
Nick Bolton
2010-06-11 21:36:11 +00:00
parent 87349de8e3
commit 1698161945
7 changed files with 146 additions and 66 deletions

View File

@@ -236,9 +236,39 @@ void MainWindow::startSynergy()
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)
{
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))
{
@@ -266,7 +296,15 @@ bool MainWindow::clientArgs(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))
{