source: experimental/osgVisualGuiNG/osgvisualgui.cpp @ 425

Last change on this file since 425 was 419, checked in by Torben Dannhauer, 12 years ago
  • Property svn:eol-style set to native
File size: 3.3 KB
RevLine 
[415]1#include "osgvisualgui.h"
2
[418]3#include <QSettings>
4#include <QCloseEvent>
5#include <QTextEdit>
6#include <QMessageBox>
7
[415]8osgVisualGUI::osgVisualGUI(QWidget *parent, Qt::WFlags flags)
9        : QMainWindow(parent, flags)
10{
[418]11        debug = NULL;
12       
13        // GUI instanziieren
[415]14        ui.setupUi(this);
[418]15
16        // GUI-Klassen instanziieren & connectieren
17       
18
19
20        // Toolbars initialisieren
[419]21        setupDockWidgets();
22        setupToolbars();
23        setupMenus();
24        setupConnections();
[418]25
26        // Windowgeometrie wiederherstellen
27        QSettings settings;
28        restoreGeometry(settings.value("mainwindow/maingeometry").toByteArray() );
29        restoreState( settings.value("mainwindow/DockwidgetLayout").toByteArray() );
30
31        // Und schlußendlich die GUI zeigen
32        this->show();
[415]33}
34
35osgVisualGUI::~osgVisualGUI()
36{
37
38}
[418]39
40void osgVisualGUI::closeEvent( QCloseEvent *event )
41{
42        // Close application
43        this->hide();
44
45        // Save geometries
46        QSettings settings;
47        settings.setValue("mainwindow/maingeometry", saveGeometry());
48        settings.setValue("mainwindow/DockwidgetLayout", saveState() );
49       
50        // Close debug widget
51         if( debug != NULL )
52         {
53                settings.setValue("debugwindow/geometry", debug->saveGeometry());
54                qInstallMsgHandler(0);
55                debug->close();
56         }
57
58         // accept event
59         event->accept();
60}
61
62void osgVisualGUI::setDebug(QTextEdit* debug_)
63{
64        if ( debug_ != NULL )
65        {
66                debug = debug_;
67                ui.dW_Debug->setWidget(debug);
68        }
69}
70
71void osgVisualGUI::setupDockWidgets()
72{
73
74}
75
76void osgVisualGUI::setupToolbars()
77{
78
79}
80
81void osgVisualGUI::setupMenus()
82{
[419]83
[418]84}
85
[419]86void osgVisualGUI::setupConnections()
87{
88        connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(on_actionAbout()));
89}
90
[418]91void osgVisualGUI::on_actionToggle_top_left_corner_triggered()
92{
93        if( this->corner( Qt::TopLeftCorner ) == Qt::LeftDockWidgetArea )
94                setCorner( Qt::TopLeftCorner, Qt::BottomDockWidgetArea );
95        else if( this->corner( Qt::TopLeftCorner ) == Qt::BottomDockWidgetArea )
96                setCorner( Qt::TopLeftCorner, Qt::LeftDockWidgetArea );
97}
98
99void osgVisualGUI::on_actionToggle_top_right_corner_triggered()
100{
101        if( this->corner( Qt::TopRightCorner ) == Qt::RightDockWidgetArea )
102                setCorner( Qt::TopRightCorner, Qt::TopDockWidgetArea );
103        else if( this->corner( Qt::TopRightCorner ) == Qt::TopDockWidgetArea )
104                setCorner( Qt::TopRightCorner, Qt::RightDockWidgetArea );
105}
106
107void osgVisualGUI::on_actionToggle_bottom_left_corner_triggered()
108{
109        if( this->corner( Qt::BottomLeftCorner ) == Qt::LeftDockWidgetArea )
110                setCorner( Qt::BottomLeftCorner, Qt::BottomDockWidgetArea );
111        else if( this->corner( Qt::BottomLeftCorner ) == Qt::BottomDockWidgetArea )
112                setCorner( Qt::BottomLeftCorner, Qt::LeftDockWidgetArea );
113}
114
115void osgVisualGUI::on_actionToggle_bottom_right_corner_triggered()
116{
117        if( this->corner( Qt::BottomRightCorner ) == Qt::RightDockWidgetArea )
118                setCorner( Qt::BottomRightCorner, Qt::BottomDockWidgetArea );
119        else if( this->corner( Qt::BottomRightCorner ) == Qt::BottomDockWidgetArea )
120                setCorner( Qt::BottomRightCorner, Qt::RightDockWidgetArea );
121}
122
[419]123void osgVisualGUI::on_actionAbout()
[418]124{
125        QMessageBox::about( this, tr("About %1").arg(QApplication::applicationName()) ,
126                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/") );
127
128}
Note: See TracBrowser for help on using the repository browser.