Commit 33bfd5b2 authored by Jan Möbius's avatar Jan Möbius

Basic skeleton for process interface

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7294 383ad7c9-94d9-4d36-a494-682f7c89f535
parent c936cb9e
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (C) 2001-2009 by Computer Graphics Group, RWTH Aachen *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
* *
* OpenFlipper is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* OpenFlipper 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 Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU LesserGeneral Public *
* License along with OpenFlipper. If not, *
* see <http://www.gnu.org/licenses/>. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision: 6727 $ *
* $Author: moebius $ *
* $Date: 2009-08-05 08:03:50 +0200 (Mi, 05. Aug 2009) $ *
* *
\*===========================================================================*/
//
// C++ Interface: ProcessInterface
//
// Description:
//
//
// Author: Jan Moebius <jan_moebius@web.de>, (C) 2007
//
#ifndef PROCESSINTERFACE_HH
#define PROCESSINTERFACE_HH
#include <QtGui>
#include <QProgressDialog>
/**
*/
class ProcessInterface {
public :
/// Destructor
virtual ~ProcessInterface() {};
signals :
/** \brief announce a new job
*
* Use this function to announce a new job. The Job Id should be a unique id for your job.
* Prepend your PluginName to your id to make it unique across plugins.
*
* The description will be the string visible to the user.
*
* min and max define the range your status values will be in.
*
*/
virtual void startJob( QString /*_jobId*/, QString /*_description */, int /*_min*/ , int /*_max*/ ) {};
/** \brief update job state
*
* Emit this signal to tell the core about your job status.
*
* _value has to be in the range you defined!
*/
virtual void setJobState(QString /*_jobId*/, int /*_value*/ ) {};
/** \brief Cancel your job
*/
virtual void cancelJob(QString /*_jobId*/ ) {};
/** \brief Finish your job
*/
virtual void finishJob(QString /*_jobId*/ ) {};
private slots :
/** \brief A job has been canceled
*
* This function is called when the user cancels a job.
* The returned name is the name of the job which has been canceled
*/
virtual void canceledJob (QString /*_job */) = 0;
};
Q_DECLARE_INTERFACE(ProcessInterface,"OpenFlipper.ProcessInterface/1.0")
#endif // PROCESSINTERFACE_HH
......@@ -898,6 +898,34 @@ private:
QTime *redrawTime_;
/** @} */
//===========================================================================
/** @name Process Interface and Controls
* @{ */
//===========================================================================
private:
private slots:
// A job has been started by a plugin
void slotStartJob( QString _jobId, QString _description , int _min , int _max );
// A job state has been updated by a plugin
void slotSetJobState(QString _jobId, int _value );
// A job state has been canceled by a plugin
void slotCancelJob(QString _jobId );
// A job state has been finished by a plugin
void slotFinishJob(QString _jobId );
signals:
void jobCanceled( QString _jobId );
/** @} */
private :
......
......@@ -74,6 +74,7 @@
#include "OpenFlipper/BasePlugin/TextureInterface.hh"
#include "OpenFlipper/BasePlugin/MenuInterface.hh"
#include "OpenFlipper/BasePlugin/ContextMenuInterface.hh"
#include "OpenFlipper/BasePlugin/ProcessInterface.hh"
#include "OpenFlipper/BasePlugin/ViewInterface.hh"
#include "OpenFlipper/BasePlugin/ViewModeInterface.hh"
#include "OpenFlipper/BasePlugin/LoadSaveInterface.hh"
......@@ -963,6 +964,42 @@ void Core::loadPlugin(QString filename, bool silent){
connect(plugin , SIGNAL(updateStackWidget( QString , QWidget*)),
coreWidget_ , SLOT( slotUpdateStackWidget( QString , QWidget* ) ) ,Qt::DirectConnection );
}
//Check if the plugin supports Process-Interface
ProcessInterface* processPlugin = qobject_cast< ProcessInterface * >(plugin);
if ( processPlugin ) {
supported = supported + "Process ";
if ( checkSignal(plugin,"startJob(QString, QString,int,int)" ) )
connect(plugin , SIGNAL(startJob(QString, QString,int,int)),
this , SLOT( slotStartJob(QString, QString,int,int) ) ,Qt::DirectConnection );
else
emit log(LOGERR,"Process Interface defined but no startJob signal found!");
if ( checkSignal(plugin,"setJobState(QString,int)" ) )
connect(plugin , SIGNAL(setJobState(QString,int)),
this , SLOT( slotSetJobState(QString,int) ) ,Qt::DirectConnection );
else
emit log(LOGERR,"Process Interface defined but no setJobState signal found!");
if ( checkSignal(plugin,"cancelJob(QString)" ) )
connect(plugin , SIGNAL(cancelJob(QString)),
this , SLOT( slotCancelJob(QString) ) ,Qt::DirectConnection );
if ( checkSignal(plugin,"finishJob(QString)" ) )
connect(plugin , SIGNAL(finishJob(QString)),
this , SLOT( slotFinishJob(QString) ) ,Qt::DirectConnection );
else
emit log(LOGERR,"Process Interface defined but no finishJob signal found!");
if ( checkSlot(plugin,"canceledJob(QString)" ) )
connect(this , SIGNAL( jobCanceled( QString ) ) ,
plugin , SLOT( canceledJob(QString) ),Qt::DirectConnection);
else
emit log(LOGERR,"Process Interface defined but no cancel canceledJob slot found!");
}
//Check if the plugin supports RPC-Interface
RPCInterface* rpcPlugin = qobject_cast< RPCInterface * >(plugin);
......
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