comparison grapher.h @ 45:4286836bb3c9

* Some more work on graph layout; ensure LANG is set for parseable UTF8 output when running Hg
author Chris Cannam <cannam@all-day-breakfast.com>
date Wed, 10 Nov 2010 12:44:11 +0000
parents bed7ab59f62e
children bd3accba9b3f
comparison
equal deleted inserted replaced
44:bed7ab59f62e 45:4286836bb3c9
2 #define GRAPHER_H 2 #define GRAPHER_H
3 3
4 #include "changeset.h" 4 #include "changeset.h"
5 #include "changesetitem.h" 5 #include "changesetitem.h"
6 6
7 typedef QMap<Changeset *, ChangesetItem *> ChangesetItemMap; 7 #include <QSet>
8 #include <QMap>
9
10 #include <exception>
8 11
9 class Grapher 12 class Grapher
10 { 13 {
11 public: 14 public:
12 void layout(Changesets csets, ChangesetItemMap items); 15 Grapher(QGraphicsScene *scene) { m_scene = scene; }
16
17 void layout(Changesets csets);
18
19 class LayoutException : public std::exception {
20 public:
21 LayoutException(QString message) throw() : m_message(message) { }
22 virtual ~LayoutException() throw() { }
23 virtual const char *what() const throw() {
24 return m_message.toLocal8Bit().data();
25 }
26 protected:
27 QString m_message;
28 };
29
30 private:
31 void layoutRow(QString id);
32 void layoutCol(QString id);
33 int findAvailableColumn(int row, int parent, bool preferParentCol);
34
35 QGraphicsScene *m_scene;
36
37 typedef QMap<QString, Changeset *> IdChangesetMap;
38 IdChangesetMap m_idCsetMap;
39
40 typedef QMap<QString, ChangesetItem *> IdItemMap;
41 IdItemMap m_items;
42
43 typedef QSet<int> ColumnSet;
44 typedef QMap<int, ColumnSet> GridAlloc;
45 GridAlloc m_alloc;
46
47 typedef QSet<QString> IdSet;
48 IdSet m_handled;
13 }; 49 };
14 50
15 #endif 51 #endif