Re: new widget for Date display + pick.

2014-06-20 Thread Davide DB
Sorry for my question, I'm just a user and I find a little bit
intimidating having a mailing list where developer's activities are
mixed with end user questions.

Is there any way to use these patches without being a developer?

I'm migrating my previous logbooks on this amazing tool but I was not
able to understand how big is the user base. Here, 99% of messages
come from developers/users. Have you any idea of how many divers uses
Subsurface?



2014-06-20 1:01 GMT+02:00 Tomaz Canabrava tcanabr...@kde.org:
 more work:

 Anyone can test those and see if it's good to work with? ( rememmber,
 that the edition will be broken after applying this as it's impossible
 to set the time right now. )

 On Thu, Jun 19, 2014 at 4:06 PM, Tomaz Canabrava tcanabr...@kde.org wrote:
 People,

 Forgive my lazyness :)

 here is the finished version of the Date picker widget, to remove the
 aberration that is the QDatePicker.

 I still need to do the QTimePicker one.

 Tomaz

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




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


Re: new widget for Date display + pick.

2014-06-20 Thread Davide DB
Thanks Tomas.

2014-06-20 12:06 GMT+02:00 Tomaz Canabrava tcanabr...@kde.org:
 On Fri, Jun 20, 2014 at 6:36 AM, Davide DB dbdav...@gmail.com wrote:
 Sorry for my question, I'm just a user and I find a little bit
 intimidating having a mailing list where developer's activities are
 mixed with end user questions.

 Is there any way to use these patches without being a developer?

 well, if you can spare a few minutes then there is, because you need
 at least to have a developer's tools installed and compile subsurface.
 but since this patch breaks workflow ( the place where you edited the
 date and time of the dive now only accepts date ) I don't think you
 should use this on your data, untill I finish the time selector. :)

 I'm migrating my previous logbooks on this amazing tool but I was not
 able to understand how big is the user base. Here, 99% of messages
 come from developers/users. Have you any idea of how many divers uses
 Subsurface?

 I don't know - but I'm a very new developer on the group. I know that
 we have a fairly good userbase, and we are used by some DC
 manufacturers to do their own version of the software.



 2014-06-20 1:01 GMT+02:00 Tomaz Canabrava tcanabr...@kde.org:
 more work:

 Anyone can test those and see if it's good to work with? ( rememmber,
 that the edition will be broken after applying this as it's impossible
 to set the time right now. )

 On Thu, Jun 19, 2014 at 4:06 PM, Tomaz Canabrava tcanabr...@kde.org wrote:
 People,

 Forgive my lazyness :)

 here is the finished version of the Date picker widget, to remove the
 aberration that is the QDatePicker.

 I still need to do the QTimePicker one.

 Tomaz

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




 --
 Davide



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


Re: new widget for Date display + pick.

2014-06-20 Thread Dirk Hohndel
On Fri, Jun 20, 2014 at 11:36:54AM +0200, Davide DB wrote:
 Sorry for my question, I'm just a user and I find a little bit
 intimidating having a mailing list where developer's activities are
 mixed with end user questions.
 
 Is there any way to use these patches without being a developer?

In general I think that might be a steep task, ESPECIALLY if you are on
Mac or (worse, in this specific situation) on Windows.

Can you tell us which platform you are running on?
That way we might be able to create binaries for you.

 I'm migrating my previous logbooks on this amazing tool but I was not
 able to understand how big is the user base. Here, 99% of messages
 come from developers/users. Have you any idea of how many divers uses
 Subsurface?

Since this is open source software this is very hard to tell. I'm actually
working on a user survey where we'll ask users to self report in
Subsurface 4.2.

For version 4.0 we had close to a thousand downloads of the Windows and
Mac binaries on our server. I don't know how many more people built from
source, got binaries from other sources or installed it as part of a Linux
distribution.

My guess is that we have maybe 1500 users, but I could be way off.

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


