mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Remove quick edit dive site widget
Voted down by common consent. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
49ab30ae8b
commit
9510f40db4
6 changed files with 8 additions and 221 deletions
|
@ -227,104 +227,6 @@ void LocationInformationWidget::resetPallete()
|
|||
ui.diveSiteNotes->setPalette(p);
|
||||
}
|
||||
|
||||
SimpleDiveSiteEditDialog::SimpleDiveSiteEditDialog(QWidget *parent) :
|
||||
QDialog(parent, Qt::FramelessWindowHint | Qt::WindowSystemMenuHint | Qt::Popup),
|
||||
ui(new Ui::SimpleDiveSiteEditDialog()), changed_dive_site(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->diveSiteDescription->installEventFilter(this);
|
||||
ui->diveSiteNotes->installEventFilter(this);
|
||||
}
|
||||
|
||||
SimpleDiveSiteEditDialog::~SimpleDiveSiteEditDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
bool SimpleDiveSiteEditDialog::eventFilter(QObject *obj, QEvent *ev)
|
||||
{
|
||||
if (ev->type() != QEvent::FocusOut)
|
||||
return false;
|
||||
|
||||
if (obj == ui->diveSiteDescription) {
|
||||
diveSiteDescription_editingFinished();
|
||||
} else if (obj == ui->diveSiteNotes) {
|
||||
diveSiteNotes_editingFinished();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void SimpleDiveSiteEditDialog::showEvent(QShowEvent *ev)
|
||||
{
|
||||
const int heigth = 275;
|
||||
const int width = 450;
|
||||
|
||||
// Position.
|
||||
QDialog::showEvent(ev);
|
||||
QRect currGeometry = geometry();
|
||||
currGeometry.setX(QCursor::pos().x() + 15);
|
||||
currGeometry.setY(QCursor::pos().y() - heigth / 2);
|
||||
currGeometry.setWidth(width);
|
||||
currGeometry.setHeight(heigth);
|
||||
setGeometry(currGeometry);
|
||||
ev->accept();
|
||||
|
||||
//Da
|
||||
ui->diveSiteName->setText(displayed_dive_site.name);
|
||||
ui->diveSiteNotes->setPlainText(displayed_dive_site.notes);
|
||||
ui->diveSiteDescription->setPlainText(displayed_dive_site.description);
|
||||
|
||||
const char *gps_text = printGPSCoords(displayed_dive_site.latitude.udeg, displayed_dive_site.longitude.udeg);
|
||||
ui->diveSiteCoordinates->setText(QString(gps_text));
|
||||
free( (void*) gps_text);
|
||||
|
||||
changed_dive_site = false;
|
||||
}
|
||||
|
||||
void SimpleDiveSiteEditDialog::on_diveSiteName_editingFinished()
|
||||
{
|
||||
if (ui->diveSiteName->text() == displayed_dive_site.name)
|
||||
return;
|
||||
free(displayed_dive_site.name);
|
||||
displayed_dive_site.name = copy_string(qPrintable(ui->diveSiteName->text()));
|
||||
changed_dive_site = true;
|
||||
}
|
||||
|
||||
void SimpleDiveSiteEditDialog::on_diveSiteCoordinates_editingFinished()
|
||||
{
|
||||
double lat, lon;
|
||||
uint32_t uLat, uLon;
|
||||
|
||||
parseGpsText(ui->diveSiteCoordinates->text(), &lat, &lon);
|
||||
uLat = lat * 1000000;
|
||||
uLon = lon * 1000000;
|
||||
|
||||
if (uLat == displayed_dive_site.latitude.udeg && uLon == displayed_dive_site.longitude.udeg)
|
||||
return;
|
||||
|
||||
displayed_dive_site.latitude.udeg = uLat;
|
||||
displayed_dive_site.longitude.udeg = uLon;
|
||||
changed_dive_site = true;
|
||||
}
|
||||
|
||||
void SimpleDiveSiteEditDialog::diveSiteDescription_editingFinished()
|
||||
{
|
||||
if (ui->diveSiteDescription->toPlainText() == displayed_dive_site.description)
|
||||
return;
|
||||
free(displayed_dive_site.description);
|
||||
displayed_dive_site.description = copy_string(qPrintable(ui->diveSiteDescription->toPlainText()));
|
||||
changed_dive_site = true;
|
||||
}
|
||||
|
||||
void SimpleDiveSiteEditDialog::diveSiteNotes_editingFinished()
|
||||
{
|
||||
if (ui->diveSiteNotes->toPlainText() == displayed_dive_site.notes)
|
||||
return;
|
||||
free(displayed_dive_site.notes);
|
||||
displayed_dive_site.notes = copy_string(qPrintable(ui->diveSiteNotes->toPlainText()));
|
||||
changed_dive_site = true;
|
||||
}
|
||||
|
||||
bool LocationManagementEditHelper::eventFilter(QObject *obj, QEvent *ev)
|
||||
{
|
||||
QListView *view = qobject_cast<QListView*>(obj);
|
||||
|
|
|
@ -44,27 +44,6 @@ private:
|
|||
mode current_mode;
|
||||
};
|
||||
|
||||
|
||||
#include "ui_simpledivesiteedit.h"
|
||||
class SimpleDiveSiteEditDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
SimpleDiveSiteEditDialog(QWidget *parent);
|
||||
virtual ~SimpleDiveSiteEditDialog();
|
||||
bool changed_dive_site;
|
||||
bool eventFilter(QObject *obj, QEvent *ev);
|
||||
public slots:
|
||||
void on_diveSiteName_editingFinished();
|
||||
void on_diveSiteCoordinates_editingFinished();
|
||||
void diveSiteDescription_editingFinished();
|
||||
void diveSiteNotes_editingFinished();
|
||||
protected:
|
||||
void showEvent(QShowEvent *ev);
|
||||
private:
|
||||
Ui::SimpleDiveSiteEditDialog *ui;
|
||||
|
||||
};
|
||||
|
||||
class LocationManagementEditHelper : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
|
|
@ -74,7 +74,6 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
|
|||
locationManagementEditHelper, &LocationManagementEditHelper::handleActivation);
|
||||
|
||||
ui.location->setCompleter(completer);
|
||||
connect(ui.addDiveSite, SIGNAL(clicked()), this, SLOT(showDiveSiteSimpleEdit()));
|
||||
connect(ui.geocodeButton, SIGNAL(clicked()), this, SLOT(reverseGeocode()));
|
||||
|
||||
QAction *action = new QAction(tr("Apply changes"), this);
|
||||
|
@ -250,27 +249,14 @@ void MainTab::setCurrentLocationIndex()
|
|||
}
|
||||
}
|
||||
|
||||
void MainTab::showDiveSiteSimpleEdit()
|
||||
{
|
||||
if (ui.location->text().isEmpty())
|
||||
return;
|
||||
SimpleDiveSiteEditDialog dlg(this);
|
||||
dlg.exec();
|
||||
if (dlg.changed_dive_site) {
|
||||
markChangedWidget(ui.location);
|
||||
}
|
||||
}
|
||||
|
||||
void MainTab::enableGeoLookupEdition()
|
||||
{
|
||||
ui.waitingSpinner->stop();
|
||||
ui.addDiveSite->show();
|
||||
}
|
||||
|
||||
void MainTab::disableGeoLookupEdition()
|
||||
{
|
||||
ui.waitingSpinner->start();
|
||||
ui.addDiveSite->hide();
|
||||
}
|
||||
|
||||
void MainTab::toggleTriggeredColumn()
|
||||
|
|
|
@ -98,7 +98,6 @@ slots:
|
|||
void enableGeoLookupEdition();
|
||||
void disableGeoLookupEdition();
|
||||
void setCurrentLocationIndex();
|
||||
void showDiveSiteSimpleEdit();
|
||||
void reverseGeocode();
|
||||
private:
|
||||
Ui::MainTab ui;
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>449</width>
|
||||
<height>751</height>
|
||||
<height>758</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
|
@ -167,15 +167,15 @@
|
|||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="LocationLayout" stretch="0,1">
|
||||
<item>
|
||||
|
@ -208,17 +208,6 @@
|
|||
<item>
|
||||
<widget class="QLineEdit" name="location"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="addDiveSite">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../subsurface.qrc">
|
||||
<normaloff>:/edit</normaloff>:/edit</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="geocodeButton">
|
||||
<property name="text">
|
||||
|
@ -658,8 +647,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>286</width>
|
||||
<height>300</height>
|
||||
<width>317</width>
|
||||
<height>365</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="diveInfoScrollAreaLayout">
|
||||
|
@ -999,8 +988,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>297</width>
|
||||
<height>177</height>
|
||||
<width>331</width>
|
||||
<height>220</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SimpleDiveSiteEditDialog</class>
|
||||
<widget class="QDialog" name="SimpleDiveSiteEditDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>449</width>
|
||||
<height>338</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="diveSiteName"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Coordinates</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="diveSiteCoordinates"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Description</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QPlainTextEdit" name="diveSiteNotes"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QPlainTextEdit" name="diveSiteDescription"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Notes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Dive site quick edit. Hit ESC or click outside to close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Add table
Reference in a new issue