diff options
author | Simon Rettberg | 2015-02-02 17:56:57 +0100 |
---|---|---|
committer | Simon Rettberg | 2015-02-02 17:56:57 +0100 |
commit | 4b58d3b01b62809ccc303027a44ea0360b2cc249 (patch) | |
tree | 3ed448ac6525c2bbaac3438b5f58593450aecd97 /src/client/main.cpp | |
parent | Try to bring connect window to top more agressively; require c++0x instead of... (diff) | |
download | pvs2-4b58d3b01b62809ccc303027a44ea0360b2cc249.tar.gz pvs2-4b58d3b01b62809ccc303027a44ea0360b2cc249.tar.xz pvs2-4b58d3b01b62809ccc303027a44ea0360b2cc249.zip |
Restore window state when opening connect window. Reconnect to session when using --auto
Diffstat (limited to 'src/client/main.cpp')
-rw-r--r-- | src/client/main.cpp | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/src/client/main.cpp b/src/client/main.cpp index efaa6c5..9b1fa81 100644 --- a/src/client/main.cpp +++ b/src/client/main.cpp @@ -20,25 +20,27 @@ int main(int argc, char** argv) // Set the global path of the settings QSettings::setPath(QSettings::IniFormat, QSettings::SystemScope, "/opt/"); - // Make sure settings directory exists - USER_SETTINGS(settings); - QFileInfo fi(settings.fileName()); - QDir path(fi.path()); - qDebug() << "User settings are in:" << settings.fileName(); - if (!path.exists()) - path.mkpath(path.absolutePath()); - // Now check if settings file exists. If not, copy system default (if available) - if (!fi.exists()) - { - SYSTEM_SETTINGS(sys); - qDebug() << "System settings are in:" << sys.fileName(); - QFileInfo sysfi(sys.fileName()); - if (sysfi.exists()) + do { + // Make sure settings directory exists + USER_SETTINGS(settings); + QFileInfo fi(settings.fileName()); + QDir path(fi.path()); + qDebug() << "User settings are in:" << settings.fileName(); + if (!path.exists()) + path.mkpath(path.absolutePath()); + // Now check if settings file exists. If not, copy system default (if available) + if (!fi.exists()) { - if (!QFile::copy(sys.fileName(), settings.fileName())) - qDebug() << "Copying default settings from " << sys.fileName() << " to " << settings.fileName() << " failed."; + SYSTEM_SETTINGS(sys); + qDebug() << "System settings are in:" << sys.fileName(); + QFileInfo sysfi(sys.fileName()); + if (sysfi.exists()) + { + if (!QFile::copy(sys.fileName(), settings.fileName())) + qDebug() << "Copying default settings from " << sys.fileName() << " to " << settings.fileName() << " failed."; + } } - } + } while (false); // use system locale as language to translate gui QTranslator translator; @@ -48,12 +50,12 @@ int main(int argc, char** argv) if (argc == 2) { if (argv[1] == std::string("--auto")) { qDebug() << "Calling Toolbar(true)"; - Toolbar *pvsclient = new Toolbar(true); // auto connect client without session ID. + new Toolbar(true); // auto connect client without session ID. } else { - Toolbar *pvsclient = new Toolbar(QByteArray(argv[1])); // connect client with given session ID. + new Toolbar(QByteArray(argv[1])); // connect client with given session ID. } } else { - Toolbar *pvsclient = new Toolbar(); // create normal client. + new Toolbar(); // create normal client. } return app.exec(); |