summaryrefslogtreecommitdiffstats
path: root/quanta/messages/annotationoutput.h
blob: 50e293d6fb764ffc0ffdd34dbfecaa75a88d8f06 (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
//
// C++ Interface: annotationoutput
//
// Description: 
//
//
// Author: Andras Mantia <[email protected]>, (C) 2005
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef ANNOTATIONOUTPUT_H
#define ANNOTATIONOUTPUT_H

#include <kurl.h>
#include <ktabwidget.h>

/**
@author Andras Mantia
*/

class QDomDocument;
class QListViewItem;
class QTimer;

class KListView;
class KListViewItem;

class MessageOutput;

enum AnnotationScope
{
  CurrentFile = 0,
  AllFiles
};

class AnnotationOutput : public KTabWidget
{
Q_OBJECT
public:
    AnnotationOutput(TQWidget *parent = 0, const char *name = 0);

    ~AnnotationOutput();
    MessageOutput *currentFileAnnotations() const {return m_currentFileAnnotations;}
    KListView *allAnnotations() const {return m_allAnnotations;}
    void writeAnnotations(const TQString &fileName, const TQMap<uint, QPair<TQString, TQString> > &annotations);

public slots:
    /**
     * Scans the project files to see if there were annotations added or modified outside of Quanta. The scan is done in background.
     */
    void updateAnnotations();
    void readAnnotations(); 
    void clearAnnotations();
    void insertAnnotation(uint line, const TQString& fileName, const QPair<TQString, TQString>& annotation);

private slots:
    void tabChanged(TQWidget *w);
    void allAnnotationsItemExecuted(TQListViewItem *item);
    void yourAnnotationsItemExecuted(TQListViewItem *item);
    void slotUpdateNextFile();

signals:
    void clicked(const TQString& fname, int line, int col);

private:
    /**
     * Updates the annotation for a file.
     * @param url 
     */
    void updateAnnotationForFile(const KURL& url);

    MessageOutput *m_currentFileAnnotations;
    KListView *m_allAnnotations;
    TQDict<KListViewItem> m_annotatedFileItems;
    TQMap<TQListViewItem*, TQString> m_fileNames;
    TQMap<TQListViewItem*, uint> m_lines;
    uint m_yourAnnotationsNum;

    KListView *m_yourAnnotations;
    TQDict<KListViewItem> m_yourFileItems;
    TQMap<TQListViewItem*, TQString> m_yourFileNames;
    TQMap<TQListViewItem*, uint> m_yourLines;

    TQTimer *m_updateTimer;
    KURL::List m_files;
    uint m_fileIndex;
};

#endif