Shift times of selected dives

This patch adds the possibility to shift the times of all selected dives
by a fixed amount to correct for time zone problems or mis-set dive
computer clocks.

Select the dives and right click in the dive list.

[Dirk Hohndel: added .ui file to FORMS and fixed some whitespace damage]

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert Helling 2013-11-18 14:53:05 +01:00 committed by Dirk Hohndel
parent e289881db9
commit 4966336e1d
8 changed files with 217 additions and 0 deletions

View file

@ -13,6 +13,7 @@
#include <QDebug>
#include "../dive.h"
#include "mainwindow.h"
class MinMaxAvgWidgetPrivate{
public:
@ -119,6 +120,32 @@ RenumberDialog::RenumberDialog(): QDialog()
connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*)));
}
ShiftTimesDialog* ShiftTimesDialog::instance()
{
static ShiftTimesDialog* self = new ShiftTimesDialog();
return self;
}
void ShiftTimesDialog::buttonClicked(QAbstractButton* button)
{
int amount;
if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole){
amount = ui.timeEdit->time().hour() * 3600 + ui.timeEdit->time().minute() * 60;
if (ui.backwards->isChecked())
amount *= -1;
shift_times(amount);
mainWindow()->refreshDisplay();
}
}
ShiftTimesDialog::ShiftTimesDialog(): QDialog()
{
ui.setupUi(this);
connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*)));
}
bool isGnome3Session()
{
#if defined(QT_OS_WIW) || defined(QT_OS_MAC)