desktop: remove DiveComputerManagementDialog

This is now done in a TabWidget with undo-support.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-10-21 23:17:37 +02:00 committed by Dirk Hohndel
parent c6188bbe47
commit 8a20d019c2
7 changed files with 0 additions and 181 deletions

View file

@ -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

View file

@ -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();
}

View file

@ -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

View file

@ -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>

View file

@ -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)

View file

@ -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();

View file

@ -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>