* [PATCH qgit] Remove obsoleted includes
@ 2006-10-26 18:47 Marco Costalba
2006-10-27 1:51 ` Petr Baudis
0 siblings, 1 reply; 2+ messages in thread
From: Marco Costalba @ 2006-10-26 18:47 UTC (permalink / raw)
To: Git Mailing List
Also small code cleanup
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
---
Still unable to push to public repo :(
src/listview.cpp | 239 ++++++++++++++++++++++++++----------------------------
src/listview.h | 4 +-
2 files changed, 115 insertions(+), 128 deletions(-)
diff --git a/src/listview.cpp b/src/listview.cpp
index 1e33ac0..84a2b4c 100644
--- a/src/listview.cpp
+++ b/src/listview.cpp
@@ -6,13 +6,9 @@
Copyright: See COPYING file that comes with this distribution
*/
-#include <qlistview.h>
#include <qpainter.h>
-#include <qbitmap.h>
#include <qapplication.h>
-#include <qstatusbar.h>
#include <qheader.h>
-#include <qpopupmenu.h>
#include <qdragobject.h>
#include "common.h"
#include "domain.h"
@@ -406,145 +402,138 @@ void ListViewItem::setDiffTarget(bool b)
/* Draw graph part for a lane
*/
void ListViewItem::paintGraphLane(QPainter* p, int type, int x1, int x2,
- const QColor& col, const QBrush& back) {
+ const QColor& col, const QBrush& back) {
- int h = height();
- int r = (x2-x1)/3;
+ int h = height() / 2;
+ int m = (x1 + x2) / 2;
+ int r = (x2 - x1) / 3;
+ int d = 2 * r;
-#define P_CENTER (x1+x2)/2, h/2
-#define P_0 x2, h/2
-#define P_90 (x1+x2)/2, 0
-#define P_180 x1, h/2
-#define P_270 (x1+x2)/2, h
-#define R_CENTER (x1+x2)/2-r, h/2-r, 2*r, 2*r
+ #define P_CENTER m , h
+ #define P_0 x2, h
+ #define P_90 m , 0
+ #define P_180 x1, h
+ #define P_270 m , 2 * h
+ #define R_CENTER m - r, h - r, d, d
- p->setPen(QPen(col, 2));
+ p->setPen(QPen(col, 2));
// vertical line
switch (type) {
- case ACTIVE:
- case NOT_ACTIVE:
- case MERGE_FORK:
- case MERGE_FORK_R:
- case MERGE_FORK_L:
- case JOIN:
- case JOIN_R:
- case JOIN_L:
- p->drawLine(P_90, P_270);
- break;
- case HEAD:
- case HEAD_R:
- case HEAD_L:
- case BRANCH:
- p->drawLine(P_CENTER, P_270);
- break;
- case TAIL:
- case TAIL_R:
- case TAIL_L:
- case INITIAL:
- case BOUNDARY:
- case BOUNDARY_C:
- case BOUNDARY_R:
- case BOUNDARY_L:
- p->drawLine(P_90, P_CENTER);
- break;
- default:
- break;
+ case ACTIVE:
+ case NOT_ACTIVE:
+ case MERGE_FORK:
+ case MERGE_FORK_R:
+ case MERGE_FORK_L:
+ case JOIN:
+ case JOIN_R:
+ case JOIN_L:
+ p->drawLine(P_90, P_270);
+ break;
+ case HEAD:
+ case HEAD_R:
+ case HEAD_L:
+ case BRANCH:
+ p->drawLine(P_CENTER, P_270);
+ break;
+ case TAIL:
+ case TAIL_R:
+ case TAIL_L:
+ case INITIAL:
+ case BOUNDARY:
+ case BOUNDARY_C:
+ case BOUNDARY_R:
+ case BOUNDARY_L:
+ p->drawLine(P_90, P_CENTER);
+ break;
+ default:
+ break;
}
// horizontal line
switch (type) {
- case MERGE_FORK:
- case JOIN:
- case HEAD:
- case TAIL:
- case CROSS:
- case CROSS_EMPTY:
- case BOUNDARY_C:
- p->drawLine(P_180, P_0);
- break;
- case MERGE_FORK_R:
- case JOIN_R:
- case HEAD_R:
- case TAIL_R:
- case BOUNDARY_R:
- p->drawLine(P_180, P_CENTER);
- break;
- case MERGE_FORK_L:
- case JOIN_L:
- case HEAD_L:
- case TAIL_L:
- case BOUNDARY_L:
- p->drawLine(P_CENTER, P_0);
- break;
- default:
- break;
+ case MERGE_FORK:
+ case JOIN:
+ case HEAD:
+ case TAIL:
+ case CROSS:
+ case CROSS_EMPTY:
+ case BOUNDARY_C:
+ p->drawLine(P_180, P_0);
+ break;
+ case MERGE_FORK_R:
+ case JOIN_R:
+ case HEAD_R:
+ case TAIL_R:
+ case BOUNDARY_R:
+ p->drawLine(P_180, P_CENTER);
+ break;
+ case MERGE_FORK_L:
+ case JOIN_L:
+ case HEAD_L:
+ case TAIL_L:
+ case BOUNDARY_L:
+ p->drawLine(P_CENTER, P_0);
+ break;
+ default:
+ break;
}
// center symbol, e.g. rect or ellipse
switch (type) {
- case ACTIVE:
- case INITIAL:
- case BRANCH:
- p->setPen(Qt::NoPen);
- p->setBrush(col);
- p->drawEllipse(R_CENTER);
- break;
- case MERGE_FORK:
- case MERGE_FORK_R:
- case MERGE_FORK_L:
- p->setPen(Qt::NoPen);
- p->setBrush(col);
- p->drawRect(R_CENTER);
- break;
-
- case UNAPPLIED:
- // Red minus sign
- p->setPen(Qt::NoPen);
- p->setBrush(red);
- p->drawRect( (x1+x2)/2-r, h/2 - 1, 2*r, 2);
- break;
-
- case APPLIED:
- // Green plus sign
- p->setPen(Qt::NoPen);
- p->setBrush(DARK_GREEN);
- p->drawRect( (x1+x2)/2-r, h/2 - 1, 2*r, 2);
- p->drawRect( (x1+x2)/2-1, h/2-r, 2, 2*r);
- break;
-
- case BOUNDARY:
- p->setBrush(back);
- p->drawEllipse(R_CENTER);
- break;
-
- case BOUNDARY_C:
- case BOUNDARY_R:
- case BOUNDARY_L:
- p->setBrush(back);
- p->drawRect(R_CENTER);
- break;
-
- default:
- break;
+ case ACTIVE:
+ case INITIAL:
+ case BRANCH:
+ p->setPen(Qt::NoPen);
+ p->setBrush(col);
+ p->drawEllipse(R_CENTER);
+ break;
+ case MERGE_FORK:
+ case MERGE_FORK_R:
+ case MERGE_FORK_L:
+ p->setPen(Qt::NoPen);
+ p->setBrush(col);
+ p->drawRect(R_CENTER);
+ break;
+ case UNAPPLIED:
+ // Red minus sign
+ p->setPen(Qt::NoPen);
+ p->setBrush(red);
+ p->drawRect(m - r, h - 1, d, 2);
+ break;
+ case APPLIED:
+ // Green plus sign
+ p->setPen(Qt::NoPen);
+ p->setBrush(DARK_GREEN);
+ p->drawRect(m - r, h - 1, d, 2);
+ p->drawRect(m - 1, h - r, 2, d);
+ break;
+ case BOUNDARY:
+ p->setBrush(back);
+ p->drawEllipse(R_CENTER);
+ break;
+ case BOUNDARY_C:
+ case BOUNDARY_R:
+ case BOUNDARY_L:
+ p->setBrush(back);
+ p->drawRect(R_CENTER);
+ break;
+ default:
+ break;
}
-
-#undef P_CENTER
-#undef P_0
-#undef P_90
-#undef P_180
-#undef P_270
-#undef R_CENTER
-
+ #undef P_CENTER
+ #undef P_0
+ #undef P_90
+ #undef P_180
+ #undef P_270
+ #undef R_CENTER
}
-void ListViewItem::paintGraph(const Rev& c, QPainter* p,
- const QColorGroup& cg, int width) {
-
- static QColor colors[COLORS_NUM] = { Qt::black, Qt::red, DARK_GREEN,
- Qt::blue, Qt::darkGray, BROWN,
- Qt::magenta, ORANGE };
+void ListViewItem::paintGraph(const Rev& c, QPainter* p, const
QColorGroup& cg, int width) {
+ static const QColor colors[COLORS_NUM] = { Qt::black, Qt::red, DARK_GREEN,
+ Qt::blue, Qt::darkGray, BROWN,
+ Qt::magenta, ORANGE };
QListView* lv = listView();
if (!lv)
return;
diff --git a/src/listview.h b/src/listview.h
index b1f1011..28d9f60 100644
--- a/src/listview.h
+++ b/src/listview.h
@@ -8,7 +8,6 @@
#include <qobject.h>
#include <qlistview.h>
-#include <qptrvector.h>
#include "common.h"
class QFont;
@@ -20,7 +19,7 @@ class FileHistory;
class ListViewItem: public QListViewItem {
public:
ListViewItem(QListView* p, ListViewItem* a, Git* g, SCRef sha,
- const int& w, bool e, unsigned long t, FileHistory* f);
+ const int& w, bool e, unsigned long t, FileHistory* f);
SCRef sha() const { return sha_; }
int getLaneType(uint pos) const;
@@ -102,4 +101,3 @@ private:
};
#endif
-
--
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH qgit] Remove obsoleted includes
2006-10-26 18:47 [PATCH qgit] Remove obsoleted includes Marco Costalba
@ 2006-10-27 1:51 ` Petr Baudis
0 siblings, 0 replies; 2+ messages in thread
From: Petr Baudis @ 2006-10-27 1:51 UTC (permalink / raw)
To: Marco Costalba; +Cc: Git Mailing List
Dear diary, on Thu, Oct 26, 2006 at 08:47:08PM CEST, I got a letter
where Marco Costalba <mcostalba@gmail.com> said that...
> Also small code cleanup
>
> Signed-off-by: Marco Costalba <mcostalba@gmail.com>
(It's whitespace-damaged.)
> ---
>
> Still unable to push to public repo :(
Hey, we're using this beautiful distributed version control system,
aren't we? :-) We could make use of it being fully distributed for once,
too - you can push to any other public repo until the original one
becomes available.
There's e.g. repo.or.cz. ;-)
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-10-27 1:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-26 18:47 [PATCH qgit] Remove obsoleted includes Marco Costalba
2006-10-27 1:51 ` Petr Baudis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).