Re: new widget for Date display + pick.

2014-06-20 Thread Tomaz Canabrava
Em 20/06/2014 10:36, Dirk Hohndel d...@hohndel.org escreveu:

 On Thu, Jun 19, 2014 at 08:01:30PM -0300, Tomaz Canabrava wrote:
  more work:
 
  Anyone can test those and see if it's good to work with? ( rememmber,
  that the edition will be broken after applying this as it's impossible
  to set the time right now. )

 Hmm - with that I'm a bit hesitant to just pull this into master... I like
 to keep that mostly useful :-)

Well, you liked the widget? I need a bit of feedback to know if im on the
rigth track.

Im gonna send the rest today, só there's no need to worry.

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


Re: new widget for Date display + pick.

2014-06-20 Thread Dirk Hohndel
On Fri, Jun 20, 2014 at 11:20:29AM -0300, Tomaz Canabrava wrote:
  Hmm - with that I'm a bit hesitant to just pull this into master... I like
  to keep that mostly useful :-)
 
 Well, you liked the widget? I need a bit of feedback to know if im on the
 rigth track.

Yes, I like the widget a lot, there are details I wonder about:

- the calendar page that we have for date: the month / year seem a bit too
  small - it's hard to quickly read the date; I think we could have a
  little less white space around the day, make the widget a bit wider and
  use a larger font for month / year. Would that work?
- I agree with Salvador that the week number isn't needed
- QtLocale tells you which day is the first day of the week in the current
  locale - could you use that to render the calendar? That would make many
  of our users happy, I think.

Can't wait to see the time picker :-)

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


Re: new widget for Date display + pick.

2014-06-19 Thread Tomaz Canabrava
more work:

Anyone can test those and see if it's good to work with? ( rememmber,
that the edition will be broken after applying this as it's impossible
to set the time right now. )

On Thu, Jun 19, 2014 at 4:06 PM, Tomaz Canabrava tcanabr...@kde.org wrote:
 People,

 Forgive my lazyness :)

 here is the finished version of the Date picker widget, to remove the
 aberration that is the QDatePicker.

 I still need to do the QTimePicker one.

 Tomaz
From 67f7aeb797888b9f2ee2820992f6f3821c427c5a Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava tomaz.canabr...@intel.com
Date: Thu, 19 Jun 2014 18:11:44 -0300
Subject: [PATCH 10/12] Better focus painting for Date Widget

This uses the system focus painging.

Signed-off-by: Tomaz Canabrava tomaz.canabr...@intel.com
---
 qt-ui/simplewidgets.cpp | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp
index eff3f66..ebb19bd 100644
--- a/qt-ui/simplewidgets.cpp
+++ b/qt-ui/simplewidgets.cpp
@@ -354,8 +354,12 @@ void DateWidget::paintEvent(QPaintEvent *event)
 	painter.setFont(font);
 	painter.drawText(QPoint(32 - metrics.width(day)/2, 45), day);
 
-	if(hasFocus())
-		painter.drawLine(0, 63, 63, 63);
+	if (hasFocus()) {
+		QStyleOptionFocusRect option;
+		option.initFrom(this);
+		option.backgroundColor = palette().color(QPalette::Background);
+		style()-drawPrimitive(QStyle::PE_FrameFocusRect, option, painter, this);
+	}
 }
 
 void DateWidget::mousePressEvent(QMouseEvent *event)
-- 
2.0.0

From ef0566cfa8727c47b6717f9817f88d24bd3085ea Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava tomaz.canabr...@intel.com
Date: Thu, 19 Jun 2014 18:45:26 -0300
Subject: [PATCH 11/12] Change the Star Widget to use QImage instead of QPixmap

Also, clean a few calls, this should make the widget a tiny
bit faster. This patch also moves the grayImage function from
the star widget to the global scope, so I can use it on the
Calendar widget.

