summaryrefslogtreecommitdiffstats
path: root/src/server/mainwindow/mainwindow.cpp
diff options
context:
space:
mode:
authorBjörn Hagemeister2014-07-21 18:14:09 +0200
committerBjörn Hagemeister2014-07-21 18:14:09 +0200
commitf7da785b78a2412d1d5bdd43836ed8c9656cae81 (patch)
tree0322fa2d2ff2712356643ce521c01b7bebf7b731 /src/server/mainwindow/mainwindow.cpp
parentMerge branch 'master' of git.openslx.org:pvs2 (diff)
downloadpvs2-f7da785b78a2412d1d5bdd43836ed8c9656cae81.tar.gz
pvs2-f7da785b78a2412d1d5bdd43836ed8c9656cae81.tar.xz
pvs2-f7da785b78a2412d1d5bdd43836ed8c9656cae81.zip
Tried to implement the fixed room settings, but is not working correctly right now.
Problem is, the frames do not appear at setted position because of placeFrameInFreeCell() - call. Also, after updateSessionName(), all frames and clients are currently deleted if SessionName want to be setted manually.
Diffstat (limited to 'src/server/mainwindow/mainwindow.cpp')
-rw-r--r--src/server/mainwindow/mainwindow.cpp57
1 files changed, 55 insertions, 2 deletions
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp
index a52690f..8762dbf 100644
--- a/src/server/mainwindow/mainwindow.cpp
+++ b/src/server/mainwindow/mainwindow.cpp
@@ -103,6 +103,39 @@ MainWindow::MainWindow(QString ipListUrl, QWidget* parent) :
connect(ui->action_Lock, SIGNAL(toggled(bool)), this, SLOT(onButtonLock(bool)));
connect(ui->action_Help, SIGNAL(triggered()), this, SLOT(onButtonHelp()));
+ USER_SETTINGS(test);
+ int i = 1;
+ QMap<QString, QPoint> ipPosList;
+ while (true)
+ {
+ test.beginGroup(QString("room%1").arg(i));
+ if (!test.contains("mgrIP"))
+ break;
+ QString mgrIP = test.value("mgrIP").toString();
+ foreach (const QHostAddress &address, QNetworkInterface::allAddresses())
+ {
+ qDebug() << "in Adress loop" << address.toString();
+ if (address != QHostAddress(QHostAddress::LocalHost)
+ && mgrIP == address.toString())
+ {
+ qDebug("matched");
+ int size = test.beginReadArray("client");
+ for (int i = 0; i < size; ++i) {
+ test.setArrayIndex(i);
+ ipPosList[test.value("ip").toString()] = test.value("pos").toPoint();
+ ConnectionFrame *cf = createFrame(test.value("ip").toString(), test.value("pos").toPoint());
+ cf->move(cf->getCurrentPosition());
+ onPlaceFrame(cf);
+ qDebug() << "IP: " << test.value("ip").toString();
+ qDebug() << "pos: " << test.value("pos").toPoint();
+ }
+ test.endArray();
+ }
+ }
+ qDebug() << "ManagerIP: " << mgrIP;
+ test.endGroup();
+ i++;
+ }
/* Stuff for the button lock */
//Setup a timeout
@@ -135,7 +168,7 @@ MainWindow::MainWindow(QString ipListUrl, QWidget* parent) :
_discoveryListener = new DiscoveryListener();
// Finally
- this->onSessionNameUpdate();
+// this->onSessionNameUpdate();
}
MainWindow::~MainWindow()
@@ -215,6 +248,26 @@ ConnectionFrame* MainWindow::createFrame()
}
/***************************************************************************//**
+ * Create new Frame.
+ * Create new frame and add to current available frame list.
+ * Also connect signals frameMoved() and clicked() with slots.
+ * @return ConnectionFrame*
+ */
+ConnectionFrame* MainWindow::createFrame(QString computerId, QPoint position)
+{
+ // Allocate and resize
+ ConnectionFrame *cf = new ConnectionFrame(ui->frmRoom, _tileWidth, _tileHeight);
+ cf->setComputerId(computerId);
+ cf->setCurrentPosition(position);
+ _clientFrames.append(cf);
+ cf->show();
+ connect(cf, SIGNAL(frameMoved(ConnectionFrame *)), this, SLOT(onPlaceFrame(ConnectionFrame *)));
+ connect(cf, SIGNAL(clicked(ConnectionFrame *)), this, SLOT(onFrameClicked(ConnectionFrame *)));
+ return cf;
+}
+
+
+/***************************************************************************//**
* Load position.
* @param settings
* @param id
@@ -225,7 +278,7 @@ ConnectionFrame* MainWindow::createFrame()
bool MainWindow::loadPosition(QSettings& settings, const QString& id, int& x, int& y)
{
settings.beginGroup("client_position");
- const QVariant retval(settings.value(id));
+ const QVariant retval = (settings.value(id));
settings.endGroup();
if (retval.type() != QVariant::Point)
return false;