summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Schneider2014-07-23 17:45:35 +0200
committerManuel Schneider2014-07-23 17:45:35 +0200
commit110265bc31b634faa73242f8d14ec7aaf95b8b15 (patch)
treeb3beea30d00e9381595cd39b1e924d4342f61f15
parentClean up students broadcast (diff)
downloadpvs2-110265bc31b634faa73242f8d14ec7aaf95b8b15.tar.gz
pvs2-110265bc31b634faa73242f8d14ec7aaf95b8b15.tar.xz
pvs2-110265bc31b634faa73242f8d14ec7aaf95b8b15.zip
Read the configfile and place the frames according to the coordinates
given in /etc/xdg/openslx/pvs2mgr.ini.
-rw-r--r--TODO11
-rw-r--r--gui/server_normal/mainwindow.ui4
-rw-r--r--src/server/mainwindow/mainwindow.cpp108
-rw-r--r--src/server/mainwindow/mainwindow.h7
4 files changed, 85 insertions, 45 deletions
diff --git a/TODO b/TODO
index bbaf6a0..df8c6ca 100644
--- a/TODO
+++ b/TODO
@@ -1,3 +1,7 @@
+----------------------------------- B U G S -------------------------------------
+[ ] Frame auf 0,0 gemoved will gelöscht werden. sollte nicht sein.
+
+
--------------------------- P V S M G R ----------------------------------------
[ ] ConnectionFrame -> ComputerID ist schwachsinn. Wirklich sinnvoll wären
@@ -19,8 +23,11 @@ aus>
[x] BUG: Changing projection source in student-to-tutor results in tutor
not starting x11vnc
-[björn] Irgendwie alles das selbe :D
+[beide] Irgendwie alles das selbe :D
<--
+[x] Kann dateien lesen und frames bewegen
+[ ] vorlagen der räume
+
Anordnung auf Monitor soll Raumstrukturen (Aufstellung der Rechner in
Reihen/Inseln) abbilden / widerspiegeln. <genau! >
--
@@ -73,7 +80,7 @@ wenn PVS-Client auf Rechner online ist. Rechnersymbol soll schwarz werden.
--------------------------- V M C H O O S E R ----------------------------------
-[manuel]
+[x]
Im VMchooser (Client): -- Häkchen gesetzt, automatische Verbindung
(Session-ID) -- wenn kein Häkchen gesetzt, soll dennoch manuelle Verbindung <per
Session-ID> wählbar sein. <das heisst, der PVS soll in jedem Fall automatisch
diff --git a/gui/server_normal/mainwindow.ui b/gui/server_normal/mainwindow.ui
index 7e4ffec..fe8ff10 100644
--- a/gui/server_normal/mainwindow.ui
+++ b/gui/server_normal/mainwindow.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>1246</width>
- <height>858</height>
+ <width>800</width>
+ <height>640</height>
</rect>
</property>
<property name="windowTitle">
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp
index db161e6..55e4bce 100644
--- a/src/server/mainwindow/mainwindow.cpp
+++ b/src/server/mainwindow/mainwindow.cpp
@@ -80,9 +80,6 @@ MainWindow::MainWindow(QString ipListUrl, QWidget* parent) :
ui->action_Exit->setStatusTip(tr("Exit"));
ui->action_Lock->setStatusTip(tr("Lock or Unlock all Clients"));
- _tileWidth = 10;
- _tileHeight = 10;
-
// Initialize FileDownloader.
if (!ipListUrl.isEmpty())
{
@@ -102,40 +99,6 @@ 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
_buttonLockTimer = new QTimer(this);
@@ -167,6 +130,12 @@ MainWindow::MainWindow(QString ipListUrl, QWidget* parent) :
// Finally
// this->onSessionNameUpdate();
+
+ _tileWidth = ui->frmRoom->size().width() / _tilesX;
+ _tileHeight = ui->frmRoom->size().height() / _tilesY;
+
+
+ tryToUseRoomTemplate();
}
MainWindow::~MainWindow()
@@ -324,6 +293,69 @@ void MainWindow::tellClientCurrentSituation(Client* client)
}
/***************************************************************************//**
+ * @brief MainWindow::tryToUseRoomTemplate
+ */
+void MainWindow::tryToUseRoomTemplate()
+{
+ SYSTEM_SETTINGS(conf);
+ qDebug() << "Settings contain" << conf.allKeys();
+
+ if (!conf.contains("rooms")) {
+ qDebug() << "Invalid config file!";
+ return;
+ }
+ QStringList rooms = conf.value("rooms").toStringList();
+ qDebug() << rooms;
+
+ for (auto i : rooms)
+ {
+ conf.beginGroup(i);
+ if (!conf.contains("mgrIP")) {
+ qDebug() << "Invalid config file!";
+ return;
+ }
+ // Find the room that list the ip of this host as mgr
+ QString mgrIP = conf.value("mgrIP").toString();
+ foreach (const QHostAddress &address, QNetworkInterface::allAddresses())
+ {
+ if (address != QHostAddress(QHostAddress::LocalHost) && mgrIP == address.toString())
+ {
+ qDebug("Found this ip in config.");
+ int size = conf.beginReadArray("client");
+ for (int i = 0; i < size; ++i) {
+ conf.setArrayIndex(i);
+
+ /*
+ *
+ * CFG to test this
+ * http://git.openslx.org/tm-scripts.git/plain/server/modules/pvs2-freiburg/etc/xdg/openslx/pvs2mgr.ini
+ *
+ */
+
+ // Add the frame
+ // Position is given in grid coordinates, createFrame take pixels
+ qDebug() << conf.value("ip").toString();
+ QPoint coord = conf.value("pos").toPoint();
+ qDebug() << coord;
+ qDebug() << _tileWidth ;
+ qDebug() << _tileHeight ;
+
+ coord.setX(coord.x() * _tileWidth);
+ coord.setY(coord.y() * _tileHeight);
+ qDebug() << coord ;
+
+ ConnectionFrame *cf = createFrame(conf.value("ip").toString(), coord);
+ cf->move(cf->getCurrentPosition());
+ onPlaceFrame(cf);
+ }
+ conf.endArray();
+ }
+ }
+ conf.endGroup();
+ }
+}
+
+/***************************************************************************//**
* Returns connected client which belongs to given id.
* Iterating over ConnectionFrames and comparing id to given id.
* @param id
@@ -538,7 +570,7 @@ void MainWindow::onPlaceFrame(ConnectionFrame* frame)
}
}
}
- qDebug("Move D");
+ qDebug("Moved");
frame->move(x, y);
savePosition(frame);
const QPoint &newpos = frame->frameGeometry().topLeft();
diff --git a/src/server/mainwindow/mainwindow.h b/src/server/mainwindow/mainwindow.h
index 5de19c1..acecc28 100644
--- a/src/server/mainwindow/mainwindow.h
+++ b/src/server/mainwindow/mainwindow.h
@@ -80,16 +80,17 @@ private:
void savePosition(ConnectionFrame *cf);
void startVncServerIfNecessary(int from);
void tellClientCurrentSituation(Client* client);
+ void tryToUseRoomTemplate();
void reset();
+ Client* getClientFromId(int id);
+ ConnectionFrame* getTutorFrame();
+ ConnectionFrame* getSelectedFrame();
void closeEvent(QCloseEvent *e);
void changeEvent(QEvent *e);
void resizeEvent(QResizeEvent *e);
void mouseReleaseEvent(QMouseEvent* e);
- Client* getClientFromId(int id);
- ConnectionFrame* getTutorFrame();
- ConnectionFrame* getSelectedFrame();
protected slots:
void onTutorListDownloaded(QByteArray& tutorList);