comparison src/grapher.cpp @ 400:07eaf4e6003a

Merge from branch "item_appearance_adjustments"
author Chris Cannam
date Wed, 25 May 2011 14:59:09 +0100
parents b1f0fa991c49
children 69fb864a3972
comparison
equal deleted inserted replaced
385:5cc0d897eb26 400:07eaf4e6003a
15 COPYING included with this distribution for more information. 15 COPYING included with this distribution for more information.
16 */ 16 */
17 17
18 #include "grapher.h" 18 #include "grapher.h"
19 #include "connectionitem.h" 19 #include "connectionitem.h"
20 #include "dateitem.h"
21 #include "debug.h" 20 #include "debug.h"
22 #include "changesetscene.h" 21 #include "changesetscene.h"
23 22
24 #include <QSettings> 23 #include <QSettings>
25 24
450 ConnectionItem *conn = new ConnectionItem(); 449 ConnectionItem *conn = new ConnectionItem();
451 conn->setConnectionType(ConnectionItem::Merge); 450 conn->setConnectionType(ConnectionItem::Merge);
452 ChangesetItem *pitem = m_items[p]; 451 ChangesetItem *pitem = m_items[p];
453 conn->setParent(pitem); 452 conn->setParent(pitem);
454 conn->setChild(m_uncommitted); 453 conn->setChild(m_uncommitted);
455 conn->setZValue(0); 454 conn->setZValue(-1);
456 m_scene->addItem(conn); 455 m_scene->addItem(conn);
457 if (pitem) { 456 if (pitem) {
458 if (pitem->getChangeset()->branch() == uncommittedBranch) { 457 if (pitem->getChangeset()->branch() == uncommittedBranch) {
459 haveParentOnBranch = true; 458 haveParentOnBranch = true;
460 } 459 }
463 462
464 // If the uncommitted item has no parents on the same branch, 463 // If the uncommitted item has no parents on the same branch,
465 // tell it it has a new branch (the "show branch" flag is set 464 // tell it it has a new branch (the "show branch" flag is set
466 // elsewhere for this item) 465 // elsewhere for this item)
467 m_uncommitted->setIsNewBranch(!haveParentOnBranch); 466 m_uncommitted->setIsNewBranch(!haveParentOnBranch);
467
468 // Uncommitted is a merge if it has more than one parent
469 m_uncommitted->setIsMerge(m_uncommittedParents.size() > 1);
468 } 470 }
469 471
470 // Add the branch labels 472 // Add the branch labels
471 473
472 foreach (Changeset *cs, csets) { 474 foreach (Changeset *cs, csets) {
579 QString date = m_rowDates[row]; 581 QString date = m_rowDates[row];
580 n++; 582 n++;
581 583
582 if (date != prevDate) { 584 if (date != prevDate) {
583 if (prevDate != "") { 585 if (prevDate != "") {
584 DateItem *item = new DateItem(); 586 m_scene->addDateRange(prevDate, changeRow, n, even);
585 item->setDateString(prevDate);
586 item->setCols(datemincol, datemaxcol - datemincol + 1);
587 item->setRows(changeRow, n);
588 item->setEven(even);
589 item->setZValue(-2);
590 m_scene->addDateItem(item);
591 even = !even; 587 even = !even;
592 } 588 }
593 prevDate = date; 589 prevDate = date;
594 changeRow = row; 590 changeRow = row;
595 n = 0; 591 n = 0;
596 } 592 }
597 } 593 }
598 594
599 if (n > 0) { 595 if (n > 0) {
600 DateItem *item = new DateItem(); 596 m_scene->addDateRange(prevDate, changeRow, n+1, even);
601 item->setDateString(prevDate);
602 item->setCols(datemincol, datemaxcol - datemincol + 1);
603 item->setRows(changeRow, n+1);
604 item->setEven(even);
605 item->setZValue(-2);
606 m_scene->addDateItem(item);
607 even = !even; 597 even = !even;
608 } 598 }
609 } 599
610 600 m_scene->itemAddCompleted();
601 }
602