diff options
author | Manuel Schneider | 2014-07-21 23:51:08 +0200 |
---|---|---|
committer | Manuel Schneider | 2014-07-21 23:51:08 +0200 |
commit | faccaa924e30d3383a3574fe9166540162337e97 (patch) | |
tree | 477994e5da1921e8295e7db667cae7f14a47909e /src/server | |
parent | Correct indenting by tabs (diff) | |
parent | Tried to implement the fixed room settings, but is not working correctly righ... (diff) | |
download | pvs2-faccaa924e30d3383a3574fe9166540162337e97.tar.gz pvs2-faccaa924e30d3383a3574fe9166540162337e97.tar.xz pvs2-faccaa924e30d3383a3574fe9166540162337e97.zip |
Merge branch 'master' of git.openslx.org:pvs2
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/connectionframe/connectionframe.h | 5 | ||||
-rw-r--r-- | src/server/mainwindow/mainwindow.cpp | 57 | ||||
-rw-r--r-- | src/server/mainwindow/mainwindow.h | 1 |
3 files changed, 61 insertions, 2 deletions
diff --git a/src/server/connectionframe/connectionframe.h b/src/server/connectionframe/connectionframe.h index 5a4e1df..faa1390 100644 --- a/src/server/connectionframe/connectionframe.h +++ b/src/server/connectionframe/connectionframe.h @@ -28,6 +28,7 @@ private: QPoint _clickPoint; QPoint _previousPosition; + QPoint _currentPosition; Client *_client; @@ -56,7 +57,11 @@ public: void setSelection(bool selected); const inline bool isSelected() const { return _isSelected; } + const inline void setCurrentPosition(QPoint position) { _currentPosition = position; } + const inline QPoint& getCurrentPosition() const { return _currentPosition; } + const QString& computerId() const { return _computerId; } + inline void setComputerId(QString computerId) { _computerId = computerId; } Client* client() const { return _client; } inline const bool isTutor() const { return _isTutor; } diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index 7f59191..ec55f75 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; diff --git a/src/server/mainwindow/mainwindow.h b/src/server/mainwindow/mainwindow.h index 5373209..8b0f133 100644 --- a/src/server/mainwindow/mainwindow.h +++ b/src/server/mainwindow/mainwindow.h @@ -76,6 +76,7 @@ private: void placeFrameInFreeSlot(ConnectionFrame* frame); ConnectionFrame* createFrame(); + ConnectionFrame* createFrame(QString computerId, QPoint position); bool loadPosition(QSettings& settings, const QString& id, int& x, int& y); void savePosition(ConnectionFrame *cf); void startVncServerIfNecessary(int from); |