summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-10-21 23:17:37 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-10-25 13:59:04 -0700
commit8a20d019c236eeebc3a6d3540936bb209d350510 (patch)
tree052a33891e031e4ef8f2933b0e3d3219cf1aa339
parentc6188bbe47469d72bcb9afba69eb27fb39646cc1 (diff)
downloadsubsurface-8a20d019c236eeebc3a6d3540936bb209d350510.tar.gz
desktop: remove DiveComputerManagementDialog
This is now done in a TabWidget with undo-support. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r--desktop-widgets/CMakeLists.txt3
-rw-r--r--desktop-widgets/divecomputermanagementdialog.cpp51
-rw-r--r--desktop-widgets/divecomputermanagementdialog.h32
-rw-r--r--desktop-widgets/divecomputermanagementdialog.ui81
-rw-r--r--desktop-widgets/mainwindow.cpp7
-rw-r--r--desktop-widgets/mainwindow.h1
-rw-r--r--desktop-widgets/mainwindow.ui6
7 files changed, 0 insertions, 181 deletions
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 <QMessageBox>
-#include <QShortcut>
-
-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 <QDialog>
-#include <memory>
-
-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<DiveComputerModel> 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 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>DiveComputerManagementDialog</class>
- <widget class="QDialog" name="DiveComputerManagementDialog">
- <property name="windowModality">
- <enum>Qt::WindowModal</enum>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>560</width>
- <height>300</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Edit dive computer nicknames</string>
- </property>
- <property name="windowIcon">
- <iconset>
- <normalon>:subsurface-icon</normalon>
- </iconset>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QTableView" name="tableView">
- <attribute name="horizontalHeaderStretchLastSection">
- <bool>true</bool>
- </attribute>
- </widget>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources>
- <include location="../subsurface.qrc"/>
- </resources>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>DiveComputerManagementDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>248</x>
- <y>254</y>
- </hint>
- <hint type="destinationlabel">
- <x>157</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>DiveComputerManagementDialog</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>316</x>
- <y>260</y>
- </hint>
- <hint type="destinationlabel">
- <x>286</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
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 @@
<addaction name="actionRenumber"/>
<addaction name="actionAutoGroup"/>
<addaction name="separator"/>
- <addaction name="actionEditDeviceNames"/>
<addaction name="actionFilterTags"/>
</widget>
<widget class="QMenu" name="menuView">
@@ -237,11 +236,6 @@
<string notr="true">Ctrl+D</string>
</property>
</action>
- <action name="actionEditDeviceNames">
- <property name="text">
- <string>Edit device &amp;names</string>
- </property>
- </action>
<action name="actionAddDive">
<property name="text">
<string>&amp;Add dive</string>