mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
desktop: add support for camera sync delta of more than 24h
When using the camera sync feature to sync media to the dive timeline, the calculated time difference was considered invalid if it was more than 24 hours. To prevent this, this commit disables the manual time offset input fields when the camera sync button is clicked. It then uses the epoch difference in the final offset calculation, enabling arbitrary time differences between camera and divecomputer. Signed-off-by: Tim Segers <tsegers@pm.me> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
8525b2e274
commit
6ea4cfcc02
2 changed files with 8 additions and 12 deletions
|
@ -122,15 +122,6 @@ ShiftTimesDialog::ShiftTimesDialog(QWidget *parent) : QDialog(parent),
|
||||||
connect(quit, SIGNAL(activated()), parent, SLOT(close()));
|
connect(quit, SIGNAL(activated()), parent, SLOT(close()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShiftImageTimesDialog::buttonClicked(QAbstractButton *button)
|
|
||||||
{
|
|
||||||
if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) {
|
|
||||||
m_amount = ui.timeEdit->time().hour() * 3600 + ui.timeEdit->time().minute() * 60;
|
|
||||||
if (ui.backwards->isChecked())
|
|
||||||
m_amount *= -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ShiftImageTimesDialog::syncCameraClicked()
|
void ShiftImageTimesDialog::syncCameraClicked()
|
||||||
{
|
{
|
||||||
QPixmap picture;
|
QPixmap picture;
|
||||||
|
@ -141,6 +132,10 @@ void ShiftImageTimesDialog::syncCameraClicked()
|
||||||
if (fileNames.isEmpty())
|
if (fileNames.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
ui.timeEdit->setEnabled(false);
|
||||||
|
ui.backwards->setEnabled(false);
|
||||||
|
ui.forward->setEnabled(false);
|
||||||
|
|
||||||
picture.load(fileNames.at(0));
|
picture.load(fileNames.at(0));
|
||||||
ui.displayDC->setEnabled(true);
|
ui.displayDC->setEnabled(true);
|
||||||
QGraphicsScene *scene = new QGraphicsScene(this);
|
QGraphicsScene *scene = new QGraphicsScene(this);
|
||||||
|
@ -160,7 +155,10 @@ void ShiftImageTimesDialog::dcDateTimeChanged(const QDateTime &newDateTime)
|
||||||
if (!dcImageEpoch)
|
if (!dcImageEpoch)
|
||||||
return;
|
return;
|
||||||
newtime.setTimeSpec(Qt::UTC);
|
newtime.setTimeSpec(Qt::UTC);
|
||||||
setOffset(dateTimeToTimestamp(newtime) - dcImageEpoch);
|
|
||||||
|
m_amount = dateTimeToTimestamp(newtime) - dcImageEpoch;
|
||||||
|
if (m_amount)
|
||||||
|
updateInvalid();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShiftImageTimesDialog::matchAllImagesToggled(bool state)
|
void ShiftImageTimesDialog::matchAllImagesToggled(bool state)
|
||||||
|
@ -179,7 +177,6 @@ ShiftImageTimesDialog::ShiftImageTimesDialog(QWidget *parent, QStringList fileNa
|
||||||
matchAllImages(false)
|
matchAllImages(false)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
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.backwards, SIGNAL(toggled(bool)), this, SLOT(timeEditChanged()));
|
||||||
|
|
|
@ -75,7 +75,6 @@ public:
|
||||||
bool matchAll();
|
bool matchAll();
|
||||||
private
|
private
|
||||||
slots:
|
slots:
|
||||||
void buttonClicked(QAbstractButton *button);
|
|
||||||
void syncCameraClicked();
|
void syncCameraClicked();
|
||||||
void dcDateTimeChanged(const QDateTime &);
|
void dcDateTimeChanged(const QDateTime &);
|
||||||
void timeEditChanged(const QTime &time);
|
void timeEditChanged(const QTime &time);
|
||||||
|
|
Loading…
Reference in a new issue