From ea55dfa2861ccc234782a896494a8a351dd504ac Mon Sep 17 00:00:00 2001
From: Ulrich Kemloh <kemlohulrich@gmail.com>
Date: Thu, 17 Jul 2014 19:35:10 +0200
Subject: [PATCH] Cleaning the GUI

---
 JPSvis.pro                  | 106 ++++++++++++++++++++----
 forms/mainwindow.ui         | 160 ++++++++++++++++++++++--------------
 forms/settings.ui           |   2 +-
 src/MainWindow.cpp          |   9 +-
 src/ThreadVisualisation.cpp |  28 ++-----
 src/TimerCallback.cpp       |   8 --
 6 files changed, 203 insertions(+), 110 deletions(-)

diff --git a/JPSvis.pro b/JPSvis.pro
index aecefb8..33c1a4d 100644
--- a/JPSvis.pro
+++ b/JPSvis.pro
@@ -1,21 +1,22 @@
 TEMPLATE = app
 TARGET = TraVisTo
 CONFIG += qt
-#CONFIG += static
+CONFIG += static
 QT += xml network
 
 #avoid some annoying dependencies
 #QMAKE_LFLAGS += -static -static-libgcc -static-libstdc++
-#QMAKE_LFLAGS += -static-libstdc++
+#QMAKE_LFLAGS += -static-libstdc++ -lstdc++
 #QMAKE_CXXFLAGS += -static -static -static-libstdc++
 #QMAKE_CXXFLAGS += -static
 
 greaterThan(QT_MAJOR_VERSION, 4):QT += widgets
 
