Some warning message changes as suggested by atdotde.

2015-03-14 18:03 GMT+01:00 Jan Darowski <[email protected]>:
> Hi!
> Here are my two commits for improving images addition. Main goal was
> to add some feedback when photos aren't in dives time range (they
> cannot be added then) as discussed with Tomaz.
>
> During my work it appeared that some refactor in images timestamps
> code was needed. Miika mentioned that we can eventually need another
> way of getting timestamtps so I completely seperated it.
>
> Right now I can see two issues:
> 1) I'm not sure if the type of warning I wrote is right. It can be
> easily changed by anyone.
> 2) EXIF funtions were located in qthelper.c. I also put there code of
> the timestamp extraction but I'm not sure if these things should be
> there... It's quiet unintuitive for me.
>
> Greetings,
> Jan Darowski
From 086eef8e0a9fbf07852cd73341faf3c3cf5dfe5e Mon Sep 17 00:00:00 2001
From: Eltharan <[email protected]>
Date: Sat, 14 Mar 2015 22:21:37 +0100
Subject: [PATCH 3/3] Fixed invalid image warning.

Changed the message, added info about invalid images timestamps.

Signed-off-by: Jan Darowski <[email protected]>
---
 qt-ui/shiftimagetimes.ui | 14 ++++++++++++--
 qt-ui/simplewidgets.cpp  | 22 +++++++++++++++++++---
 2 files changed, 31 insertions(+), 5 deletions(-)
 mode change 100644 => 100755 qt-ui/shiftimagetimes.ui
 mode change 100644 => 100755 qt-ui/simplewidgets.cpp

diff --git a/qt-ui/shiftimagetimes.ui b/qt-ui/shiftimagetimes.ui
old mode 100644
new mode 100755
index ad81923..273333e
--- a/qt-ui/shiftimagetimes.ui
+++ b/qt-ui/shiftimagetimes.ui
@@ -126,8 +126,18 @@
         </property>
         <property name="text">
          <string>Warning!
-Not all images have timestamps between
-30 minutes before the dive and 30 minutes after the dive ends.</string>
+Not all images have timestamps in the range between
+30 minutes before the start and 30 minutes after the end of any selected dive.</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLabel" name="invalidLabel">
+        <property name="styleSheet">
+         <string notr="true">color: red; </string>
+        </property>
+        <property name="text">
+         <string/>
         </property>
        </widget>
       </item>
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp
old mode 100644
new mode 100755
index b499095..eba763c
--- a/qt-ui/simplewidgets.cpp
+++ b/qt-ui/simplewidgets.cpp
@@ -330,13 +330,29 @@ void ShiftImageTimesDialog::setOffset(time_t offset)
 
 void ShiftImageTimesDialog::updateInvalid()
 {
-	ui.warningLabel->hide();
+	timestamp_t timestamp;
+	QDateTime time;
 	bool allValid = true;
+	ui.warningLabel->hide();
+	ui.invalidLabel->hide();
+	ui.invalidLabel->clear();
+	
 	Q_FOREACH (const QString &fileName, fileNames) {
-		allValid = allValid && picture_check_valid(qstrdup(fileName.toUtf8().data()), m_amount);
+		if (picture_check_valid(qstrdup(fileName.toUtf8().data()), m_amount))
+			continue;
+		
+		// We've found invalid image
+		picture_get_timestamp(qstrdup(fileName.toUtf8().data()), &timestamp);
+		dcImageEpoch = timestamp;
+		time.setTime_t(timestamp + m_amount);
+		ui.invalidLabel->setText(ui.invalidLabel->text() + fileName + " " + time.toString() + "\n");
+		allValid = false;
 	}
-	if (!allValid)
+	
+	if (!allValid){
 		ui.warningLabel->show();
+		ui.invalidLabel->show();
+	}
 }
 
 void ShiftImageTimesDialog::timeEditChanged(const QTime &time)
-- 
2.2.2

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to