INIInterface.hh 7.05 KB
 Jan Möbius committed Aug 05, 2009 1 /*===========================================================================*\  Jan Möbius committed Nov 25, 2010 2 3 * * * OpenFlipper *  Jan Möbius committed Jan 26, 2011 4 * Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen *  Jan Möbius committed Nov 25, 2010 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 . * * *  Jan Möbius committed Aug 05, 2009 33 34 35 \*===========================================================================*/ /*===========================================================================*\  Jan Möbius committed Nov 25, 2010 36 37 38 39 40 * * * $Revision$ * * $LastChangedBy$ * * $Date$ * * *  Jan Möbius committed Aug 05, 2009 41 \*===========================================================================*/  Jan Möbius committed Aug 29, 2008 42 43   Jan Möbius committed Jan 27, 2009 44 45 #ifndef INIINTERFACE_HH #define INIINTERFACE_HH  Jan Möbius committed Aug 29, 2008 46 47 48 49  #include #include #include  Jan Möbius committed Jan 27, 2009 50   Jan Möbius committed Aug 29, 2008 51  #include  Jan Möbius committed Jan 27, 2009 52 53 54  /** \brief Interface class for Plugins which have to store information in ini files *  Jan Möbius committed Feb 03, 2009 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.  Jan Möbius committed Aug 29, 2008 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  Jan Möbius committed Feb 03, 2009 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.  Mike Kremer committed Feb 04, 2009 64 65  * * See \ref dataFlow for a detailed overview of OpenFlipper's data flow and interface function calls.  Jan Möbius committed Aug 29, 2008 66 67  */ class INIInterface {  Jan Möbius committed Jan 27, 2009 68 69  public :  Jan Möbius committed Aug 29, 2008 70 71  /// Destructor virtual ~INIInterface() {};  Jan Möbius committed Jan 27, 2009 72   Jan Möbius committed Aug 29, 2008 73  private slots:  Jan Möbius committed Feb 03, 2009 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. *  Jan Möbius committed Aug 29, 2008 86 87 88  * @param _ini ini file * @param _id Id of the object to load data for */  Dirk Wilden committed Sep 30, 2008 89  virtual void loadIniFile( INIFile& /*_ini*/ ,int /*_id*/ ) {};  Jan Möbius committed Jan 27, 2009 90   Jan Möbius committed Feb 03, 2009 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. *  Jan Möbius committed Aug 29, 2008 97  * @param _ini ini file  Jan Möbius committed Feb 03, 2009 98  * @param _id Identifier of the object to save  Jan Möbius committed Aug 29, 2008 99  */  Dirk Wilden committed Sep 30, 2008 100  virtual void saveIniFile( INIFile& /*_ini*/ ,int /*_id*/) {};  Jan Möbius committed Jan 27, 2009 101   Jan Möbius committed Feb 03, 2009 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 *  Jan Möbius committed Aug 29, 2008 120 121  * @param _ini ini file */  Dirk Wilden committed Sep 30, 2008 122  virtual void loadIniFileOptions( INIFile& /*_ini*/ ) {};  Jan Möbius committed Jan 27, 2009 123   Jan Möbius committed Feb 03, 2009 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  Jan Möbius committed May 18, 2009 136  * When the core is about to save an ini file this slot will be  Jan Möbius committed Feb 03, 2009 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 *  Jan Möbius committed Aug 29, 2008 141 142  * @param _ini ini file */  Dirk Wilden committed Sep 30, 2008 143  virtual void saveIniFileOptions( INIFile& /*_ini*/ ) {};  Jan Möbius committed Jan 27, 2009 144   Jan Möbius committed May 18, 2009 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*/ ) {};  Jan Möbius committed Feb 03, 2009 155 156 157  /** @} */  Jan Möbius committed Aug 29, 2008 158 159 160 }; Q_DECLARE_INTERFACE(INIInterface,"OpenFlipper.INIInterface/1.2")  Jan Möbius committed Jan 27, 2009 161   Jan Möbius committed Aug 29, 2008 162 #endif // INIINTERFACE_HH