INIInterface.hh 7.05 KB
Newer Older
1
/*===========================================================================*\
Jan Möbius's avatar
Jan Möbius committed
2 3
*                                                                            *
*                              OpenFlipper                                   *
Jan Möbius's avatar
Jan Möbius committed
4
*      Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen       *
Jan Möbius's avatar
Jan Möbius committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
*                           www.openflipper.org                              *
*                                                                            *
*--------------------------------------------------------------------------- *
*  This file is part of OpenFlipper.                                         *
*                                                                            *
*  OpenFlipper is free software: you can redistribute it and/or modify       *
*  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 with the               *
*  following exceptions:                                                     *
*                                                                            *
*  If other files instantiate templates or use macros                        *
*  or inline functions from this file, or you compile this file and          *
*  link it with other files to produce an executable, this file does         *
*  not by itself cause the resulting executable to be covered by the         *
*  GNU Lesser General Public License. This exception does not however        *
*  invalidate any other reasons why the executable file might be             *
*  covered by the GNU Lesser General Public License.                         *
*                                                                            *
*  OpenFlipper is distributed in the hope that it will be useful,            *
*  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 LesserGeneral Public           *
*  License along with OpenFlipper. If not,                                   *
*  see <http://www.gnu.org/licenses/>.                                       *
*                                                                            *
33 34 35
\*===========================================================================*/

/*===========================================================================*\
Jan Möbius's avatar
Jan Möbius committed
36 37 38 39 40
*                                                                            *
*   $Revision$                                                       *
*   $LastChangedBy$                                                *
*   $Date$                     *
*                                                                            *
41
\*===========================================================================*/
42 43


44 45
#ifndef INIINTERFACE_HH
#define INIINTERFACE_HH
46 47 48 49

 #include <QtGui>
 #include <QMenuBar>
 #include <OpenFlipper/common/Types.hh>
50

51
 #include <OpenFlipper/INIFile/INIFile.hh>
52 53 54

 /** \brief Interface class for Plugins which have to store information in ini files
  *
55 56 57 58
  * Using this interface you can store or load additional information to an ini file on a
  * per object basis or settings for your plugin. After basic information is written to the
  * ini file by the core ( or loaded by the core ) the corresponding functions in this
  * Interface will be executed.
59 60
  * You get the object id for the object which has to be used. For every object the functions
  * will get called and you have to save your data only for the given object!\n
61 62 63
  * The ini file in the functions is already open. You may not close it!
  * Additionally there are two slots which are called once per plugin when writing a settings
  * file. These slots should be used to store information which is used by your plugin.
64 65
  *
  * See \ref dataFlow for a detailed overview of OpenFlipper's data flow and interface function calls.
66 67
 */
class INIInterface {
68 69
   public :

70 71
      /// Destructor
      virtual ~INIInterface() {};
72

73
   private slots:
74 75 76 77 78 79 80 81 82 83 84 85

    //=======================================
    /** @name Per object settings
    * @{ */
    //=======================================
      /** \brief Load per object settings
       *
       *  Every time the core opens a settings file containing objects
       *  the core will call this slot for each object it finds.
       *  The object itself is loaded before the slot is called. Therefore
       *  the object is available from within your plugin.
       *
86 87 88
       *  @param _ini ini file
       *  @param _id Id of the object to load data for
       */
Dirk Wilden's avatar
Dirk Wilden committed
89
      virtual void loadIniFile( INIFile& /*_ini*/ ,int /*_id*/ ) {};
90

91 92 93 94 95 96
      /** \brief Save per object settings
       *
       * Every time a settings file is created this slot is called
       * once per object. Here you can write additional information
       * handled by your plugin which is attached to the object.
       *
97
       * @param _ini ini file
98
       * @param _id Identifier of the object to save
99
       */
Dirk Wilden's avatar
Dirk Wilden committed
100
      virtual void saveIniFile( INIFile& /*_ini*/ ,int /*_id*/) {};
101

102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
    /** @} */


    //=======================================
    /** @name Plugin Options and Settings
    * @{ */
    //=======================================

    private slots:

      /** \brief Load per Plugin settings
       *
       *  When the core loads an ini file and it contains settings for
       *  Plugin or the core itself this slot will be
       *  called once per Plugin.
       *  This Slot will be called after loading the core settings and
       *  before objects are loaded
       *
120 121
       * @param _ini  ini file
       */
Dirk Wilden's avatar
Dirk Wilden committed
122
      virtual void loadIniFileOptions( INIFile& /*_ini*/ ) {};
123

124 125 126 127 128 129 130 131 132 133 134 135
      /** \brief Load per Plugin settings after objects are loaded
       *
       *  When the core loads an ini file and it contains settings for
       *  Plugin or the core itself this slot will be
       *  called once per Plugin. In contrast to loadIniFileOptions
       *  this slot will be called after all objects are loaded
       *
       * @param _ini  ini file
       */
      virtual void loadIniFileOptionsLast( INIFile& /*_ini*/ ) {};

      /** \brief Save Plugin Options
136
       *  When the core is about to save an ini file this slot will be
137 138 139 140
       *  called once per Plugin.
       *  This Slot will be called after saving the core settings and
       *  before objects are saved to the file
       *
141 142
       * @param _ini ini file
       */
Dirk Wilden's avatar
Dirk Wilden committed
143
      virtual void saveIniFileOptions( INIFile& /*_ini*/ ) {};
144

145 146 147 148 149 150 151 152 153 154
      /** \brief Save per Plugin settings when application is about to quit
       *
       * Before the Core is closed, this slot will be called per plugin to
       * save per plugin settings.
       *
       * @param _ini ini file
       */
      virtual void saveOnExit( INIFile& /*_ini*/ ) {};


155 156 157
   /** @} */


158 159 160
};

Q_DECLARE_INTERFACE(INIInterface,"OpenFlipper.INIInterface/1.2")
161

162
#endif // INIINTERFACE_HH