INIInterface.hh 7.17 KB
Newer Older
1 2 3 4 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 33 34 35 36 37 38 39 40 41
/*===========================================================================*\
 *                                                                           *
 *                              OpenFlipper                                  *
 *      Copyright (C) 2001-2009 by Computer Graphics Group, RWTH Aachen      *
 *                           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/>.                                      *
 *                                                                           *
\*===========================================================================*/

/*===========================================================================*\
 *                                                                           *
 *   $Revision$                                                         *
 *   $Author$                                                      *
 *   $Date$                   *
 *                                                                           *
\*===========================================================================*/
Jan Möbius's avatar
 
Jan Möbius committed
42 43 44 45 46 47 48




//
// C++ Interface: BasePlugin
//
Jan Möbius's avatar
 
Jan Möbius committed
49
// Description:
Jan Möbius's avatar
 
Jan Möbius committed
50 51 52 53 54
//
//
// Author: Jan Moebius <jan_moebius@web.de>, (C) 2007
//

Jan Möbius's avatar
 
Jan Möbius committed
55 56
#ifndef INIINTERFACE_HH
#define INIINTERFACE_HH
Jan Möbius's avatar
 
Jan Möbius committed
57 58 59 60

 #include <QtGui>
 #include <QMenuBar>
 #include <OpenFlipper/common/Types.hh>
Jan Möbius's avatar
 
Jan Möbius committed
61

Jan Möbius's avatar
 
Jan Möbius committed
62
 #include <OpenFlipper/INIFile/INIFile.hh>
Jan Möbius's avatar
 
Jan Möbius committed
63 64 65

 /** \brief Interface class for Plugins which have to store information in ini files
  *
Jan Möbius's avatar
Jan Möbius committed
66 67 68 69
  * 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.
Jan Möbius's avatar
 
Jan Möbius committed
70 71
  * 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
Jan Möbius's avatar
Jan Möbius committed
72 73 74
  * 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.
75 76
  *
  * See \ref dataFlow for a detailed overview of OpenFlipper's data flow and interface function calls.
Jan Möbius's avatar
 
Jan Möbius committed
77 78
 */
class INIInterface {
Jan Möbius's avatar
 
Jan Möbius committed
79 80
   public :

Jan Möbius's avatar
 
Jan Möbius committed
81 82
      /// Destructor
      virtual ~INIInterface() {};
Jan Möbius's avatar
 
Jan Möbius committed
83

Jan Möbius's avatar
 
Jan Möbius committed
84
   private slots:
Jan Möbius's avatar
Jan Möbius committed
85 86 87 88 89 90 91 92 93 94 95 96

    //=======================================
    /** @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.
       *
Jan Möbius's avatar
 
Jan Möbius committed
97 98 99
       *  @param _ini ini file
       *  @param _id Id of the object to load data for
       */
Dirk Wilden's avatar
Dirk Wilden committed
100
      virtual void loadIniFile( INIFile& /*_ini*/ ,int /*_id*/ ) {};
Jan Möbius's avatar
 
Jan Möbius committed
101

Jan Möbius's avatar
Jan Möbius committed
102 103 104 105 106 107
      /** \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.
       *
Jan Möbius's avatar
 
Jan Möbius committed
108
       * @param _ini ini file
Jan Möbius's avatar
Jan Möbius committed
109
       * @param _id Identifier of the object to save
Jan Möbius's avatar
 
Jan Möbius committed
110
       */
Dirk Wilden's avatar
Dirk Wilden committed
111
      virtual void saveIniFile( INIFile& /*_ini*/ ,int /*_id*/) {};
Jan Möbius's avatar
 
Jan Möbius committed
112

Jan Möbius's avatar
Jan Möbius committed
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
    /** @} */


    //=======================================
    /** @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
       *
Jan Möbius's avatar
 
Jan Möbius committed
131 132
       * @param _ini  ini file
       */
Dirk Wilden's avatar
Dirk Wilden committed
133
      virtual void loadIniFileOptions( INIFile& /*_ini*/ ) {};
Jan Möbius's avatar
 
Jan Möbius committed
134

Jan Möbius's avatar
Jan Möbius committed
135 136 137 138 139 140 141 142 143 144 145 146
      /** \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
147
       *  When the core is about to save an ini file this slot will be
Jan Möbius's avatar
Jan Möbius committed
148 149 150 151
       *  called once per Plugin.
       *  This Slot will be called after saving the core settings and
       *  before objects are saved to the file
       *
Jan Möbius's avatar
 
Jan Möbius committed
152 153
       * @param _ini ini file
       */
Dirk Wilden's avatar
Dirk Wilden committed
154
      virtual void saveIniFileOptions( INIFile& /*_ini*/ ) {};
Jan Möbius's avatar
 
Jan Möbius committed
155

156 157 158 159 160 161 162 163 164 165
      /** \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*/ ) {};


Jan Möbius's avatar
Jan Möbius committed
166 167 168
   /** @} */


Jan Möbius's avatar
 
Jan Möbius committed
169 170 171
};

Q_DECLARE_INTERFACE(INIInterface,"OpenFlipper.INIInterface/1.2")
Jan Möbius's avatar
 
Jan Möbius committed
172

Jan Möbius's avatar
 
Jan Möbius committed
173
#endif // INIINTERFACE_HH