comparison grapher.cpp @ 273:cc95394e2392 easyhg_v0.3.2

* Add warning dialog for "restore default settings"; add option for dates or ages in history list
author Chris Cannam
date Tue, 25 Jan 2011 16:41:40 +0000
parents b8ded5213d16
children 4811eb34e819
comparison
equal deleted inserted replaced
272:256138a4ed0e 273:cc95394e2392
19 #include "connectionitem.h" 19 #include "connectionitem.h"
20 #include "dateitem.h" 20 #include "dateitem.h"
21 #include "debug.h" 21 #include "debug.h"
22 #include "changesetscene.h" 22 #include "changesetscene.h"
23 23
24 #include <QSettings>
25
24 #include <iostream> 26 #include <iostream>
27
28 Grapher::Grapher(ChangesetScene *scene) :
29 m_scene(scene)
30 {
31 QSettings settings;
32 settings.beginGroup("Presentation");
33 m_showDates = (settings.value("dateformat", 0) == 1);
34 }
25 35
26 int Grapher::findAvailableColumn(int row, int parent, bool preferParentCol) 36 int Grapher::findAvailableColumn(int row, int parent, bool preferParentCol)
27 { 37 {
28 int col = parent; 38 int col = parent;
29 if (preferParentCol) { 39 if (preferParentCol) {
92 // row is now an upper bound on our eventual row (because we want 102 // row is now an upper bound on our eventual row (because we want
93 // to be above all parents). But we also want to ensure we are 103 // to be above all parents). But we also want to ensure we are
94 // above all nodes that have earlier dates (to the nearest day). 104 // above all nodes that have earlier dates (to the nearest day).
95 // m_rowDates maps each row to a date: use that. 105 // m_rowDates maps each row to a date: use that.
96 106
97 QString date = cs->age(); 107 QString date;
108 if (m_showDates) {
109 date = cs->date();
110 } else {
111 date = cs->age();
112 }
98 while (m_rowDates.contains(row) && m_rowDates[row] != date) { 113 while (m_rowDates.contains(row) && m_rowDates[row] != date) {
99 --row; 114 --row;
100 } 115 }
101 116
102 // We have already laid out all nodes that have earlier timestamps 117 // We have already laid out all nodes that have earlier timestamps