Commit f4a7a753 authored by Stéphane Albert's avatar Stéphane Albert

ENH: Removed obsolete code about SQL-database.

parent 0bfc9d65
......@@ -121,7 +121,7 @@ if(CMAKE_VERSION VERSION_GREATER 2.8.11)
endif()
set(QT_USE_IMPORTED_TARGETS ON)
find_package( Qt4 REQUIRED QtCore QtGui QtOpenGL QtMain QtSql QtXml )
find_package( Qt4 REQUIRED QtCore QtGui QtOpenGL QtMain QtXml )
include( ${QT_USE_FILE} )
if( QT_FOUND )
# message( "Qt plugins dir: '${QT_PLUGINS_DIR}'" )
......@@ -268,9 +268,6 @@ add_subdirectory( i18n )
# Data related files
add_subdirectory( Data )
# SQL related files.
add_subdirectory( Sql )
#----------------------------------------------------------------------------
# Enable / Disable testing
......
......@@ -34,7 +34,6 @@
//
// Monteverdi includes (sorted by alphabetic order)
#include "Core/mvdDatabaseModel.h"
//
#ifdef OTB_USE_QT4
......
......@@ -196,7 +196,7 @@ ApplicationLauncher
// Create GUI based on module
Wrapper::QtWidgetView * gui =
new Wrapper::QtWidgetView( otbApp, isStandalone, parent, flags );
new Wrapper::QtWidgetView( otbApp, parent, flags );
gui->CreateGui();
......
......@@ -92,12 +92,6 @@ template< typename W >
void
SetupForFilenameDrop( W* widget, const char* text =NULL );
/**
*/
template< typename W >
void
SetupForDatasetDrop( W* widget, const char* text =NULL );
/**
*/
template< typename W >
......@@ -134,11 +128,8 @@ class FileSelectionInitializer : public std::unary_function<
>
{
public:
inline FileSelectionInitializer( bool supportsDataset );
inline FileSelectionInitializer();
inline result_type operator () ( argument_type widget ) const;
private:
bool m_SupportsDataset;
};
/**
......@@ -152,11 +143,8 @@ class InputImageInitializer : public std::unary_function<
>
{
public:
inline InputImageInitializer( bool supportsDataset );
inline InputImageInitializer();
inline result_type operator () ( argument_type widget ) const;
private:
bool m_SupportsDataset;
};
/**
......@@ -170,13 +158,12 @@ class InputImageListInitializer : public std::unary_function<
>
{
public:
inline InputImageListInitializer( QWidget * view, bool supportsDataset );
inline InputImageListInitializer( QWidget * view );
inline result_type operator () ( argument_type widget ) const;
private:
QWidget * m_View;
bool m_SupportsDataset;
};
/**
......@@ -355,9 +342,7 @@ public:
//
// Monteverdi includes (sorted by alphabetic order)
#ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility
#include "Core/mvdDatabaseModel.h"
#include "Core/mvdI18nCoreApplication.h"
#include "Gui/mvdDatasetDragAndDropEventFilter.h"
#include "Gui/mvdFilenameDragAndDropEventFilter.h"
#endif //tag=QT4-boost-compatibility
......@@ -370,8 +355,7 @@ namespace Wrapper
/*****************************************************************************/
inline
FileSelectionInitializer
::FileSelectionInitializer( bool supportsDataset ) :
m_SupportsDataset( supportsDataset )
::FileSelectionInitializer()
{
}
......@@ -382,20 +366,14 @@ FileSelectionInitializer
::operator () ( argument_type widget ) const
{
assert( widget!=NULL );
if( m_SupportsDataset )
{
SetupForFilenameDrop( widget, "You can drop dataset or filename here." );
SetupForDatasetDrop( widget );
}
else
SetupForFilenameDrop( widget, "You can drop filename here." );
SetupForFilenameDrop( widget, "You can drop filename here." );
}
/*****************************************************************************/
inline
InputImageInitializer
::InputImageInitializer( bool supportsDataset ) :
m_SupportsDataset( supportsDataset )
::InputImageInitializer()
{
}
......@@ -407,21 +385,14 @@ InputImageInitializer
{
assert( widget!=NULL );
if( m_SupportsDataset )
{
SetupForFilenameDrop( widget, "You can drop dataset or filename here." );
SetupForDatasetDrop( widget );
}
else
SetupForFilenameDrop( widget, "You can drop filename here." );
SetupForFilenameDrop( widget, "You can drop filename here." );
}
/*****************************************************************************/
inline
InputImageListInitializer
::InputImageListInitializer( QWidget * view, bool supportsDataset ) :
m_View( view ),
m_SupportsDataset( supportsDataset )
::InputImageListInitializer( QWidget * view ) :
m_View( view )
{
}
......@@ -433,18 +404,12 @@ InputImageListInitializer
{
assert( widget!=NULL );
if( m_SupportsDataset )
QObject::connect(
widget, SIGNAL( FileSelectionWidgetAdded( QWidget * ) ),
m_View, SLOT( OnFileSelectionWidgetAdded1( QWidget * ) )
);
else
QObject::connect(
widget, SIGNAL( FileSelectionWidgetAdded( QWidget * ) ),
m_View, SLOT( OnFileSelectionWidgetAdded0( QWidget * ) )
);
QObject::connect(
widget, SIGNAL( FileSelectionWidgetAdded( QWidget * ) ),
m_View, SLOT( OnFileSelectionWidgetAdded0( QWidget * ) )
);
SetupWidget( widget, FileSelectionInitializer( m_SupportsDataset ) );
SetupWidget( widget, FileSelectionInitializer() );
}
/*****************************************************************************/
......@@ -479,7 +444,7 @@ InputFilenameListInitializer
m_View, SLOT( OnFileSelectionWidgetAdded0( QWidget * ) )
);
SetupWidget( widget, FileSelectionInitializer( false ) );
SetupWidget( widget, FileSelectionInitializer() );
}
/*****************************************************************************/
......@@ -514,7 +479,7 @@ InputVectorDataListInitializer
m_View, SLOT( OnFileSelectionWidgetAdded0( QWidget * ) )
);
SetupWidget( widget, FileSelectionInitializer( false ) );
SetupWidget( widget, FileSelectionInitializer() );
}
/*****************************************************************************/
......@@ -687,67 +652,6 @@ SetupForFilenameDrop( W* widget, const char* text )
);
}
/*****************************************************************************/
template< typename W >
void
SetupForDatasetDrop( W* widget, const char* text )
{
assert( widget!=NULL );
QLineEdit* lineEdit = widget->GetInput();
//
// Setup widget.
bool signalsBlocked = lineEdit->blockSignals( true );
{
if( text!=NULL )
{
lineEdit->setPlaceholderText(
QCoreApplication::translate(
"mvd::Wrapper::QtWidgetView",
text
)
);
}
// lineEdit->setReadOnly( true );
lineEdit->setToolTip(
lineEdit->toolTip() +
"\n" +
QCoreApplication::translate(
"mvd::Wrapper::QtWidgetView",
"You can drag dataset from dataset-browser and drop it here."
)
);
}
lineEdit->blockSignals( signalsBlocked );
//
// Install event-filters.
assert(
I18nCoreApplication::ConstInstance()->GetModel()==
I18nCoreApplication::ConstInstance()->GetModel< DatabaseModel >()
);
QObject* eventFilter =
new DatasetDragAndDropEventFilter(
I18nCoreApplication::Instance()->GetModel< DatabaseModel >(),
lineEdit
);
lineEdit->installEventFilter( eventFilter );
QObject::connect(
eventFilter,
SIGNAL( ImageFilenameDropped( const QString& ) ),
// to:
lineEdit,
SLOT( setText( const QString& ) )
);
}
/*****************************************************************************/
template< typename W >
void
......
......@@ -136,7 +136,6 @@ QtWidgetView
/*****************************************************************************/
QtWidgetView
::QtWidgetView( const otb::Wrapper::Application::Pointer & otbApp,
bool isStandalone,
QWidget* parent,
Qt::WindowFlags flags ) :
QWidget( parent, flags ),
......@@ -145,8 +144,7 @@ QtWidgetView
m_ExecButton( NULL ),
m_QuitButton( NULL ),
m_Message( NULL ),
m_IsClosable( true ),
m_IsStandalone( isStandalone )
m_IsClosable( true )
{
setObjectName( QtWidgetView::OBJECT_NAME );
......@@ -341,8 +339,8 @@ QtWidgetView
SetupWidget( widget, InputFilenameInitializer() );
SetupWidget( widget, InputFilenameListInitializer( this ) );
SetupWidget( widget, InputImageInitializer( false /* !m_IsStandalone */) );
SetupWidget( widget, InputImageListInitializer( this, false /* !m_IsStandalone */ ) );
SetupWidget( widget, InputImageInitializer() );
SetupWidget( widget, InputImageListInitializer( this ) );
SetupWidget( widget, InputProcessXMLInitializer() );
SetupWidget( widget, InputVectorDataInitializer() );
SetupWidget( widget, InputVectorDataListInitializer( this ) );
......@@ -355,11 +353,7 @@ QtWidgetView
SetupWidget(
widget,
OutputImageInitializer(
m_IsStandalone
? QString()
: m_Application->GetName()
)
OutputImageInitializer( m_Application->GetName() )
);
SetupWidget( widget, OutputVectorDataInitializer() );
......@@ -368,14 +362,14 @@ QtWidgetView
/*******************************************************************************/
void
QtWidgetView
::SetupFileSelectionWidget( QWidget * widget, bool supportsDataset )
::SetupFileSelectionWidget( QWidget * widget )
{
assert( widget!=NULL );
assert(
qobject_cast< FileSelectionInitializer::argument_type >( widget )!=NULL
);
FileSelectionInitializer initialize( supportsDataset );
FileSelectionInitializer initialize;
initialize( qobject_cast< FileSelectionInitializer::argument_type >( widget ) );
}
......
......@@ -88,9 +88,6 @@ class Monteverdi_EXPORT QtWidgetView :
READ IsClosable
WRITE SetClosable );
Q_PROPERTY( bool isStandalone
READ IsStandalone );
/*-[ PUBLIC SECTION ]------------------------------------------------------*/
//
......@@ -103,7 +100,6 @@ public:
/** \brief Constructor. */
QtWidgetView( const otb::Wrapper::Application::Pointer & otbApp,
bool isStandalone,
QWidget* parent =0,
Qt::WindowFlags flags =0 );
......@@ -133,13 +129,6 @@ public:
*/
inline bool IsClosable() const;
/**
*/
bool IsStandalone() const
{
return m_IsStandalone;
}
/*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/
//
......@@ -195,7 +184,7 @@ private:
/**
*/
void SetupFileSelectionWidget( QWidget *, bool supportsDataset );
void SetupFileSelectionWidget( QWidget * );
//
// Private attributes.
......@@ -210,7 +199,6 @@ private:
QLabel* m_Message;
bool m_IsClosable : 1;
bool m_IsStandalone : 1;
/*-[ PRIVATE SLOTS SECTION ]-----------------------------------------------*/
......@@ -314,7 +302,7 @@ void
QtWidgetView
::OnFileSelectionWidgetAdded0( QWidget * widget )
{
SetupFileSelectionWidget( widget, false );
SetupFileSelectionWidget( widget );
}
/*******************************************************************************/
......@@ -323,7 +311,7 @@ void
QtWidgetView
::OnFileSelectionWidgetAdded1( QWidget * widget )
{
SetupFileSelectionWidget( widget, true );
SetupFileSelectionWidget( widget );
}
} // end namespace 'Wrapper'
......
......@@ -11,10 +11,6 @@ set( Common_Core_SOURCES
mvdCore.cxx
mvdDatasetDescriptor.cxx
mvdDataStream.cxx
mvdDatabaseConnection.cxx
mvdDatabaseError.cxx
mvdDatabaseModel.cxx
mvdDatabaseQueries.cxx
mvdDatasetModel.cxx
mvdFilenameInterface.cxx
mvdHistogramModel.cxx
......@@ -51,10 +47,6 @@ set( Common_Core_HEADERS_MOC
# mvdAlgorithm.h
mvdBackgroundTask.h
# mvdCore.h
mvdDatabaseConnection.h
# mvdDatabaseError.h
mvdDatabaseModel.h
mvdDatabaseQueries.h
mvdDatasetDescriptor.h
mvdDatasetModel.h
mvdHistogramModel.h
......
This diff is collapsed.
/*=========================================================================
Program: Monteverdi
Language: C++
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See Copyright.txt for details.
Monteverdi is distributed under the CeCILL licence version 2. See
Licence_CeCILL_V2-en.txt or
http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt for more details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __mvdDatabaseConnection_h
#define __mvdDatabaseConnection_h
//
// Configuration include.
//// Included at first position before any other ones.
#ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility
#include "ConfigureMonteverdi.h"
#endif //tag=QT4-boost-compatibility
/*****************************************************************************/
/* INCLUDE SECTION */
//
// Qt includes (sorted by alphabetic order)
//// Must be included before system/custom includes.
// #include <QtCore>
#include <QtSql>
//
// System includes (sorted by alphabetic order)
//
// ITK includes (sorted by alphabetic order)
//
// OTB includes (sorted by alphabetic order)
//
// Monteverdi includes (sorted by alphabetic order)
#ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility
#include "Core/mvdDatabaseError.h"
#include "Core/mvdTypes.h"
#endif //tag=QT4-boost-compatibility
/*****************************************************************************/
/* MACROS */
#define USE_DEBUG 0
#define USE_DEBUG_BINDINGS 0
#define USE_DEBUG_SIZE 0
#define USE_DEBUG_VALUES 0
#define FORCE_DEBUG_BINDINGS 0
#define FORCE_DEBUG_SIZE 0
#define FORCE_DEBUG_VALUES 0
/*****************************************************************************/
#define QUERY_NEXT( query ) \
if( !( query ).next() ) \
{ \
throw DatabaseError( \
( query ).lastError(), \
QCoreApplication::translate( \
"mvd::DatabaseConnection", \
"Failed to fetch query record %1. " \
) \
.arg( ( query ).at() ), \
QString( "\n\"%1\"" ) \
.arg( ( query ).lastQuery() ) \
); \
}
/*****************************************************************************/
#define QUERY_NEXT_STATIC( query ) \
if( !( query ).next() ) \
{ \
throw DatabaseError( \
( query ).lastError(), \
QCoreApplication::translate( \
"mvd::DatabaseConnection", \
"Failed to fetch query record %1. " \
) \
.arg( ( query ).at() ), \
QString( "\n\"%1\"" ) \
.arg( ( query ).lastQuery() ) \
); \
}
/*****************************************************************************/
#if (USE_DEBUG && USE_DEBUG_VALUES) || USE_DEBUG_VALUES
#define QUERY_DEBUG_FIELDS( query ) \
{ \
QVariant field; \
int i; \
for( i=0, field=( query ).value( i ); \
field.isValid(); \
field=( query ).value( ++i ) ) \
{ \
qDebug() << i << field; \
} \
}
#else
#define QUERY_DEBUG_FIELDS( query )
#endif
/*****************************************************************************/
/* PRE-DECLARATION SECTION */
//
// External classes pre-declaration.
namespace
{
}
namespace mvd
{
//
// Internal classes pre-declaration.
/*****************************************************************************/
/* CLASS DEFINITION SECTION */
/**
* \class DatabaseConnection
*
* \brief WIP.
*/
class Monteverdi_EXPORT DatabaseConnection :
public QObject
{
/*-[ QOBJECT SECTION ]-----------------------------------------------------*/
Q_OBJECT;
/*-[ PUBLIC SECTION ]------------------------------------------------------*/
//
//
public:
/**
*/
typedef QMap< SqlId, QString > DatasetMap;
/**
*/
enum ConnectionMode
{
CONNECTION_MODE_OPEN_ONLY = 0,
CONNECTION_MODE_OPEN_OR_CREATE = 1,
};
//
// Public methods.
public:
/**
*/
inline static QFileInfo SqlDatabaseFileInfo();
/** \brief Constructor. */
DatabaseConnection( ConnectionMode mode, QObject* parent =NULL );
/** \brief Destructor. */
virtual ~DatabaseConnection();
//
// Database related methods.
/**
*/
static void InitializeDatabase();
// static void InitializeDatabase2();
/**
*/
void SetAttribute( const QString& name, const QVariant& value );
/**
*/
QVariant GetAttribute( const QString& name, SqlId* id =NULL ) const;
//