~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/core/qgsrunprocess.h

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
                          qgsrunprocess.h
 
3
 
 
4
 A class that runs an external program
 
5
 
 
6
                             -------------------
 
7
    begin                : Jan 2005
 
8
    copyright            : (C) 2005 by Gavin Macaulay
 
9
    email                : gavin at macaulay dot co dot nz
 
10
 ***************************************************************************/
 
11
 
 
12
/***************************************************************************
 
13
 *                                                                         *
 
14
 *   This program is free software; you can redistribute it and/or modify  *
 
15
 *   it under the terms of the GNU General Public License as published by  *
 
16
 *   the Free Software Foundation; either version 2 of the License, or     *
 
17
 *   (at your option) any later version.                                   *
 
18
 *                                                                         *
 
19
 ***************************************************************************/
 
20
/* $Id$ */
 
21
 
 
22
#ifndef QGSRUNPROCESS_H
 
23
#define QGSRUNPROCESS_H
 
24
 
 
25
#include <QObject>
 
26
#include <QProcess>
 
27
 
 
28
class QgsMessageOutput;
 
29
 
 
30
/** \ingroup core
 
31
 * A class that executes an external program/script.
 
32
 * It can optionally capture the standard output and error from the
 
33
 * process and displays them in a dialog box.
 
34
 */
 
35
class CORE_EXPORT QgsRunProcess: public QObject
 
36
{
 
37
    Q_OBJECT
 
38
 
 
39
  public:
 
40
    // This class deletes itself, so to ensure that it is only created
 
41
    // using new, the Named Consturctor Idiom is used, and one needs to
 
42
    // use the create() static function to get an instance of this class.
 
43
 
 
44
    // The action argument contains string with the command.
 
45
    // If capture is true, the standard output and error from the process
 
46
    // will be sent to QgsMessageOuptut - usually a dialog box.
 
47
    static QgsRunProcess* create( const QString& action, bool capture )
 
48
    { return new QgsRunProcess( action, capture ); }
 
49
 
 
50
  public slots:
 
51
    void stdoutAvailable();
 
52
    void stderrAvailable();
 
53
    void processError( QProcess::ProcessError );
 
54
    void processExit( int, QProcess::ExitStatus );
 
55
    void dialogGone();
 
56
 
 
57
  private:
 
58
    QgsRunProcess( const QString& action, bool capture );
 
59
    ~QgsRunProcess();
 
60
 
 
61
    // Deletes the instance of the class
 
62
    void die();
 
63
 
 
64
    QProcess* mProcess;
 
65
    QgsMessageOutput* mOutput;
 
66
    QString mCommand;
 
67
};
 
68
 
 
69
#endif