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

ENH: Added AbstractWorker class.

parent a1cfb8e2
......@@ -158,7 +158,7 @@ MainWindow
m_OtbApplicationsBrowserDock->findChild< ApplicationsToolBox* >()
);
assert( appWidget!=NULL );
// # Step 2 : setup connections
QObject::connect(
appWidget,
......@@ -720,6 +720,41 @@ MainWindow
/*****************************************************************************/
/* SLOTS */
/*****************************************************************************/
void
MainWindow
::on_action_OpenImage_triggered()
{
QString filename(
QFileDialog::getOpenFileName( this, tr( "Open file..." ) )
);
if( filename.isNull() )
return;
// emit OpenImageRequest( filename );
/*
try
{
DatasetModel* model = Application::LoadDatasetModel(
m_Filename, m_Width, m_Height );
// We can only push to another thread,
// so thread affinity must be set here,
// and not in the slot that receives the object
model->moveToThread(Application::Instance()->thread());
emit ModelLoaded(model);
}
catch( std::exception& exc )
{
emit Error( exc.what() );
}
emit Finished();
*/
}
/*****************************************************************************/
void
MainWindow
......
......@@ -281,6 +281,11 @@ private:
//
// Private slots.
private slots:
/**
* \brief Qt auto-connected slot which is called when 'File/Open
* image' menu action is triggered.
*/
void on_action_OpenImage_triggered();
/** */
void OnUserCoordinatesEditingFinished();
......
......@@ -30,7 +30,7 @@
<property name="title">
<string>&amp;File</string>
</property>
<addaction name="action_Open"/>
<addaction name="action_OpenImage"/>
<addaction name="separator"/>
<addaction name="action_Quit"/>
</widget>
......@@ -73,7 +73,7 @@
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="action_Open"/>
<addaction name="action_OpenImage"/>
</widget>
<action name="action_Quit">
<property name="text">
......@@ -86,22 +86,22 @@
<string>Ctrl+Q</string>
</property>
</action>
<action name="action_Open">
<action name="action_OpenImage">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="mvdMainWindow.qrc">
<normaloff>:/icons/action_Open_Icon</normaloff>:/icons/action_Open_Icon</iconset>
</property>
<property name="text">
<string>&amp;Open...</string>
<string>&amp;Open image...</string>
</property>
<property name="iconText">
<string>Open...</string>
<string>Open image...</string>
</property>
<property name="toolTip">
<string>Open file.</string>
<string>Open image-file.</string>
</property>
<property name="shortcut">
<string>Ctrl+O</string>
......
......@@ -5,6 +5,7 @@
set( Common_Core_SOURCES
mvdAbstractImageModel.cxx
mvdAbstractModel.cxx
mvdAbstractWorker.cxx
mvdAlgorithm.cxx
mvdDatasetDescriptor.cxx
mvdDatabaseModel.cxx
......@@ -29,6 +30,7 @@ set( Common_Core_SOURCES
set( Common_Core_HEADERS_MOC
mvdAbstractImageModel.h
mvdAbstractModel.h
mvdAbstractWorker.h
# mvdAlgorithm.h
mvdDatabaseModel.h
mvdDatasetDescriptor.h
......
/*=========================================================================
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 "mvdAbstractWorker.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)
namespace mvd
{
/*
TRANSLATOR mvd::AbstractWorker
Necessary for lupdate to be aware of C++ namespaces.
Context comment for translator.
*/
/*****************************************************************************/
/* CONSTANTS */
namespace
{
} // end of anonymous namespace.
/*****************************************************************************/
/* STATIC IMPLEMENTATION SECTION */
/*****************************************************************************/
/* CLASS IMPLEMENTATION SECTION */
/*******************************************************************************/
AbstractWorker
::AbstractWorker( QObject* parent ) :
QObject( parent )
{
}
/*******************************************************************************/
AbstractWorker
::~AbstractWorker()
{
}
/*******************************************************************************/
/* 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 __mvdAbstractWorker_h
#define __mvdAbstractWorker_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.
#include <QtCore>
//
// System includes (sorted by alphabetic order)
//
// ITK includes (sorted by alphabetic order)
//
// OTB includes (sorted by alphabetic order)
//
// Monteverdi includes (sorted by alphabetic order)
/*****************************************************************************/
/* PRE-DECLARATION SECTION */
//
// External classes pre-declaration.
namespace
{
}
namespace mvd
{
//
// Internal classes pre-declaration.
/*****************************************************************************/
/* CLASS DEFINITION SECTION */
/**
* \class AbstractWorker
*
* \brief Abstract worker object used as a base-class for threaded tasks.
*/
class Monteverdi2_EXPORT AbstractWorker :
public QObject
{
/*-[ QOBJECT SECTION ]-----------------------------------------------------*/
Q_OBJECT;
/*-[ PUBLIC SECTION ]------------------------------------------------------*/
//
// Public methods.
public:
/** \brief Destructor. */
virtual ~AbstractWorker();
/*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/
//
// Public SLOTS.
public slots:
/*-[ SIGNALS SECTION ]-----------------------------------------------------*/
//
// Signals.
signals:
/*-[ PROTECTED SECTION ]---------------------------------------------------*/
//
// Protected methods.
protected:
/** \brief Constructor. */
AbstractWorker( QObject* parent =NULL );
//
// Protected attributes.
protected:
/*-[ PRIVATE SECTION ]-----------------------------------------------------*/
//
// Private methods.
private:
//
// Private attributes.
private:
/*-[ PRIVATE SLOTS SECTION ]-----------------------------------------------*/
//
// Slots.
private slots:
};
} // end namespace 'mvd'.
/*****************************************************************************/
/* INLINE 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)
namespace mvd
{
} // end namespace 'mvd'
#endif // __mvdAbstractWorker_h
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment