diff options
Diffstat (limited to 'qt-ui/simplewidgets.cpp')
-rw-r--r-- | qt-ui/simplewidgets.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index 8932baf15..99e0ba362 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -16,8 +16,9 @@ #include <QDateTime> #include <QShortcut> #include "exif.h" -#include "../dive.h" -#include "../file.h" +#include "dive.h" +#include "file.h" +#include "display.h" #include "mainwindow.h" #include "helpers.h" @@ -117,15 +118,24 @@ RenumberDialog *RenumberDialog::instance() return self; } +void RenumberDialog::renumberOnlySelected(bool selected) +{ + if (selected && amount_selected == 1) + ui.groupBox->setTitle(tr("New number")); + else + ui.groupBox->setTitle(tr("New starting number")); + selectedOnly = selected; +} + void RenumberDialog::buttonClicked(QAbstractButton *button) { if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) { qDebug() << "Renumbering."; - renumber_dives(ui.spinBox->value()); + renumber_dives(ui.spinBox->value(), selectedOnly); } } -RenumberDialog::RenumberDialog(QWidget *parent) : QDialog(parent) +RenumberDialog::RenumberDialog(QWidget *parent) : QDialog(parent), selectedOnly(false) { ui.setupUi(this); connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *))); @@ -161,10 +171,10 @@ void ShiftTimesDialog::buttonClicked(QAbstractButton *button) } } -void ShiftTimesDialog::showEvent(QShowEvent * event) +void ShiftTimesDialog::showEvent(QShowEvent *event) { ui.timeEdit->setTime(QTime(0, 0, 0, 0)); - when = get_times();//get time of first selected dive + when = get_times(); //get time of first selected dive ui.currentTime->setText(get_dive_date_string(when)); ui.shiftedTime->setText(get_dive_date_string(when)); } @@ -177,7 +187,7 @@ void ShiftTimesDialog::changeTime() if (ui.backwards->isChecked()) amount *= -1; - ui.shiftedTime->setText (get_dive_date_string(amount+when)); + ui.shiftedTime->setText(get_dive_date_string(amount + when)); } ShiftTimesDialog::ShiftTimesDialog(QWidget *parent) : QDialog(parent) |