From 8a20d019c236eeebc3a6d3540936bb209d350510 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Wed, 21 Oct 2020 23:17:37 +0200 Subject: desktop: remove DiveComputerManagementDialog This is now done in a TabWidget with undo-support. Signed-off-by: Berthold Stoeger --- desktop-widgets/CMakeLists.txt | 3 - desktop-widgets/divecomputermanagementdialog.cpp | 51 --------------- desktop-widgets/divecomputermanagementdialog.h | 32 ---------- desktop-widgets/divecomputermanagementdialog.ui | 81 ------------------------ desktop-widgets/mainwindow.cpp | 7 -- desktop-widgets/mainwindow.h | 1 - desktop-widgets/mainwindow.ui | 6 -- 7 files changed, 181 deletions(-) delete mode 100644 desktop-widgets/divecomputermanagementdialog.cpp delete mode 100644 desktop-widgets/divecomputermanagementdialog.h delete mode 100644 desktop-widgets/divecomputermanagementdialog.ui diff --git a/desktop-widgets/CMakeLists.txt b/desktop-widgets/CMakeLists.txt index f86d89ad7..7fc76ece3 100644 --- a/desktop-widgets/CMakeLists.txt +++ b/desktop-widgets/CMakeLists.txt @@ -20,7 +20,6 @@ set (SUBSURFACE_UI btdeviceselectiondialog.ui configuredivecomputerdialog.ui divecomponentselection.ui - divecomputermanagementdialog.ui divelogexportdialog.ui divelogimportdialog.ui divesiteimportdialog.ui @@ -62,8 +61,6 @@ set(SUBSURFACE_INTERFACE about.h configuredivecomputerdialog.cpp configuredivecomputerdialog.h - divecomputermanagementdialog.cpp - divecomputermanagementdialog.h divelistview.cpp divelistview.h divelogexportdialog.cpp diff --git a/desktop-widgets/divecomputermanagementdialog.cpp b/desktop-widgets/divecomputermanagementdialog.cpp deleted file mode 100644 index 92f7c2096..000000000 --- a/desktop-widgets/divecomputermanagementdialog.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include "desktop-widgets/divecomputermanagementdialog.h" -#include "desktop-widgets/mainwindow.h" -#include "core/qthelper.h" -#include "qt-models/divecomputermodel.h" -#include -#include - -DiveComputerManagementDialog::DiveComputerManagementDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f) -{ - ui.setupUi(this); - init(); - connect(ui.tableView, SIGNAL(clicked(QModelIndex)), this, SLOT(tryRemove(QModelIndex))); - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); - connect(close, SIGNAL(activated()), this, SLOT(close())); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); - connect(quit, SIGNAL(activated()), parent, SLOT(close())); -} - -void DiveComputerManagementDialog::init() -{ - model.reset(new DiveComputerModel); - proxyModel.setSourceModel(model.get()); - ui.tableView->setModel(&proxyModel); - ui.tableView->setSortingEnabled(true); - ui.tableView->resizeColumnsToContents(); - ui.tableView->setColumnWidth(DiveComputerModel::REMOVE, 22); - layout()->activate(); -} - -DiveComputerManagementDialog *DiveComputerManagementDialog::instance() -{ - static DiveComputerManagementDialog *self = new DiveComputerManagementDialog(MainWindow::instance()); - return self; -} - -void DiveComputerManagementDialog::tryRemove(const QModelIndex &index) -{ -} - -void DiveComputerManagementDialog::accept() -{ - hide(); - close(); -} - -void DiveComputerManagementDialog::reject() -{ - hide(); - close(); -} diff --git a/desktop-widgets/divecomputermanagementdialog.h b/desktop-widgets/divecomputermanagementdialog.h deleted file mode 100644 index d80f8f9d3..000000000 --- a/desktop-widgets/divecomputermanagementdialog.h +++ /dev/null @@ -1,32 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#ifndef DIVECOMPUTERMANAGEMENTDIALOG_H -#define DIVECOMPUTERMANAGEMENTDIALOG_H - -#include "ui_divecomputermanagementdialog.h" -#include "qt-models/divecomputermodel.h" -#include -#include - -class QModelIndex; - -class DiveComputerManagementDialog : public QDialog { - Q_OBJECT - -public: - static DiveComputerManagementDialog *instance(); - void init(); - -public -slots: - void tryRemove(const QModelIndex &index); - void accept(); - void reject(); - -private: - explicit DiveComputerManagementDialog(QWidget *parent = 0, Qt::WindowFlags f = 0); - Ui::DiveComputerManagementDialog ui; - std::unique_ptr model; - DiveComputerSortedModel proxyModel; -}; - -#endif // DIVECOMPUTERMANAGEMENTDIALOG_H diff --git a/desktop-widgets/divecomputermanagementdialog.ui b/desktop-widgets/divecomputermanagementdialog.ui deleted file mode 100644 index 0533f681d..000000000 --- a/desktop-widgets/divecomputermanagementdialog.ui +++ /dev/null @@ -1,81 +0,0 @@ - - - DiveComputerManagementDialog - - - Qt::WindowModal - - - - 0 - 0 - 560 - 300 - - - - Edit dive computer nicknames - - - - :subsurface-icon - - - - - - - true - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - - - buttonBox - accepted() - DiveComputerManagementDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - DiveComputerManagementDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index b1307593a..74dd166e6 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -37,7 +37,6 @@ #include "core/settings/qPrefTechnicalDetails.h" #include "desktop-widgets/about.h" -#include "desktop-widgets/divecomputermanagementdialog.h" #include "desktop-widgets/divelistview.h" #include "desktop-widgets/divelogexportdialog.h" #include "desktop-widgets/divelogimportdialog.h" @@ -748,12 +747,6 @@ void MainWindow::on_actionDivelogs_de_triggered() DivelogsDeWebServices::instance()->downloadDives(); } -void MainWindow::on_actionEditDeviceNames_triggered() -{ - DiveComputerManagementDialog::instance()->init(); - DiveComputerManagementDialog::instance()->show(); -} - bool MainWindow::plannerStateClean() { if (progressDialog) diff --git a/desktop-widgets/mainwindow.h b/desktop-widgets/mainwindow.h index d7a8acf08..4785760a5 100644 --- a/desktop-widgets/mainwindow.h +++ b/desktop-widgets/mainwindow.h @@ -107,7 +107,6 @@ slots: /* log menu actions */ void on_actionDownloadDC_triggered(); void on_actionDivelogs_de_triggered(); - void on_actionEditDeviceNames_triggered(); void on_actionAddDive_triggered(); void on_actionRenumber_triggered(); void on_actionAutoGroup_triggered(); diff --git a/desktop-widgets/mainwindow.ui b/desktop-widgets/mainwindow.ui index 5b9e318f5..071e4fe53 100644 --- a/desktop-widgets/mainwindow.ui +++ b/desktop-widgets/mainwindow.ui @@ -96,7 +96,6 @@ - @@ -237,11 +236,6 @@ Ctrl+D - - - Edit device &names - - &Add dive -- cgit v1.2.3-70-g09d2