mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 13:10:19 +00:00
56dcbd9588
Implement a dive site addition undo command and connect it to the add dive site button. The added dive site has a default name ("new dive site"). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
35 lines
912 B
C++
35 lines
912 B
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#include "TabDiveSite.h"
|
|
#include "qt-models/divelocationmodel.h"
|
|
#include "desktop-widgets/command.h"
|
|
|
|
#include <qt-models/divecomputerextradatamodel.h>
|
|
|
|
TabDiveSite::TabDiveSite(QWidget *parent) : TabBase(parent)
|
|
{
|
|
ui.setupUi(this);
|
|
ui.diveSites->setTitle(tr("Dive sites"));
|
|
ui.diveSites->setModel(&model);
|
|
// Default: sort by name
|
|
ui.diveSites->view()->sortByColumn(LocationInformationModel::NAME, Qt::AscendingOrder);
|
|
ui.diveSites->view()->setSortingEnabled(true);
|
|
|
|
// Show only the first few columns
|
|
for (int i = LocationInformationModel::COORDS; i < LocationInformationModel::COLUMNS; ++i)
|
|
ui.diveSites->view()->setColumnHidden(i, true);
|
|
|
|
connect(ui.diveSites, &TableView::addButtonClicked, this, &TabDiveSite::add);
|
|
}
|
|
|
|
void TabDiveSite::updateData()
|
|
{
|
|
}
|
|
|
|
void TabDiveSite::clear()
|
|
{
|
|
}
|
|
|
|
void TabDiveSite::add()
|
|
{
|
|
Command::addDiveSite(tr("New dive site"));
|
|
}
|