diff options
author | Manuel Schneider | 2014-09-03 15:40:39 +0200 |
---|---|---|
committer | Manuel Schneider | 2014-09-03 15:40:39 +0200 |
commit | 6017ad54c22bcb991c832f90d2a19722198886bb (patch) | |
tree | 384bbf35357aba506d2bae131abc4747b8c30af0 | |
parent | Change system settings path. Change name of config file (diff) | |
parent | Added german translations for client. (diff) | |
download | pvs2-6017ad54c22bcb991c832f90d2a19722198886bb.tar.gz pvs2-6017ad54c22bcb991c832f90d2a19722198886bb.tar.xz pvs2-6017ad54c22bcb991c832f90d2a19722198886bb.zip |
Merge branch 'master' of git.openslx.org:pvs2
26 files changed, 687 insertions, 207 deletions
@@ -1,8 +1,17 @@ ----------------------------------- B U G S ------------------------------------- -[ ] Frame auf 0,0 gemoved will gelöscht werden. sollte nicht sein. - +[x] Frame auf 0,0 gemoved will gelöscht werden. sollte nicht sein. +[ ] Bei setzen des Session Name werden wieder alle Frames geschmissen, d.h. + die Raumbelegungsaufteilung ist hinüber. + [ ]--> Lösung: Clienten und Frames nicht löschen bei SessionName + aktualisierung --> sinnvoll? oder zu allgemein? + [x]--> Möglichkeit mit Counter: bei erster Änderung --> nicht löschen + bei weiteren Änderungen --> löschen + --> evtl. auch mit jetziger Nutzerwarunung + zu kompliziert für Nutzer? --------------------------- P V S M G R ---------------------------------------- +[x] Button plus Auswahlmenü für Räume. Idee: falls alles durcheinander, neue + Raumauswahl --> Startconfig wird geladen. [ ] ConnectionFrame -> ComputerID ist schwachsinn. Wirklich sinnvoll wären 'int IDs' welche dann auch die 1 Million (*it)->client->id() zu (*it)->id() @@ -63,7 +72,7 @@ anmelden, in der Zwischenzeit kann das System auf den default resetten....> --------------------------- P V S C L I E N T ---------------------------------- -[funktioniert bei mir] +[funktioniert bei mir(manuel), bei mir(bjoern) auch] Beim Client: Wenn Session-ID im laufenden betrieb geändert wird, fliegt der Client raus. Man kann als Client (dann) keine neue Session-ID setzen. diff --git a/gui/server_normal/mainwindow.ui b/gui/server_normal/mainwindow.ui index fe8ff10..fe87433 100644 --- a/gui/server_normal/mainwindow.ui +++ b/gui/server_normal/mainwindow.ui @@ -113,6 +113,7 @@ <addaction name="separator"/> <addaction name="action_SetAsTutor"/> <addaction name="separator"/> + <addaction name="actionReload_Room_Configuration"/> <addaction name="action_Help"/> </widget> <action name="action_Exit"> @@ -221,6 +222,18 @@ <bool>true</bool> </property> </action> + <action name="actionReload_Room_Configuration"> + <property name="icon"> + <iconset resource="../../pvsmgr.qrc"> + <normaloff>:/refresh</normaloff>:/refresh</iconset> + </property> + <property name="text"> + <string>Reload Room Configuration</string> + </property> + <property name="toolTip"> + <string>Reload Room Configuration</string> + </property> + </action> </widget> <layoutdefault spacing="6" margin="11"/> <resources> diff --git a/gui/server_normal/reloadroom.ui b/gui/server_normal/reloadroom.ui new file mode 100644 index 0000000..2013ed9 --- /dev/null +++ b/gui/server_normal/reloadroom.ui @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>ReloadRoom</class> + <widget class="QDialog" name="ReloadRoom"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Reload Room</string> + </property> + <property name="widgetResizable" stdset="0"> + <bool>true</bool> + </property> + <widget class="QWidget" name="scrollAreaWidgetContents" native="true"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>398</width> + <height>298</height> + </rect> + </property> + <widget class="QLabel" name="label"> + <property name="geometry"> + <rect> + <x>60</x> + <y>10</y> + <width>281</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Choose room configuration to reload:</string> + </property> + </widget> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="geometry"> + <rect> + <x>210</x> + <y>260</y> + <width>181</width> + <height>27</height> + </rect> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + <property name="centerButtons"> + <bool>true</bool> + </property> + </widget> + <widget class="QListWidget" name="roomList"> + <property name="geometry"> + <rect> + <x>70</x> + <y>50</y> + <width>256</width> + <height>192</height> + </rect> + </property> + <property name="font"> + <font> + <pointsize>20</pointsize> + <stylestrategy>PreferDefault</stylestrategy> + </font> + </property> + <property name="contextMenuPolicy"> + <enum>Qt::DefaultContextMenu</enum> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="resizeMode"> + <enum>QListView::Adjust</enum> + </property> + </widget> + </widget> + </widget> + <resources/> + <connections/> +</ui> diff --git a/i18n/client/pvsclient_de_DE.ts b/i18n/client/pvsclient_de_DE.ts index 2d7f7c7..96b870b 100644 --- a/i18n/client/pvsclient_de_DE.ts +++ b/i18n/client/pvsclient_de_DE.ts @@ -283,7 +283,7 @@ <message> <location filename="../../src/client/connectwindow/connectwindow.cpp" line="75"/> <source>Connected.</source> - <translation type="unfinished">Verbunden.</translation> + <translation>Verbunden.</translation> </message> <message> <source>Connect</source> @@ -292,57 +292,57 @@ <message> <location filename="../../src/client/connectwindow/connectwindow.cpp" line="74"/> <source>&Disconnect</source> - <translation type="unfinished">&Trennen</translation> + <translation>&Trennen</translation> </message> <message> <location filename="../../src/client/connectwindow/connectwindow.cpp" line="81"/> <source>&Stop</source> - <translation type="unfinished"></translation> + <translation>&Stop</translation> </message> <message> <location filename="../../src/client/connectwindow/connectwindow.cpp" line="83"/> <source>&Connect</source> - <translation type="unfinished"></translation> + <translation>&Verbinden</translation> </message> <message> <location filename="../../src/client/connectwindow/connectwindow.cpp" line="88"/> <source>Ready to connect; please enter session name.</source> - <translation type="unfinished"></translation> + <translation>Bereit für Verbindung; Bitte den Sitzungsname eingeben.</translation> </message> <message> <location filename="../../src/client/connectwindow/connectwindow.cpp" line="91"/> <source>Scanning for session %1.</source> - <translation type="unfinished"></translation> + <translation>Suche nach Sitzung %1.</translation> </message> <message> <location filename="../../src/client/connectwindow/connectwindow.cpp" line="95"/> <source>Found session, connecting...</source> - <translation type="unfinished"></translation> + <translation>Sitzung gefunden, verbinden...</translation> </message> <message> <location filename="../../src/client/connectwindow/connectwindow.cpp" line="98"/> <source>Waiting for server challenge...</source> - <translation type="unfinished"></translation> + <translation>Warten auf Serveranforderung...</translation> </message> <message> <location filename="../../src/client/connectwindow/connectwindow.cpp" line="101"/> <source>Replied to challenge, sent own...</source> - <translation type="unfinished"></translation> + <translation>Anforderung erwiedert, sende eigene...</translation> </message> <message> <location filename="../../src/client/connectwindow/connectwindow.cpp" line="104"/> <source>Logging in...</source> - <translation type="unfinished"></translation> + <translation>Einloggen...</translation> </message> <message> <location filename="../../src/client/connectwindow/connectwindow.cpp" line="107"/> <source>Connection established!</source> - <translation type="unfinished"></translation> + <translation>Verbindung vorhanden!</translation> </message> <message> <location filename="../../src/client/connectwindow/connectwindow.cpp" line="113"/> <source>Invalid hash: %1; invalid cert: %2; invalid iplist: %3; invalid sslhash: %4</source> - <translation type="unfinished"></translation> + <translation>Ungültiger hash: %1; ungültiges Zertifikat: %2; ungültige IP - Liste: %3; ungültiger sslhash: %4</translation> </message> </context> <context> @@ -350,17 +350,17 @@ <message> <location filename="../../build/ui_connect.h" line="80"/> <source>Connect to PVS session</source> - <translation type="unfinished"></translation> + <translation>Verbinde zu PVS Sitzung</translation> </message> <message> <location filename="../../build/ui_connect.h" line="81"/> <source>Session Name</source> - <translation type="unfinished"></translation> + <translation>Sitzungsname</translation> </message> <message> <location filename="../../build/ui_connect.h" line="82"/> <source>Hide</source> - <translation type="unfinished"></translation> + <translation>Ausblenden</translation> </message> </context> <context> @@ -473,22 +473,22 @@ <message> <location filename="../../src/client/toolbar/toolbar.cpp" line="38"/> <source>&Connect</source> - <translation type="unfinished"></translation> + <translation>&Verbinde</translation> </message> <message> <location filename="../../src/client/toolbar/toolbar.cpp" line="40"/> <source>&Quit</source> - <translation type="unfinished">&Beenden</translation> + <translation>&Beenden</translation> </message> <message> <location filename="../../src/client/toolbar/toolbar.cpp" line="168"/> <source>Offline</source> - <translation type="unfinished"></translation> + <translation>Offline</translation> </message> <message> <location filename="../../src/client/toolbar/toolbar.cpp" line="174"/> <source>Online</source> - <translation type="unfinished"></translation> + <translation>Online</translation> </message> </context> <context> @@ -496,27 +496,27 @@ <message> <location filename="../../build/ui_toolbar.h" line="169"/> <source>Form</source> - <translation type="unfinished"></translation> + <translation>Form</translation> </message> <message> <location filename="../../build/ui_toolbar.h" line="171"/> <source>Menu</source> - <translation type="unfinished">Menü</translation> + <translation>Menü</translation> </message> <message> <location filename="../../build/ui_toolbar.h" line="173"/> <source>Host:</source> - <translation type="unfinished"></translation> + <translation>Host:</translation> </message> <message> <location filename="../../build/ui_toolbar.h" line="175"/> <source>Click to connect</source> - <translation type="unfinished">Zum Verbinden Klicken</translation> + <translation>Zum Verbinden Klicken</translation> </message> <message> <location filename="../../build/ui_toolbar.h" line="177"/> <source>-</source> - <translation type="unfinished"></translation> + <translation>-</translation> </message> </context> </TS> diff --git a/i18n/server/pvsmgr_de_DE.ts b/i18n/server/pvsmgr_de_DE.ts index 216f223..7ef0974 100644 --- a/i18n/server/pvsmgr_de_DE.ts +++ b/i18n/server/pvsmgr_de_DE.ts @@ -2,202 +2,199 @@ <!DOCTYPE TS> <TS version="2.0" language="de_DE" sourcelanguage="en_US"> <context> - <name>AboutDialog</name> + <name>Help</name> <message> - <source>Version: </source> - <translation type="obsolete">Version:</translation> - </message> -</context> -<context> - <name>AboutDialogClass</name> - <message> - <source>PVS - About</source> - <translation type="obsolete">PVS - Über</translation> - </message> - <message> - <source>About</source> - <translation type="obsolete">Über</translation> + <location filename="../../build/ui_help.h" line="245"/> + <source>Form</source> + <translation>Form</translation> </message> <message> - <source>Authors</source> - <translation type="obsolete">Autoren</translation> + <location filename="../../build/ui_help.h" line="246"/> + <source>Cancel</source> + <translation>Abbruch</translation> </message> <message> - <source>Translation</source> - <translation type="obsolete">Übersetzung</translation> + <location filename="../../build/ui_help.h" line="248"/> + <source>Stop running projections.</source> + <translation>Alle Projektionen abbrechen.</translation> </message> -</context> -<context> - <name>ClientFileSendDialogClass</name> <message> - <source>PVS - File Transfer</source> - <translation type="obsolete">PVS - Dateiübertragung</translation> + <location filename="../../build/ui_help.h" line="250"/> + <source>Start projection from selected student to tutor and blank all others.</source> + <translation>Projektion des ausgewählten Studierendens an Tutor; alle anderen ausblenden.</translation> </message> <message> - <source>Sending to:</source> - <translation type="obsolete">Senden an:</translation> + <location filename="../../build/ui_help.h" line="252"/> + <source>Start projection from selected student to tutor.</source> + <translation>Startet Projektion von ausgewähltem Studierenden an Tutor.</translation> </message> <message> - <source>unknown</source> - <translation type="obsolete">unbekannt</translation> + <location filename="../../build/ui_help.h" line="254"/> + <source>Start projection from tutor to selected student.</source> + <translation>Startet Projektion von Tutor an ausgewählten Studierenden.</translation> </message> <message> - <source>0</source> - <translation type="obsolete">0</translation> + <location filename="../../build/ui_help.h" line="256"/> + <source>Start projection from tutor to all connected students.</source> + <translation>Startet Projektion von Tutor an alle verbundenen Studierenden.</translation> </message> <message> - <source>/</source> - <translation type="obsolete">/</translation> + <location filename="../../build/ui_help.h" line="258"/> + <source>Lock all connected students screens.</source> + <translation>Alle verbundenen Studierendenbildschirme sperren.</translation> </message> <message> - <source>&Cancel</source> - <translation type="obsolete">&Abbruch</translation> + <location filename="../../build/ui_help.h" line="260"/> + <source>Set selected client to tutor.</source> + <translation>Ausgewählten Klienten als Tutor festlegen.</translation> </message> </context> <context> <name>MainWindow</name> <message> - <location filename="../../build/ui_mainwindow.h" line="130"/> - <location filename="../../src/server/mainwindow/mainwindow.cpp" line="59"/> + <location filename="../../build/ui_mainwindow.h" line="160"/> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="80"/> <source>Exit</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../../src/server/mainwindow/mainwindow.cpp" line="338"/> - <source>Session Name: %1 [click to edit]</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../../src/server/mainwindow/mainwindow.cpp" line="453"/> - <location filename="../../src/server/mainwindow/mainwindow.cpp" line="481"/> - <location filename="../../src/server/mainwindow/mainwindow.cpp" line="486"/> - <location filename="../../src/server/mainwindow/mainwindow.cpp" line="491"/> - <location filename="../../src/server/mainwindow/mainwindow.cpp" line="518"/> - <location filename="../../src/server/mainwindow/mainwindow.cpp" line="546"/> - <location filename="../../src/server/mainwindow/mainwindow.cpp" line="551"/> - <location filename="../../src/server/mainwindow/mainwindow.cpp" line="556"/> - <source>Projection</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../../src/server/mainwindow/mainwindow.cpp" line="454"/> - <location filename="../../src/server/mainwindow/mainwindow.cpp" line="482"/> - <location filename="../../src/server/mainwindow/mainwindow.cpp" line="547"/> - <source>No projection source selected.</source> - <translation type="unfinished"></translation> + <translation>Ausgang</translation> </message> <message> - <location filename="../../src/server/mainwindow/mainwindow.cpp" line="487"/> - <location filename="../../src/server/mainwindow/mainwindow.cpp" line="519"/> - <location filename="../../src/server/mainwindow/mainwindow.cpp" line="552"/> - <source>No tutor defined, or tutor is offline.</source> - <translation type="unfinished"></translation> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="557"/> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="891"/> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="898"/> + <source>Selection</source> + <translation>Auswahl</translation> </message> <message> - <location filename="../../src/server/mainwindow/mainwindow.cpp" line="492"/> - <source>Selected projection target is tutor.</source> - <translation type="unfinished"></translation> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="652"/> + <source>Session Name: %1 [click to edit]</source> + <translation>Sitzungsname: %1 [anklicken editiert]</translation> </message> <message> - <location filename="../../src/server/mainwindow/mainwindow.cpp" line="557"/> - <source>Selected projection source is tutor.</source> - <translation type="unfinished"></translation> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="698"/> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="700"/> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="702"/> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="731"/> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="733"/> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="735"/> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="737"/> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="739"/> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="770"/> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="772"/> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="774"/> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="776"/> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="778"/> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="810"/> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="812"/> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="814"/> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="816"/> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="818"/> + <source>Projection</source> + <translation>Projektion</translation> </message> <message> - <location filename="../../src/server/mainwindow/mainwindow.cpp" line="770"/> - <source>Projection Error</source> - <translation type="unfinished"></translation> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="891"/> + <source>No client is selected.</source> + <translation>Kein Klient ausgewählt.</translation> </message> <message> - <location filename="../../src/server/mainwindow/mainwindow.cpp" line="771"/> - <source>Could not send screen contents of %1 to other clients: VNC Startup failed.</source> - <translation type="unfinished"></translation> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="898"/> + <source>The selected client is not connected.</source> + <translation>Ausgewählter Klient ist nicht verbunden.</translation> </message> <message> - <location filename="../../build/ui_mainwindow.h" line="135"/> - <location filename="../../src/server/mainwindow/mainwindow.cpp" line="60"/> + <location filename="../../build/ui_mainwindow.h" line="165"/> + <location filename="../../src/server/mainwindow/mainwindow.cpp" line="81"/> <source>Lock or Unlock all Clients</source> - <translation type="unfinished"></translation> + <translation>Alle Klienten sperren oder entsperren</translation> </message> <message> - <location filename="../../build/ui_mainwindow.h" line="127"/> + <location filename="../../build/ui_mainwindow.h" line="157"/> <source>PVS2 Manager</source> - <translation type="unfinished"></translation> + <translation>PVS2-Manager</translation> </message> <message> - <location filename="../../build/ui_mainwindow.h" line="128"/> + <location filename="../../build/ui_mainwindow.h" line="158"/> <source>&Exit</source> - <translation type="unfinished"></translation> + <translation>&Abbruch</translation> </message> <message> - <location filename="../../build/ui_mainwindow.h" line="132"/> + <location filename="../../build/ui_mainwindow.h" line="162"/> <source>Ctrl+Q</source> - <translation type="unfinished"></translation> + <translation>Strg+Q</translation> </message> <message> - <location filename="../../build/ui_mainwindow.h" line="133"/> + <location filename="../../build/ui_mainwindow.h" line="163"/> <source>lock</source> - <translation type="unfinished"></translation> + <translation>lock</translation> </message> <message> - <location filename="../../build/ui_mainwindow.h" line="137"/> + <location filename="../../build/ui_mainwindow.h" line="167"/> <source>Ctrl+A</source> - <translation type="unfinished"></translation> + <translation>Strg+A</translation> </message> <message> - <location filename="../../build/ui_mainwindow.h" line="138"/> - <source>Broadcast Screen to Everyone</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../../build/ui_mainwindow.h" line="140"/> - <source>Student's Screen to Everyone</source> - <translation type="unfinished"></translation> + <location filename="../../build/ui_mainwindow.h" line="168"/> + <source>Student's Screen to Tutor</source> + <translation>Studierendenbildschirm an Tutor</translation> </message> <message> - <location filename="../../build/ui_mainwindow.h" line="142"/> - <source>Student's Screen to Tutor</source> - <translation type="unfinished"></translation> + <location filename="../../build/ui_mainwindow.h" line="169"/> + <source>Student's Screen to Tutor, others blanked</source> + <translation>Studierendenbildschirm an Tutor; alle anderen ausgeblendet</translation> </message> <message> - <location filename="../../build/ui_mainwindow.h" line="143"/> + <location filename="../../build/ui_mainwindow.h" line="170"/> <source>Tutor's Screen to Student</source> - <translation type="unfinished"></translation> + <translation>Tutorenbildschirm an Studierenden</translation> </message> <message> - <location filename="../../build/ui_mainwindow.h" line="144"/> + <location filename="../../build/ui_mainwindow.h" line="171"/> <source>Tutor's Screen to Everyone</source> - <translation type="unfinished"></translation> + <translation>Tutorenbildschirm an alle</translation> </message> <message> - <location filename="../../build/ui_mainwindow.h" line="145"/> - <source>toolBar</source> - <translation type="unfinished"></translation> + <location filename="../../build/ui_mainwindow.h" line="172"/> + <source>Stop Projection on every Client</source> + <translation>Projektion an alle Klienten abbrechen</translation> + </message> + <message> + <location filename="../../build/ui_mainwindow.h" line="173"/> + <source>SetAsTutor</source> + <translation>AlsTutorSetzen</translation> + </message> + <message> + <location filename="../../build/ui_mainwindow.h" line="175"/> + <source>Set current Frame as Tutor</source> + <translation>Derzeitigen Rahmen als Tutor festlegen</translation> + </message> + <message> + <location filename="../../build/ui_mainwindow.h" line="177"/> + <location filename="../../build/ui_mainwindow.h" line="179"/> + <source>Help</source> + <translation>Hilfe</translation> </message> -</context> -<context> - <name>ServerFileTransfert</name> <message> - <source>PVS - File Transfer</source> - <translation type="obsolete">PVS - Dateiübertragung</translation> + <location filename="../../build/ui_mainwindow.h" line="182"/> + <source>toolBar</source> + <translation>toolBar</translation> </message> </context> <context> <name>SessionName</name> <message> - <location filename="../../build/ui_sessionname.h" line="72"/> + <location filename="../../build/ui_sessionname.h" line="71"/> <source>Set session name</source> - <translation type="unfinished"></translation> + <translation>Sitzungsname eingeben</translation> </message> <message> - <location filename="../../build/ui_sessionname.h" line="73"/> + <location filename="../../build/ui_sessionname.h" line="72"/> <source>New session name</source> - <translation type="unfinished"></translation> + <translation>Neuer Sitzungsname</translation> </message> <message> - <location filename="../../build/ui_sessionname.h" line="74"/> + <location filename="../../build/ui_sessionname.h" line="73"/> <source>Random name</source> - <translation type="unfinished"></translation> + <translation>Zufälliger Sitzungsname</translation> </message> </context> </TS> diff --git a/icons/refresh.svg b/icons/refresh.svg Binary files differnew file mode 100644 index 0000000..e499882 --- /dev/null +++ b/icons/refresh.svg diff --git a/pvs2.config b/pvs2.config new file mode 100644 index 0000000..8cec188 --- /dev/null +++ b/pvs2.config @@ -0,0 +1 @@ +// ADD PREDEFINED MACROS HERE! diff --git a/pvs2.creator b/pvs2.creator new file mode 100644 index 0000000..e94cbbd --- /dev/null +++ b/pvs2.creator @@ -0,0 +1 @@ +[General] diff --git a/pvs2.files b/pvs2.files new file mode 100644 index 0000000..1c0e283 --- /dev/null +++ b/pvs2.files @@ -0,0 +1,90 @@ +build/CMakeFiles/2.8.12.2/CompilerIdC/CMakeCCompilerId.c +build/CMakeFiles/2.8.12.2/CompilerIdCXX/CMakeCXXCompilerId.cpp +build/src/client/connectwindow/moc_connectwindow.cxx +build/src/client/net/moc_serverconnection.cxx +build/src/client/net/moc_serverdiscovery.cxx +build/src/client/toolbar/moc_toolbar.cxx +build/src/client/util/platform/moc_blankscreen.cxx +build/src/client/util/moc_util.cxx +build/src/client/vnc/moc_vncserver.cxx +build/src/client/vnc/moc_vncthread.cxx +build/src/client/vnc/moc_vncwindow.cxx +build/src/server/clicklabel/moc_clicklabel.cxx +build/src/server/connectionframe/moc_connectionframe.cxx +build/src/server/helpwindow/moc_helpwindow.cxx +build/src/server/mainwindow/moc_mainwindow.cxx +build/src/server/net/moc_certmanager.cxx +build/src/server/net/moc_client.cxx +build/src/server/net/moc_discoverylistener.cxx +build/src/server/net/moc_filedownloader.cxx +build/src/server/net/moc_listenserver.cxx +build/src/server/net/moc_sslserver.cxx +build/src/server/reloadroomwindow/moc_reloadroomwindow.cxx +build/src/server/reloadwindow/moc_reloadwindow.cxx +build/src/server/sessionnamewindow/moc_sessionnamewindow.cxx +build/src/server/util/moc_global.cxx +build/src/server/util/moc_util.cxx +build/qrc_pvsclient.cxx +build/qrc_pvsmgr.cxx +build/ui_connect.h +build/ui_help.h +build/ui_mainwindow.h +build/ui_reloadroom.h +build/ui_sessionname.h +build/ui_toolbar.h +src/client/connectwindow/connectwindow.cpp +src/client/connectwindow/connectwindow.h +src/client/net/serverconnection.cpp +src/client/net/serverconnection.h +src/client/net/serverdiscovery.cpp +src/client/net/serverdiscovery.h +src/client/toolbar/toolbar.cpp +src/client/toolbar/toolbar.h +src/client/util/platform/blankscreen.h +src/client/util/platform/blankscreen_Win32.cpp +src/client/util/platform/blankscreen_X11.cpp +src/client/util/util.cpp +src/client/util/util.h +src/client/vnc/vncserver.cpp +src/client/vnc/vncserver.h +src/client/vnc/vncthread.cpp +src/client/vnc/vncthread.h +src/client/vnc/vncwindow.cpp +src/client/vnc/vncwindow.h +src/client/main.cpp +src/server/clicklabel/clicklabel.cpp +src/server/clicklabel/clicklabel.h +src/server/connectionframe/connectionframe.cpp +src/server/connectionframe/connectionframe.h +src/server/helpwindow/helpwindow.cpp +src/server/helpwindow/helpwindow.h +src/server/mainwindow/mainwindow.cpp +src/server/mainwindow/mainwindow.h +src/server/net/certmanager.cpp +src/server/net/certmanager.h +src/server/net/client.cpp +src/server/net/client.h +src/server/net/discoverylistener.cpp +src/server/net/discoverylistener.h +src/server/net/filedownloader.cpp +src/server/net/filedownloader.h +src/server/net/listenserver.cpp +src/server/net/listenserver.h +src/server/net/sslserver.cpp +src/server/net/sslserver.h +src/server/reloadroomwindow/reloadroomwindow.cpp +src/server/reloadroomwindow/reloadroomwindow.h +src/server/sessionnamewindow/sessionnamewindow.cpp +src/server/sessionnamewindow/sessionnamewindow.h +src/server/util/global.cpp +src/server/util/global.h +src/server/util/util.cpp +src/server/util/util.h +src/server/main.cpp +src/shared/network.cpp +src/shared/network.h +src/shared/networkmessage.cpp +src/shared/networkmessage.h +src/shared/settings.h +src/shared/util.cpp +src/shared/util.h
\ No newline at end of file diff --git a/pvs2.includes b/pvs2.includes new file mode 100644 index 0000000..1b64a2e --- /dev/null +++ b/pvs2.includes @@ -0,0 +1,16 @@ +build +src/client/connectwindow +src/client/net +src/client/toolbar +src/client/util +src/client/util/platform +src/client/vnc +src/server/clicklabel +src/server/connectionframe +src/server/helpwindow +src/server/mainwindow +src/server/net +src/server/reloadroomwindow +src/server/sessionnamewindow +src/server/util +src/shared
\ No newline at end of file @@ -16,6 +16,7 @@ <file alias="student2tutorextension">icons/student2tutor_extension.svg</file> <file alias="helpme">icons/help.svg</file> <file alias="trash">icons/trash.svg</file> + <file alias="refresh">icons/refresh.svg</file> <file alias="AUTHORS">AUTHORS</file> <file alias="TRANSLATION">TRANSLATION</file> <file alias="pvsmgr.qm">build/pvsmgr_de_DE.qm</file> diff --git a/src/client/connectwindow/connectwindow.cpp b/src/client/connectwindow/connectwindow.cpp index 7f24281..90cba27 100644 --- a/src/client/connectwindow/connectwindow.cpp +++ b/src/client/connectwindow/connectwindow.cpp @@ -158,13 +158,13 @@ void ConnectWindow::showEvent(QShowEvent* event) * if not --> connect to given sessionName. * @param sessionName */ -void ConnectWindow::connectToSession(const QByteArray sessionName) +void ConnectWindow::connectToSession(const QByteArray sessionName, QString mgrIP) { if (_connected || _state != Idle) return; _state = Scanning; this->updateState(); - _serverDiscovery.start(sessionName); + _serverDiscovery.start(sessionName, mgrIP); } /* @@ -199,7 +199,8 @@ void ConnectWindow::onBtnConnection() { // Connect (scan for session) _tryReconnect = true; - connectToSession(_ui->lineEditName->text().toUtf8()); + // qDebug() << _ui->lineEditName->text().toUtf8(); + connectToSession(_ui->lineEditName->text().toUtf8(), NULL); } } @@ -279,5 +280,5 @@ void ConnectWindow::onConnectionDisconnected() _state = Idle; this->updateState(); if (_tryReconnect) - connectToSession(_ui->lineEditName->text().toUtf8()); + connectToSession(_ui->lineEditName->text().toUtf8(), NULL); } diff --git a/src/client/connectwindow/connectwindow.h b/src/client/connectwindow/connectwindow.h index df112fe..a786119 100644 --- a/src/client/connectwindow/connectwindow.h +++ b/src/client/connectwindow/connectwindow.h @@ -54,7 +54,7 @@ public: explicit ConnectWindow(QWidget *parent = NULL); virtual ~ConnectWindow(); - void connectToSession(const QByteArray sessionName); + void connectToSession(const QByteArray sessionName, QString mgrIP); private: Ui::ConnectWindow *_ui; diff --git a/src/client/main.cpp b/src/client/main.cpp index 0907528..b268ca3 100644 --- a/src/client/main.cpp +++ b/src/client/main.cpp @@ -5,7 +5,7 @@ int main(int argc, char** argv) { if (argc > 2) { - std::cerr << "Usage: " << argv[0] << " [sessionId]" << std::endl; + std::cerr << "Usage: " << argv[0] << " [sessionId] | --auto" << std::endl; exit(EXIT_FAILURE); } @@ -42,7 +42,16 @@ int main(int argc, char** argv) translator.load(":pvsclient"); app.installTranslator(&translator); + if (argc == 2) { + if (argv[1] == std::string("--auto")) { + qDebug() << "Calling Toolbar(true)"; + Toolbar *pvsclient = new Toolbar(true); // auto connect client without session ID. + } else { + Toolbar *pvsclient = new Toolbar(QByteArray(argv[1])); // connect client with given session ID. + } + } else { + Toolbar *pvsclient = new Toolbar(); // create normal client. + } - Toolbar *pvsclient = argc == 2 ? new Toolbar(QByteArray(argv[1])) : new Toolbar(); return app.exec(); } diff --git a/src/client/net/serverconnection.cpp b/src/client/net/serverconnection.cpp index babd64f..7954c34 100644 --- a/src/client/net/serverconnection.cpp +++ b/src/client/net/serverconnection.cpp @@ -26,7 +26,7 @@ ServerConnection::ServerConnection(const QString& host, const quint16 port, cons connect(_socket, SIGNAL(encrypted()), this, SLOT(sock_connected())); connect(_socket, SIGNAL(readyRead()), this, SLOT(sock_dataArrival())); connect(_socket, SIGNAL(disconnected()), this, SLOT(sock_closed())); - connect(_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(sock_error(QAbstractSocket::SocketError))); + connect(_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(sock_error(QAbstractSocket::SocketError))); connect(_socket, SIGNAL(sslErrors(const QList<QSslError> &)), this, diff --git a/src/client/net/serverdiscovery.cpp b/src/client/net/serverdiscovery.cpp index a4edb46..2cd0796 100644 --- a/src/client/net/serverdiscovery.cpp +++ b/src/client/net/serverdiscovery.cpp @@ -45,8 +45,14 @@ ServerDiscovery::~ServerDiscovery() /***************************************************************************//** * @brief start */ -void ServerDiscovery::start(const QByteArray& sessionName) +void ServerDiscovery::start(const QByteArray& sessionName, QString mgrIP) { + if (mgrIP != NULL) { + _mgrIP.setAddress(mgrIP); + } else { + _mgrIP = NULL; + } + //assert(!this->isActive()); // Set the session which is searched @@ -98,21 +104,31 @@ void ServerDiscovery::doDiscovery() _packet.setField(_SALT1, salt1); _packet.setField(_SALT2, _salt2); _packet.setField(_IPLIST, iplist); - foreach (QNetworkInterface interface, QNetworkInterface::allInterfaces()) + + // Check if specifig manager IP is given. If not broadcast in whole network. + if (_mgrIP != QHostAddress::Null) + { + qDebug() << "Broadcasting to " << _mgrIP.toString(); + if (!_packet.writeMessage(&_discoverySocket, _mgrIP, SERVICE_DISCOVERY_PORT)) + qDebug("Failed"); + } else { - foreach (QNetworkAddressEntry entry, interface.addressEntries()) + foreach (QNetworkInterface interface, QNetworkInterface::allInterfaces()) { - if (!entry.broadcast().isNull() && entry.ip() != QHostAddress::LocalHost && entry.ip() != QHostAddress::LocalHostIPv6) + foreach (QNetworkAddressEntry entry, interface.addressEntries()) { - qDebug() << "Broadcasting to " << entry.broadcast().toString(); - if (!_packet.writeMessage(&_discoverySocket, entry.broadcast(), SERVICE_DISCOVERY_PORT)) - qDebug("FAILED"); + if (!entry.broadcast().isNull() && entry.ip() != QHostAddress::LocalHost && entry.ip() != QHostAddress::LocalHostIPv6) + { + qDebug() << "Broadcasting to " << entry.broadcast().toString(); + if (!_packet.writeMessage(&_discoverySocket, entry.broadcast(), SERVICE_DISCOVERY_PORT)) + qDebug("FAILED"); + } } } + qDebug("Broadcasting to 255.255.255.255"); + if (!_packet.writeMessage(&_discoverySocket, QHostAddress::Broadcast, SERVICE_DISCOVERY_PORT)) + qDebug("FAILED"); } - qDebug("Broadcasting to 255.255.255.255"); - if (!_packet.writeMessage(&_discoverySocket, QHostAddress::Broadcast, SERVICE_DISCOVERY_PORT)) - qDebug("FAILED"); // Start the timer again with a larger interval if (_discoveryTimer.interval() < 5000) diff --git a/src/client/net/serverdiscovery.h b/src/client/net/serverdiscovery.h index 093b841..fee9fd0 100644 --- a/src/client/net/serverdiscovery.h +++ b/src/client/net/serverdiscovery.h @@ -19,7 +19,7 @@ class ServerDiscovery : public QObject explicit ServerDiscovery(QObject *parent = 0); ~ServerDiscovery(); - void start(const QByteArray& sessionName); + void start(const QByteArray& sessionName, QString mgrIP); void stop(); inline bool isActive(){ return _discoveryTimer.isActive(); } @@ -32,6 +32,8 @@ class ServerDiscovery : public QObject QUdpSocket _discoverySocket; NetworkMessage _packet; + QHostAddress _mgrIP; + static const int UDPBUFSIZ = 9000; static const int SALT_LEN = 18; diff --git a/src/client/toolbar/toolbar.cpp b/src/client/toolbar/toolbar.cpp index 837bc08..1838166 100644 --- a/src/client/toolbar/toolbar.cpp +++ b/src/client/toolbar/toolbar.cpp @@ -4,18 +4,20 @@ * Created on: 21.01.2013 * Author: sr */ +#include <QNetworkInterface> #include "../../shared/settings.h" #include "../net/serverconnection.h" #include "../vnc/vncwindow.h" #include "../vnc/vncserver.h" +#include "../util/util.h" #include "toolbar.h" #include "ui_toolbar.h" /***************************************************************************//** - * @brief Constructor of the Toolbar. + * @brief * * Does exact teh same as Toolbar::Toolbar(QWidget *parent) but additionally * instantly tries to connect to a pvsmgr with the given sessionName. @@ -27,7 +29,38 @@ Toolbar::Toolbar(const QByteArray sessionName, QWidget *parent) : Toolbar(parent) { - _connectWindow->connectToSession(sessionName); + qDebug() << "sessionName - constructor"; + _connectWindow->connectToSession(sessionName, NULL); +} + +/***************************************************************************//** + * @brief Constructor of the Toolbar. + * + * Does exact the same as Toolbar::Toolbar(QWidget *parent) but additionally + * instantly tries to connect to the pvsmgr in its room without sessionName. + * @param autoConnect + * @param parent If parent is 0, the new widget becomes a window. If parent is + * another widget, this widget becomes a child window inside parent. The new + * widget is deleted when its parent is deleted. + */ +Toolbar::Toolbar(const bool autoConnect, QWidget *parent) : Toolbar(parent) +{ + qDebug() << "auto - constructor!"; + + if (autoConnect) { + // Try getting manager ip. + QString mgrIp = identifyMgrIP(); + qDebug() << "mgrIP: " << mgrIp; + if (mgrIp != NULL) { + qDebug() << "Starting WITH specific mgrIP"; + _connectWindow->connectToSession("", mgrIp); + } else { + qDebug() << "Starting WITHOUT specific mgrIP"; + _connectWindow->connectToSession("", NULL); + } + } else { + _connectWindow->connectToSession("", NULL); + } } /***************************************************************************//** @@ -144,6 +177,55 @@ void Toolbar::enterEvent(QEvent* e) QWidget::enterEvent(e); } +QString Toolbar::identifyMgrIP() +{ + SYSTEM_SETTINGS(conf); + qDebug() << "Settings contain" << conf.allKeys(); + + if (!conf.contains("rooms")) { + qDebug() << "Invalid config file!"; + return NULL; + } + + QStringList rooms = conf.value("rooms").toStringList(); + // qDebug() << rooms; + + for (auto i : rooms) + { + qDebug() << "i: " << i; + conf.beginGroup(i); + if (!conf.contains("mgrIP")) { + qDebug() << "Invalid config file!"; + return NULL; + } + + // Find the managerIP of current room. + QString mgrIP = conf.value("mgrIP").toString(); + foreach (const QHostAddress &address, QNetworkInterface::allAddresses()) + { + int size = conf.beginReadArray("client"); + for (int j = 0; j < size; ++j) { + conf.setArrayIndex(j); + /* + * + * CFG to test this + * http://git.openslx.org/tm-scripts.git/plain/server/modules/pvs2-freiburg/etc/xdg/openslx/pvs2client.ini + * + */ + QString ip = conf.value("ip").toString(); + if (address != QHostAddress(QHostAddress::LocalHost) && ip == address.toString()) + { + qDebug("Found this ip in config."); + return mgrIP; + } + } + conf.endArray(); + } + conf.endGroup(); + } + return NULL; +} + /* * Slots */ diff --git a/src/client/toolbar/toolbar.h b/src/client/toolbar/toolbar.h index 80ddd69..84f6d2d 100644 --- a/src/client/toolbar/toolbar.h +++ b/src/client/toolbar/toolbar.h @@ -32,6 +32,7 @@ class Toolbar : public QWidget public: Toolbar(QWidget *parent = 0); Toolbar(const QByteArray sessionName, QWidget *parent = 0); + Toolbar(const bool autoConnect, QWidget *parent = 0); virtual ~Toolbar(); private: @@ -49,6 +50,7 @@ private: void leaveEvent(QEvent* e); void enterEvent(QEvent* e); + QString identifyMgrIP(); private slots: void onVncServerIsRunning(int port); diff --git a/src/client/util/util.h b/src/client/util/util.h index 82248c0..662599f 100644 --- a/src/client/util/util.h +++ b/src/client/util/util.h @@ -6,8 +6,8 @@ // Use like this: // USER_SETTINGS(settings) // settings.value("somekey") -#define USER_SETTINGS(name) QSettings name (QSettings::IniFormat, QSettings::UserScope, "openslx", "pvs2client") -#define SYSTEM_SETTINGS(name) QSettings name (QSettings::IniFormat, QSettings::SystemScope, "openslx", "pvs2client") +#define USER_SETTINGS(name) QSettings name (QSettings::IniFormat, QSettings::UserScope, "openslx", "pvs2") +#define SYSTEM_SETTINGS(name) QSettings name (QSettings::IniFormat, QSettings::SystemScope, "openslx", "pvs2") #include <QDir> diff --git a/src/server/connectionframe/connectionframe.cpp b/src/server/connectionframe/connectionframe.cpp index 1bf6fb6..39aba12 100644 --- a/src/server/connectionframe/connectionframe.cpp +++ b/src/server/connectionframe/connectionframe.cpp @@ -188,7 +188,7 @@ void ConnectionFrame::mouseReleaseEvent(QMouseEvent* event) if ((this->pos() - _previousPosition).manhattanLength() > _startDragDistance ) { qDebug("Moved"); - emit frameMoved(this); + emit frameMoved(true, this); } else { diff --git a/src/server/connectionframe/connectionframe.h b/src/server/connectionframe/connectionframe.h index faa1390..188cdc7 100644 --- a/src/server/connectionframe/connectionframe.h +++ b/src/server/connectionframe/connectionframe.h @@ -61,7 +61,7 @@ public: const inline QPoint& getCurrentPosition() const { return _currentPosition; } const QString& computerId() const { return _computerId; } - inline void setComputerId(QString computerId) { _computerId = computerId; } + const inline void setComputerId(QString computerId) { _computerId = computerId; } Client* client() const { return _client; } inline const bool isTutor() const { return _isTutor; } @@ -78,7 +78,7 @@ protected: void timerEvent(QTimerEvent* event); signals: - void frameMoved(ConnectionFrame* frame); + void frameMoved(bool activateTrash, ConnectionFrame* frame); void doubleClicked(ConnectionFrame* frame); void clicked(ConnectionFrame* frame); diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index 55e4bce..17e821a 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -24,6 +24,8 @@ #include "../sessionnamewindow/sessionnamewindow.h" #include "../connectionframe/connectionframe.h" #include "../helpwindow/helpwindow.h" +#include "../reloadroomwindow/reloadroomwindow.h" +#include "ui_reloadroom.h" // Network #include "../net/listenserver.h" #include "../net/client.h" @@ -61,6 +63,8 @@ MainWindow::MainWindow(QString ipListUrl, QWidget* parent) : _sessionNameWindow = new SessionNameWindow(this); _helpWindow = new HelpWindow(this); _helpWindow->setWindowTitle("Help"); + _reloadWindow = new ReloadRoomWindow(this); + _reloadWindow->setWindowTitle("Reload Room"); ui->setupUi(this); Global::setSessionName(); @@ -98,6 +102,7 @@ MainWindow::MainWindow(QString ipListUrl, QWidget* parent) : connect(ui->action_SetAsTutor, SIGNAL(triggered()), this, SLOT(onButtonStopProjection())); connect(ui->action_Lock, SIGNAL(toggled(bool)), this, SLOT(onButtonLock(bool))); connect(ui->action_Help, SIGNAL(triggered()), this, SLOT(onButtonHelp())); + connect(ui->actionReload_Room_Configuration, SIGNAL(triggered()), this, SLOT(onButtonReloadRoomConfig())); /* Stuff for the button lock */ //Setup a timeout @@ -129,7 +134,9 @@ MainWindow::MainWindow(QString ipListUrl, QWidget* parent) : _discoveryListener = new DiscoveryListener(); // Finally -// this->onSessionNameUpdate(); + _countSessionNameUpdate = 0; + this->onSessionNameUpdate(); // Just make lable visible. + _countSessionNameUpdate = 0; _tileWidth = ui->frmRoom->size().width() / _tilesX; _tileHeight = ui->frmRoom->size().height() / _tilesY; @@ -209,7 +216,7 @@ ConnectionFrame* MainWindow::createFrame() ConnectionFrame *cf = new ConnectionFrame(ui->frmRoom, _tileWidth, _tileHeight); _clientFrames.append(cf); cf->show(); - connect(cf, SIGNAL(frameMoved(ConnectionFrame *)), this, SLOT(onPlaceFrame(ConnectionFrame *))); + connect(cf, SIGNAL(frameMoved(bool, ConnectionFrame *)), this, SLOT(onPlaceFrame(bool, ConnectionFrame *))); connect(cf, SIGNAL(clicked(ConnectionFrame *)), this, SLOT(onFrameClicked(ConnectionFrame *))); return cf; } @@ -228,7 +235,7 @@ ConnectionFrame* MainWindow::createFrame(QString computerId, QPoint position) cf->setCurrentPosition(position); _clientFrames.append(cf); cf->show(); - connect(cf, SIGNAL(frameMoved(ConnectionFrame *)), this, SLOT(onPlaceFrame(ConnectionFrame *))); + connect(cf, SIGNAL(frameMoved(bool, ConnectionFrame *)), this, SLOT(onPlaceFrame(bool, ConnectionFrame *))); connect(cf, SIGNAL(clicked(ConnectionFrame *)), this, SLOT(onFrameClicked(ConnectionFrame *))); return cf; } @@ -309,12 +316,23 @@ void MainWindow::tryToUseRoomTemplate() for (auto i : rooms) { + qDebug() << "i: " << i; conf.beginGroup(i); if (!conf.contains("mgrIP")) { qDebug() << "Invalid config file!"; return; } - // Find the room that list the ip of this host as mgr + + // First store all room configurations in _rooms. + int size = conf.beginReadArray("client"); + for (int j = 0; j < size; j++) { + conf.setArrayIndex(j); + // qDebug() << "ip: " << conf.value("ip").toString() << " pos: " << conf.value("pos").toPoint(); + _rooms[i].append(qMakePair(conf.value("ip").toString(), conf.value("pos").toPoint())); + } + conf.endArray(); + + // Find the managerIP of current room. QString mgrIP = conf.value("mgrIP").toString(); foreach (const QHostAddress &address, QNetworkInterface::allAddresses()) { @@ -322,8 +340,8 @@ void MainWindow::tryToUseRoomTemplate() { qDebug("Found this ip in config."); int size = conf.beginReadArray("client"); - for (int i = 0; i < size; ++i) { - conf.setArrayIndex(i); + for (int j = 0; j < size; ++j) { + conf.setArrayIndex(j); /* * @@ -334,8 +352,9 @@ void MainWindow::tryToUseRoomTemplate() // Add the frame // Position is given in grid coordinates, createFrame take pixels - qDebug() << conf.value("ip").toString(); + QString computerId = conf.value("ip").toString(); QPoint coord = conf.value("pos").toPoint(); + qDebug() << computerId; qDebug() << coord; qDebug() << _tileWidth ; qDebug() << _tileHeight ; @@ -344,9 +363,9 @@ void MainWindow::tryToUseRoomTemplate() coord.setY(coord.y() * _tileHeight); qDebug() << coord ; - ConnectionFrame *cf = createFrame(conf.value("ip").toString(), coord); + ConnectionFrame *cf = createFrame(computerId, coord); cf->move(cf->getCurrentPosition()); - onPlaceFrame(cf); + onPlaceFrame(false, cf); } conf.endArray(); } @@ -525,7 +544,7 @@ void MainWindow::onTutorListDownloaded(QByteArray& tutorList) * Place Frame to from user specified position. * @param frame */ -void MainWindow::onPlaceFrame(ConnectionFrame* frame) +void MainWindow::onPlaceFrame(bool activateTrash, ConnectionFrame* frame) { if (_tilesX <= 0 || _tilesY <= 0) return; @@ -542,31 +561,34 @@ void MainWindow::onPlaceFrame(ConnectionFrame* frame) else if (y > s.height() - _tileHeight) y = (_tilesY - 1) * _tileHeight; - const QRect &trashCenter = ui->trash->geometry(); - // Check if x coordinate is in trash position. - if (trashCenter.contains(p)) + // Check if x coordinate is in trash position. Check only if activateTrash = true! + if (activateTrash) { - // Do not offer deleting online client. - if (frame->client() != NULL) - { - QMessageBox::critical(this, tr("Selection"), sStrClientOnline); - frame->move(frame->getPreviousPosition()); - return; - } - else + const QRect &trashCenter = ui->trash->geometry(); + if (trashCenter.contains(p)) { - int ret = QMessageBox::question(this, "Warning", "Sure, You want to delete selected client?", 0, 1, 2); - if (ret == 1) + // Do not offer deleting online client. + if (frame->client() != NULL) { - frame->hide(); - frame->deleteLater(); - _clientFrames.removeOne(frame); + QMessageBox::critical(this, tr("Selection"), sStrClientOnline); + frame->move(frame->getPreviousPosition()); return; } else { - frame->move(frame->getPreviousPosition()); - return; + int ret = QMessageBox::question(this, "Warning", "Sure, You want to delete selected client?", 0, 1, 2); + if (ret == 1) + { + frame->hide(); + frame->deleteLater(); + _clientFrames.removeOne(frame); + return; + } + else + { + frame->move(frame->getPreviousPosition()); + return; + } } } } @@ -611,7 +633,18 @@ void MainWindow::onFrameClicked(ConnectionFrame* frame) */ void MainWindow::onSessionNameClick() { - _sessionNameWindow->show(Global::sessionName()); + _countSessionNameUpdate++; + if (_countSessionNameUpdate > 1) + { + int ret = QMessageBox::question(this, "Warning", "Sure, You want to change SessionName again?\n" + "All Clients will be deleted afterwards.", 0, 1, 2); + if (ret == 1) + { + _sessionNameWindow->show(Global::sessionName()); + } + } + else + _sessionNameWindow->show((Global::sessionName())); } /***************************************************************************//** @@ -621,12 +654,17 @@ void MainWindow::onSessionNameUpdate() { // Stop all projections and clear all clients, which where connected to old sessionName. reset(); - for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) + if (_countSessionNameUpdate > 1) { - (*it)->hide(); - (*it)->deleteLater(); + { + for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) + { + (*it)->hide(); + (*it)->deleteLater(); + } + _clientFrames.clear(); + } } - _clientFrames.clear(); _sessionNameLabel->setText(tr("Session Name: %1 [click to edit]").arg(Global::sessionName())); } @@ -655,6 +693,71 @@ void MainWindow::startVncServerIfNecessary(int from) } } +void MainWindow::onButtonReloadRoomConfig() +{ + connect(_reloadWindow->ui->buttonBox, SIGNAL(accepted()), this, SLOT(onReloadRoomOk())); + connect(_reloadWindow->ui->buttonBox, SIGNAL(rejected()), this, SLOT(onReloadRoomCancel())); + qDebug() << "in onButtonReloadRoomConfig!" << "size of room: " << _rooms.size(); + QList<QString> keyList = _rooms.keys(); + for (QList<QString>::iterator it = keyList.begin(); it != keyList.end() ; it++) { + _reloadWindow->ui->roomList->addItem(*it); + } + _reloadWindow->show(); +} + +void MainWindow::onReloadRoomCancel() +{ + disconnect(_reloadWindow->ui->buttonBox, SIGNAL(accepted()), this, SLOT(onReloadRoomOk())); + disconnect(_reloadWindow->ui->buttonBox, SIGNAL(rejected()), this, SLOT(onReloadRoomCancel())); + _reloadWindow->ui->roomList->clear(); + _reloadWindow->hide(); +} + +void MainWindow::onReloadRoomOk() +{ + int ret = QMessageBox::QMessageBox::question(this, "Warning", tr("Are you sure you want to reload the room?\n" + "Note that all clients will be deleted."), 0, 1, 2); + + if (ret == 1) { + disconnect(_reloadWindow->ui->buttonBox, SIGNAL(accepted()), this, SLOT(onReloadRoomOk())); + disconnect(_reloadWindow->ui->buttonBox, SIGNAL(rejected()), this, SLOT(onReloadRoomCancel())); + // Delete all clients. + for (QList<ConnectionFrame*>::iterator it = _clientFrames.begin(); it != _clientFrames.end(); it++) + { + (*it)->hide(); + (*it)->deleteLater(); + } + _clientFrames.clear(); + + // Load new room configuration. + QString roomToReload = _reloadWindow->ui->roomList->currentItem()->data(0).toString(); + // qDebug() << roomToReload; + + _reloadWindow->ui->roomList->clear(); + _reloadWindow->hide(); + + QList<QPair<QString, QPoint>> room = _rooms[roomToReload]; + // qDebug() << " Room: " << room; + // qDebug() << "_rooms: " << _rooms; + for (QList<QPair<QString, QPoint>>::iterator it = room.begin(); it != room.end(); ++it) + { + QString computerId = (*it).first; + QPoint pos = (*it).second; + + qDebug() << "ComputerID: " << computerId; + qDebug() << "Pos: " << pos; + + // Transform to pixels for createFrame(computerId, position). + pos.setX(pos.x() * _tileWidth); + pos.setY(pos.y() * _tileHeight); + + ConnectionFrame *cf = createFrame(computerId, pos); + cf->move(cf->getCurrentPosition()); + onPlaceFrame(false, cf); + } + } +} + /***************************************************************************//** * Display popup which explains possible actions about the buttons. */ @@ -969,8 +1072,13 @@ void MainWindow::onClientAuthenticated(Client* client) ConnectionFrame *existing = NULL; for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) { + // qDebug() << "Existing frame ip: " << (*it)->computerId(); + // qDebug() << "New Clients ip: " << client->ip(); + // qDebug() << ((*it)->computerId() == client->ip()); if ((*it)->computerId() == client->ip()) + { existing = *it; + } if ((*it)->isTutor()) { if ((*it)->client() != NULL) @@ -994,6 +1102,7 @@ void MainWindow::onClientAuthenticated(Client* client) // Clients ip already exists, but was not active. if (existing != NULL) { + // qDebug() << "Should go into this if clause."; existing->setTutor(isTutor); existing->assignClient(client); tellClientCurrentSituation(client); @@ -1027,7 +1136,7 @@ void MainWindow::onClientAuthenticated(Client* client) y = 0; qDebug("Move E"); cf->move(x * _tileWidth, y * _tileHeight); - onPlaceFrame(cf); + onPlaceFrame(true, cf); } else { diff --git a/src/server/mainwindow/mainwindow.h b/src/server/mainwindow/mainwindow.h index acecc28..f8d0164 100644 --- a/src/server/mainwindow/mainwindow.h +++ b/src/server/mainwindow/mainwindow.h @@ -11,6 +11,7 @@ class ConnectionFrame; class ListenServer; class DiscoveryListener; class HelpWindow; +class ReloadRoomWindow; namespace Ui{ class MainWindow; @@ -35,6 +36,7 @@ private: Ui::MainWindow *ui; SessionNameWindow *_sessionNameWindow; HelpWindow *_helpWindow; + ReloadRoomWindow *_reloadWindow; QLabel *_sessionNameLabel; int _tbIconSize; Qt::ToolBarArea _tbArea; @@ -56,12 +58,14 @@ private: None } _mode; int _streamingSource; + int _countSessionNameUpdate; QList<ConnectionFrame*> _clientFrames; ListenServer *_listenServer; DiscoveryListener *_discoveryListener; FileDownloader _fileDownloader; QStringList _tutorList; + QMap<QString, QList<QPair<QString, QPoint> > > _rooms; static const QString sStrTutorNdef; static const QString sStrTutorOffline; @@ -105,13 +109,16 @@ protected slots: void onButtonStopProjection(); void onButtonSetAsTutor(); + void onButtonReloadRoomConfig(); + void onReloadRoomOk(); + void onReloadRoomCancel(); void onButtonExit(); void onButtonHelp(); void DisableButtons(); void EnableButtons(); // connection frame - void onPlaceFrame(ConnectionFrame* frame); + void onPlaceFrame(bool activateTrash, ConnectionFrame* frame); void onFrameClicked(ConnectionFrame* frame); // Net void onClientConnected(Client* client); diff --git a/src/server/reloadroomwindow/reloadroomwindow.cpp b/src/server/reloadroomwindow/reloadroomwindow.cpp new file mode 100644 index 0000000..3070148 --- /dev/null +++ b/src/server/reloadroomwindow/reloadroomwindow.cpp @@ -0,0 +1,13 @@ +#include "reloadroomwindow.h" +#include "ui_reloadroom.h" + +ReloadRoomWindow::ReloadRoomWindow(QWidget *parent) : + QDialog(parent), ui(new Ui::ReloadRoom) +{ + ui->setupUi(this); +} + +ReloadRoomWindow::~ReloadRoomWindow() +{ + delete ui; +} diff --git a/src/server/reloadroomwindow/reloadroomwindow.h b/src/server/reloadroomwindow/reloadroomwindow.h new file mode 100644 index 0000000..9ce0aba --- /dev/null +++ b/src/server/reloadroomwindow/reloadroomwindow.h @@ -0,0 +1,25 @@ +#ifndef RELOADROOMWINDOW_H +#define RELOADROOMWINDOW_H + +#include <QDialog> + +namespace Ui { +class ReloadRoom; +} + +class ReloadRoomWindow : public QDialog +{ + Q_OBJECT + +public: + explicit ReloadRoomWindow(QWidget *parent = 0); + ~ReloadRoomWindow(); + Ui::ReloadRoom *ui; + + // void show(); + +private: + +}; + +#endif |