[go: up one dir, main page]

File: smartbrowse.h

package info (click to toggle)
qgit 2.3-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 1,152 kB
  • ctags: 1,477
  • sloc: cpp: 11,857; makefile: 51; sh: 39
file content (57 lines) | stat: -rw-r--r-- 1,107 bytes parent folder | download | duplicates (6)
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
/*
	Author: Marco Costalba (C) 2005-2007

	Copyright: See COPYING file that comes with this distribution

*/
#ifndef SMARTBROWSE_H
#define SMARTBROWSE_H

#include <QLabel>
#include <QTime>
#include "revsview.h"

class SmartLabel : public QLabel {
Q_OBJECT
public:
	SmartLabel(const QString& text, QWidget* par);
	void paintEvent(QPaintEvent* event);

protected:
	virtual void contextMenuEvent(QContextMenuEvent* e);

private slots:
	void switchLinks();
};

class SmartBrowse : public QObject {
Q_OBJECT
public:
	SmartBrowse(RevsView* par);

protected:
	bool eventFilter(QObject *obj, QEvent *event);

public slots:
	void updateVisibility();
	void linkActivated(const QString&);
	void flagChanged(uint);

private:
	QTextEdit* curTextEdit(bool* isDiff = NULL);
	void setVisible(bool b);
	void updatePosition();
	int visibilityFlags(bool* isDiff = NULL);
	bool wheelRolled(int delta, int flags);

	RevsView* rv;
	SmartLabel* logTopLbl;
	SmartLabel* logBottomLbl;
	SmartLabel* diffTopLbl;
	SmartLabel* diffBottomLbl;
	QTime scrollTimer, switchTimer, timeoutTimer;
	int wheelCnt;
	bool lablesEnabled;
};

#endif