2007-01-09 02:39:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
\brief Interface for showing messages from QGIS in GUI independent way
|
|
|
|
|
|
|
|
This class provides abstraction of a dialog for showing output to the user.
|
|
|
|
By default QgsMessageConsoleOutput will be used if not overridden
|
|
|
|
with other message output creator function.
|
|
|
|
|
|
|
|
QGIS application uses QgsMessageView class for displaying a dialog to the user.
|
|
|
|
|
|
|
|
Object deletes itself when it's not needed anymore. Children should use
|
|
|
|
signal destroyed() to notify the deletion
|
|
|
|
*/
|
|
|
|
class QgsMessageOutput
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgsmessageoutput.h>
|
|
|
|
%End
|
|
|
|
|
|
|
|
public:
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
//! message can be in plain text or in html format
|
|
|
|
enum MessageType { MessageText, MessageHtml };
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
//! virtual destructor
|
|
|
|
virtual ~QgsMessageOutput();
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
//! set message, it won't be displayed until
|
|
|
|
virtual void setMessage( const QString& message, MessageType msgType ) = 0;
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
//! message to be appended to the current text
|
2012-09-24 02:28:15 +02:00
|
|
|
virtual void appendMessage( const QString& message ) = 0;
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
//! set title for the messages
|
2012-09-24 02:28:15 +02:00
|
|
|
virtual void setTitle( const QString& title ) = 0;
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
//! display the message to the user
|
2012-09-24 02:28:15 +02:00
|
|
|
virtual void showMessage( bool blocking = true ) = 0;
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
//! sets function that will be used to create message output
|
|
|
|
// TODO: implementation where python class could be passed
|
|
|
|
// static void setMessageOutputCreator(MESSAGE_OUTPUT_CREATOR f);
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
//! function that returns new class derived from QgsMessageOutput
|
|
|
|
//! (don't forget to delete it then)
|
|
|
|
static QgsMessageOutput* createMessageOutput();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
\brief Default implementation of message output interface
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
This class outputs messages to the standard output. Therefore it might
|
|
|
|
be the right choice for apps without GUI.
|
|
|
|
*/
|
|
|
|
class QgsMessageOutputConsole : QObject, QgsMessageOutput
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgsmessageoutput.h>
|
|
|
|
%End
|
|
|
|
|
|
|
|
public:
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
QgsMessageOutputConsole();
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
virtual void setMessage( const QString& message, MessageType msgType );
|
|
|
|
|
|
|
|
virtual void appendMessage( const QString& message );
|
|
|
|
|
|
|
|
virtual void setTitle( const QString& title );
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
//! sends the message to the standard output
|
2012-09-24 02:28:15 +02:00
|
|
|
virtual void showMessage( bool blocking = true );
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
signals:
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
//! signals that object will be destroyed and shouldn't be used anymore
|
|
|
|
void destroyed();
|
|
|
|
|
|
|
|
};
|
|
|
|
|