summaryrefslogtreecommitdiffstats
path: root/vcs/cvsservice/annotatepage.h
blob: b6a52b66d846c2eb24ef68dd1acc16acd5e252d1 (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/***************************************************************************
 *   Copyright (C) 2005 by Robert Gruber                                   *
 *   rgruber@users.sourceforge.net                                         *
 *                                                                         *
 *   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 ANNOTATEPAGE_H
#define ANNOTATEPAGE_H

#include "cvsservicedcopIface.h"
#include <tqwidget.h>
#include <tqmap.h>
#include <tqlistview.h>

class CvsJob_stub;
class CvsService_stub;
class QTextBrowser;
class AnnotateView;
class QStringList;
class KLineEdit;
class KPushButton;

/**
 * Implementation for the page displaying 'cvs annotate' output.
 * To the top of the page the user can enter a revision and request
 * a annotate run for it.
 * The main widget of a page is the AnnotateView. It holds the output
 * of the cvs annotate job. See there for further detail.
 *
 * @author Robert Gruber <rgruber@users.sourceforge.net>
 */
class AnnotatePage : public TQWidget, virtual public CVSServiceDCOPIface
{
    Q_OBJECT

    friend class AnnotateDialog;
    friend class AnnotateView;

public:
    AnnotatePage( CvsService_stub *cvsService, TQWidget *parent=0, const char *name=0, int flags=0 );
    virtual ~AnnotatePage();

    /**
     * Call cvs annotate for the given file and revistion.
     * @param pathName The filename to annotate
     * @param revision The CVS revision number
     */
    void startAnnotate( const TQString pathName, const TQString revision="" );

    /**
     * Cancels the current operation if any
     */
    void cancel();

signals:
    /**
     * This signal is ment to be emitted by the nested AnnotateView.
     * The dialog that holds this page catches it in order to create
     * a new page with the annotate output for the given revision.
     * @param rev The revision for which a new annotate run is requested
     */
    void requestAnnotate(const TQString rev);

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

    /**
     * This slot is connected to the button next to m_leRevision.
     * It clears the AnnotateView and reruns cvs annotate with the
     * revision the user entered into m_leRevision
     */
    void slotNewAnnotate();

private:
    /**
     * This method is executed after the cvs annotate job finished.
     * It parses the output and passes it to the AnnotateView
     */
    void parseAnnotateOutput(TQStringList& lines);


    /**
     * This is the output buffer for the cvs annotate job.
     * Everytime slotReceivedOutput() is called by dcop
     * we append the gained data to this buffer.
     */
    TQString m_output;
    /**
     * This is the AnnotateView. It gets nested into this page.
     */
    AnnotateView *m_annotateView;
    /**
     * The file for which this page holds the annotate output.
     */
    TQString m_pathName;
    /**
     * Maps the checkin comments to revision numbers
     */
    TQMap<TQString, TQString>  m_comments;

    /**
     * With this KLineEdit and the KPushButton next to it
     * the user can rerun cvs annotate for any revision he
     * enters into this KLineEdit.
     */
    KLineEdit *m_leRevision;
    /**
     * With this KPushButton the user can rerun cvs annotate
     * for the revision he entered into m_leRevision
     */
    KPushButton *m_btnAnnotate;

    CvsService_stub *m_cvsService;
    CvsJob_stub *m_cvsAnnotateJob;
};

#endif