FileInterface.hh 3.5 KB
Newer Older
Jan Möbius's avatar
 
Jan Möbius committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
//=============================================================================
//
//                               OpenFlipper
//        Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen
//                           www.openflipper.org
//
//-----------------------------------------------------------------------------
//
//                                License
//
//  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.
15
//
Jan Möbius's avatar
 
Jan Möbius committed
16 17 18 19
//  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.
20
//
Jan Möbius's avatar
 
Jan Möbius committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
//  You should have received a copy of the GNU Lesser General Public License
//  along with OpenFlipper.  If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
//
//   $Revision$
//   $Author$
//   $Date$
//
//=============================================================================




//
// C++ Interface: BasePlugin
//
38
// Description:
Jan Möbius's avatar
 
Jan Möbius committed
39 40 41 42 43
//
//
// Author: Jan Moebius <jan_moebius@web.de>, (C) 2007
//

44 45
#ifndef FILEINTERFACE_HH
#define FILEINTERFACE_HH
Jan Möbius's avatar
 
Jan Möbius committed
46 47 48

 #include <QtGui>
 #include <OpenFlipper/common/Types.hh>
49

Jan Möbius's avatar
 
Jan Möbius committed
50
 /** \brief Interface class for file and object handling
51 52
  *
  * This interface class has to be fully implemented. When you want to support save and load
Jan Möbius's avatar
 
Jan Möbius committed
53 54 55 56 57 58 59
  * for an object type you have to implement all functions in this class. The core manages the
  * load and save interaction and gives the load and save actions to your plugin. The decision
  * which plugin is called for saving an object depends on your supportedTypes() and the filters
  * defined by your plugin.
 */

class FileInterface {
60 61 62

   public :

Jan Möbius's avatar
 
Jan Möbius committed
63
      /// Return support for adding empty objects
64 65
      virtual bool supportAddEmpty() = 0;

Jan Möbius's avatar
 
Jan Möbius committed
66 67
      /// Add an empty object
      virtual int addEmpty() = 0;
68

Jan Möbius's avatar
 
Jan Möbius committed
69 70
      /// Return name for the types of data this plugin handles
      virtual QString typeName() = 0;
71

Jan Möbius's avatar
 
Jan Möbius committed
72 73
      /// Return supported Object type
      virtual DataType supportedType() = 0;
74

Jan Möbius's avatar
 
Jan Möbius committed
75 76
      /// Get the Qt Filters for Filedialogs when loading files
      virtual QString getLoadFilters() = 0;
77

Jan Möbius's avatar
 
Jan Möbius committed
78 79
      /// Get the Qt Filters for Filedialogs when saving files
      virtual QString getSaveFilters() = 0;
Dirk Wilden's avatar
Dirk Wilden committed
80

Dirk Wilden's avatar
Dirk Wilden committed
81
      /** You can provide a special widget showing options for saving your file types
Dirk Wilden's avatar
Dirk Wilden committed
82 83 84 85
       *  depending on the current filter
       *
       *  _currentFilter: one filter from saveFilters
       *
86
       *  Return 0 when you dont need one
Dirk Wilden's avatar
Dirk Wilden committed
87
       */
Dirk Wilden's avatar
Dirk Wilden committed
88
      virtual QWidget* saveOptionsWidget(QString /*_currentFilter*/) = 0;
Dirk Wilden's avatar
Dirk Wilden committed
89

Dirk Wilden's avatar
Dirk Wilden committed
90
      /** You can provide a special widget showing options for loading your file types
Dirk Wilden's avatar
Dirk Wilden committed
91 92 93 94
       *  depending on the current filter
       *
       *  _currentFilter: one filter from loadFilters
       *
95
       *  Return 0 when you dont need one
Dirk Wilden's avatar
Dirk Wilden committed
96
       */
Dirk Wilden's avatar
Dirk Wilden committed
97
      virtual QWidget* loadOptionsWidget(QString /*_currentFilter*/) = 0;
98 99 100

public slots:

Jan Möbius's avatar
 
Jan Möbius committed
101
      /// load an object from the given file
Dirk Wilden's avatar
Dirk Wilden committed
102
      virtual int loadObject(QString /*_filename*/) = 0;
103

Jan Möbius's avatar
 
Jan Möbius committed
104
      /// Save the object with given id,filename
Dirk Wilden's avatar
Dirk Wilden committed
105
      virtual bool saveObject(int /*_id*/, QString /*_filename*/) = 0;
106

Jan Möbius's avatar
 
Jan Möbius committed
107
      //Optionswidget
108

Jan Möbius's avatar
 
Jan Möbius committed
109 110 111
};

Q_DECLARE_INTERFACE(FileInterface,"OpenFlipper.FileInterface/0.3")
112

Jan Möbius's avatar
 
Jan Möbius committed
113
#endif // FILEINTERFACE_HH