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