Signed-off-by: Tomaz Canabrava tomaz.canabr...@intel.com
---
 qt-ui/modeldelegates.cpp |  7 +--
 qt-ui/simplewidgets.cpp  |  3 ++-
 qt-ui/simplewidgets.h|  1 +
 qt-ui/starwidget.cpp | 35 ++-
 qt-ui/starwidget.h   |  9 -
 5 files changed, 30 insertions(+), 25 deletions(-)

diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp
index d06c662..dc6af56 100644
--- a/qt-ui/modeldelegates.cpp
+++ b/qt-ui/modeldelegates.cpp
@@ -47,10 +47,13 @@ void StarWidgetsDelegate::paint(QPainter *painter, const QStyleOptionViewItem o
 	int deltaY = option.rect.height() / 2 - StarWidget::starActive().height() / 2;
 	painter-save();
 	painter-setRenderHint(QPainter::Antialiasing, true);
+	const QPixmap active = QPixmap::fromImage(StarWidget::starActive());
+	const QPixmap inactive = QPixmap::fromImage(StarWidget::starInactive());
+
 	for (int i = 0; i  rating; i++)
-		painter-drawPixmap(option.rect.x() + i * IMG_SIZE + SPACING, option.rect.y() + deltaY, StarWidget::starActive());
+		painter-drawPixmap(option.rect.x() + i * IMG_SIZE + SPACING, option.rect.y() + deltaY, active);
 	for (int i = rating; i  TOTALSTARS; i++)
-		painter-drawPixmap(option.rect.x() + i * IMG_SIZE + SPACING, option.rect.y() + deltaY, StarWidget::starInactive());
+		painter-drawPixmap(option.rect.x() + i * IMG_SIZE + SPACING, option.rect.y() + deltaY, inactive);
 	painter-restore();
 }
 
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp
index ebb19bd..5fb9308 100644
--- a/qt-ui/simplewidgets.cpp
+++ b/qt-ui/simplewidgets.cpp
@@ -332,7 +332,8 @@ void DateWidget::paintEvent(QPaintEvent *event)
 	static int pixRedTag = 18; 	/* calculated using a ruler. */
 
 	QPainter painter(this);
-	painter.drawPixmap(QPoint(0,0), pix);
+
+	painter.drawPixmap(QPoint(0,0), isEnabled() ? pix : QPixmap::fromImage(grayImage(pix.toImage(;
 
 	QString month = mDate.toString(MMM);
 	QString year = mDate.toString();
diff --git a/qt-ui/simplewidgets.h b/qt-ui/simplewidgets.h
index 6587c27..b8cb8ae 100644
--- a/qt-ui/simplewidgets.h
+++ b/qt-ui/simplewidgets.h
@@ -111,5 +111,6 @@ private:
 };
 
 bool isGnome3Session();
+QImage grayImage(const QImage coloredImg);
 
 #endif // SIMPLEWIDGETS_H
diff --git a/qt-ui/starwidget.cpp b/qt-ui/starwidget.cpp
index ff185a4..c682d95 100644
--- a/qt-ui/starwidget.cpp
+++ b/qt-ui/starwidget.cpp
@@ -7,18 +7,19 @@
 #include unistd.h
 #include QStyle
 #include QStyleOption
+#include simplewidgets.h
 
-QPixmap *StarWidget::activeStar = 0;
-QPixmap *StarWidget::inactiveStar = 0;
+QImage StarWidget::activeStar;
+QImage StarWidget::inactiveStar;
 
-QPixmap StarWidget::starActive()
+const QImage StarWidget::starActive()
 {
-	return (*activeStar);
+	return activeStar;
 }
 
-QPixmap StarWidget::starInactive()
+const QImage StarWidget::starInactive()
 {
-	return (*inactiveStar);
+	return inactiveStar;
 }
 
 int StarWidget::currentStars() const
@@ -48,12 +49,14 @@ void StarWidget::mouseReleaseEvent(QMouseEvent *event)
 void