fixed: Bug #3968 - GUI auto-hides on initial first install (with no config)

This commit is contained in:
Nick Bolton 2014-03-21 09:22:18 +00:00
parent 0745d5884b
commit 4d75150143
6 changed files with 28 additions and 6 deletions

View File

@ -112,6 +112,7 @@ void AppConfig::loadSettings()
m_Language = settings().value("language", QLocale::system().name()).toString(); m_Language = settings().value("language", QLocale::system().name()).toString();
m_PremiumEmail = settings().value("premiumEmail", "").toString(); m_PremiumEmail = settings().value("premiumEmail", "").toString();
m_PremiumToken = settings().value("premiumToken", "").toString(); m_PremiumToken = settings().value("premiumToken", "").toString();
m_StartedBefore = settings().value("startedBefore", false).toBool();
} }
void AppConfig::saveSettings() void AppConfig::saveSettings()
@ -128,6 +129,7 @@ void AppConfig::saveSettings()
settings().setValue("language", m_Language); settings().setValue("language", m_Language);
settings().setValue("premiumEmail", m_PremiumEmail); settings().setValue("premiumEmail", m_PremiumEmail);
settings().setValue("premiumToken", m_PremiumToken); settings().setValue("premiumToken", m_PremiumToken);
settings().setValue("startedBefore", m_StartedBefore);
} }
void AppConfig::setCryptoPass(const QString &s) void AppConfig::setCryptoPass(const QString &s)

View File

@ -68,6 +68,7 @@ class AppConfig
const QString& language() const { return m_Language; } const QString& language() const { return m_Language; }
const QString& premiumEmail() const { return m_PremiumEmail; } const QString& premiumEmail() const { return m_PremiumEmail; }
const QString& premiumToken() const { return m_PremiumToken; } const QString& premiumToken() const { return m_PremiumToken; }
bool startedBefore() const { return m_StartedBefore; }
QString synergysName() const { return m_SynergysName; } QString synergysName() const { return m_SynergysName; }
QString synergycName() const { return m_SynergycName; } QString synergycName() const { return m_SynergycName; }
@ -91,6 +92,7 @@ class AppConfig
void setLanguage(const QString language) { m_Language = language; } void setLanguage(const QString language) { m_Language = language; }
void setPremiumEmail(const QString premiumEmail) { m_PremiumEmail = premiumEmail; } void setPremiumEmail(const QString premiumEmail) { m_PremiumEmail = premiumEmail; }
void setPremiumToken(const QString premiumToken) { m_PremiumToken = premiumToken; } void setPremiumToken(const QString premiumToken) { m_PremiumToken = premiumToken; }
void setStartedBefore(bool b) { m_StartedBefore = b; }
void loadSettings(); void loadSettings();
void saveSettings(); void saveSettings();
@ -112,6 +114,7 @@ class AppConfig
QString m_Language; QString m_Language;
QString m_PremiumEmail; QString m_PremiumEmail;
QString m_PremiumToken; QString m_PremiumToken;
bool m_StartedBefore;
static const char m_SynergysName[]; static const char m_SynergysName[];
static const char m_SynergycName[]; static const char m_SynergycName[];

View File

@ -119,7 +119,7 @@ MainWindow::~MainWindow()
saveSettings(); saveSettings();
} }
void MainWindow::start() void MainWindow::open()
{ {
updatePremiumInfo(); updatePremiumInfo();
@ -129,7 +129,10 @@ void MainWindow::start()
m_VersionChecker.checkLatest(); m_VersionChecker.checkLatest();
if (appConfig().processMode() == Desktop) { // only start if user has previously started. this stops the gui from
// auto hiding before the user has configured synergy (which of course
// confuses first time users, who think synergy has crashed).
if (appConfig().startedBefore() && appConfig().processMode() == Desktop) {
startSynergy(); startSynergy();
} }
} }
@ -463,6 +466,20 @@ void MainWindow::startSynergy()
QString command(app + " " + args.join(" ")); QString command(app + " " + args.join(" "));
m_IpcClient.sendCommand(command, m_ElevateProcess); m_IpcClient.sendCommand(command, m_ElevateProcess);
} }
else {
if (!appConfig().startedBefore()) {
QMessageBox::information(
this, "Synergy",
tr("Synergy has been minimized to the notification "
"area. This happens automatically when Synergy "
"starts."));
}
}
appConfig().setStartedBefore(true);
appConfig().saveSettings();
} }
bool MainWindow::clientArgs(QStringList& args, QString& app) bool MainWindow::clientArgs(QStringList& args, QString& app)

View File

@ -88,7 +88,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
QString configFilename(); QString configFilename();
QString address(); QString address();
QString appPath(const QString& name); QString appPath(const QString& name);
void start(); void open();
void clearLog(); void clearLog();
VersionChecker& versionChecker() { return m_VersionChecker; } VersionChecker& versionChecker() { return m_VersionChecker; }

View File

@ -205,7 +205,7 @@ void SetupWizard::accept()
if (m_StartMain) if (m_StartMain)
{ {
m_MainWindow.start(); m_MainWindow.open();
} }
QWizard::accept(); QWizard::accept();
@ -217,7 +217,7 @@ void SetupWizard::reject()
if (m_StartMain) if (m_StartMain)
{ {
m_MainWindow.start(); m_MainWindow.open();
} }
QWizard::reject(); QWizard::reject();

View File

@ -94,7 +94,7 @@ int main(int argc, char* argv[])
} }
else else
{ {
mainWindow.start(); mainWindow.open();
} }
return app.exec(); return app.exec();