mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 21:43:23 +00:00
Dive site rewrite: fill and change the current dive site
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
6afd9161e8
commit
09f2d3b35d
2 changed files with 43 additions and 1 deletions
|
@ -244,12 +244,49 @@ void SimpleDiveSiteEditDialog::showEvent(QShowEvent *ev)
|
||||||
const int heigth = 190;
|
const int heigth = 190;
|
||||||
const int width = 280;
|
const int width = 280;
|
||||||
|
|
||||||
|
// Position.
|
||||||
QDialog::showEvent(ev);
|
QDialog::showEvent(ev);
|
||||||
QRect currGeometry = geometry();
|
QRect currGeometry = geometry();
|
||||||
currGeometry.setX(QCursor::pos().x() + 10);
|
currGeometry.setX(QCursor::pos().x() + 15);
|
||||||
currGeometry.setY(QCursor::pos().y() - heigth / 2);
|
currGeometry.setY(QCursor::pos().y() - heigth / 2);
|
||||||
currGeometry.setWidth(width);
|
currGeometry.setWidth(width);
|
||||||
currGeometry.setHeight(heigth);
|
currGeometry.setHeight(heigth);
|
||||||
setGeometry(currGeometry);
|
setGeometry(currGeometry);
|
||||||
ev->accept();
|
ev->accept();
|
||||||
|
|
||||||
|
//Da
|
||||||
|
ui->diveSiteName->setText(displayed_dive_site.name);
|
||||||
|
ui->diveSiteNotes->setText(displayed_dive_site.notes);
|
||||||
|
ui->diveSiteDescription->setText(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);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimpleDiveSiteEditDialog::on_diveSiteName_editingFinished()
|
||||||
|
{
|
||||||
|
free(displayed_dive_site.name);
|
||||||
|
displayed_dive_site.name = copy_string(qPrintable(ui->diveSiteName->text()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimpleDiveSiteEditDialog::on_diveSiteCoordinates_editingFinished()
|
||||||
|
{
|
||||||
|
double lat, lon;
|
||||||
|
|
||||||
|
parseGpsText(ui->diveSiteCoordinates->text(), &lat, &lon);
|
||||||
|
displayed_dive_site.latitude.udeg = lat * 1000000;
|
||||||
|
displayed_dive_site.longitude.udeg = lon * 1000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimpleDiveSiteEditDialog::on_diveSiteDescription_editingFinished()
|
||||||
|
{
|
||||||
|
free(displayed_dive_site.description);
|
||||||
|
displayed_dive_site.description = copy_string(qPrintable(ui->diveSiteDescription->text()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimpleDiveSiteEditDialog::on_diveSiteNotes_editingFinished()
|
||||||
|
{
|
||||||
|
free(displayed_dive_site.notes);
|
||||||
|
displayed_dive_site.notes = copy_string(qPrintable(ui->diveSiteNotes->text()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,11 @@ Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SimpleDiveSiteEditDialog(QWidget *parent);
|
SimpleDiveSiteEditDialog(QWidget *parent);
|
||||||
virtual ~SimpleDiveSiteEditDialog();
|
virtual ~SimpleDiveSiteEditDialog();
|
||||||
|
public slots:
|
||||||
|
void on_diveSiteName_editingFinished();
|
||||||
|
void on_diveSiteCoordinates_editingFinished();
|
||||||
|
void on_diveSiteDescription_editingFinished();
|
||||||
|
void on_diveSiteNotes_editingFinished();
|
||||||
protected:
|
protected:
|
||||||
void showEvent(QShowEvent *ev);
|
void showEvent(QShowEvent *ev);
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Add table
Reference in a new issue