Changeset 418 for experimental


Ignore:
Timestamp:
Aug 17, 2012, 10:36:03 PM (12 years ago)
Author:
Torben Dannhauer
Message:
 
Location:
experimental/osgVisualGuiNG
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • experimental/osgVisualGuiNG/main.cpp

    r415 r418  
    11#include "osgvisualgui.h"
     2#include "debug.h"
    23#include <QtGui/QApplication>
    34
     
    56{
    67        QApplication a(argc, argv);
     8        a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
     9
     10        QCoreApplication::setOrganizationName("osgVisual");
     11        QCoreApplication::setOrganizationDomain("osgvisual.org");
     12        QCoreApplication::setApplicationName("osgVisualGUI");
     13
     14        // DEBUG-Handler installieren
     15        QTextEdit *debug = new QTextEdit;
     16        debug->hide();
     17        setDebugPointer( debug );
     18        qInstallMsgHandler( myMessageOutput );
     19        qDebug("MessageHandler installiert");
     20
    721        osgVisualGUI w;
     22        w.setDebug(debug);
    823        w.show();
    924        return a.exec();
  • experimental/osgVisualGuiNG/osgvisualgui.cpp

    r415 r418  
    11#include "osgvisualgui.h"
     2
     3#include <QSettings>
     4#include <QCloseEvent>
     5#include <QTextEdit>
     6#include <QMessageBox>
    27
    38osgVisualGUI::osgVisualGUI(QWidget *parent, Qt::WFlags flags)
    49        : QMainWindow(parent, flags)
    510{
     11        debug = NULL;
     12       
     13        // GUI instanziieren
    614        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();
    732}
    833
     
    1136
    1237}
     38
     39void 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
     61void osgVisualGUI::setDebug(QTextEdit* debug_)
     62{
     63        if ( debug_ != NULL )
     64        {
     65                debug = debug_;
     66                ui.dW_Debug->setWidget(debug);
     67        }
     68}
     69
     70void osgVisualGUI::setupDockWidgets()
     71{
     72
     73}
     74
     75void osgVisualGUI::setupToolbars()
     76{
     77
     78}
     79
     80void osgVisualGUI::setupMenus()
     81{
     82        ui.menuEdit->addAction( ui.actionSettings );
     83}
     84
     85void 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
     93void 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
     101void 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
     109void 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
     117void 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}
  • experimental/osgVisualGuiNG/osgvisualgui.h

    r415 r418  
    44#include <QtGui/QMainWindow>
    55#include "ui_osgvisualgui.h"
     6
     7class QTextEdit;
    68
    79class osgVisualGUI : public QMainWindow
     
    1315        ~osgVisualGUI();
    1416
     17        /**
     18        * Intercepts closeEvents to perform userdef actions and finally accept the event.
     19        * Zu den Aktionen gehört das Speichern der Einstellungen, das Schliessen das Debugfensters etc.
     20        * @return void
     21        * @param event: Abzufangender CloseEvent
     22        */
     23        void closeEvent( QCloseEvent *event );
     24
     25        void setDebug(QTextEdit* debug_);
     26
    1527private:
     28        void setupDockWidgets();
     29        void setupToolbars();
     30        void setupMenus();
     31
    1632        Ui::osgVisualGUIClass ui;
     33
     34        /**
     35         * Pointer to the debug widget
     36         */
     37        QTextEdit* debug;
     38
     39private slots:
     40        void on_actionToggle_bottom_right_corner_triggered();
     41        void on_actionToggle_bottom_left_corner_triggered();
     42        void on_actionToggle_top_right_corner_triggered();
     43        void on_actionToggle_top_left_corner_triggered();
     44        void on_actionAbout_This_Programm_triggered();
    1745};
    1846
  • experimental/osgVisualGuiNG/osgvisualgui.ui

    r415 r418  
    1 <UI version="4.0" >
     1<?xml version="1.0" encoding="UTF-8"?>
     2<ui version="4.0">
    23 <class>osgVisualGUIClass</class>
    3  <widget class="QMainWindow" name="osgVisualGUIClass" >
    4   <property name="objectName" >
    5    <string notr="true">osgVisualGUIClass</string>
    6   </property>
    7   <property name="geometry" >
     4 <widget class="QMainWindow" name="osgVisualGUIClass">
     5  <property name="geometry">
    86   <rect>
    9         <x>0</x>
    10         <y>0</y>
    11         <width>600</width>
    12         <height>400</height>
     7    <x>0</x>
     8    <y>0</y>
     9    <width>600</width>
     10    <height>400</height>
    1311   </rect>
    1412  </property>
    15   <property name="windowTitle" >
     13  <property name="windowTitle">
    1614   <string>osgVisualGUI</string>
    1715  </property>
    18   <widget class="QMenuBar" name="menuBar" />
    19   <widget class="QToolBar" name="mainToolBar" />
    20   <widget class="QWidget" name="centralWidget" />
    21   <widget class="QStatusBar" name="statusBar" />
     16  <widget class="QWidget" name="centralWidget"/>
     17  <widget class="QMenuBar" name="menuBar">
     18   <property name="geometry">
     19    <rect>
     20     <x>0</x>
     21     <y>0</y>
     22     <width>600</width>
     23     <height>21</height>
     24    </rect>
     25   </property>
     26   <widget class="QMenu" name="menuFile">
     27    <property name="title">
     28     <string>File</string>
     29    </property>
     30    <addaction name="actionQuit"/>
     31   </widget>
     32   <widget class="QMenu" name="menu">
     33    <property name="title">
     34     <string>?</string>
     35    </property>
     36    <addaction name="actionAbout"/>
     37   </widget>
     38   <widget class="QMenu" name="menuEdit">
     39    <property name="title">
     40     <string>Edit</string>
     41    </property>
     42   </widget>
     43   <addaction name="menuFile"/>
     44   <addaction name="menuEdit"/>
     45   <addaction name="menu"/>
     46  </widget>
     47  <widget class="QToolBar" name="mainToolBar">
     48   <attribute name="toolBarArea">
     49    <enum>TopToolBarArea</enum>
     50   </attribute>
     51   <attribute name="toolBarBreak">
     52    <bool>false</bool>
     53   </attribute>
     54  </widget>
     55  <widget class="QStatusBar" name="statusBar"/>
     56  <widget class="QDockWidget" name="dW_Debug">
     57   <attribute name="dockWidgetArea">
     58    <number>2</number>
     59   </attribute>
     60   <widget class="QWidget" name="dockWidgetContents"/>
     61  </widget>
     62  <action name="actionAbout">
     63   <property name="text">
     64    <string>About</string>
     65   </property>
     66  </action>
     67  <action name="actionQuit">
     68   <property name="text">
     69    <string>Quit</string>
     70   </property>
     71  </action>
    2272 </widget>
    23  <layoutDefault spacing="6" margin="11" />
    24  <pixmapfunction></pixmapfunction>
     73 <layoutdefault spacing="6" margin="11"/>
    2574 <resources>
    26    <include location="osgvisualgui.qrc"/>
     75  <include location="osgvisualgui.qrc"/>
    2776 </resources>
    2877 <connections/>
    29 </UI>
     78</ui>
Note: See TracChangeset for help on using the changeset viewer.