2012-05-18 02:45:23 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
|
|
|
//
|
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// ResInsight 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 General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "cafPdmObject.h"
|
|
|
|
#include "cafPdmPointer.h"
|
2013-03-20 00:11:45 -05:00
|
|
|
#include "cafPdmDocument.h"
|
2012-05-18 02:45:23 -05:00
|
|
|
#include "cafUiTreeModelPdm.h"
|
|
|
|
|
2013-03-18 05:40:39 -05:00
|
|
|
#include <QMimeData>
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
class QFileSystemWatcher;
|
|
|
|
|
|
|
|
class RimCellPropertyFilter;
|
2012-06-26 09:10:41 -05:00
|
|
|
class RimCellRangeFilter;
|
2013-03-20 09:04:28 -05:00
|
|
|
class RimReservoir;
|
2012-06-26 09:10:41 -05:00
|
|
|
class RimReservoirView;
|
|
|
|
class RimInputProperty;
|
2013-02-15 01:44:45 -06:00
|
|
|
class RimStatisticalCalculation;
|
2013-03-14 03:50:40 -05:00
|
|
|
class RimIdenticalGridCaseGroup;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-03-18 05:40:39 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// MimeData class used to carry a QModelIndexList
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
class MimeDataWithIndexes : public QMimeData
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
MimeDataWithIndexes()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-03-20 00:11:45 -05:00
|
|
|
|
|
|
|
MimeDataWithIndexes(const MimeDataWithIndexes & other) : QMimeData()
|
2013-03-18 05:40:39 -05:00
|
|
|
{
|
|
|
|
setIndexes(other.indexes());
|
|
|
|
}
|
|
|
|
|
|
|
|
void setIndexes(const QModelIndexList & indexes)
|
|
|
|
{
|
|
|
|
m_indexes = indexes;
|
|
|
|
}
|
|
|
|
|
|
|
|
const QModelIndexList& indexes() const { return m_indexes; }
|
|
|
|
|
|
|
|
virtual bool hasFormat( const QString &mimetype ) const
|
|
|
|
{
|
|
|
|
return (mimetype == formatName());
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual QStringList formats() const
|
|
|
|
{
|
|
|
|
QStringList supportedFormats = QMimeData::formats();
|
|
|
|
supportedFormats << formatName();
|
|
|
|
|
|
|
|
return supportedFormats;
|
|
|
|
}
|
|
|
|
|
|
|
|
static QString formatName()
|
|
|
|
{
|
|
|
|
return "MimeDataWithIndexes";
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
QModelIndexList m_indexes;
|
|
|
|
};
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(MimeDataWithIndexes)
|
|
|
|
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
//==================================================================================================
|
|
|
|
///
|
|
|
|
///
|
|
|
|
//==================================================================================================
|
|
|
|
class RimUiTreeModelPdm : public caf::UiTreeModelPdm
|
|
|
|
{
|
|
|
|
Q_OBJECT;
|
|
|
|
|
|
|
|
public:
|
|
|
|
RimUiTreeModelPdm(QObject* parent);
|
|
|
|
|
|
|
|
// Overrides
|
|
|
|
virtual bool insertRows(int position, int rows, const QModelIndex &parent = QModelIndex());
|
|
|
|
|
|
|
|
// Special edit methods
|
2012-06-26 09:10:41 -05:00
|
|
|
bool deleteRangeFilter(const QModelIndex& itemIndex);
|
|
|
|
bool deletePropertyFilter(const QModelIndex& itemIndex);
|
|
|
|
bool deleteReservoirView(const QModelIndex& itemIndex);
|
|
|
|
void deleteInputProperty(const QModelIndex& itemIndex);
|
2013-03-20 09:04:28 -05:00
|
|
|
void deleteReservoir(RimReservoir* reservoir);
|
2012-06-26 09:10:41 -05:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
RimCellPropertyFilter* addPropertyFilter(const QModelIndex& itemIndex, QModelIndex& insertedModelIndex);
|
|
|
|
RimCellRangeFilter* addRangeFilter(const QModelIndex& itemIndex, QModelIndex& insertedModelIndex);
|
|
|
|
RimReservoirView* addReservoirView(const QModelIndex& itemIndex, QModelIndex& insertedModelIndex);
|
2012-06-26 09:10:41 -05:00
|
|
|
void addInputProperty(const QModelIndex& itemIndex, const QStringList& fileNames);
|
2013-03-20 01:42:26 -05:00
|
|
|
void addObjects(const QModelIndex& itemIndex, caf::PdmObjectGroup& pdmObjects);
|
2013-02-15 01:44:45 -06:00
|
|
|
|
|
|
|
RimStatisticalCalculation* addStatisticalCalculation(const QModelIndex& itemIndex, QModelIndex& insertedModelIndex);
|
2013-03-14 03:50:40 -05:00
|
|
|
RimIdenticalGridCaseGroup* addCaseGroup(const QModelIndex& itemIndex, QModelIndex& insertedModelIndex);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-03-20 06:08:40 -05:00
|
|
|
bool deleteObjectFromPdmPointersField(const QModelIndex& itemIndex);
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
void updateScriptPaths();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void slotRefreshScriptTree(QString path);
|
2013-03-20 09:04:28 -05:00
|
|
|
void clearClipboard();
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
QFileSystemWatcher* m_scriptChangeDetector;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|