diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-05-27 14:13:15 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-05-27 09:47:35 -0700 |
commit | 7417f865cd628aa5df78961dc198a9070822ed72 (patch) | |
tree | 84a4b8232b849748ce937e110134b2fde665d9f6 /desktop-widgets/simplewidgets.cpp | |
parent | 25f1bc488f68395390a3a87328b31dfa7deac11c (diff) | |
download | subsurface-7417f865cd628aa5df78961dc198a9070822ed72.tar.gz |
cleanup: un-singletonize ShiftTimesDialog
There is no reason that this dialog is a singleton. Since it is modal,
it can be created on demand. Apart from removing superfluous global state,
this simplifies code, because preparing the widget can now be done in
the constructor instead of overriding the showEvent() function.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/simplewidgets.cpp')
-rw-r--r-- | desktop-widgets/simplewidgets.cpp | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp index ef7ca71d0..f30b9fc46 100644 --- a/desktop-widgets/simplewidgets.cpp +++ b/desktop-widgets/simplewidgets.cpp @@ -179,12 +179,6 @@ SetpointDialog::SetpointDialog(struct dive *dIn, int dcNrIn, int seconds) : QDia connect(quit, &QShortcut::activated, MainWindow::instance(), &QWidget::close); } -ShiftTimesDialog *ShiftTimesDialog::instance() -{ - static ShiftTimesDialog *self = new ShiftTimesDialog(MainWindow::instance()); - return self; -} - void ShiftTimesDialog::buttonClicked(QAbstractButton *button) { int amount; @@ -196,10 +190,7 @@ void ShiftTimesDialog::buttonClicked(QAbstractButton *button) if (amount != 0) Command::shiftTime(getDiveSelection(), amount); } -} -void ShiftTimesDialog::showEvent(QShowEvent*) -{ ui.timeEdit->setTime(QTime(0, 0, 0, 0)); when = get_times(); //get time of first selected dive ui.currentTime->setText(get_dive_date_string(when)); |