------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee. http://bugs.kde.org/show_bug.cgi?id=111560 ------- Additional Comments From caulier.gilles free fr 2006-09-26 13:37 ------- SVN commit 588569 by cgilles: kipi-plugins from trunk : GPSSync tool : improve GPS position editor dialog with a better precision. Don't use a KDoubleNumInput widget but a KLineEdit instead to be able to cut and paste easily position coordinate from konqueror. Added buttons to clear GPS position entries. CCMAIL: gerhard kulzer net CCBUGS: 133359, 111560 M +70 -21 gpseditdialog.cpp M +1 -0 gpseditdialog.h M +3 -3 gpslistviewitem.cpp --- trunk/extragear/libs/kipi-plugins/gpssync/gpseditdialog.cpp #588568:588569 @ -24,6 +24,7 @ #include <qlayout.h> #include <qcombobox.h> #include <qpushbutton.h> +#include <qvalidator.h> // KDE includes. @ -31,7 +32,8 @ #include <kdebug.h> #include <kiconloader.h> #include <kapplication.h> -#include <knuminput.h> +#include <klineedit.h> +#include <kmessagebox.h> // Local includes. @ -62,13 +64,13 @ gpsCombo = 0; } - QPushButton *gpsButton; + QPushButton *gpsButton; - QComboBox *gpsCombo; + QComboBox *gpsCombo; - KDoubleSpinBox *altitudeInput; - KDoubleSpinBox *latitudeInput; - KDoubleSpinBox *longitudeInput; + KLineEdit *altitudeInput; + KLineEdit *latitudeInput; + KLineEdit *longitudeInput; }; GPSEditDialog::GPSEditDialog(QWidget* parent, GPSDataContainer gpsData, @ -82,21 +84,28 @ setHelp("gpssync", "kipi-plugins"); setButtonText(User1, i18n("Delete")); - QGridLayout* grid = new QGridLayout(plainPage(), 3, 1, 0, spacingHint()); + QGridLayout* grid = new QGridLayout(plainPage(), 3, 2, 0, spacingHint()); QLabel *altitudeLabel = new QLabel(i18n("Altitude:"), plainPage()); QLabel *latitudeLabel = new QLabel(i18n("Latitude:"), plainPage()); QLabel *longitudeLabel = new QLabel(i18n("Longitude:"), plainPage()); - d->altitudeInput = new KDoubleSpinBox(plainPage()); - d->latitudeInput = new KDoubleSpinBox(plainPage()); - d->longitudeInput = new KDoubleSpinBox(plainPage()); - d->altitudeInput->setRange(-20000.0, 20000.0, 1.0, 1); - d->latitudeInput->setRange(-90.0, 90.0, 1E-6, 6); - d->longitudeInput->setRange(-180.0, 180.0, 1E-6, 6); - d->altitudeInput->setValue(gpsData.altitude()); - d->latitudeInput->setValue(gpsData.latitude()); - d->longitudeInput->setValue(gpsData.longitude()); + d->altitudeInput = new KLineEdit(plainPage()); + d->latitudeInput = new KLineEdit(plainPage()); + d->longitudeInput = new KLineEdit(plainPage()); + + QPushButton *altResetButton = new QPushButton(SmallIcon("clear_left"), QString::null, plainPage()); + QPushButton *latResetButton = new QPushButton(SmallIcon("clear_left"), QString::null, plainPage()); + QPushButton *lonResetButton = new QPushButton(SmallIcon("clear_left"), QString::null, plainPage()); + + d->altitudeInput->setValidator(new QDoubleValidator(-20000.0, 20000.0, 1, this)); + d->latitudeInput->setValidator(new QDoubleValidator(-90.0, 90.0, 8, this)); + d->longitudeInput->setValidator(new QDoubleValidator(-180.0, 180.0, 8, this)); + + d->altitudeInput->setText(QString::number(gpsData.altitude(), 'g', 12)); + d->latitudeInput->setText(QString::number(gpsData.latitude(), 'g', 12)); + d->longitudeInput->setText(QString::number(gpsData.longitude(), 'g', 12)); + d->gpsCombo = new QComboBox( false, plainPage() ); d->gpsButton = new QPushButton(i18n("Get GPS Coordinates..."), plainPage()); d->gpsCombo->insertItem(QString("Capelinks"), GPSEditDialogDialogPrivate::CapeLinks); @ -110,12 +119,24 @ grid->addMultiCellWidget(d->altitudeInput, 0, 0, 1, 1); grid->addMultiCellWidget(d->latitudeInput, 1, 1, 1, 1); grid->addMultiCellWidget(d->longitudeInput, 2, 2, 1, 1); - grid->addMultiCellWidget(d->gpsCombo, 3, 3, 0, 0 ); - grid->addMultiCellWidget(d->gpsButton, 3, 3, 1, 1 ); + grid->addMultiCellWidget(altResetButton, 0, 0, 2, 2); + grid->addMultiCellWidget(latResetButton, 1, 1, 2, 2); + grid->addMultiCellWidget(lonResetButton, 2, 2, 2, 2); + grid->addMultiCellWidget(d->gpsCombo, 3, 3, 0, 0); + grid->addMultiCellWidget(d->gpsButton, 3, 3, 1, 2); connect(d->gpsButton, SIGNAL(clicked()), this, SLOT(slotGPSLocator())); + connect(altResetButton, SIGNAL(clicked()), + d->altitudeInput, SLOT(clear())); + + connect(latResetButton, SIGNAL(clicked()), + d->latitudeInput, SLOT(clear())); + + connect(lonResetButton, SIGNAL(clicked()), + d->longitudeInput, SLOT(clear())); + adjustSize(); } @ -126,12 +147,40 @ GPSDataContainer GPSEditDialog::getGPSInfo() { - return GPSDataContainer(d->altitudeInput->value(), - d->latitudeInput->value(), - d->longitudeInput->value(), + return GPSDataContainer(d->altitudeInput->text().toDouble(), + d->latitudeInput->text().toDouble(), + d->longitudeInput->text().toDouble(), false); } +void GPSEditDialog::slotOk() +{ + bool ok; + + d->altitudeInput->text().toDouble(&ok); + if (!ok) + { + KMessageBox::error(this, i18n("Altitude value is not correct!"), i18n("GPS Sync")); + return; + } + + d->latitudeInput->text().toDouble(&ok); + if (!ok) + { + KMessageBox::error(this, i18n("Latitude value is not correct!"), i18n("GPS Sync")); + return; + } + + d->longitudeInput->text().toDouble(&ok); + if (!ok) + { + KMessageBox::error(this, i18n("Longitude value is not correct!"), i18n("GPS Sync")); + return; + } + + accept(); +} + void GPSEditDialog::slotUser1() { done(-1); --- trunk/extragear/libs/kipi-plugins/gpssync/gpseditdialog.h #588568:588569 @ -48,6 +48,7 @ protected slots: + void slotOk(); void slotUser1(); void slotGPSLocator(); --- trunk/extragear/libs/kipi-plugins/gpssync/gpslistviewitem.cpp #588568:588569 @ -93,9 +93,9 @ setEnabled(true); d->dirty = dirty; d->gpsData = gpsData; - setText(2, QString::number(d->gpsData.altitude())); - setText(3, QString::number(d->gpsData.latitude())); - setText(4, QString::number(d->gpsData.longitude())); + setText(2, QString::number(d->gpsData.altitude(), 'g', 12)); + setText(3, QString::number(d->gpsData.latitude(), 'g', 12)); + setText(4, QString::number(d->gpsData.longitude(), 'g', 12)); QString status; if (isDirty()) _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
Free forum by Nabble | Edit this page |