2017-04-27 18:26:05 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2016-04-05 05:02:03 +00:00
|
|
|
#include "desktop-widgets/locationinformation.h"
|
2018-05-11 15:25:41 +00:00
|
|
|
#include "core/subsurface-string.h"
|
2016-04-05 05:02:03 +00:00
|
|
|
#include "desktop-widgets/mainwindow.h"
|
|
|
|
#include "desktop-widgets/divelistview.h"
|
|
|
|
#include "core/qthelper.h"
|
2017-07-15 20:52:59 +00:00
|
|
|
#include "desktop-widgets/mapwidget.h"
|
2016-04-05 05:02:03 +00:00
|
|
|
#include "qt-models/filtermodels.h"
|
|
|
|
#include "core/divesitehelpers.h"
|
|
|
|
#include "desktop-widgets/modeldelegates.h"
|
2015-08-25 21:45:29 +00:00
|
|
|
|
2015-05-17 19:13:41 +00:00
|
|
|
#include <QDebug>
|
|
|
|
#include <QShowEvent>
|
2015-09-01 00:11:28 +00:00
|
|
|
#include <QItemSelectionModel>
|
2015-09-01 01:01:25 +00:00
|
|
|
#include <qmessagebox.h>
|
2015-09-01 00:35:17 +00:00
|
|
|
#include <cstdlib>
|
2015-09-21 19:08:58 +00:00
|
|
|
#include <QDesktopWidget>
|
|
|
|
#include <QScrollBar>
|
2015-05-17 19:13:41 +00:00
|
|
|
|
2018-10-13 11:14:48 +00:00
|
|
|
LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBox(parent), modified(false), diveSite(nullptr)
|
2015-05-17 19:13:41 +00:00
|
|
|
{
|
2018-10-13 09:52:59 +00:00
|
|
|
memset(&taxonomy, 0, sizeof(taxonomy));
|
2015-05-17 19:13:41 +00:00
|
|
|
ui.setupUi(this);
|
|
|
|
ui.diveSiteMessage->setCloseButtonVisible(false);
|
|
|
|
|
|
|
|
acceptAction = new QAction(tr("Apply changes"), this);
|
|
|
|
connect(acceptAction, SIGNAL(triggered(bool)), this, SLOT(acceptChanges()));
|
|
|
|
|
|
|
|
rejectAction = new QAction(tr("Discard changes"), this);
|
|
|
|
connect(rejectAction, SIGNAL(triggered(bool)), this, SLOT(rejectChanges()));
|
|
|
|
|
|
|
|
ui.diveSiteMessage->setText(tr("Dive site management"));
|
2015-06-04 03:18:25 +00:00
|
|
|
ui.diveSiteMessage->addAction(acceptAction);
|
|
|
|
ui.diveSiteMessage->addAction(rejectAction);
|
2015-05-17 19:13:41 +00:00
|
|
|
|
2015-05-26 20:42:45 +00:00
|
|
|
connect(this, SIGNAL(startFilterDiveSite(uint32_t)), MultiFilterSortModel::instance(), SLOT(startFilterDiveSite(uint32_t)));
|
|
|
|
connect(this, SIGNAL(stopFilterDiveSite()), MultiFilterSortModel::instance(), SLOT(stopFilterDiveSite()));
|
2015-08-25 21:45:29 +00:00
|
|
|
connect(ui.geoCodeButton, SIGNAL(clicked()), this, SLOT(reverseGeocode()));
|
2017-11-26 09:42:22 +00:00
|
|
|
connect(this, SIGNAL(nameChanged(const QString &, const QString &)),
|
|
|
|
LocationFilterModel::instance(), SLOT(changeName(const QString &, const QString &)));
|
2017-11-26 22:26:46 +00:00
|
|
|
connect(ui.updateLocationButton, SIGNAL(clicked()), this, SLOT(updateLocationOnMap()));
|
|
|
|
connect(ui.diveSiteCoordinates, SIGNAL(returnPressed()), this, SLOT(updateLocationOnMap()));
|
|
|
|
ui.diveSiteCoordinates->installEventFilter(this);
|
2015-07-31 01:10:01 +00:00
|
|
|
|
2018-10-08 17:01:45 +00:00
|
|
|
ui.diveSiteListView->setModel(&filter_model);
|
2015-09-01 00:03:31 +00:00
|
|
|
ui.diveSiteListView->setModelColumn(LocationInformationModel::NAME);
|
2015-09-01 00:11:28 +00:00
|
|
|
ui.diveSiteListView->installEventFilter(this);
|
2017-07-15 20:52:59 +00:00
|
|
|
// Map Management Code.
|
|
|
|
connect(MapWidget::instance(), &MapWidget::coordinatesChanged,
|
|
|
|
this, &LocationInformationWidget::updateGpsCoordinates);
|
2015-05-17 20:14:23 +00:00
|
|
|
}
|
|
|
|
|
2017-11-26 22:26:46 +00:00
|
|
|
bool LocationInformationWidget::eventFilter(QObject *object, QEvent *ev)
|
2015-09-01 00:11:28 +00:00
|
|
|
{
|
2015-09-29 23:57:53 +00:00
|
|
|
if (ev->type() == QEvent::ContextMenu) {
|
|
|
|
QContextMenuEvent *ctx = (QContextMenuEvent *)ev;
|
2015-09-04 10:23:19 +00:00
|
|
|
QMenu contextMenu;
|
|
|
|
contextMenu.addAction(tr("Merge into current site"), this, SLOT(mergeSelectedDiveSites()));
|
|
|
|
contextMenu.exec(ctx->globalPos());
|
|
|
|
return true;
|
2017-11-26 22:26:46 +00:00
|
|
|
} else if (ev->type() == QEvent::FocusOut && object == ui.diveSiteCoordinates) {
|
2018-10-08 10:57:46 +00:00
|
|
|
updateLocationOnMap();
|
2015-09-01 00:11:28 +00:00
|
|
|
}
|
2015-09-01 02:24:36 +00:00
|
|
|
return false;
|
2015-09-01 00:11:28 +00:00
|
|
|
}
|
|
|
|
|
2017-11-26 22:26:46 +00:00
|
|
|
void LocationInformationWidget::enableLocationButtons(bool enable)
|
|
|
|
{
|
|
|
|
ui.geoCodeButton->setEnabled(enable);
|
|
|
|
ui.updateLocationButton->setEnabled(enable);
|
|
|
|
}
|
|
|
|
|
2015-09-29 23:57:53 +00:00
|
|
|
void LocationInformationWidget::mergeSelectedDiveSites()
|
|
|
|
{
|
2018-10-13 11:14:48 +00:00
|
|
|
if (!diveSite)
|
|
|
|
return;
|
2015-09-01 01:01:25 +00:00
|
|
|
if (QMessageBox::warning(MainWindow::instance(), tr("Merging dive sites"),
|
2015-09-29 23:57:53 +00:00
|
|
|
tr("You are about to merge dive sites, you can't undo that action \n Are you sure you want to continue?"),
|
|
|
|
QMessageBox::Ok, QMessageBox::Cancel) != QMessageBox::Ok)
|
2015-09-01 01:01:25 +00:00
|
|
|
return;
|
|
|
|
|
2015-09-01 00:35:17 +00:00
|
|
|
QModelIndexList selection = ui.diveSiteListView->selectionModel()->selectedIndexes();
|
2015-09-29 23:57:53 +00:00
|
|
|
uint32_t *selected_dive_sites = (uint32_t *)malloc(sizeof(uint32_t) * selection.count());
|
2015-09-01 00:35:17 +00:00
|
|
|
int i = 0;
|
2015-09-29 23:57:53 +00:00
|
|
|
Q_FOREACH (const QModelIndex &idx, selection) {
|
|
|
|
selected_dive_sites[i] = (uint32_t)idx.data(LocationInformationModel::UUID_ROLE).toInt();
|
2015-09-01 01:01:25 +00:00
|
|
|
i++;
|
2015-09-01 00:35:17 +00:00
|
|
|
}
|
2018-10-13 11:14:48 +00:00
|
|
|
merge_dive_sites(diveSite->uuid, selected_dive_sites, i);
|
2015-09-01 01:01:25 +00:00
|
|
|
LocationInformationModel::instance()->update();
|
2015-09-29 23:57:53 +00:00
|
|
|
QSortFilterProxyModel *m = (QSortFilterProxyModel *)ui.diveSiteListView->model();
|
2015-09-01 01:01:25 +00:00
|
|
|
m->invalidate();
|
2015-09-01 00:35:17 +00:00
|
|
|
free(selected_dive_sites);
|
|
|
|
}
|
|
|
|
|
2015-07-25 16:03:14 +00:00
|
|
|
void LocationInformationWidget::updateLabels()
|
2015-05-17 19:13:41 +00:00
|
|
|
{
|
2018-10-13 11:14:48 +00:00
|
|
|
if (!diveSite) {
|
|
|
|
clearLabels();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (diveSite->name)
|
|
|
|
ui.diveSiteName->setText(diveSite->name);
|
2015-05-17 19:13:41 +00:00
|
|
|
else
|
|
|
|
ui.diveSiteName->clear();
|
2018-10-13 09:52:59 +00:00
|
|
|
const char *country = taxonomy_get_country(&taxonomy);
|
2017-10-03 06:03:44 +00:00
|
|
|
if (country)
|
|
|
|
ui.diveSiteCountry->setText(country);
|
2017-10-02 15:51:20 +00:00
|
|
|
else
|
|
|
|
ui.diveSiteCountry->clear();
|
2018-10-13 11:14:48 +00:00
|
|
|
if (diveSite->description)
|
|
|
|
ui.diveSiteDescription->setText(diveSite->description);
|
2015-05-17 19:13:41 +00:00
|
|
|
else
|
|
|
|
ui.diveSiteDescription->clear();
|
2018-10-13 11:14:48 +00:00
|
|
|
if (diveSite->notes)
|
|
|
|
ui.diveSiteNotes->setPlainText(diveSite->notes);
|
2015-05-17 19:13:41 +00:00
|
|
|
else
|
|
|
|
ui.diveSiteNotes->clear();
|
2018-10-13 11:14:48 +00:00
|
|
|
if (diveSite->latitude.udeg || diveSite->longitude.udeg) {
|
|
|
|
const char *coords = printGPSCoords(diveSite->latitude.udeg, diveSite->longitude.udeg);
|
2015-10-02 01:00:38 +00:00
|
|
|
ui.diveSiteCoordinates->setText(coords);
|
|
|
|
free((void *)coords);
|
|
|
|
} else {
|
2015-05-17 19:13:41 +00:00
|
|
|
ui.diveSiteCoordinates->clear();
|
2015-10-02 01:00:38 +00:00
|
|
|
}
|
2015-10-07 23:00:22 +00:00
|
|
|
|
2018-10-13 09:52:59 +00:00
|
|
|
ui.locationTags->setText(constructLocationTags(&taxonomy, false));
|
2015-05-17 19:13:41 +00:00
|
|
|
}
|
|
|
|
|
2017-10-06 19:06:13 +00:00
|
|
|
void LocationInformationWidget::clearLabels()
|
|
|
|
{
|
|
|
|
ui.diveSiteName->clear();
|
|
|
|
ui.diveSiteCountry->clear();
|
|
|
|
ui.diveSiteDescription->clear();
|
|
|
|
ui.diveSiteNotes->clear();
|
|
|
|
ui.diveSiteCoordinates->clear();
|
|
|
|
ui.locationTags->clear();
|
|
|
|
}
|
|
|
|
|
2018-10-08 11:51:57 +00:00
|
|
|
void LocationInformationWidget::updateGpsCoordinates(degrees_t latitude, degrees_t longitude)
|
2015-05-17 19:13:41 +00:00
|
|
|
{
|
2015-07-31 01:41:02 +00:00
|
|
|
QString oldText = ui.diveSiteCoordinates->text();
|
2018-10-08 11:51:57 +00:00
|
|
|
const char *coords = printGPSCoords(latitude.udeg, longitude.udeg);
|
2015-10-02 01:00:38 +00:00
|
|
|
ui.diveSiteCoordinates->setText(coords);
|
2018-10-13 10:30:32 +00:00
|
|
|
enableLocationButtons(latitude.udeg || longitude.udeg);
|
2015-10-02 01:00:38 +00:00
|
|
|
free((void *)coords);
|
2015-07-31 01:41:02 +00:00
|
|
|
if (oldText != ui.diveSiteCoordinates->text())
|
|
|
|
markChangedWidget(ui.diveSiteCoordinates);
|
2015-05-17 19:13:41 +00:00
|
|
|
}
|
|
|
|
|
2018-10-13 10:30:32 +00:00
|
|
|
// Parse GPS text into latitude and longitude.
|
|
|
|
// On error, false is returned and the output parameters are left unmodified.
|
|
|
|
bool parseGpsText(const QString &text, degrees_t &latitude, degrees_t &longitude)
|
|
|
|
{
|
|
|
|
double lat, lon;
|
|
|
|
if (parseGpsText(text, &lat, &lon)) {
|
|
|
|
latitude.udeg = lrint(lat * 1000000.0);
|
|
|
|
longitude.udeg = lrint(lon * 1000000.0);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-05-17 19:13:41 +00:00
|
|
|
void LocationInformationWidget::acceptChanges()
|
|
|
|
{
|
2018-10-13 11:14:48 +00:00
|
|
|
if (!diveSite) {
|
2017-10-07 06:00:17 +00:00
|
|
|
qWarning() << "did not have valid dive site in LocationInformationWidget";
|
2018-10-13 11:14:48 +00:00
|
|
|
return;
|
2017-10-07 06:00:17 +00:00
|
|
|
}
|
2018-10-13 11:14:48 +00:00
|
|
|
|
|
|
|
char *uiString;
|
|
|
|
uiString = copy_qstring(ui.diveSiteName->text());
|
|
|
|
if (!same_string(uiString, diveSite->name)) {
|
|
|
|
emit nameChanged(QString(diveSite->name), ui.diveSiteName->text());
|
|
|
|
free(diveSite->name);
|
|
|
|
diveSite->name = uiString;
|
2017-10-08 00:03:53 +00:00
|
|
|
} else {
|
|
|
|
free(uiString);
|
2015-05-17 19:13:41 +00:00
|
|
|
}
|
2018-02-28 22:37:09 +00:00
|
|
|
uiString = copy_qstring(ui.diveSiteDescription->text());
|
2018-10-13 11:14:48 +00:00
|
|
|
if (!same_string(uiString, diveSite->description)) {
|
|
|
|
free(diveSite->description);
|
|
|
|
diveSite->description = uiString;
|
2017-10-08 00:03:53 +00:00
|
|
|
} else {
|
|
|
|
free(uiString);
|
2015-05-17 19:13:41 +00:00
|
|
|
}
|
2018-02-28 22:37:09 +00:00
|
|
|
uiString = copy_qstring(ui.diveSiteCountry->text());
|
2018-10-13 09:52:59 +00:00
|
|
|
// if the user entered a different country, first update the local taxonomy
|
2018-10-13 11:14:48 +00:00
|
|
|
// this below will get copied into the diveSite
|
2018-10-13 09:52:59 +00:00
|
|
|
if (!same_string(uiString, taxonomy_get_country(&taxonomy)) &&
|
2018-01-07 10:12:48 +00:00
|
|
|
!empty_string(uiString))
|
2018-10-13 09:52:59 +00:00
|
|
|
taxonomy_set_country(&taxonomy, uiString, taxonomy_origin::GEOMANUAL);
|
2017-10-08 00:03:53 +00:00
|
|
|
else
|
|
|
|
free(uiString);
|
2018-10-13 11:14:48 +00:00
|
|
|
// now update the diveSite
|
|
|
|
copy_taxonomy(&taxonomy, &diveSite->taxonomy);
|
2017-10-03 06:03:44 +00:00
|
|
|
|
2018-02-28 22:37:09 +00:00
|
|
|
uiString = copy_qstring(ui.diveSiteNotes->document()->toPlainText());
|
2018-10-13 11:14:48 +00:00
|
|
|
if (!same_string(uiString, diveSite->notes)) {
|
|
|
|
free(diveSite->notes);
|
|
|
|
diveSite->notes = uiString;
|
2017-10-08 00:03:53 +00:00
|
|
|
} else {
|
|
|
|
free(uiString);
|
2015-05-17 19:13:41 +00:00
|
|
|
}
|
2017-10-08 00:03:53 +00:00
|
|
|
|
2018-10-13 10:30:32 +00:00
|
|
|
if (!ui.diveSiteCoordinates->text().isEmpty())
|
2018-10-13 11:14:48 +00:00
|
|
|
parseGpsText(ui.diveSiteCoordinates->text(), diveSite->latitude, diveSite->longitude);
|
|
|
|
if (dive_site_is_empty(diveSite)) {
|
|
|
|
LocationInformationModel::instance()->removeRow(get_divesite_idx(diveSite));
|
2015-05-17 19:13:41 +00:00
|
|
|
displayed_dive.dive_site_uuid = 0;
|
2018-10-13 11:14:48 +00:00
|
|
|
diveSite = nullptr;
|
2015-05-17 19:13:41 +00:00
|
|
|
}
|
|
|
|
mark_divelist_changed(true);
|
|
|
|
resetState();
|
|
|
|
}
|
|
|
|
|
|
|
|
void LocationInformationWidget::rejectChanges()
|
|
|
|
{
|
|
|
|
resetState();
|
|
|
|
}
|
|
|
|
|
2018-10-13 06:57:46 +00:00
|
|
|
void LocationInformationWidget::initFields(dive_site *ds)
|
2015-05-17 20:14:23 +00:00
|
|
|
{
|
2018-10-13 11:14:48 +00:00
|
|
|
diveSite = ds;
|
2018-10-13 06:57:46 +00:00
|
|
|
if (ds) {
|
2018-10-13 09:52:59 +00:00
|
|
|
copy_taxonomy(&ds->taxonomy, &taxonomy);
|
2018-10-13 11:14:48 +00:00
|
|
|
filter_model.set(ds->uuid, ds->latitude, ds->longitude);
|
2015-07-25 16:03:14 +00:00
|
|
|
updateLabels();
|
2018-10-13 11:14:48 +00:00
|
|
|
enableLocationButtons(dive_site_has_gps_location(ds));
|
2015-09-29 23:57:53 +00:00
|
|
|
QSortFilterProxyModel *m = qobject_cast<QSortFilterProxyModel *>(ui.diveSiteListView->model());
|
2018-10-13 11:14:48 +00:00
|
|
|
emit startFilterDiveSite(ds->uuid);
|
2015-08-31 23:59:13 +00:00
|
|
|
if (m)
|
|
|
|
m->invalidate();
|
2017-10-06 19:06:13 +00:00
|
|
|
} else {
|
2018-10-13 11:14:48 +00:00
|
|
|
free_taxonomy(&taxonomy);
|
2018-10-08 17:01:45 +00:00
|
|
|
filter_model.set(0, degrees_t{ 0 }, degrees_t{ 0 });
|
2017-10-06 19:06:13 +00:00
|
|
|
clearLabels();
|
2015-07-31 01:10:01 +00:00
|
|
|
}
|
2018-10-13 11:14:48 +00:00
|
|
|
MapWidget::instance()->prepareForGetDiveCoordinates(ds ? ds->uuid : 0);
|
2015-05-17 19:13:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void LocationInformationWidget::markChangedWidget(QWidget *w)
|
|
|
|
{
|
|
|
|
QPalette p;
|
|
|
|
qreal h, s, l, a;
|
|
|
|
if (!modified)
|
|
|
|
enableEdition();
|
|
|
|
qApp->palette().color(QPalette::Text).getHslF(&h, &s, &l, &a);
|
2015-09-29 23:57:53 +00:00
|
|
|
p.setBrush(QPalette::Base, (l <= 0.3) ? QColor(Qt::yellow).lighter() : (l <= 0.6) ? QColor(Qt::yellow).light() : /* else */ QColor(Qt::yellow).darker(300));
|
2015-05-17 19:13:41 +00:00
|
|
|
w->setPalette(p);
|
|
|
|
modified = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void LocationInformationWidget::resetState()
|
|
|
|
{
|
|
|
|
modified = false;
|
|
|
|
resetPallete();
|
2018-10-12 14:13:42 +00:00
|
|
|
MainWindow::instance()->diveList->setEnabled(true);
|
2015-05-17 19:13:41 +00:00
|
|
|
MainWindow::instance()->setEnabledToolbar(true);
|
|
|
|
ui.diveSiteMessage->setText(tr("Dive site management"));
|
2018-10-08 13:43:06 +00:00
|
|
|
MapWidget::instance()->endGetDiveCoordinates();
|
|
|
|
MapWidget::instance()->repopulateLabels();
|
|
|
|
emit stopFilterDiveSite();
|
|
|
|
emit endEditDiveSite();
|
|
|
|
updateLocationOnMap();
|
2015-05-17 19:13:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void LocationInformationWidget::enableEdition()
|
|
|
|
{
|
2018-10-12 14:13:42 +00:00
|
|
|
MainWindow::instance()->diveList->setEnabled(false);
|
2015-05-17 19:13:41 +00:00
|
|
|
MainWindow::instance()->setEnabledToolbar(false);
|
|
|
|
ui.diveSiteMessage->setText(tr("You are editing a dive site"));
|
|
|
|
}
|
|
|
|
|
2015-09-29 23:57:53 +00:00
|
|
|
void LocationInformationWidget::on_diveSiteCoordinates_textChanged(const QString &text)
|
2015-05-17 19:13:41 +00:00
|
|
|
{
|
2018-10-13 11:14:48 +00:00
|
|
|
if (!diveSite)
|
|
|
|
return;
|
2018-10-13 10:30:32 +00:00
|
|
|
degrees_t latitude, longitude;
|
2018-10-13 11:14:48 +00:00
|
|
|
bool ok_old = diveSite->latitude.udeg || diveSite->longitude.udeg;
|
2018-10-13 10:30:32 +00:00
|
|
|
bool ok = parseGpsText(text, latitude, longitude);
|
2018-10-13 11:14:48 +00:00
|
|
|
if (ok != ok_old || latitude.udeg != diveSite->latitude.udeg || longitude.udeg != diveSite->longitude.udeg) {
|
2018-10-13 10:30:32 +00:00
|
|
|
if (ok) {
|
2015-05-22 18:56:03 +00:00
|
|
|
markChangedWidget(ui.diveSiteCoordinates);
|
2018-10-13 10:30:32 +00:00
|
|
|
enableLocationButtons(true);
|
|
|
|
filter_model.setCoordinates(latitude, longitude);
|
2015-10-13 20:34:16 +00:00
|
|
|
} else {
|
2017-11-26 22:26:46 +00:00
|
|
|
enableLocationButtons(false);
|
2015-05-22 18:56:03 +00:00
|
|
|
}
|
|
|
|
}
|
2015-05-17 19:13:41 +00:00
|
|
|
}
|
|
|
|
|
2017-10-02 15:51:20 +00:00
|
|
|
void LocationInformationWidget::on_diveSiteCountry_textChanged(const QString& text)
|
|
|
|
{
|
2018-10-13 09:52:59 +00:00
|
|
|
if (!same_string(qPrintable(text), taxonomy_get_country(&taxonomy)))
|
2017-10-02 15:51:20 +00:00
|
|
|
markChangedWidget(ui.diveSiteCountry);
|
|
|
|
}
|
|
|
|
|
2015-09-29 23:57:53 +00:00
|
|
|
void LocationInformationWidget::on_diveSiteDescription_textChanged(const QString &text)
|
2015-05-17 19:13:41 +00:00
|
|
|
{
|
2018-10-13 11:14:48 +00:00
|
|
|
if (diveSite && !same_string(qPrintable(text), diveSite->description))
|
2015-05-17 19:13:41 +00:00
|
|
|
markChangedWidget(ui.diveSiteDescription);
|
|
|
|
}
|
|
|
|
|
2015-09-29 23:57:53 +00:00
|
|
|
void LocationInformationWidget::on_diveSiteName_textChanged(const QString &text)
|
2015-05-17 19:13:41 +00:00
|
|
|
{
|
2018-10-13 11:14:48 +00:00
|
|
|
if (diveSite && !same_string(qPrintable(text), diveSite->name))
|
2015-05-17 19:13:41 +00:00
|
|
|
markChangedWidget(ui.diveSiteName);
|
|
|
|
}
|
|
|
|
|
|
|
|
void LocationInformationWidget::on_diveSiteNotes_textChanged()
|
|
|
|
{
|
2018-10-13 11:14:48 +00:00
|
|
|
if (diveSite && !same_string(qPrintable(ui.diveSiteNotes->toPlainText()), diveSite->notes))
|
2015-05-17 19:13:41 +00:00
|
|
|
markChangedWidget(ui.diveSiteNotes);
|
|
|
|
}
|
|
|
|
|
|
|
|
void LocationInformationWidget::resetPallete()
|
|
|
|
{
|
|
|
|
QPalette p;
|
|
|
|
ui.diveSiteCoordinates->setPalette(p);
|
|
|
|
ui.diveSiteDescription->setPalette(p);
|
2017-10-02 15:51:20 +00:00
|
|
|
ui.diveSiteCountry->setPalette(p);
|
2015-05-17 19:13:41 +00:00
|
|
|
ui.diveSiteName->setPalette(p);
|
|
|
|
ui.diveSiteNotes->setPalette(p);
|
|
|
|
}
|
2015-06-26 16:23:53 +00:00
|
|
|
|
2015-08-25 21:45:29 +00:00
|
|
|
void LocationInformationWidget::reverseGeocode()
|
|
|
|
{
|
2018-10-13 10:30:32 +00:00
|
|
|
degrees_t latitude, longitude;
|
|
|
|
if (!parseGpsText(ui.diveSiteCoordinates->text(), latitude, longitude))
|
|
|
|
return;
|
|
|
|
reverseGeoLookup(latitude, longitude, &taxonomy);
|
|
|
|
ui.locationTags->setText(constructLocationTags(&taxonomy, false));
|
2015-08-25 21:45:29 +00:00
|
|
|
}
|
2015-09-21 17:01:58 +00:00
|
|
|
|
2017-11-26 22:26:46 +00:00
|
|
|
void LocationInformationWidget::updateLocationOnMap()
|
|
|
|
{
|
2018-10-13 11:14:48 +00:00
|
|
|
if (!diveSite)
|
2018-10-08 17:01:45 +00:00
|
|
|
return;
|
2018-10-13 10:30:32 +00:00
|
|
|
degrees_t latitude, longitude;
|
|
|
|
if (!parseGpsText(ui.diveSiteCoordinates->text(), latitude, longitude))
|
|
|
|
return;
|
2018-10-13 11:14:48 +00:00
|
|
|
MapWidget::instance()->updateDiveSiteCoordinates(diveSite->uuid, latitude, longitude);
|
2018-10-13 10:30:32 +00:00
|
|
|
filter_model.setCoordinates(latitude, longitude);
|
2017-11-26 22:26:46 +00:00
|
|
|
}
|
|
|
|
|
2018-05-21 16:09:09 +00:00
|
|
|
DiveLocationFilterProxyModel::DiveLocationFilterProxyModel(QObject*)
|
2015-09-21 17:01:58 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
DiveLocationLineEdit *location_line_edit = 0;
|
|
|
|
|
2018-05-21 16:09:09 +00:00
|
|
|
bool DiveLocationFilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex&) const
|
2015-09-21 17:01:58 +00:00
|
|
|
{
|
2015-09-29 23:57:53 +00:00
|
|
|
if (source_row == 0)
|
2015-09-21 17:01:58 +00:00
|
|
|
return true;
|
|
|
|
|
2018-10-09 10:26:58 +00:00
|
|
|
QString sourceString = sourceModel()->index(source_row, LocationInformationModel::NAME).data(Qt::DisplayRole).toString();
|
2015-11-24 19:11:39 +00:00
|
|
|
return sourceString.toLower().contains(location_line_edit->text().toLower());
|
2015-09-21 17:01:58 +00:00
|
|
|
}
|
|
|
|
|
2015-09-29 23:57:53 +00:00
|
|
|
bool DiveLocationFilterProxyModel::lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const
|
2015-09-21 18:04:52 +00:00
|
|
|
{
|
2017-12-28 09:53:26 +00:00
|
|
|
return source_left.data().toString() < source_right.data().toString();
|
2015-09-21 18:04:52 +00:00
|
|
|
}
|
|
|
|
|
2018-05-21 16:09:09 +00:00
|
|
|
DiveLocationModel::DiveLocationModel(QObject*)
|
2015-09-21 17:01:58 +00:00
|
|
|
{
|
|
|
|
resetModel();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DiveLocationModel::resetModel()
|
|
|
|
{
|
|
|
|
beginResetModel();
|
|
|
|
endResetModel();
|
|
|
|
}
|
|
|
|
|
2015-09-29 23:57:53 +00:00
|
|
|
QVariant DiveLocationModel::data(const QModelIndex &index, int role) const
|
2015-09-21 17:01:58 +00:00
|
|
|
{
|
2017-11-29 09:57:08 +00:00
|
|
|
static const QIcon plusIcon(":list-add-icon");
|
|
|
|
static const QIcon geoCode(":geotag-icon");
|
2015-09-25 15:19:41 +00:00
|
|
|
|
2015-09-29 23:57:53 +00:00
|
|
|
if (index.row() <= 1) { // two special cases.
|
2018-10-09 10:26:58 +00:00
|
|
|
if (index.column() == LocationInformationModel::UUID) {
|
2015-09-22 19:36:17 +00:00
|
|
|
return RECENTLY_ADDED_DIVESITE;
|
|
|
|
}
|
2015-09-29 23:57:53 +00:00
|
|
|
switch (role) {
|
|
|
|
case Qt::DisplayRole:
|
|
|
|
return new_ds_value[index.row()];
|
|
|
|
case Qt::ToolTipRole:
|
2018-10-13 08:59:16 +00:00
|
|
|
return displayed_dive.dive_site_uuid ?
|
2015-09-30 22:33:33 +00:00
|
|
|
tr("Create a new dive site, copying relevant information from the current dive.") :
|
|
|
|
tr("Create a new dive site with this name");
|
2015-09-29 23:57:53 +00:00
|
|
|
case Qt::DecorationRole:
|
|
|
|
return plusIcon;
|
2015-09-21 17:01:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// The dive sites are -2 because of the first two items.
|
|
|
|
struct dive_site *ds = get_dive_site(index.row() - 2);
|
2018-10-09 10:26:58 +00:00
|
|
|
return LocationInformationModel::getDiveSiteData(ds, index.column(), role);
|
2015-09-21 17:01:58 +00:00
|
|
|
}
|
|
|
|
|
2018-05-21 16:09:09 +00:00
|
|
|
int DiveLocationModel::columnCount(const QModelIndex&) const
|
2015-09-21 17:01:58 +00:00
|
|
|
{
|
2018-10-09 10:26:58 +00:00
|
|
|
return LocationInformationModel::COLUMNS;
|
2015-09-21 17:01:58 +00:00
|
|
|
}
|
|
|
|
|
2018-05-21 16:09:09 +00:00
|
|
|
int DiveLocationModel::rowCount(const QModelIndex&) const
|
2015-09-21 17:01:58 +00:00
|
|
|
{
|
|
|
|
return dive_site_table.nr + 2;
|
|
|
|
}
|
|
|
|
|
2018-05-21 16:09:09 +00:00
|
|
|
bool DiveLocationModel::setData(const QModelIndex &index, const QVariant &value, int)
|
2015-09-21 17:01:58 +00:00
|
|
|
{
|
2015-09-29 23:57:53 +00:00
|
|
|
if (!index.isValid())
|
2015-09-21 17:01:58 +00:00
|
|
|
return false;
|
|
|
|
if (index.row() > 1)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
new_ds_value[index.row()] = value.toString();
|
|
|
|
|
|
|
|
dataChanged(index, index);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-09-22 17:31:56 +00:00
|
|
|
DiveLocationLineEdit::DiveLocationLineEdit(QWidget *parent) : QLineEdit(parent),
|
2015-09-29 23:57:53 +00:00
|
|
|
proxy(new DiveLocationFilterProxyModel()),
|
|
|
|
model(new DiveLocationModel()),
|
2015-10-02 19:22:55 +00:00
|
|
|
view(new DiveLocationListView()),
|
|
|
|
currType(NO_DIVE_SITE)
|
2015-09-21 17:01:58 +00:00
|
|
|
{
|
2015-09-24 07:12:18 +00:00
|
|
|
currUuid = 0;
|
2015-09-21 18:04:52 +00:00
|
|
|
location_line_edit = this;
|
2015-09-21 17:01:58 +00:00
|
|
|
|
|
|
|
proxy->setSourceModel(model);
|
2018-10-09 10:26:58 +00:00
|
|
|
proxy->setFilterKeyColumn(LocationInformationModel::NAME);
|
2015-09-21 19:51:39 +00:00
|
|
|
|
2015-09-21 18:04:52 +00:00
|
|
|
view->setModel(proxy);
|
2018-10-09 10:26:58 +00:00
|
|
|
view->setModelColumn(LocationInformationModel::NAME);
|
2015-09-21 18:04:52 +00:00
|
|
|
view->setItemDelegate(new LocationFilterDelegate());
|
2015-09-21 19:51:39 +00:00
|
|
|
view->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
|
|
|
view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
|
|
view->setSelectionBehavior(QAbstractItemView::SelectRows);
|
|
|
|
view->setSelectionMode(QAbstractItemView::SingleSelection);
|
|
|
|
view->setParent(0, Qt::Popup);
|
|
|
|
view->installEventFilter(this);
|
2015-09-22 17:31:56 +00:00
|
|
|
view->setFocusPolicy(Qt::NoFocus);
|
|
|
|
view->setFocusProxy(this);
|
2015-09-25 16:11:44 +00:00
|
|
|
view->setMouseTracking(true);
|
2015-09-21 19:51:39 +00:00
|
|
|
|
2015-09-21 17:01:58 +00:00
|
|
|
connect(this, &QLineEdit::textEdited, this, &DiveLocationLineEdit::setTemporaryDiveSiteName);
|
2015-09-21 20:18:52 +00:00
|
|
|
connect(view, &QAbstractItemView::activated, this, &DiveLocationLineEdit::itemActivated);
|
2015-09-25 16:11:44 +00:00
|
|
|
connect(view, &QAbstractItemView::entered, this, &DiveLocationLineEdit::entered);
|
2015-09-25 16:21:23 +00:00
|
|
|
connect(view, &DiveLocationListView::currentIndexChanged, this, &DiveLocationLineEdit::currentChanged);
|
2015-09-21 17:01:58 +00:00
|
|
|
}
|
|
|
|
|
2018-05-21 16:09:09 +00:00
|
|
|
bool DiveLocationLineEdit::eventFilter(QObject*, QEvent *e)
|
2015-09-21 19:51:39 +00:00
|
|
|
{
|
2015-09-29 23:57:53 +00:00
|
|
|
if (e->type() == QEvent::KeyPress) {
|
|
|
|
QKeyEvent *keyEv = (QKeyEvent *)e;
|
2015-09-21 19:51:39 +00:00
|
|
|
|
|
|
|
if (keyEv->key() == Qt::Key_Escape) {
|
|
|
|
view->hide();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-09-29 23:57:53 +00:00
|
|
|
if (keyEv->key() == Qt::Key_Return ||
|
|
|
|
keyEv->key() == Qt::Key_Enter) {
|
2015-10-25 01:38:16 +00:00
|
|
|
#if __APPLE__
|
|
|
|
// for some reason it seems like on a Mac hitting return/enter
|
|
|
|
// doesn't call 'activated' for that index. so let's do it manually
|
|
|
|
if (view->currentIndex().isValid())
|
|
|
|
itemActivated(view->currentIndex());
|
|
|
|
#endif
|
2015-09-21 19:51:39 +00:00
|
|
|
view->hide();
|
|
|
|
return false;
|
|
|
|
}
|
2015-09-22 19:27:07 +00:00
|
|
|
|
2015-09-29 23:57:53 +00:00
|
|
|
if (keyEv->key() == Qt::Key_Tab) {
|
|
|
|
itemActivated(view->currentIndex());
|
|
|
|
view->hide();
|
|
|
|
return false;
|
|
|
|
}
|
2015-09-21 20:11:59 +00:00
|
|
|
event(e);
|
2015-09-29 23:57:53 +00:00
|
|
|
} else if (e->type() == QEvent::MouseButtonPress) {
|
2015-09-22 17:31:56 +00:00
|
|
|
if (!view->underMouse()) {
|
|
|
|
view->hide();
|
|
|
|
return true;
|
|
|
|
}
|
2015-09-21 19:51:39 +00:00
|
|
|
}
|
2018-06-26 04:17:00 +00:00
|
|
|
else if (e->type() == QEvent::InputMethod) {
|
|
|
|
this->inputMethodEvent(static_cast<QInputMethodEvent *>(e));
|
|
|
|
}
|
2015-09-21 20:11:59 +00:00
|
|
|
|
2015-09-21 19:51:39 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-09-29 23:57:53 +00:00
|
|
|
void DiveLocationLineEdit::focusOutEvent(QFocusEvent *ev)
|
2015-09-22 18:23:38 +00:00
|
|
|
{
|
|
|
|
if (!view->isVisible()) {
|
|
|
|
QLineEdit::focusOutEvent(ev);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-29 23:57:53 +00:00
|
|
|
void DiveLocationLineEdit::itemActivated(const QModelIndex &index)
|
2015-09-21 20:18:52 +00:00
|
|
|
{
|
2015-10-05 21:01:28 +00:00
|
|
|
QModelIndex idx = index;
|
2018-10-09 10:26:58 +00:00
|
|
|
if (index.column() == LocationInformationModel::UUID)
|
|
|
|
idx = index.model()->index(index.row(), LocationInformationModel::NAME);
|
2015-10-05 21:01:28 +00:00
|
|
|
|
2018-10-09 10:26:58 +00:00
|
|
|
QModelIndex uuidIndex = index.model()->index(index.row(), LocationInformationModel::UUID);
|
2015-09-22 19:36:17 +00:00
|
|
|
uint32_t uuid = uuidIndex.data().toInt();
|
|
|
|
currType = uuid == 1 ? NEW_DIVE_SITE : EXISTING_DIVE_SITE;
|
|
|
|
currUuid = uuid;
|
2015-10-05 21:01:28 +00:00
|
|
|
setText(idx.data().toString());
|
2015-09-29 23:57:53 +00:00
|
|
|
if (currUuid == NEW_DIVE_SITE)
|
2015-09-22 20:20:55 +00:00
|
|
|
qDebug() << "Setting a New dive site";
|
|
|
|
else
|
|
|
|
qDebug() << "Setting a Existing dive site";
|
2015-09-29 23:57:53 +00:00
|
|
|
if (view->isVisible())
|
2015-09-23 16:56:49 +00:00
|
|
|
view->hide();
|
2015-09-23 17:46:29 +00:00
|
|
|
emit diveSiteSelected(currUuid);
|
2015-09-21 20:18:52 +00:00
|
|
|
}
|
|
|
|
|
2015-09-21 17:01:58 +00:00
|
|
|
void DiveLocationLineEdit::refreshDiveSiteCache()
|
|
|
|
{
|
|
|
|
model->resetModel();
|
|
|
|
}
|
|
|
|
|
2015-09-29 23:57:53 +00:00
|
|
|
static struct dive_site *get_dive_site_name_start_which_str(const QString &str)
|
|
|
|
{
|
2015-09-21 17:01:58 +00:00
|
|
|
struct dive_site *ds;
|
|
|
|
int i;
|
2015-09-29 23:57:53 +00:00
|
|
|
for_each_dive_site (i, ds) {
|
2015-09-21 17:01:58 +00:00
|
|
|
QString dsName(ds->name);
|
2015-09-21 18:04:52 +00:00
|
|
|
if (dsName.toLower().startsWith(str.toLower())) {
|
2015-09-21 17:01:58 +00:00
|
|
|
return ds;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2018-05-21 16:09:09 +00:00
|
|
|
void DiveLocationLineEdit::setTemporaryDiveSiteName(const QString&)
|
2015-09-21 17:01:58 +00:00
|
|
|
{
|
2018-10-08 20:23:47 +00:00
|
|
|
// This function fills the first two entries with potential names of
|
|
|
|
// a dive site to be generated. The first entry is simply the entered
|
|
|
|
// text. The second entry is the first known dive site name starting
|
|
|
|
// with the entered text.
|
2018-10-09 10:26:58 +00:00
|
|
|
QModelIndex i0 = model->index(0, LocationInformationModel::NAME);
|
|
|
|
QModelIndex i1 = model->index(1, LocationInformationModel::NAME);
|
2015-09-21 17:01:58 +00:00
|
|
|
model->setData(i0, text());
|
|
|
|
|
2018-10-08 20:23:47 +00:00
|
|
|
// Note: if i1_name stays empty, the line will automatically
|
|
|
|
// be filtered out by the proxy filter, as it does not contain
|
|
|
|
// the user entered text.
|
|
|
|
QString i1_name;
|
2015-09-21 18:04:52 +00:00
|
|
|
if (struct dive_site *ds = get_dive_site_name_start_which_str(text())) {
|
|
|
|
const QString orig_name = QString(ds->name).toLower();
|
|
|
|
const QString new_name = text().toLower();
|
|
|
|
if (new_name != orig_name)
|
|
|
|
i1_name = QString(ds->name);
|
|
|
|
}
|
|
|
|
|
2015-09-29 23:57:53 +00:00
|
|
|
model->setData(i1, i1_name);
|
2015-09-21 18:04:52 +00:00
|
|
|
proxy->invalidate();
|
2015-09-23 19:27:44 +00:00
|
|
|
fixPopupPosition();
|
|
|
|
if (!view->isVisible())
|
|
|
|
view->show();
|
2015-09-21 17:01:58 +00:00
|
|
|
}
|
|
|
|
|
2015-09-21 19:08:58 +00:00
|
|
|
void DiveLocationLineEdit::keyPressEvent(QKeyEvent *ev)
|
|
|
|
{
|
2015-09-21 20:22:31 +00:00
|
|
|
QLineEdit::keyPressEvent(ev);
|
2015-09-29 23:57:53 +00:00
|
|
|
if (ev->key() != Qt::Key_Left &&
|
|
|
|
ev->key() != Qt::Key_Right &&
|
|
|
|
ev->key() != Qt::Key_Escape &&
|
|
|
|
ev->key() != Qt::Key_Return) {
|
2015-09-22 20:20:55 +00:00
|
|
|
|
2015-09-29 23:57:53 +00:00
|
|
|
if (ev->key() != Qt::Key_Up && ev->key() != Qt::Key_Down) {
|
2015-09-22 20:20:55 +00:00
|
|
|
currType = NEW_DIVE_SITE;
|
|
|
|
currUuid = RECENTLY_ADDED_DIVESITE;
|
2015-09-23 19:27:44 +00:00
|
|
|
} else {
|
|
|
|
showPopup();
|
2015-09-22 20:20:55 +00:00
|
|
|
}
|
2015-09-21 19:51:39 +00:00
|
|
|
} else if (ev->key() == Qt::Key_Escape) {
|
|
|
|
view->hide();
|
2015-09-21 19:08:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-23 19:03:28 +00:00
|
|
|
void DiveLocationLineEdit::fixPopupPosition()
|
2015-09-21 19:08:58 +00:00
|
|
|
{
|
2015-09-22 17:13:51 +00:00
|
|
|
const QRect screen = QApplication::desktop()->availableGeometry(this);
|
|
|
|
const int maxVisibleItems = 5;
|
|
|
|
QPoint pos;
|
|
|
|
int rh, w;
|
|
|
|
int h = (view->sizeHintForRow(0) * qMin(maxVisibleItems, view->model()->rowCount()) + 3) + 3;
|
|
|
|
QScrollBar *hsb = view->horizontalScrollBar();
|
|
|
|
if (hsb && hsb->isVisible())
|
|
|
|
h += view->horizontalScrollBar()->sizeHint().height();
|
|
|
|
|
|
|
|
rh = height();
|
|
|
|
pos = mapToGlobal(QPoint(0, height() - 2));
|
|
|
|
w = width();
|
|
|
|
|
|
|
|
if (w > screen.width())
|
|
|
|
w = screen.width();
|
|
|
|
if ((pos.x() + w) > (screen.x() + screen.width()))
|
|
|
|
pos.setX(screen.x() + screen.width() - w);
|
|
|
|
if (pos.x() < screen.x())
|
|
|
|
pos.setX(screen.x());
|
|
|
|
|
|
|
|
int top = pos.y() - rh - screen.top() + 2;
|
|
|
|
int bottom = screen.bottom() - pos.y();
|
|
|
|
h = qMax(h, view->minimumHeight());
|
|
|
|
if (h > bottom) {
|
|
|
|
h = qMin(qMax(top, bottom), h);
|
|
|
|
if (top > bottom)
|
|
|
|
pos.setY(pos.y() - h - rh + 2);
|
|
|
|
}
|
2015-09-21 19:08:58 +00:00
|
|
|
|
2015-09-22 17:13:51 +00:00
|
|
|
view->setGeometry(pos.x(), pos.y(), w, h);
|
2015-10-01 19:27:22 +00:00
|
|
|
if (!view->currentIndex().isValid() && view->model()->rowCount()) {
|
2016-01-19 19:35:52 +00:00
|
|
|
view->setCurrentIndex(view->model()->index(0, 1));
|
2015-09-23 19:19:58 +00:00
|
|
|
}
|
2015-09-23 19:03:28 +00:00
|
|
|
}
|
2015-09-21 19:08:58 +00:00
|
|
|
|
2015-09-25 17:51:10 +00:00
|
|
|
void DiveLocationLineEdit::setCurrentDiveSiteUuid(uint32_t uuid)
|
|
|
|
{
|
|
|
|
currUuid = uuid;
|
2015-09-29 23:57:53 +00:00
|
|
|
if (uuid == 0) {
|
2015-09-25 17:51:10 +00:00
|
|
|
currType = NO_DIVE_SITE;
|
|
|
|
}
|
|
|
|
struct dive_site *ds = get_dive_site_by_uuid(uuid);
|
2015-09-29 23:57:53 +00:00
|
|
|
if (!ds)
|
2015-09-25 17:51:10 +00:00
|
|
|
clear();
|
2015-10-02 01:24:04 +00:00
|
|
|
else
|
|
|
|
setText(ds->name);
|
2015-09-25 17:51:10 +00:00
|
|
|
}
|
|
|
|
|
2015-09-23 19:03:28 +00:00
|
|
|
void DiveLocationLineEdit::showPopup()
|
|
|
|
{
|
|
|
|
fixPopupPosition();
|
2015-09-22 17:13:51 +00:00
|
|
|
if (!view->isVisible()) {
|
2015-09-22 19:27:07 +00:00
|
|
|
setTemporaryDiveSiteName(text());
|
2015-09-22 17:31:56 +00:00
|
|
|
proxy->invalidate();
|
|
|
|
view->show();
|
2015-09-22 17:13:51 +00:00
|
|
|
}
|
2015-09-21 19:08:58 +00:00
|
|
|
}
|
|
|
|
|
2015-09-23 17:46:29 +00:00
|
|
|
DiveLocationLineEdit::DiveSiteType DiveLocationLineEdit::currDiveSiteType() const
|
|
|
|
{
|
|
|
|
return currType;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t DiveLocationLineEdit::currDiveSiteUuid() const
|
|
|
|
{
|
|
|
|
return currUuid;
|
|
|
|
}
|
|
|
|
|
2018-05-21 16:09:09 +00:00
|
|
|
DiveLocationListView::DiveLocationListView(QWidget*)
|
2015-09-21 17:01:58 +00:00
|
|
|
{
|
|
|
|
}
|
2015-09-25 16:21:23 +00:00
|
|
|
|
2015-09-29 23:57:53 +00:00
|
|
|
void DiveLocationListView::currentChanged(const QModelIndex ¤t, const QModelIndex &previous)
|
2015-09-25 16:21:23 +00:00
|
|
|
{
|
|
|
|
QListView::currentChanged(current, previous);
|
|
|
|
emit currentIndexChanged(current);
|
|
|
|
}
|