From a780afe9f9ab9ac6938ee6d9919e2a70e9735cbb Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 26 Oct 2016 15:10:30 +0200 Subject: Fix GUI translation: Don't create persistent objects on stack :/ --- src/client/toolbar/toolbar.cpp | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) (limited to 'src/client/toolbar/toolbar.cpp') diff --git a/src/client/toolbar/toolbar.cpp b/src/client/toolbar/toolbar.cpp index 56e1c23..3d370dd 100644 --- a/src/client/toolbar/toolbar.cpp +++ b/src/client/toolbar/toolbar.cpp @@ -4,8 +4,8 @@ * Created on: 21.01.2013 * Author: sr */ -#include #include +#include #include #include "../../shared/settings.h" #include "../net/serverconnection.h" @@ -110,8 +110,7 @@ void Toolbar::init() initMenu(); /* setup manager button */ - _isManagerPc = isManagerPc(); - if (_isManagerPc) { + if (clientApp->isManagerPc()) { connect(_ui->btnManager, SIGNAL(toggled(bool)), this, SLOT(onBtnManager())); } else { setFixedWidth(width() - _ui->btnManager->width()); @@ -240,29 +239,6 @@ void Toolbar::enterEvent(QEvent* e) */ -/* returns true when the pc of this client is also eligible to be a manager */ -bool Toolbar::isManagerPc() -{ - QList myRooms; - auto conf = clientApp->getSettings(); - QStringList roomNames = conf->value("rooms").toStringList(); - - /* go through all rooms and check if this client is a manager of the room. */ - for (auto roomName : roomNames) { - conf->beginGroup(roomName); - QString mgrIP = conf->value("mgrIP").toString(); - - foreach (const QHostAddress & address, QNetworkInterface::allAddresses()) { - QString ip = conf->value("ip").toString(); - if (address.toString() == mgrIP) { - return true; - } - } - conf->endGroup(); - } - return false; -} - /* returns a sorted list of available rooms. * (Available means that this client is configured to be in that room) */ QList Toolbar::myRooms() -- cgit v1.2.3-55-g7522