Grip-Reloaded
Grip version visualizaiton interface for DART (DynamicAnimationandRoboticsToolkits)
/home/pete/myRepos/grip2/include/MainWindow.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2014, Georgia Tech Research Corporation
00003  * All rights reserved.
00004  *
00005  * Author: Shailesh Lohia <shailesh.lohia@gatech.edu>
00006  * Date: Jan 2014
00007  *
00008  * Humanoid Robotics Lab      Georgia Institute of Technology
00009  * Director: Mike Stilman     http://www.golems.org
00010  *
00011  *
00012  * This file is provided under the following "BSD-style" License:
00013  *   Redistribution and use in source and binary forms, with or
00014  *   without modification, are permitted provided that the following
00015  *   conditions are met:
00016  *
00017  *   * Redistributions of source code must retain the above copyright
00018  *     notice, this list of conditions and the following disclaimer.
00019  *
00020  *   * Redistributions in binary form must reproduce the above
00021  *     copyright notice, this list of conditions and the following
00022  *     disclaimer in the documentation and/or other materials provided
00023  *     with the distribution.
00024  *
00025  *   * Neither the name of the Humanoid Robotics Lab nor the names of
00026  *     its contributors may be used to endorse or promote products
00027  *     derived from this software without specific prior written
00028  *     permission
00029  *
00030  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
00031  *   CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
00032  *   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00033  *   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00034  *   DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
00035  *   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00036  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00037  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
00038  *   USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00039  *   AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00040  *   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00041  *   ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00042  *   POSSIBILITY OF SUCH DAMAGE.
00043  */
00044 
00050 #ifndef MAINWINDOW_H
00051 #define MAINWINDOW_H
00052 
00053 // Qt includes
00054 #include <QMainWindow>
00055 #include <QDir>
00056 #include <QtXml>
00057 
00058 // C++ Standard includes
00059 #include <iostream>
00060 #include <cstdio>
00061 
00062 // Forward declarations
00063 class QAction;
00064 class QActionGroup;
00065 class QLabel;
00066 class QMenu;
00067 
00073 class MainWindow : public QMainWindow
00074 {
00076     Q_OBJECT
00077 
00078 public:
00082     MainWindow();
00083 
00087     ~MainWindow();
00088 
00093     void Toolbar();
00094 
00095 public slots:
00101     void slotSetStatusBarMessage(QString msg);
00102 
00108     virtual void slotSetWorldFromPlayback(int sliderTick) = 0;
00109 
00113     virtual void slotPlaybackStart() = 0;
00114 
00118     virtual void slotPlaybackPause() = 0;
00119 
00123     virtual void slotPlaybackReverse() = 0;
00124 
00128     virtual void slotPlaybackTimeStep(bool playForward) = 0;
00129 
00135     virtual void slotPlaybackBeginning() = 0;
00136 
00137 protected:
00143     virtual QDomDocument* generateWorkspaceXML() = 0;
00144 
00149     virtual void parseConfig(QDomDocument config) = 0;
00150 
00152     QToolBar* _getToolBar();
00153 
00155     const QString LAST_LOAD_FILE;
00156 
00158     QString* configFilePath;
00159 
00160 protected slots:
00165     void loadScene();
00166 
00171     void quickLoad();
00172 
00177     void saveScene();
00178 
00183     void loadPluginFileWithDialog();
00184 
00189     void loadPluginDirWithDialog();
00190 
00195     virtual void loadPluginDirectory(QDir pluginsDirName) = 0;
00196 
00202     virtual void loadPluginFile(QString pluginFilename) = 0;
00203 
00208     virtual void close();
00209 
00214     void exit();
00215 
00220     virtual void front() = 0;
00221 
00226     virtual void top() = 0;
00227 
00232     virtual void side() = 0;
00233 
00238     virtual void startSimulation() = 0;
00239 
00244     virtual void stopSimulation() = 0;
00245 
00250     virtual void simulateSingleStep() = 0;
00251 
00256     virtual void renderDuringSimulation() = 0;
00257 
00262     virtual void white() = 0;
00263 
00268     virtual void gray() = 0;
00269 
00274     virtual void black() = 0;
00275 
00280     virtual void resetCamera() = 0;
00281 
00282     virtual void xga1024x768() = 0;
00283 
00284     virtual void vga640x480() = 0;
00285 
00286     virtual void hd1280x720() = 0;
00287 
00292     virtual void simulationStopped() = 0;
00293 
00299     virtual void setSimulationRelativeTime(double time) = 0;
00300 
00305     void about();
00306 
00311     void saveWorkspace();
00312 
00317     void saveNewWorkspace();
00318 
00323     void loadWorkspace(std::string workspaceFile="");
00324 
00325 
00326 private:
00331     void saveConfigFile(QDomDocument* config, QString* filename);
00332 
00337     void createActions();
00338 
00343     void createMenus();
00344 
00349     virtual void createRenderingWindow() = 0;
00350 
00355     virtual void createTreeView() = 0;
00356 
00361     virtual void createTabs() = 0;
00362 
00369     virtual void doLoad(std::string fileName) = 0;
00370 
00371     QMenu *fileMenu;
00372         QAction *loadSceneAct;
00373         QAction *quickLoadAct;
00374         QAction *saveSceneAct;
00375         QAction *loadPluginFileAct;
00376         QAction *loadPluginDirAct;
00377         QAction *saveWorkspaceConfigurationAct;
00378         QAction *saveNewWorkspaceConfigurationAct;
00379         QAction *loadWorkspaceConfigurationAct;
00380         QAction *closeSceneAct;
00381         QAction *exitAct;
00382     QMenu *viewMenu;
00383         QAction *frontAct;
00384         QAction *topAct;
00385         QAction *sideAct;
00386     QMenu *simulationMenu;
00387         QAction *startSimulationAct;
00388         QAction *stopSimulationAct;
00389         QAction *simulateSingleStepAct;
00390     QMenu *settingsMenu;
00391         QAction *renderDuringSimulationAct;
00392         QMenu *backgroundMenu;
00393             QAction *whiteAct;
00394             QAction *grayAct;
00395             QAction *blackAct;
00396         QAction *resetCameraAct;
00397     QMenu *renderMenu;
00398         QAction *xga1024x768Act;
00399         QAction *vga640x480Act;
00400         QAction *hd1280x720Act;
00401     QMenu *helpMenu;
00402         QAction *aboutAct;
00403 
00404     QToolBar *toolbar;
00405 
00406 }; // end class MainWindow
00407 
00408 #endif // MAINWINDOW_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator