summaryrefslogtreecommitdiffstats
path: root/vcs/cvsservice/cvsprocesswidget.h
blob: 81e34f04119b819feab8f7bca684ec3387890bef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/***************************************************************************
 *   Copyright (C) 2003 by KDevelop Authors                                *
 *   www.kdevelop.org                                                      *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef _CVSPROCESSWIDGET_H_
#define _CVSPROCESSWIDGET_H_

#include <tqtextedit.h>
#include <tqstringlist.h>

#include "cvsservicedcopIface.h"
#include "bufferedstringreader.h"

class CvsServicePart;
class DCOPRef;
class CvsJob_stub;
class CvsService_stub;
class TQStyleSheetItem;

class CvsProcessWidget : public TQTextEdit, virtual public CVSServiceDCOPIface
{
    Q_OBJECT
public:
    CvsProcessWidget( CvsService_stub *service, CvsServicePart *part,
        TQWidget *parent, const char *name );
    virtual ~CvsProcessWidget();

    bool startJob( const DCOPRef &aJob );

    /**
    * @return true if there is already a job pending, false otherwise
    * (another job can be requested)
    */
    bool isAlreadyWorking() const;
    void cancelJob();

    virtual void clear();

    TQStringList output() const { return m_output; }
    TQStringList errors() const { return m_errors; }

//private slots:
    //! DCOP Iface
    virtual void slotJobExited( bool normalExit, int exitStatus );
    virtual void slotReceivedOutput( TQString someOutput );
    virtual void slotReceivedErrors( TQString someErrors );

signals:
    void jobFinished( bool normalExit, int exitStatus );

private:
    void showInfo( const TQStringList &msg );
    void showError( const TQStringList &msg  );
    void showOutput( const TQStringList &msg  );

    CvsServicePart *m_part;
    CvsService_stub *m_service;
    CvsJob_stub *m_job;

    //! Buffered reader for safely reading stdout and stderr from cvs
    //! commands' output
    BufferedStringReader m_outputBuffer,
        m_errorBuffer;

    TQStringList m_output,
        m_errors;
};

#endif