summaryrefslogtreecommitdiffstats
path: root/src/client/toolbar/toolbar.cpp
diff options
context:
space:
mode:
authorChristian Klinger2016-05-13 10:26:58 +0200
committerChristian Klinger2016-05-13 10:26:58 +0200
commit494fb466ff24944160fb737e422e46f6d345f000 (patch)
tree228ccdded6f2429f935936cc3cc64e14f76dc194 /src/client/toolbar/toolbar.cpp
parentconnect/disconnect events are working (again). (diff)
downloadpvs2-494fb466ff24944160fb737e422e46f6d345f000.tar.gz
pvs2-494fb466ff24944160fb737e422e46f6d345f000.tar.xz
pvs2-494fb466ff24944160fb737e422e46f6d345f000.zip
configurable quit button.
Diffstat (limited to 'src/client/toolbar/toolbar.cpp')
-rw-r--r--src/client/toolbar/toolbar.cpp57
1 files changed, 35 insertions, 22 deletions
diff --git a/src/client/toolbar/toolbar.cpp b/src/client/toolbar/toolbar.cpp
index f938494..83b1a9d 100644
--- a/src/client/toolbar/toolbar.cpp
+++ b/src/client/toolbar/toolbar.cpp
@@ -103,28 +103,8 @@ void Toolbar::init()
connect(_connectWindow, SIGNAL(disconnect()), this, SLOT(onDoDisconnect()));
connect(_connectWindow, SIGNAL(connected(ServerConnection*)), this, SLOT(onConnected(ServerConnection*)));
- /* Setup menu */
- _menu = new QMenu(this);
- _acnConnect = new QAction(tr("&Connect..."), this);
- _acnDisconnect = new QAction(tr("&Disconnect"), this);
- _acnDisconnect->setEnabled(false);
- _acnAbout= new QAction(tr("&What's this?"), this);
- _acnQuit = new QAction(tr("&Quit"), this);
-
- _menu->addAction(_acnConnect);
- _menu->addAction(_acnDisconnect);
- _menu->addSeparator();
- _menu->addAction(_acnAbout);
- _menu->addSeparator();
- _menu->addAction(_acnQuit);
- _ui->cmdMenu->setMenu(_menu);
-
- // Connect the signals
- connect(_menu, SIGNAL(aboutToHide()), this, SLOT(hideBar()));
- connect(_acnConnect, SIGNAL(triggered()), _connectWindow, SLOT(doShow()));
- connect(_acnDisconnect, SIGNAL(triggered()), _connectWindow, SLOT(DoDisconnect()));
- connect(_acnAbout, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
- connect(_acnQuit, SIGNAL(triggered()), this, SLOT(exit()));
+ /* Setup menu */
+ initMenu();
/* Connect the signals from vnc server */
connect(VncServer::instance(), SIGNAL(started(int, QString&, QString&)), this, SLOT(onVncServerIsRunning(int)));
@@ -148,6 +128,39 @@ void Toolbar::init()
connect(&_blinkTimer, SIGNAL(timeout()), this, SLOT(cameraBlink()));
}
+/**
+ * This function should be called once from the main init() function which in
+ * turn should only be called by the constructor.
+ **/
+void Toolbar::initMenu() {
+ _menu = new QMenu(this);
+ _acnConnect = new QAction(tr("&Connect..."), this);
+ _acnDisconnect = new QAction(tr("&Disconnect"), this);
+ _acnDisconnect->setEnabled(false);
+ _acnAbout= new QAction(tr("&What's this?"), this);
+ _acnQuit = new QAction(tr("&Quit"), this);
+
+ _menu->addAction(_acnConnect);
+ _menu->addAction(_acnDisconnect);
+ _menu->addSeparator();
+ _menu->addAction(_acnAbout);
+ _menu->addSeparator();
+ _menu->addAction(_acnQuit);
+ _ui->cmdMenu->setMenu(_menu);
+
+ /* only add a "quit"-button when the configuration allows it. */
+ SYSTEM_SETTINGS(conf);
+
+ bool allow = conf.value("allowClientQuit").toBool();
+ _acnQuit->setVisible(allow);
+
+ // Connect the signals
+ connect(_menu, SIGNAL(aboutToHide()), this, SLOT(hideBar()));
+ connect(_acnConnect, SIGNAL(triggered()), _connectWindow, SLOT(doShow()));
+ connect(_acnDisconnect, SIGNAL(triggered()), _connectWindow, SLOT(DoDisconnect()));
+ connect(_acnAbout, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
+ connect(_acnQuit, SIGNAL(triggered()), this, SLOT(exit()));
+}
/***************************************************************************//**
* Destructor of the Toolbar. Destroys the widget. All this widget's children