summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
authorSimon Rettberg2015-02-02 17:56:57 +0100
committerSimon Rettberg2015-02-02 17:56:57 +0100
commit4b58d3b01b62809ccc303027a44ea0360b2cc249 (patch)
tree3ed448ac6525c2bbaac3438b5f58593450aecd97 /src/client
parentTry to bring connect window to top more agressively; require c++0x instead of... (diff)
downloadpvs2-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')
-rw-r--r--src/client/connectwindow/connectwindow.cpp5
-rw-r--r--src/client/connectwindow/connectwindow.h3
-rw-r--r--src/client/main.cpp42
-rw-r--r--src/client/toolbar/toolbar.cpp22
-rw-r--r--src/client/toolbar/toolbar.h1
5 files changed, 45 insertions, 28 deletions
diff --git a/src/client/connectwindow/connectwindow.cpp b/src/client/connectwindow/connectwindow.cpp
index 8631b43..be4e7fd 100644
--- a/src/client/connectwindow/connectwindow.cpp
+++ b/src/client/connectwindow/connectwindow.cpp
@@ -145,6 +145,7 @@ void ConnectWindow::closeEvent(QCloseEvent *e)
void ConnectWindow::doShow()
{
show();
+ showNormal();
activateWindow();
raise();
}
@@ -170,8 +171,11 @@ void ConnectWindow::connectToSession(const QByteArray sessionName, QString mgrIP
{
if (_state != Idle)
return;
+ _currentSession = sessionName;
+ _currentIp = mgrIP;
_state = Scanning;
this->updateUserInterface();
+ _tryReconnect = true;
_serverDiscovery.start(sessionName, mgrIP);
}
@@ -206,7 +210,6 @@ void ConnectWindow::onBtnConnection()
else
{
// Connect (scan for session)
- _tryReconnect = true;
// qDebug() << _ui->lineEditName->text().toUtf8();
connectToSession(_ui->lineEditName->text().toUtf8(), NULL);
}
diff --git a/src/client/connectwindow/connectwindow.h b/src/client/connectwindow/connectwindow.h
index 7cf52c3..bc8a4ba 100644
--- a/src/client/connectwindow/connectwindow.h
+++ b/src/client/connectwindow/connectwindow.h
@@ -62,7 +62,8 @@ private:
int _hashSslErrorCount;
ServerDiscovery _serverDiscovery;
ConnectionState _state;
- QByteArray _sessionNameBytes;
+ QByteArray _currentSession;
+ QString _currentIp;
NetworkMessage _packet;
bool _tryReconnect;
int _timerHide;
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();
diff --git a/src/client/toolbar/toolbar.cpp b/src/client/toolbar/toolbar.cpp
index 9b2b668..d542eb5 100644
--- a/src/client/toolbar/toolbar.cpp
+++ b/src/client/toolbar/toolbar.cpp
@@ -27,9 +27,11 @@
* widget is deleted when its parent is deleted.
*/
Toolbar::Toolbar(const QByteArray sessionName, QWidget *parent)
- : QWidget(parent)
+ : QWidget(parent), _hideTimer(this), _blinkTimer(this), _beWatchedEye(":eye")
{
qDebug() << "sessionName - constructor";
+ init();
+
_connectWindow->connectToSession(sessionName, "");
}
@@ -43,9 +45,11 @@ Toolbar::Toolbar(const QByteArray sessionName, QWidget *parent)
* another widget, this widget becomes a child window inside parent. The new
* widget is deleted when its parent is deleted.
*/
-Toolbar::Toolbar(const bool autoConnect, QWidget *parent) : QWidget(parent)
+Toolbar::Toolbar(const bool autoConnect, QWidget *parent)
+ : QWidget(parent), _hideTimer(this), _blinkTimer(this), _beWatchedEye(":eye")
{
qDebug() << "auto - constructor!";
+ init();
if (autoConnect) {
// Try getting manager ip.
@@ -65,10 +69,16 @@ Toolbar::Toolbar(const bool autoConnect, QWidget *parent) : QWidget(parent)
* another widget, this widget becomes a child window inside parent. The new
* widget is deleted when its parent is deleted.
*/
-Toolbar::Toolbar(QWidget *parent) :
- QWidget(parent), _ui(new Ui::Toolbar), _hideTimer(this), _connection(NULL),
- _blinkTimer(this),_cam32(QPixmap()), _beWatchedEye(":eye")
+Toolbar::Toolbar(QWidget *parent)
+ : QWidget(parent), _hideTimer(this), _blinkTimer(this), _beWatchedEye(":eye")
{
+ init();
+}
+
+void Toolbar::init()
+{
+ _ui = new Ui::Toolbar;
+ _connection = NULL;
/* Initialize the GUI */
_ui->setupUi(this);
@@ -90,7 +100,7 @@ Toolbar::Toolbar(QWidget *parent) :
/* Setup menu */
_menu = new QMenu(this);
_acnDisconnect = new QAction(tr("Set &session ID"), this);
- _acnAbout= new QAction(tr("&Was ist das hier?"), this);
+ _acnAbout= new QAction(tr("&What's this?"), this);
_acnQuit = new QAction(tr("&Quit"), this);
_menu->addAction(_acnDisconnect);
_menu->addSeparator();
diff --git a/src/client/toolbar/toolbar.h b/src/client/toolbar/toolbar.h
index 84f6d2d..25964c6 100644
--- a/src/client/toolbar/toolbar.h
+++ b/src/client/toolbar/toolbar.h
@@ -51,6 +51,7 @@ private:
void leaveEvent(QEvent* e);
void enterEvent(QEvent* e);
QString identifyMgrIP();
+ void init();
private slots:
void onVncServerIsRunning(int port);