+#Dynamic linking
+#Windows  VTK 6.1
 win32 {
-        INCLUDEPATH += C:/VTK/include/vtk-6.1
-
-        LIBS += -LC:/VTK/bin \
+        INCLUDEPATH += C:/VTK/VTK6.1/include
+        LIBS += -LC:/VTK/VTK6.1/bin_shared \
         #LIBS += -LC:/VTK/bin_static/lib \
         -lwsock32 \
         -lvtkCommonCore-6.1    \
@@ -96,11 +97,11 @@ win32 {
 #        -lvtkInteractionStyle-6.1   \
         }
 
-win32_ {
-        INCLUDEPATH += C:/VTK/include/vtk-6.1
-	
-        LIBS += -LC:/VTK/bin \
-#        LIBS += -LC:/VTK/bin_static/lib \
+#Satic linking
+#Windows  VTK 6.1
+win32_6.1 {
+        INCLUDEPATH += C:/VTK/VTK6.1/include
+        LIBS += -LC:/VTK/VTK6.1/bin_static \
             -lvtkCommonCore-6.1  \
             -lvtkalglib-6.1  \
             -lvtkChartsCore-6.1  \
@@ -217,10 +218,12 @@ win32_ {
             -lvtkzlib-6.1  \
             -lwsock32
         }
-win32_5 {
-        INCLUDEPATH += C:/VTK/include/vtk-5.10
-
-        LIBS += -LC:/VTK/bin_5 \
+		
+#Dynamic linking
+#Windows  VTK 5.10
+win32_te {
+        INCLUDEPATH += C:/VTK/VTK5.1/include
+        LIBS += -LC:/VTK/VTK5.1/bin_shared \
             -lvtksys \
             -lvtkzlib \
             -lvtkjpeg \
@@ -242,14 +245,83 @@ win32_5 {
             -lvtkGraphics \
             -lvtkIO \
             -lvtkRendering \
-            -lvtkParallel \
+#            -lvtkParallel \
             -lvtkHybrid \
             -lvtkWidgets \
             -lvtkInfovis\
             -lvtkViews\
             -lwsock32\
 }
-        
+
+#Static compilation 
+#VTK 5.10 Windows
+win32_te {
+    INCLUDEPATH += C:/VTK/VTK5.1/include
+    LIBS += -LC:/VTK/VTK5.1/bin_static \
+#        -lvtkCommon   \
+        -lvtkRendering  \
+        -lvtkHybrid   \
+        -lvtkGraphics   \
+        -lvtkIO   \
+        -lvtkImaging   \
+#        -lvtkFiltering   \
+#        -lvtkCommon   \
+#        -lvtkverdict   \
+#        -lvtkexoIIc   \
+#        -lvtkDICOMParser   \
+#        -lvtkmetaio   \
+#        -lvtkftgl  \
+#        -lLSDyna \
+#        -lvtkViews \
+#        -lvtksys   \
+#        -lvtkpng \
+#        -lvtktiff \
+#        -lvtkjpeg \
+#        -lvtklibxml2 \
+#        -lvtkzlib \
+#        -lvtkexpat \
+#        -lvtkfreetype \
+        -lwsock32\
+
+#-lLSDyna \
+#-lMapReduceMPI \
+#-lmpistubs \
+#-lvtkCharts \
+#-lvtkCommon \
+#-lvtkDICOMParser \
+#-lvtkFiltering \
+#-lvtkGenericFiltering  \
+#-lvtkGeovis \
+#-lvtkGraphics \
+#-lvtkHybrid \
+#-lvtkIO \
+#-lvtkImaging \
+#-lvtkInfovis \
+#-lvtkNetCDF \
+#-lvtkNetCDF_cxx \
+#-lvtkRendering \
+#-lvtkViews \
+#-lvtkVolumeRendering \
+#-lvtkWidgets \
+#-lvtkalglib \
+#-lvtkexoIIc \
+#-lvtkexpat \
+#-lvtkfreetype \
+#-lvtkftgl \
+#-lvtkhdf5 \
+#-lvtkhdf5_hl \
+#-lvtkjpeg \
+#-lvtklibxml2 \
+#-lvtkmetaio \
+#-lvtkpng \
+#-lvtkproj4 \
+#-lvtksqlite \
+#-lvtksys \
+#-lvtktiff \
+#-lvtkverdict \
+#-lvtkzlib \
+ }
+ 
 unix_6 {
     INCLUDEPATH += /usr/local/include/vtk-6.0
     
@@ -403,7 +475,7 @@ LIBS += -L/usr/lib \
 
  }
  
-#Static compilation 
+#Static compilation linux
 unix_static {
 #INCLUDEPATH += /usr/include/vtk-5.8
 #LIBS += -L/usr/lib \
diff --git a/forms/mainwindow.ui b/forms/mainwindow.ui
index 3340f6e..84e4f4d 100644
--- a/forms/mainwindow.ui
+++ b/forms/mainwindow.ui
@@ -61,9 +61,9 @@
     <property name="geometry">
      <rect>
       <x>160</x>
-      <y>30</y>
+      <y>20</y>
       <width>271</width>
-      <height>151</height>
+      <height>161</height>
      </rect>
     </property>
     <property name="sizePolicy">
@@ -183,9 +183,9 @@
     <property name="geometry">
      <rect>
       <x>30</x>
-      <y>30</y>
+      <y>20</y>
       <width>111</width>
-      <height>201</height>
+      <height>161</height>
      </rect>
     </property>
     <property name="sizePolicy">
@@ -200,10 +200,10 @@
     <widget class="QPushButton" name="BtStart">
      <property name="geometry">
       <rect>
-       <x>10</x>
-       <y>24</y>
-       <width>81</width>
-       <height>28</height>
+       <x>11</x>
+       <y>21</y>
+       <width>80</width>
+       <height>30</height>
       </rect>
      </property>
      <property name="toolTip">
@@ -229,10 +229,10 @@
      </property>
      <property name="geometry">
       <rect>
-       <x>10</x>
-       <y>58</y>
-       <width>81</width>
-       <height>28</height>
+       <x>11</x>
+       <y>55</y>
+       <width>80</width>
+       <height>30</height>
       </rect>
      </property>
      <property name="toolTip">
@@ -258,10 +258,10 @@
      </property>
      <property name="geometry">
       <rect>
-       <x>10</x>
-       <y>92</y>
-       <width>81</width>
-       <height>28</height>
+       <x>11</x>
+       <y>89</y>
+       <width>80</width>
+       <height>30</height>
       </rect>
      </property>
      <property name="toolTip">
@@ -281,46 +281,20 @@
       </size>
      </property>
     </widget>
-    <widget class="QPushButton" name="BtFullscreen">
-     <property name="enabled">
-      <bool>false</bool>
-     </property>
+    <widget class="QPushButton" name="BtReset">
      <property name="geometry">
       <rect>
-       <x>10</x>
-       <y>126</y>
-       <width>81</width>
-       <height>28</height>
+       <x>11</x>
+       <y>123</y>
+       <width>80</width>
+       <height>30</height>
       </rect>
      </property>
-     <property name="toolTip">
-      <string>Fullscreen</string>
-     </property>
-     <property name="autoFillBackground">
-      <bool>false</bool>
-     </property>
-     <property name="text">
-      <string/>
-     </property>
-     <property name="icon">
-      <iconset resource="icons.qrc">
-       <normaloff>:/new/iconsS/icons/window_fullscreen-64.png</normaloff>:/new/iconsS/icons/window_fullscreen-64.png</iconset>
-     </property>
-     <property name="iconSize">
+     <property name="minimumSize">
       <size>
-       <width>20</width>
-       <height>20</height>
-      </size>
-     </property>
-    </widget>
-    <widget class="QPushButton" name="BtReset">
-     <property name="geometry">
-      <rect>
-       <x>10</x>
-       <y>160</y>
-       <width>81</width>
+       <width>0</width>
        <height>23</height>
-      </rect>
+      </size>
      </property>
      <property name="toolTip">
       <string>Reset the simulation and clear all datasets loaded</string>
@@ -526,6 +500,38 @@ border-color: rgb(255, 255, 255);</string>
      <string>Previous</string>
     </property>
    </widget>
+   <widget class="QPushButton" name="BtFullscreen">
+    <property name="enabled">
+     <bool>false</bool>
+    </property>
+    <property name="geometry">
+     <rect>
+      <x>40</x>
+      <y>200</y>
+      <width>80</width>
+      <height>30</height>
+     </rect>
+    </property>
+    <property name="toolTip">
+     <string>Fullscreen</string>
+    </property>
+    <property name="autoFillBackground">
+     <bool>false</bool>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+    <property name="icon">
+     <iconset resource="icons.qrc">
+      <normaloff>:/new/iconsS/icons/window_fullscreen-64.png</normaloff>:/new/iconsS/icons/window_fullscreen-64.png</iconset>
+    </property>
+    <property name="iconSize">
+     <size>
+      <width>20</width>
+      <height>20</height>
+     </size>
+    </property>
+   </widget>
   </widget>
   <widget class="QMenuBar" name="menubar">
    <property name="geometry">
@@ -614,26 +620,25 @@ border-color: rgb(255, 255, 255);</string>
     </widget>
     <addaction name="action2_D"/>
     <addaction name="action3_D"/>
+    <addaction name="menuCamera_View"/>
     <addaction name="separator"/>
     <addaction name="actionShow_Agents"/>
+    <addaction name="actionShow_Captions"/>
     <addaction name="actionShow_Trajectories"/>
+    <addaction name="separator"/>
     <addaction name="actionShow_Geometry"/>
     <addaction name="actionShow_Exits"/>
     <addaction name="actionShow_Walls"/>
     <addaction name="actionShow_Legend"/>
-    <addaction name="actionShow_Captions"/>
     <addaction name="actionShow_Axis"/>
     <addaction name="actionShow_Wall_Caption"/>
     <addaction name="actionShow_Room_Caption"/>
     <addaction name="actionShow_Door_Caption"/>
     <addaction name="actionShow_Geometry_Captions"/>
-    <addaction name="separator"/>
     <addaction name="actionFirst_Group"/>
     <addaction name="actionSecond_Group"/>
     <addaction name="actionThird_Group"/>
     <addaction name="separator"/>
-    <addaction name="menuCamera_View"/>
-    <addaction name="separator"/>
     <addaction name="actionShow_Onscreen_Infos"/>
     <addaction name="separator"/>
    </widget>
@@ -734,7 +739,7 @@ border-color: rgb(255, 255, 255);</string>
     <bool>true</bool>
    </property>
    <property name="text">
-    <string>Network settings</string>
+    <string>Listening Port</string>
    </property>
   </action>
   <action name="actionOnline">
@@ -778,6 +783,9 @@ border-color: rgb(255, 255, 255);</string>
    <property name="text">
     <string>Fullscreen</string>
    </property>
+   <property name="visible">
+    <bool>false</bool>
+   </property>
   </action>
   <action name="actionRecord">
    <property name="enabled">
@@ -797,6 +805,9 @@ border-color: rgb(255, 255, 255);</string>
    <property name="text">
     <string>Load Project</string>
    </property>
+   <property name="visible">
+    <bool>false</bool>
+   </property>
   </action>
   <action name="action2_D">
    <property name="checkable">
@@ -822,7 +833,7 @@ border-color: rgb(255, 255, 255);</string>
   </action>
   <action name="actionAdd_Trajectories_File">
    <property name="enabled">
-    <bool>true</bool>
+    <bool>false</bool>
    </property>
    <property name="text">
     <string>Add Trajectories File</string>
@@ -830,10 +841,13 @@ border-color: rgb(255, 255, 255);</string>
    <property name="shortcut">
     <string>Ctrl+A</string>
    </property>
+   <property name="visible">
+    <bool>false</bool>
+   </property>
   </action>
   <action name="actionClear_Trajectories_Files">
    <property name="enabled">
-    <bool>true</bool>
+    <bool>false</bool>
    </property>
    <property name="text">
     <string>Clear Trajectories Files</string>
@@ -841,6 +855,9 @@ border-color: rgb(255, 255, 255);</string>
    <property name="shortcut">
     <string>Ctrl+C</string>
    </property>
+   <property name="visible">
+    <bool>false</bool>
+   </property>
   </action>
   <action name="actionLoad_Geometry">
    <property name="text">
@@ -855,7 +872,7 @@ border-color: rgb(255, 255, 255);</string>
     <bool>true</bool>
    </property>
    <property name="text">
-    <string>Load File</string>
+    <string>Open File</string>
    </property>
    <property name="shortcut">
     <string>Ctrl+O</string>
@@ -885,6 +902,9 @@ border-color: rgb(255, 255, 255);</string>
    <property name="text">
     <string>First Group</string>
    </property>
+   <property name="visible">
+    <bool>false</bool>
+   </property>
   </action>
   <action name="actionSecond_Group">
    <property name="checkable">
@@ -896,6 +916,9 @@ border-color: rgb(255, 255, 255);</string>
    <property name="text">
     <string>Second Group</string>
    </property>
+   <property name="visible">
+    <bool>false</bool>
+   </property>
   </action>
   <action name="actionThird_Group">
    <property name="checkable">
@@ -907,13 +930,16 @@ border-color: rgb(255, 255, 255);</string>
    <property name="text">
     <string>Third Group</string>
    </property>
+   <property name="visible">
+    <bool>false</bool>
+   </property>
   </action>
   <action name="actionShow_Legend">
    <property name="checkable">
     <bool>true</bool>
    </property>
    <property name="enabled">
-    <bool>true</bool>
+    <bool>false</bool>
    </property>
    <property name="text">
     <string>Show Legend</string>
@@ -924,6 +950,9 @@ border-color: rgb(255, 255, 255);</string>
    <property name="shortcut">
     <string>S, L</string>
    </property>
+   <property name="visible">
+    <bool>false</bool>
+   </property>
   </action>
   <action name="action3_D">
    <property name="checkable">
@@ -1003,7 +1032,7 @@ border-color: rgb(255, 255, 255);</string>
     <bool>false</bool>
    </property>
    <property name="text">
-    <string>Show Captions</string>
+    <string>Show Agents Captions</string>
    </property>
    <property name="shortcut">
     <string>S, C</string>
@@ -1041,6 +1070,9 @@ border-color: rgb(255, 255, 255);</string>
    <property name="shortcut">
     <string>S, A</string>
    </property>
+   <property name="visible">
+    <bool>false</bool>
+   </property>
   </action>
   <action name="actionCameraViewTop">
    <property name="checkable">
@@ -1082,6 +1114,9 @@ border-color: rgb(255, 255, 255);</string>
    <property name="shortcut">
     <string>Ctrl+,</string>
    </property>
+   <property name="visible">
+    <bool>false</bool>
+   </property>
   </action>
   <action name="actionSnapshot">
    <property name="text">
@@ -1224,6 +1259,11 @@ border-color: rgb(255, 255, 255);</string>
     <string>Show Geometry Captions</string>
    </property>
   </action>
+  <action name="actionTest">
+   <property name="text">
+    <string>test</string>
+   </property>
+  </action>
  </widget>
  <resources>
   <include location="icons.qrc"/>
diff --git a/forms/settings.ui b/forms/settings.ui
index 5f4661b..52d4fdd 100644
--- a/forms/settings.ui
+++ b/forms/settings.ui
@@ -35,7 +35,7 @@
     </rect>
    </property>
    <property name="currentIndex">
-    <number>0</number>
+    <number>3</number>
    </property>
    <widget class="QWidget" name="tab">
     <attribute name="title">
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index 6c3f0df..001e4d0 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -139,6 +139,8 @@ MainWindow::MainWindow(QWidget *parent) :
     numberOfDatasetLoaded=0;
     frameSliderHold=false;
 
+    //some hand made stuffs
+    ui.BtFullscreen->setVisible(false);
 
     labelCurrentAction = new QLabel();
     labelCurrentAction->setFrameStyle(QFrame::Panel | QFrame::Sunken);
@@ -285,7 +287,7 @@ void MainWindow::slotNetworkSettings() {
     bool ok;
 
     int port = QInputDialog::getInt(this, tr("input a port "), tr(
-                                        "port(default to 8081):"), 8989, 5000, 65355, 1, &ok);
+                                        "port(default to 8989):"), 8989, 5000, 65355, 1, &ok);
 
     if (ok) {
         SystemSettings::setListningPort(port);
@@ -682,8 +684,9 @@ QString MainWindow::getTagValueFromElement(QDomNode node,
 void MainWindow::slotFullScreen(bool status) {
 
     Debug::Messages("changing full screen status %d",status);
-    extern_fullscreen_enable = true;
 
+    extern_fullscreen_enable = true;
+    //cout<<"clicked "<< status <<endl;
     //dont forget this.
     extern_force_system_update=true;
 
@@ -920,7 +923,7 @@ void MainWindow::resetGraphicalElements(){
     ui.BtRecord->setEnabled(false);
 
     //disable fullscreen
-    ui.BtFullscreen->setEnabled(false);
+    //ui.BtFullscreen->setEnabled(false);
 
     //disable stop button
 
diff --git a/src/ThreadVisualisation.cpp b/src/ThreadVisualisation.cpp
index e769207..66aaf5f 100644
--- a/src/ThreadVisualisation.cpp
+++ b/src/ThreadVisualisation.cpp
@@ -161,17 +161,17 @@ void ThreadVisualisation::run(){
 	initGlyphs();
 
 	// add axis
-	axis= vtkAxesActor::New();
+    //axis= vtkAxesActor::New();
 	//axis->SetScale(10);
 	//axis->SetConeRadius(30);
 	//axis->SetXAxisLabelText("1 Meter");
 	//axis->SetYAxisLabelText("1 Meter");
 	//axis->SetZAxisLabelText("1 Meter");
-	axis->AxisLabelsOff();
+    //axis->AxisLabelsOff();
 	//axis->SetCylinderRadius(100);
 	//axis->set
-	axis->SetTotalLength(1000,1000,1000);
-	axis->SetVisibility(true);
+    //axis->SetTotalLength(1000,1000,1000);
+    //axis->SetVisibility(true);
 	//renderer->AddActor(axis);
 
 	//add big circle at null point
@@ -228,13 +228,6 @@ void ThreadVisualisation::run(){
 		//renderer->AddActor(actor);
 	}
 
-
-	//cout << "diffuse: "<<actor->GetProperty()->GetDiffuse()<<" [" << actor->GetProperty()->GetDiffuseMinValue()<<" , "<<actor->GetProperty()->GetDiffuseMaxValue() << " ]"<<endl;
-	//cout << "ambiant: "<<actor->GetProperty()->GetAmbient()<<" [" << actor->GetProperty()->GetAmbientMinValue()<<" , "<<actor->GetProperty()->GetAmbientMaxValue() << " ]"<<endl;
-	//cout << "specular:"<<actor->GetProperty()->GetSpecular()<<" [" << actor->GetProperty()->GetSpecularMinValue()<<" , "<<actor->GetProperty()->GetSpecularMaxValue()<< " ]"<<endl;
-
-
-
 	//compute the relatives delays
 	// necessary in the case several dataset were loaded
 	computeDelays();
@@ -345,13 +338,6 @@ void ThreadVisualisation::run(){
 	renderingTimer->setTextActor(runningTime);
 	renderWinInteractor->AddObserver(vtkCommand::TimerEvent,renderingTimer);
 
-	// check for windows changes
-
-	//WindowCallback*  windowModified = new WindowCallback();
-	//VTK_CREATE(vtkCallbackCommand,windowModified);
-	//windowModified->SetCallback (WindowModifiedCallback);
-	//renderWindow->AddObserver(vtkCommand::ModifiedEvent ,windowModified);
-
 
 	//create the necessary connections
 	QObject::connect(renderingTimer, SIGNAL(signalRunningTime(unsigned long )),
@@ -387,11 +373,12 @@ void ThreadVisualisation::run(){
 		setWallsColor(wallcol);
 		//showDoors(false);
 	}
-
 	//renderWinInteractor->Initialize();
 	// Initialize and enter interactive mode
 	// should be called after the observer has been added
-	renderWinInteractor->Start();
+    //renderWindow->Modified();
+
+    renderWinInteractor->Start();
 
 
 	//emit signalStatusMessage("Idle");
@@ -407,7 +394,6 @@ void ThreadVisualisation::run(){
 	renderWindow->Delete();
 	renderWinInteractor->Delete();
 	renderer=NULL;
-	exit(0);
 }
 
 
diff --git a/src/TimerCallback.cpp b/src/TimerCallback.cpp
index 5ebf3d6..a98f431 100644
--- a/src/TimerCallback.cpp
+++ b/src/TimerCallback.cpp
@@ -324,12 +324,6 @@ void TimerCallback::Execute(vtkObject *caller, unsigned long eventId,
                     pAVIWriter->SetQuality(2);
                     pAVIWriter->SetRate(1000.0/iren->GetTimerDuration(tid));
 
-                    //static int videoID=0;
-                    //char filename[20]={0};
-                    //sprintf(filename,"travisto_video_%d.avi",videoID++);
-                    //pAVIWriter->SetFileName(filename);
-
-
                     QString videoName;
                     SystemSettings::getOutputDirectory(videoName);
                     //create directory if not exits
@@ -382,8 +376,6 @@ void TimerCallback::Execute(vtkObject *caller, unsigned long eventId,
                     //exit if and only if the recording process is terminated
                     if(isRecording) extern_recording_enable=false;
                     else iren->ExitCallback();
-
-
                 }
             }
         }
-- 
GitLab