itom 1.3.0
|
00001 /* ******************************************************************** 00002 itom software 00003 URL: http://www.uni-stuttgart.de/ito 00004 Copyright (C) 2013, Institut für Technische Optik (ITO), 00005 Universität Stuttgart, Germany 00006 00007 This file is part of itom. 00008 00009 itom is free software; you can redistribute it and/or modify it 00010 under the terms of the GNU Library General Public Licence as published by 00011 the Free Software Foundation; either version 2 of the Licence, or (at 00012 your option) any later version. 00013 00014 itom is distributed in the hope that it will be useful, but 00015 WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library 00017 General Public Licence for more details. 00018 00019 You should have received a copy of the GNU Library General Public License 00020 along with itom. If not, see <http://www.gnu.org/licenses/>. 00021 *********************************************************************** */ 00022 00023 #ifndef IOHELPER_H 00024 #define IOHELPER_H 00025 00026 #include "../global.h" 00027 #include "../common/sharedStructures.h" 00028 #include "../common/sharedStructuresQt.h" 00029 #include "../../common/addInInterface.h" 00030 00031 #include <qstring.h> 00032 #include <qobject.h> 00033 00034 namespace ito { 00035 00036 class IOHelper : public QObject 00037 { 00038 Q_OBJECT 00039 public: 00040 enum IOFilter 00041 { 00042 IOInput = 0x001, 00043 IOOutput = 0x002, 00044 IOPlugin = 0x004, 00045 IOAllFiles = 0x008, 00046 IOWorkspace = 0x010, 00047 IOMimeDataObject = 0x020, 00048 IOMimePointCloud = 0x040, 00049 IOMimePolygonMesh = 0x080, 00050 IOMimeAll = IOMimeDataObject | IOMimePointCloud | IOMimePolygonMesh 00051 }; 00052 Q_DECLARE_FLAGS(IOFilters, IOFilter) 00053 00054 static RetVal openGeneralFile(const QString &generalFileName, bool openUnknownsWithExternalApp = true, bool showMessages = false, QWidget* parent = NULL, const char* errorSlotMemberOfParent = NULL, bool globalNotLocalWorkspace = true); 00055 00056 static RetVal uiExportPyWorkspaceVars(bool globalNotLocal, const QStringList &varNames, QVector<int> compatibleParamBaseTypes, QString defaultPath = QString::Null(), QWidget* parent = NULL); 00057 static RetVal exportPyWorkspaceVars(const QString &filename, bool globalNotLocal, const QStringList &varNames); 00058 00059 static RetVal uiImportPyWorkspaceVars(bool globalNotLocal, IOFilters IOfilters, QString defaultPath = QString::Null(), QWidget* parent = NULL); 00060 static RetVal importPyWorkspaceVars(const QString &filename, bool globalNotLocal); 00061 00062 static RetVal uiOpenPythonScript(QString defaultPath = QString::Null(), QWidget* parent = NULL); 00063 static RetVal openPythonScript(const QString &filename); 00064 00065 static RetVal uiOpenFileWithFilter(const ito::AddInAlgo::FilterDef *filter, const QString &filename, QWidget *parent = NULL, bool globalNotLocal = true); 00066 static RetVal uiSaveFileWithFilter(QSharedPointer<ito::ParamBase> &value, const QString &filename, QWidget *parent = NULL); 00067 00068 static RetVal openUIFile(const QString &filename, QWidget* parent = NULL, const char* errorSlotMemberOfParent = NULL); 00069 00070 static QString getFileFilters(const IOFilters &IOfilters, QStringList *allPatterns = NULL); 00071 00072 static bool fileFitsToFileFilters(const QString &filename, const IOFilters &IOfilters); 00073 00074 static void elideFilepathMiddle(QString &path, int pixelLength); 00075 00076 private: 00077 IOHelper() {}; 00078 ~IOHelper() {}; 00079 IOHelper(const IOHelper &) : QObject() {}; 00080 00081 }; 00082 00083 } //end namespace ito 00084 00085 #endif