Moved MimeData into RimMimeData

p4#: 21317
This commit is contained in:
Magne Sjaastad 2013-04-16 11:19:37 +02:00
parent 427bf5a2dd
commit 9f07daefad
7 changed files with 132 additions and 51 deletions

View File

@ -89,6 +89,7 @@ set ( QT_MOC_HEADERS
ProjectDataModel/RimUiTreeModelPdm.h
ProjectDataModel/RimUiTreeView.h
ProjectDataModel/RimMimeData.h
UserInterface/RiuMainWindow.h
UserInterface/RiuPreferencesDialog.h

View File

@ -38,6 +38,7 @@ ${CEE_CURRENT_LIST_DIR}RimUiTreeModelPdm.h
${CEE_CURRENT_LIST_DIR}RimUiTreeView.h
${CEE_CURRENT_LIST_DIR}RimReservoirCellResultsCacher.h
${CEE_CURRENT_LIST_DIR}RimStatisticsCaseEvaluator.h
${CEE_CURRENT_LIST_DIR}RimMimeData.h
)
list(APPEND CODE_SOURCE_FILES
@ -73,6 +74,7 @@ ${CEE_CURRENT_LIST_DIR}RimUiTreeModelPdm.cpp
${CEE_CURRENT_LIST_DIR}RimUiTreeView.cpp
${CEE_CURRENT_LIST_DIR}RimReservoirCellResultsCacher.cpp
${CEE_CURRENT_LIST_DIR}RimStatisticsCaseEvaluator.cpp
${CEE_CURRENT_LIST_DIR}RimMimeData.cpp
)

View File

@ -0,0 +1,81 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiaStdInclude.h"
#include "RimMimeData.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
MimeDataWithIndexes::MimeDataWithIndexes()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
MimeDataWithIndexes::MimeDataWithIndexes(const MimeDataWithIndexes & other) : QMimeData()
{
setIndexes(other.indexes());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void MimeDataWithIndexes::setIndexes(const QModelIndexList & indexes)
{
m_indexes = indexes;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QModelIndexList& MimeDataWithIndexes::indexes() const
{
return m_indexes;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool MimeDataWithIndexes::hasFormat(const QString &mimetype) const
{
return (mimetype == formatName());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QStringList MimeDataWithIndexes::formats() const
{
QStringList supportedFormats = QMimeData::formats();
supportedFormats << formatName();
return supportedFormats;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString MimeDataWithIndexes::formatName()
{
return "MimeDataWithIndexes";
}

View File

@ -0,0 +1,46 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 <QMimeData>
#include <QModelIndex>
//--------------------------------------------------------------------------------------------------
/// MimeData class used to carry a QModelIndexList
//--------------------------------------------------------------------------------------------------
class MimeDataWithIndexes : public QMimeData
{
Q_OBJECT
public:
MimeDataWithIndexes();
MimeDataWithIndexes(const MimeDataWithIndexes & other);
void setIndexes(const QModelIndexList& indexes);
const QModelIndexList& indexes() const;
virtual bool hasFormat(const QString& mimetype) const;
virtual QStringList formats() const;
static QString formatName();
private:
QModelIndexList m_indexes;
};
Q_DECLARE_METATYPE(MimeDataWithIndexes)

View File

@ -40,6 +40,7 @@
#include "RigGridManager.h"
#include "RimCase.h"
#include "RigCaseData.h"
#include "RimMimeData.h"
//--------------------------------------------------------------------------------------------------
///

View File

@ -23,8 +23,6 @@
#include "cafPdmDocument.h"
#include "cafUiTreeModelPdm.h"
#include <QMimeData>
class QFileSystemWatcher;
class RimCellPropertyFilter;
@ -35,55 +33,6 @@ class RimInputProperty;
class RimStatisticsCase;
class RimIdenticalGridCaseGroup;
//--------------------------------------------------------------------------------------------------
/// MimeData class used to carry a QModelIndexList
//--------------------------------------------------------------------------------------------------
class MimeDataWithIndexes : public QMimeData
{
Q_OBJECT
public:
MimeDataWithIndexes()
{
}
MimeDataWithIndexes(const MimeDataWithIndexes & other) : QMimeData()
{
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)
//==================================================================================================
///

View File

@ -35,6 +35,7 @@
#include "RigCaseCellResultsData.h"
#include "RimStatisticsCase.h"
#include "RimResultCase.h"
#include "RimMimeData.h"
//--------------------------------------------------------------------------------------------------
///