this fixes the color bug on the new profile,
Unfortunately I found two bugs on the new profile from the tests that I did
today,
I'll do my best to fix it by tomorrow, they are as follows:

1 - when adding a dive from the add dive panel, it will load the wrong dive
points ( it will load the initial dive points ), but when you re-selet this
dive by selecting an old dive then this new one, it will show the correct
values. most probably it's not re-selecting when the add dive finishing.
should be easy to fix.

2 - graphics artifacts while moving the ruler slowly on the profile. this
is a bit boring to trace, but important. the boundingrect of the ellipse is
most probably a bit out of bounds and I need to track this too.

those two are easy things for a summer of code experiment, easy to fix and
not so hard to track.

Tomaz
From a5518d153fd769d26ccd7f78e1ca27c0ac2f02ce Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tomaz.canabr...@intel.com>
Date: Sat, 8 Mar 2014 00:25:12 -0300
Subject: [PATCH 6/6] Fixe colors on the new profile.

This patch fixes the colors on the new profile,
the init of the colors map was not being done,
this fixes it.

a few problems were spotted on the new profile
dealing with the ruler graph and the newly
added dive, when using the dive add dialog, I'll
be on it later.

Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com>
---
 main.cpp                      | 2 +-
 qt-ui/diveplanner.cpp         | 8 --------
 qt-ui/graphicsview-common.cpp | 2 +-
 qt-ui/graphicsview-common.h   | 2 +-
 4 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/main.cpp b/main.cpp
index c447a45..2296960 100644
--- a/main.cpp
+++ b/main.cpp
@@ -21,7 +21,7 @@ int main(int argc, char **argv)
 
 	setup_system_prefs();
 	prefs = default_prefs;
-
+	fill_profile_color();
 	init_ui(&argc, &argv);
 	parse_xml_init();
 	taglist_init_global();
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 6a26e00..c5715f9 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -42,13 +42,6 @@ QString dpGasToStr(const divedatapoint &p)
 	return gasToStr(p.o2, p.he);
 }
 
-QColor getColor(const color_indice_t i)
-{
-	if (profile_color.count() > i && i >= 0)
-		return profile_color[i].at(0);
-	return QColor(Qt::black);
-}
-
 static DivePlannerPointsModel *plannerModel = DivePlannerPointsModel::instance();
 
 DivePlannerGraphics::DivePlannerGraphics(QWidget *parent) : QGraphicsView(parent),
@@ -65,7 +58,6 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget *parent) : QGraphicsView(parent
 	minDepth(M_OR_FT(40, 120)),
 	dpMaxTime(0)
 {
-	fill_profile_color();
 	setBackgroundBrush(profile_color[BACKGROUND].at(0));
 	setMouseTracking(true);
 	setScene(new QGraphicsScene());
diff --git a/qt-ui/graphicsview-common.cpp b/qt-ui/graphicsview-common.cpp
index 2490160..0c64831 100644
--- a/qt-ui/graphicsview-common.cpp
+++ b/qt-ui/graphicsview-common.cpp
@@ -58,7 +58,7 @@ void fill_profile_color()
 #undef COLOR
 }
 
-QColor getColor(const color_indice_t i, bool isGrayscale = false)
+QColor getColor(const color_indice_t i, bool isGrayscale)
 {
 	if (profile_color.count() > i && i >= 0)
 		return profile_color[i].at((isGrayscale) ? 1 : 0);
diff --git a/qt-ui/graphicsview-common.h b/qt-ui/graphicsview-common.h
index 046527d..417cd2e 100644
--- a/qt-ui/graphicsview-common.h
+++ b/qt-ui/graphicsview-common.h
@@ -73,7 +73,7 @@ typedef enum {
 
 extern QMap<color_indice_t, QVector<QColor> > profile_color;
 void fill_profile_color();
-QColor getColor(const color_indice_t i);
+QColor getColor(const color_indice_t i, bool isGrayscale = false);
 QColor getSacColor(int sac, int diveSac);
 struct text_render_options {
 	double size;
-- 
1.9.0

_______________________________________________
subsurface mailing list
subsurface@hohndel.org
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to