Commit a18e44fe authored by Stéphane Albert's avatar Stéphane Albert
Browse files

ENH: Added mvd2-catalogue trivial (empty) application.

parent 55d2b019
############################################################################
# Sub-directory entries
add_subdirectory( Viewer )
#add_subdirectory( Catalogue )
add_subdirectory( Catalogue )
#############################################################################
# Input files.
set( Catalogue_SOURCES
mvdApplication.cxx
mvdMainWindow.cxx
)
# Headers for classes with Q_OBJECT macro (needs to go to Qt moc)
set( Catalogue_HEADERS_MOC
mvdApplication.h
mvdMainWindow.h
)
# Qt designer UI files
set( Catalogue_FORMS
mvdMainWindow.ui
)
# Qt resources included in executable
set( Catalogue_RESOURCES
mvdMainWindow.qrc
)
# General include directories.
include_directories(
${Monteverdi2_BINARY_DIR}
${Monteverdi2_SOURCE_DIR}/Code/Common
${Monteverdi2_SOURCE_DIR}/Code/Application/Catalogue
${Monteverdi2_BINARY_DIR}/Code/Application/Catalogue
${Monteverdi2_SOURCE_DIR}/Data/Icons
)
#############################################################################
# Qt4 wrapped files.
qt4_wrap_cpp( Catalogue_SRC_MOC ${Catalogue_HEADERS_MOC} )
qt4_wrap_ui( Catalogue_FORMS_HEADERS ${Catalogue_FORMS} )
qt4_add_resources( Catalogue_RESOURCES_RCC ${Catalogue_RESOURCES} )
#############################################################################
# Sources files to translate.
add_to_qt4_i18n_sources(
${Catalogue_SOURCES}
${Catalogue_HEADERS_MOC}
${Catalogue_FORMS}
)
if (WIN32)
# Windows Resource file need to have the full path to icon
# if the .ico is not in the current dir
set( Monteverdi2_WIN32_ICON ${Monteverdi2_SOURCE_DIR}/Data/Icons/monteverdi2.ico)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/mvdWin32.rc.in
${CMAKE_CURRENT_BINARY_DIR}/mvdWin32.rc
@ONLY
)
# The RC file to be added to source list
set( Monteverdi2_WIN32_RC_FILE ${CMAKE_CURRENT_BINARY_DIR}/mvdWin32.rc )
endif()
#############################################################################
# Monteverdi2_Catalogue library
# STATIC so that the monteverdi2 executable does not depend on another shared lib
# The library is also used in tests, waiting for a better test strategy
# The library is not installed
add_library(Monteverdi2_Catalogue
STATIC
${Catalogue_SOURCES}
${Catalogue_FORMS_HEADERS}
${Catalogue_SRC_MOC}
)
target_link_libraries(Monteverdi2_Catalogue
Monteverdi2_Common
${QT_LIBRARIES}
)
#############################################################################
# monteverdi2 executable
add_executable( mvd2-catalogue
WIN32
main.cxx
${Monteverdi2_WIN32_RC_FILE}
${Catalogue_RESOURCES_RCC}
)
target_link_libraries( mvd2-catalogue
Monteverdi2_Catalogue
Monteverdi2_Common
${QT_LIBRARIES}
)
# deploy a qt.conf file in the monteverdi2 target build dir
# to avoid warning on translation discovery
add_custom_command(
TARGET mvd2-catalogue
PRE_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -D QT_TRANSLATIONS_DIR:PATH=${QT_TRANSLATIONS_DIR}
-D SOURCE_DIR:PATH=${CMAKE_CURRENT_SOURCE_DIR}
-D TARGET_DIR:PATH=$<TARGET_FILE_DIR:mvd2-catalogue>
-P ${CMAKE_CURRENT_SOURCE_DIR}/DeployQtConf.cmake
COMMENT "Deploying qt.conf in build dir"
VERBATIM
)
#############################################################################
install(
TARGETS mvd2-catalogue
RUNTIME DESTINATION ${Monteverdi2_INSTALL_BIN_DIR} COMPONENT Runtime
LIBRARY DESTINATION ${Monteverdi2_INSTALL_LIB_DIR} COMPONENT Runtime
ARCHIVE DESTINATION ${Monteverdi2_INSTALL_LIB_DIR} COMPONENT Development
)
#############################################################################
/*=========================================================================
Program: Monteverdi2
Language: C++
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See Copyright.txt for details.
Monteverdi2 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.
=========================================================================*/
//
// Configuration include.
//// Included at first position before any other ones.
#include "ConfigureMonteverdi2.h"
/*****************************************************************************/
/* INCLUDE SECTION */
//
// Qt includes (sorted by alphabetic order)
//// Must be included before system/custom includes.
//
// System includes (sorted by alphabetic order)
//
// ITK includes (sorted by alphabetic order)
//
// OTB includes (sorted by alphabetic order)
//
// Monteverdi includes (sorted by alphabetic order)
#include "mvdApplication.h"
#include "mvdMainWindow.h"
/*****************************************************************************/
/* FUNCTIONS DECLARATION */
/*****************************************************************************/
/* MAIN */
int
main( int argc, char* argv[] )
{
mvd::Application application( argc, argv );
//
// Force numeric options of locale to "C"
// See issue #635
//
// TODO: Move into I18nApplication.
setlocale( LC_NUMERIC, "C" );
/*
// TODO: 1) MVD2-viewer: Factorize settings loading between Viewer & Catalogue // Check if the application have a settings file already available
bool appHasSettingsFile = application.HasSettingsFile();
bool appHasIncorrectCacheDir(false);
if (appHasSettingsFile)
{
// Read cache dir from settings
application.ReadCacheDirFromSettings();
// Check the cache dir
if (!application.CheckCacheDirIsCorrect() )
{
appHasIncorrectCacheDir = true;
}
}
*/
mvd::MainWindow mainWindow;
/*
// TODO: 1) MVD2-viewer: Factorize cache-dir search between Viewer & Catalogue.
if (!appHasSettingsFile || appHasIncorrectCacheDir)
{
// Loop until the directory will be correct
while (true)
{
// Select a new location for the cache director
try
{
// Create the cache directory
application.MakeCacheDir(mainWindow.SelectCacheDir(appHasIncorrectCacheDir));
break;
}
catch (...)
{
appHasIncorrectCacheDir = true;
}
}
// Save the cache directory into the settings file
application.WriteCacheDirIntoSettings();
}
*/
// Show window.
mainWindow.show();
// Run application and return exit code.
return application.exec();
}
/*****************************************************************************/
/* FUNCTIONS IMPLEMENTATION */
/*=========================================================================
Program: Monteverdi2
Language: C++
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See Copyright.txt for details.
Monteverdi2 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.
=========================================================================*/
#include "mvdApplication.h"
/*****************************************************************************/
/* INCLUDE SECTION */
//
// Qt includes (sorted by alphabetic order)
//// Must be included before system/custom includes.
//
// System includes (sorted by alphabetic order)
//
// OTB includes (sorted by alphabetic order)
//
// Monteverdi includes (sorted by alphabetic order)
//
// Class implementation.
namespace mvd
{
/*
TRANSLATOR mvd::Application
Necessary for lupdate to be aware of C++ namespaces.
Context comment for translator.
*/
/*****************************************************************************/
/* CONSTANTS */
/*****************************************************************************/
/* STATIC IMPLEMENTATION SECTION */
/*****************************************************************************/
/* CLASS IMPLEMENTATION SECTION */
/*******************************************************************************/
Application
::Application( int& argc, char** argv ) :
I18nApplication( argc, argv )
{
InitializeCore();
}
/*******************************************************************************/
Application
::~Application()
{
}
/*******************************************************************************/
void
Application
::InitializeCore()
{
setObjectName( "mvd::Application" );
//
// Setup application tags.
//
QCoreApplication::setApplicationName(
PROJECT_NAME "-Catalogue"
);
QCoreApplication::setApplicationVersion(
Monteverdi2_VERSION_STRING
);
//
// Setup organization tags.
//
QCoreApplication::setOrganizationName(
"OrfeoToolBox"
);
QCoreApplication::setOrganizationDomain(
"orfeo-toolbox.org"
);
#ifndef Q_WS_MAC
setWindowIcon(QIcon(QLatin1String(":/images/application_icon")));
#endif
}
/*******************************************************************************/
/* SLOTS */
} // end namespace 'mvd'
/*=========================================================================
Program: Monteverdi2
Language: C++
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See Copyright.txt for details.
Monteverdi2 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 __mvdApplication_h
#define __mvdApplication_h
//
// Configuration include.
//// Included at first position before any other ones.
#include "ConfigureMonteverdi2.h"
/*****************************************************************************/
/* INCLUDE SECTION */
//
// Qt includes (sorted by alphabetic order)
//// Must be included before system/custom includes.
//
// System includes (sorted by alphabetic order)
//
// ITK includes (sorted by alphabetic order)
//
// OTB includes (sorted by alphabetic order)
//
// Monteverdi includes (sorted by alphabetic order)
#include "mvdI18nApplication.h"
/*****************************************************************************/
/* PRE-DECLARATION SECTION */
//
// External classes pre-declaration.
namespace
{
}
namespace mvd
{
//
// Class declaration.
/*****************************************************************************/
/* CLASS DEFINITION SECTION */
/** \class Application
*
*/
class Monteverdi2_EXPORT Application
: public I18nApplication
{
/*-[ QOBJECT SECTION ]-----------------------------------------------------*/
Q_OBJECT;
/*-[ PUBLIC SECTION ]------------------------------------------------------*/
//
// Public constants.
public:
//
// Public methods.
public:
/**
* \brief Constructor.
*
* \param argc Command-line argument count in the argv array.
* \param argv Array of command-argument (whitespace-separated) strings.
*/
Application( int& argc, char** argv );
/** \brief Destructor. */
virtual ~Application();
/*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/
public slots:
/*-[ SIGNALS SECTION ]-----------------------------------------------------*/
//
// Signals.
signals:
/*-[ PROTECTED SECTION ]---------------------------------------------------*/
//
// Protected methods.
protected:
//
// Protected attributes.
protected:
/*-[ PRIVATE SECTION ]-----------------------------------------------------*/
//
// Private methods.
private:
/**
*/
void InitializeCore();
//
// Private attributes.
private:
/*-[ PRIVATE SLOTS SECTION ]-----------------------------------------------*/
//
// Slots
private slots:
};
/*****************************************************************************/
/* INLINE SECTION */
} // end namespace 'mvd'
#endif // __Application_h
/*=========================================================================
Program: Monteverdi2
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for 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.
=========================================================================*/
#include "mvdMainWindow.h"
#include "ui_mvdMainWindow.h"
/*****************************************************************************/
/* INCLUDE SECTION */
//
// Qt includes (sorted by alphabetic order)
//// Must be included before system/custom includes.
#include <QtGui>
//
// System includes (sorted by alphabetic order)
//
// ITK includes (sorted by alphabetic order)
//
// OTB includes (sorted by alphabetic order)
//
// Monteverdi includes (sorted by alphabetic order)
namespace mvd
{
/*
TRANSLATOR mvd::MainWindow
Necessary for lupdate to be aware of C++ namespaces.
Context comment for translator.
*/
/*****************************************************************************/
/* CONSTANTS */
/*****************************************************************************/
/* STATIC IMPLEMENTATION SECTION */
/*****************************************************************************/
/* CLASS IMPLEMENTATION SECTION */
/*****************************************************************************/
MainWindow
::MainWindow( QWidget* parent, Qt::WindowFlags flags ) :
QMainWindow( parent, flags ),
m_UI( new mvd::Ui::MainWindow() )
{
m_UI->setupUi( this );
Initialize();
}
/*****************************************************************************/
MainWindow
::~MainWindow()
{
}
/*****************************************************************************/
void
MainWindow
::Initialize()
{
setObjectName( "mvd::MainWindow" );
setWindowTitle( PROJECT_NAME );
// add the needed docks
InitializeDockWidgets();
// add needed widget to the status bar
InitializeStatusBar();
}
/*****************************************************************************/
void
MainWindow
::InitializeStatusBar()
{
}
/*****************************************************************************/
void
MainWindow
::InitializeDockWidgets()
{
}
/*****************************************************************************/
void
MainWindow::closeEvent( QCloseEvent* event )
{
assert( event!=NULL );
qDebug() << "MainWindow::closeEvent(" << event << ")";
}
/*****************************************************************************/