source: experimental/osgVisual-GUI/Sichtsystem-GUI/sichtsystemgui.cpp @ 326

Last change on this file since 326 was 236, checked in by Torben Dannhauer, 14 years ago
File size: 6.0 KB
Line 
1#include "sichtsystemgui.h"
2
3SichtsystemGUI::SichtsystemGUI(QWidget *parent, Qt::WFlags flags)
4        : QMainWindow(parent, flags)
5{
6        debug = NULL;
7       
8        // Help-Process vorbereiten
9        helpProcess = new QProcess;
10
11        // Instantiate externalLinkDataContainer
12        externalDataContainer = new visualGUI_externalDataContainer(this);
13
14        // Intantiate externalLink
15        externalLink = new visualGUI_externalLinkVCL(this, externalDataContainer);
16        externalLink->InitExternalLink();       
17
18        // Activate externalLink
19         externalLinkTimer = new QTimer(this);
20     connect( externalLinkTimer, SIGNAL(timeout()), this, SLOT(on_actionTriggerExternalLink_triggered()) );
21     externalLinkTimer->start(25);
22
23        // GUI instanziieren
24        ui.setupUi(this);
25
26        // GUI-Klassen instanziieren & connectieren
27       
28        // Centralwidget initialisieren -> Workflow
29        //workflow = new chm3ReadWorkflow( this );
30        //this->setCentralWidget( workflow );
31
32        // Toolbars initialisieren
33        setupDockWidgets();
34        setupToolbars();
35
36        // Windowgeometrie wiederherstellen
37        QSettings settings("OSG-Visual", "Visual-GUI 1.0");
38        restoreGeometry(settings.value("mainwindow/maingeometry").toByteArray() );
39        restoreState( settings.value("mainwindow/DockwidgetLayout").toByteArray() );
40
41        // Und schlußendlich die GUI zeigen
42        this->show();
43}
44
45SichtsystemGUI::~SichtsystemGUI()
46{
47
48}
49
50void SichtsystemGUI::closeEvent(QCloseEvent *event)
51{
52        // Anwendung schliessen:
53        this->hide();
54
55        // Geometrien speichern
56        QSettings settings("OSG-Visual", "Visual-GUI 1.0");
57        settings.setValue("mainwindow/maingeometry", saveGeometry());
58        settings.setValue("mainwindow/DockwidgetLayout", saveState() );
59        //Debugfenster schliessen
60         if( debug != NULL )
61         {
62                settings.setValue("debugwindow/geometry", debug->saveGeometry());
63                qInstallMsgHandler(0);
64                debug->close();
65         }
66
67         // Event akzeptieren
68         event->accept();
69}
70
71void SichtsystemGUI::setDebug(QTextEdit* debug_)
72{
73        if ( debug_ != NULL )
74        {
75                debug = debug_;
76                ui.dW_Debug->setWidget(debug);
77        }
78}
79
80void SichtsystemGUI::on_actionAbout_Qt_triggered()
81{
82        QMessageBox::aboutQt( this, "About Qt Toolkit" );
83}
84
85void SichtsystemGUI::on_actionAbout_This_Programm_triggered()
86{
87        QMessageBox::about( this, tr("About OSG Visual GUI"),
88                tr("OSG Visual is a GUI application for easy controlling and testing of the OSG-Visual programm.\n\n It is freely available unter GNU LGPL license\n\n Developement version 0.1\n\nLGPL icons created & copyright by the \"Crystal - Interaction Design Project\".\nPlease visit http://www.everaldo.com/crystal/") );
89
90}
91
92void SichtsystemGUI::setupDockWidgets()
93{
94        // DateTime Widget
95        //
96        dateTimeWidget = new visualGUI_DateTime( this );
97        ui.dW_DateTime->setWidget( dateTimeWidget );
98
99        // Objects
100        objectPositionWidget = new visualGUI_ObjectPosition(this);
101        ui.dW_Objects->setWidget(objectPositionWidget);
102       
103       
104
105        // Menü populieren
106        //
107        ui.menuEdit->addAction( ui.dW_DateTime->toggleViewAction() );
108        ui.dW_DateTime->toggleViewAction()->setText( tr("Show/Hide Date & Time") );
109        ui.dW_DateTime->toggleViewAction()->setToolTip( tr("Show/Hide date & time area") );
110       
111        //
112        ui.menuEdit->addAction( ui.dW_Objects->toggleViewAction() );
113        ui.dW_Objects->toggleViewAction()->setText( tr("Show/Hide Object Position") );
114        ui.dW_Objects->toggleViewAction()->setToolTip( tr("Show/Hide the object positioning area") );
115       
116        //
117        ui.menuEdit->addAction( ui.dW_Weather->toggleViewAction() );
118        ui.dW_Weather->toggleViewAction()->setText( tr("Show/Hide Weather") );
119        ui.dW_Weather->toggleViewAction()->setToolTip( tr("Show/Hide the weather area") );
120       
121        ui.menuEdit->addAction( ui.actionSettings );
122}
123
124
125void SichtsystemGUI::setupToolbars()
126{
127        // main-Toolbar
128        ui.mainToolBar->addAction( ui.actionExit );
129        ui.mainToolBar->addAction( ui.actionSettings );
130}
131
132void SichtsystemGUI::on_actionToggle_top_left_corner_triggered()
133{
134        if( this->corner( Qt::TopLeftCorner ) == Qt::LeftDockWidgetArea )
135                setCorner( Qt::TopLeftCorner, Qt::BottomDockWidgetArea );
136        else if( this->corner( Qt::TopLeftCorner ) == Qt::BottomDockWidgetArea )
137                setCorner( Qt::TopLeftCorner, Qt::LeftDockWidgetArea );
138}
139
140void SichtsystemGUI::on_actionToggle_top_right_corner_triggered()
141{
142        if( this->corner( Qt::TopRightCorner ) == Qt::RightDockWidgetArea )
143                setCorner( Qt::TopRightCorner, Qt::TopDockWidgetArea );
144        else if( this->corner( Qt::TopRightCorner ) == Qt::TopDockWidgetArea )
145                setCorner( Qt::TopRightCorner, Qt::RightDockWidgetArea );
146}
147
148void SichtsystemGUI::on_actionToggle_bottom_left_corner_triggered()
149{
150        if( this->corner( Qt::BottomLeftCorner ) == Qt::LeftDockWidgetArea )
151                setCorner( Qt::BottomLeftCorner, Qt::BottomDockWidgetArea );
152        else if( this->corner( Qt::BottomLeftCorner ) == Qt::BottomDockWidgetArea )
153                setCorner( Qt::BottomLeftCorner, Qt::LeftDockWidgetArea );
154}
155
156void SichtsystemGUI::on_actionToggle_bottom_right_corner_triggered()
157{
158        if( this->corner( Qt::BottomRightCorner ) == Qt::RightDockWidgetArea )
159                setCorner( Qt::BottomRightCorner, Qt::BottomDockWidgetArea );
160        else if( this->corner( Qt::BottomRightCorner ) == Qt::BottomDockWidgetArea )
161                setCorner( Qt::BottomRightCorner, Qt::RightDockWidgetArea );
162}
163
164void SichtsystemGUI::on_actionTriggerExternalLink_triggered()
165{
166        // Copy Data to Transfercontainer after converting ( GUI is in deg, osgvisual+VCL need rad)
167        externalDataContainer->lat = osg::DegreesToRadians( objectPositionWidget->getUI()->dSB_Lat->value() );
168        externalDataContainer->lon = osg::DegreesToRadians( objectPositionWidget->getUI()->dSB_Lon->value() );
169        externalDataContainer->alt = objectPositionWidget->getUI()->dSB_Alt->value();
170        externalDataContainer->bank_phi = osg::DegreesToRadians( objectPositionWidget->getUI()->dSB_bank_phi->value() );
171        externalDataContainer->pitch_theta = osg::DegreesToRadians( objectPositionWidget->getUI()->dSB_pitch_theta->value() );
172        externalDataContainer->azimuth_psi = osg::DegreesToRadians( objectPositionWidget->getUI()->dSB_azimuth_psi->value() );
173        externalDataContainer->idToTrack = objectPositionWidget->getUI()->idToTrack->value();
174
175        // TransferData
176        externalLink->processExternalLink();
177}
Note: See TracBrowser for help on using the repository browser.