WQt4Gui.h 3.95 KB
Newer Older
1 2
//---------------------------------------------------------------------------
//
3
// Project: OpenWalnut ( http://www.openwalnut.org )
4
//
5 6
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
7
//
wiebel's avatar
wiebel committed
8
// This file is part of OpenWalnut.
9
//
wiebel's avatar
wiebel committed
10
// OpenWalnut is free software: you can redistribute it and/or modify
11 12 13 14
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
wiebel's avatar
wiebel committed
15
// OpenWalnut is distributed in the hope that it will be useful,
16 17 18 19 20
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
wiebel's avatar
wiebel committed
21
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 23 24
//
//---------------------------------------------------------------------------

25 26 27 28 29
#ifndef WQT4GUI_H
#define WQT4GUI_H

#include <string>
#include <vector>
30

31 32
#include <boost/program_options.hpp>

33 34
#include "../WGUI.h"

35
class WMainWindow;
36 37
class WGraphicsEngine;
class WKernel;
ebaum's avatar
ebaum committed
38

39
/**
40
 * The QT4 Based GUI implementation. Implements WGUI.
wiebel's avatar
wiebel committed
41
 * \ingroup gui
42
 */
43
class WQt4Gui : public WGUI
44 45
{
public:
46

47
    /**
48
     * Constructor.
49
     *
50 51
     * \param argc number of arguments given on command line.
     * \param argv arguments given on command line.
ebaum's avatar
ebaum committed
52
     */
53
    WQt4Gui( int argc, char** argv );
ebaum's avatar
ebaum committed
54

55
    /**
ebaum's avatar
ebaum committed
56
     * Default destructor.
57
     */
58 59
    virtual ~WQt4Gui();

60
    /**
61 62 63
     * Runs the GUI. All initialization should be done here.
     *
     * \return the return code.
64
     */
65
    virtual int run();
66

67
    /**
68
     * adds a dataset to the dataset browser
69
     *
70 71
     * \param module
     * \param subjectId
72
     */
73
    void addDatasetToBrowser( boost::shared_ptr< WModule > module, int subjectId );
74

75 76 77 78 79 80 81
    /**
     * adds a module to the dataset browser
     *
     * \param module
     */
    void addModuleToBrowser( boost::shared_ptr< WModule > module );

82
    /**
83 84 85 86 87 88
     * returns a vector of pointers to the loaded datasets for a given subject.
     *
     * \param subjectId the ID of the subject to get the list for.
     * \param onlyTextures true if only textures should be returned.
     *
     * \return list of datasets.
89
     */
90
    virtual std::vector< boost::shared_ptr< WDataSet > > getDataSetList( int subjectId, bool onlyTextures = false );
91

92 93 94 95 96 97 98 99 100

    /**
     * returns a pointer to the selected module in the dataset browser
     *
     * \return the module
     */
    virtual boost::shared_ptr< WModule > getSelectedModule();


101 102 103
    /**
     * getter functions for the signales proved by the gui
     */
schurade's avatar
schurade committed
104 105 106
    boost::signals2::signal1< void, std::vector< std::string > >* getLoadButtonSignal();

    boost::signals2::signal1< void, std::string >* getPickSignal();
107

108 109 110
    /**
     * this function allows modules to register their property object with the gui
     */
111
    virtual void connectProperties( boost::shared_ptr<WProperties> properties );
112 113

protected:
ebaum's avatar
ebaum committed
114

115 116
private:

117
    /**
118
     * Main window containing all needed widgets.
ebaum's avatar
ebaum committed
119
     */
120
    WMainWindow* m_gui;
ebaum's avatar
ebaum committed
121

122 123 124 125
    /**
     * Graphics Engine instance.
     */
    boost::shared_ptr< WGraphicsEngine > m_ge;
126

127 128 129 130
    /**
     * Kernel instance.
     */
    boost::shared_ptr< WKernel > m_kernel;
131 132

    boost::program_options::variables_map m_optionsMap; //!< Map storing the program options.
133 134 135 136 137 138 139 140 141 142
    boost::program_options::variables_map m_guiConfiguration; //!< Map storing the configuration of the GUI

    /**
     * This function defines and parses the valid command line options.
     * This might once be put in a separate class like WOptionHandler.
     * At the moment it seems reasonable that different GUIs might have
     * different command line options, thus we implement their parsing
     * in the GUI implemntation itself, i.e. here.
     */
    bool parseOptions( int argc, char** argv );
143 144
};

145
#endif  // WQT4GUI_H
146