Picture feature: Improve UI and translation of shift image times dialog

For the list of pictures with inappropriate date/time not fitting with
the dive time use a QTextEdit in read only mode with scroll bars
enabled instead of a QLabel.
Also update and translate some strings used there.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
Stefan Fuchs 2017-04-30 20:31:56 +02:00 committed by Dirk Hohndel
parent 9084bbae57
commit fff253e8cf
2 changed files with 14 additions and 7 deletions

View file

@ -10,7 +10,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>693</width> <width>693</width>
<height>606</height> <height>600</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -139,11 +139,17 @@ Not all images have timestamps in the range between
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="invalidLabel"> <widget class="QTextEdit" name="invalidFilesText">
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">color: red; </string> <string notr="true">color: red; </string>
</property> </property>
<property name="text"> <property name="lineWrapMode">
<enum>QTextEdit::NoWrap</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="text" stdset="0">
<string/> <string/>
</property> </property>
</widget> </widget>

View file

@ -380,9 +380,10 @@ void ShiftImageTimesDialog::updateInvalid()
timestamp_t timestamp; timestamp_t timestamp;
bool allValid = true; bool allValid = true;
ui.warningLabel->hide(); ui.warningLabel->hide();
ui.invalidLabel->hide(); ui.invalidFilesText->hide();
QDateTime time = QDateTime::fromTime_t(displayed_dive.when, Qt::UTC); QDateTime time = QDateTime::fromTime_t(displayed_dive.when, Qt::UTC);
ui.invalidLabel->setText("Dive:" + time.toString() + "\n"); ui.invalidFilesText->setPlainText(tr("Dive date/time") + ": " + time.toString() + "\n");
ui.invalidFilesText->append(tr("Files with inappropriate date/time") + ":");
Q_FOREACH (const QString &fileName, fileNames) { Q_FOREACH (const QString &fileName, fileNames) {
if (picture_check_valid(fileName.toUtf8().data(), m_amount)) if (picture_check_valid(fileName.toUtf8().data(), m_amount))
@ -391,13 +392,13 @@ void ShiftImageTimesDialog::updateInvalid()
// We've found invalid image // We've found invalid image
timestamp = picture_get_timestamp(fileName.toUtf8().data()); timestamp = picture_get_timestamp(fileName.toUtf8().data());
time.setTime_t(timestamp + m_amount); time.setTime_t(timestamp + m_amount);
ui.invalidLabel->setText(ui.invalidLabel->text() + fileName + " " + time.toString() + "\n"); ui.invalidFilesText->append(fileName + " " + time.toString());
allValid = false; allValid = false;
} }
if (!allValid){ if (!allValid){
ui.warningLabel->show(); ui.warningLabel->show();
ui.invalidLabel->show(); ui.invalidFilesText->show();
} }
} }