Updraft  1.0
Open source glider flight visualisation tool.
filetypemanager.h
Go to the documentation of this file.
00001 #ifndef UPDRAFT_SRC_CORE_FILETYPEMANAGER_H_
00002 #define UPDRAFT_SRC_CORE_FILETYPEMANAGER_H_
00003 
00004 #include <QList>
00005 #include <QString>
00006 #include <QDir>
00007 #include <QStandardItemModel>
00008 #include <QCoreApplication>
00009 
00010 #include "../coreinterface.h"
00011 
00012 namespace Updraft {
00013 
00014 class PluginBase;
00015 
00016 namespace Core {
00017 
00020 class FileTypeManager {
00021   Q_DECLARE_TR_FUNCTIONS(FileTypeManager)
00022 
00023  public:
00024   void registerFiletype(const FileRegistration &registration);
00025 
00026   bool openFile(const QString &path, bool showDialog = true) const;
00027 
00028   void openFileDialog(const QString &caption);
00029 
00030   QDir lastDirectory();
00031   void setLastDirectory(const QDir& dir);
00032 
00033  private:
00034   class FileOpenOption;
00035 
00036   void getOpenOptions(QString path, QStandardItemModel* out) const;
00037 
00038   bool importFile(QString *newPath,
00039     const QString &importDirectory, const QString &srcPath) const;
00040 
00041   bool openFileInternal(const QString &path,
00042     QStandardItemModel const* model) const;
00043 
00045   QList<FileRegistration> registered;
00046 
00047   friend class FileOpenDialog;
00048 
00050   QString lastFileOpenDir;
00051 };
00052 
00053 }  // End namespace Core
00054 }  // End namespace Updraft
00055 
00056 #endif  // UPDRAFT_SRC_CORE_FILETYPEMANAGER_H_
00057 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines