mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Picture feature: Improve UI and translation of shift image times...
... dialog (part 2) Show date/time of first/last selected dive instead of displayed_dive. Thats more useful to identify the right time offset for the images. Trigger first update of image info already in constructor of the dialog. Update the results and UI also when the "backwards" radio button is changed. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
parent
fff253e8cf
commit
d5af6cab9f
2 changed files with 22 additions and 5 deletions
|
@ -355,8 +355,11 @@ ShiftImageTimesDialog::ShiftImageTimesDialog(QWidget *parent, QStringList fileNa
|
||||||
connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *)));
|
connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *)));
|
||||||
connect(ui.syncCamera, SIGNAL(clicked()), this, SLOT(syncCameraClicked()));
|
connect(ui.syncCamera, SIGNAL(clicked()), this, SLOT(syncCameraClicked()));
|
||||||
connect(ui.timeEdit, SIGNAL(timeChanged(const QTime &)), this, SLOT(timeEditChanged(const QTime &)));
|
connect(ui.timeEdit, SIGNAL(timeChanged(const QTime &)), this, SLOT(timeEditChanged(const QTime &)));
|
||||||
|
connect(ui.backwards, SIGNAL(toggled(bool)), this, SLOT(timeEditChanged()));
|
||||||
connect(ui.matchAllImages, SIGNAL(toggled(bool)), this, SLOT(matchAllImagesToggled(bool)));
|
connect(ui.matchAllImages, SIGNAL(toggled(bool)), this, SLOT(matchAllImagesToggled(bool)));
|
||||||
dcImageEpoch = (time_t)0;
|
dcImageEpoch = (time_t)0;
|
||||||
|
|
||||||
|
updateInvalid();
|
||||||
}
|
}
|
||||||
|
|
||||||
time_t ShiftImageTimesDialog::amount() const
|
time_t ShiftImageTimesDialog::amount() const
|
||||||
|
@ -381,9 +384,15 @@ void ShiftImageTimesDialog::updateInvalid()
|
||||||
bool allValid = true;
|
bool allValid = true;
|
||||||
ui.warningLabel->hide();
|
ui.warningLabel->hide();
|
||||||
ui.invalidFilesText->hide();
|
ui.invalidFilesText->hide();
|
||||||
QDateTime time = QDateTime::fromTime_t(displayed_dive.when, Qt::UTC);
|
QDateTime time_first = QDateTime::fromTime_t(first_selected_dive()->when, Qt::UTC);
|
||||||
ui.invalidFilesText->setPlainText(tr("Dive date/time") + ": " + time.toString() + "\n");
|
QDateTime time_last = QDateTime::fromTime_t(last_selected_dive()->when, Qt::UTC);
|
||||||
ui.invalidFilesText->append(tr("Files with inappropriate date/time") + ":");
|
if (first_selected_dive() == last_selected_dive())
|
||||||
|
ui.invalidFilesText->setPlainText(tr("Selected dive date/time") + ": " + time_first.toString());
|
||||||
|
else {
|
||||||
|
ui.invalidFilesText->setPlainText(tr("First selected dive date/time") + ": " + time_first.toString());
|
||||||
|
ui.invalidFilesText->append(tr("Last selected dive date/time") + ": " + time_last.toString());
|
||||||
|
}
|
||||||
|
ui.invalidFilesText->append(tr("\nFiles 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,8 +400,8 @@ 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_first.setTime_t(timestamp + m_amount);
|
||||||
ui.invalidFilesText->append(fileName + " " + time.toString());
|
ui.invalidFilesText->append(fileName + " " + time_first.toString());
|
||||||
allValid = false;
|
allValid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,6 +419,13 @@ void ShiftImageTimesDialog::timeEditChanged(const QTime &time)
|
||||||
updateInvalid();
|
updateInvalid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShiftImageTimesDialog::timeEditChanged()
|
||||||
|
{
|
||||||
|
if (m_amount > 0 == ui.backwards->isChecked())
|
||||||
|
m_amount *= -1;
|
||||||
|
if (m_amount) updateInvalid();
|
||||||
|
}
|
||||||
|
|
||||||
URLDialog::URLDialog(QWidget *parent) : QDialog(parent)
|
URLDialog::URLDialog(QWidget *parent) : QDialog(parent)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
|
@ -111,6 +111,7 @@ slots:
|
||||||
void syncCameraClicked();
|
void syncCameraClicked();
|
||||||
void dcDateTimeChanged(const QDateTime &);
|
void dcDateTimeChanged(const QDateTime &);
|
||||||
void timeEditChanged(const QTime &time);
|
void timeEditChanged(const QTime &time);
|
||||||
|
void timeEditChanged();
|
||||||
void updateInvalid();
|
void updateInvalid();
|
||||||
void matchAllImagesToggled(bool);
|
void matchAllImagesToggled(bool);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue