00001 /* This file is part of Rocs, 00002 Copyright (C) 2008 by: 00003 Tomaz Canabrava <tomaz.canabrava@gmail.com> 00004 Ugo Sangiori <ugorox@gmail.com> 00005 00006 Rocs is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 Rocs is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with Step; if not, write to the Free Software 00018 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00019 */ 00020 00021 #ifndef SUI_MAINWINDOW_H 00022 #define SUI_MAINWINDOW_H 00023 00024 //#include <KXmlGuiWindow> 00025 #include <kmessagebox.h> 00026 #include <KToolBar> 00027 #include <KComboBox> 00028 #include <QtGui/QAction> 00029 #include <QtGui/QVBoxLayout> 00030 #include <QtGui/QUndoCommand> 00031 #include <QtCore/QTextStream> 00032 #include <engine/gameobject.h> 00033 #include <engine/component.h> 00034 #include <engine/game.h> 00035 #include <engine/gameproject.h> 00036 #include <engine/scene.h> 00037 #include <creator/lib/historymanager.h> 00038 00039 class KPushButton; 00040 class GraphVisualEditor; 00041 class KActionCollection; 00042 class GraphDocument; 00043 class Graph; 00044 class GraphScene; 00045 class KAction; 00046 class MoveNodeAction; 00047 class TabWidget; 00048 class CodeEditor; 00049 00050 #include <QtCore/QWaitCondition> 00051 00052 class MainWindow : public QWidget 00053 { 00054 Q_OBJECT 00055 00056 public: 00058 MainWindow(); 00059 00060 Graph* graph() const; 00061 GraphScene* scene() const; 00062 void debug( const QString& s ); 00063 GraphDocument* activeDocument() const; 00064 00065 00066 private: // Methods 00067 void setupWidgets(); // Setup all the widgets. 00068 void setupActions(); // Setup all the actions. 00069 void setupLists(); //Setup all them lists. 00070 void startThreadDocument(); 00071 void addCustomTypes( KComboBox* bigList ); 00072 void eatChildren( GluonEngine::GameObject* trap ); 00073 00074 public slots: 00075 void setActiveGraphDocument( GraphDocument* d ); 00076 void setActiveGraph( Graph* g ); 00077 void toggleWidgetTypeShown(); 00078 void readTheScene(); 00079 void saveStateGDL(); 00080 void loadStateGDL(); 00081 void updateNodesFromModel( const QUndoCommand* cmd ); 00082 void deleteThisSceneObject( QString objectName, QString objectParent ); 00083 void markAsGameObject(); 00084 void markAsGameComponent(); 00085 void exportCode( bool checked ); 00086 GluonCore::GluonObject* surfNodesIntoTree(); 00087 void traceNodeGen( GluonCore::GluonObject* n ); 00088 void exportFromThisNode( GluonCore::GluonObject* o, QTextStream* file ); 00089 signals: 00090 void sendDisappoint(); 00091 00092 private: 00093 GraphVisualEditor* _graphVisualEditor; 00094 KToolBar* _actionButtons; 00095 KComboBox* _widgetType; 00096 KPushButton* _exportCode; 00097 QAction* _widgetTypeBar; 00098 QVBoxLayout* _layout; 00099 KActionCollection* ac; 00100 //KActionCollection *_paletteActions; //! the pallete actions, move, add, etc. 00101 GraphDocument* _tDocument; 00102 Graph* _graph; 00103 bool _idle; 00104 QString _lastScene; 00105 bool _skipNextUpdate; 00106 bool _isGameObject; 00107 bool _isGameComponent; 00108 bool _skipSaving; 00109 QList<QString> _objectTypes; 00110 00111 }; 00112 00113 #endif