diff --git a/core/divesitehelpers.cpp b/core/divesitehelpers.cpp index 3f752a320..b77bc8fec 100644 --- a/core/divesitehelpers.cpp +++ b/core/divesitehelpers.cpp @@ -20,17 +20,7 @@ #include #include -ReverseGeoLookupThread* ReverseGeoLookupThread::instance() -{ - static ReverseGeoLookupThread* self = new ReverseGeoLookupThread(); - return self; -} - -ReverseGeoLookupThread::ReverseGeoLookupThread(QObject *obj) : QThread(obj) -{ -} - -void ReverseGeoLookupThread::run() +void reverseGeoLookup() { QNetworkRequest request; QNetworkAccessManager *rgl = new QNetworkAccessManager(); @@ -41,7 +31,7 @@ void ReverseGeoLookupThread::run() request.setRawHeader("Accept", "text/json"); request.setRawHeader("User-Agent", getUserAgent().toUtf8()); - connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); + QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); struct dive_site *ds = &displayed_dive_site; @@ -50,7 +40,7 @@ void ReverseGeoLookupThread::run() QNetworkReply *reply = rgl->get(request); timer.setSingleShot(true); - connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); + QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); timer.start(5000); // 5 secs. timeout loop.exec(); @@ -119,13 +109,13 @@ void ReverseGeoLookupThread::run() } } else { report_error("timeout accessing geonames.org"); - disconnect(reply, SIGNAL(finished()), &loop, SLOT(quit())); + QObject::disconnect(reply, SIGNAL(finished()), &loop, SLOT(quit())); reply->abort(); } // next check the oceans API to figure out the body of water request.setUrl(geonamesOceanURL.arg(uiLanguage(NULL).section(QRegExp("[-_ ]"), 0, 0)).arg(ds->latitude.udeg / 1000000.0).arg(ds->longitude.udeg / 1000000.0)); reply = rgl->get(request); - connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); + QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); timer.start(5000); // 5 secs. timeout loop.exec(); if (timer.isActive()) { @@ -165,7 +155,7 @@ void ReverseGeoLookupThread::run() } } else { report_error("timeout accessing geonames.org"); - disconnect(reply, SIGNAL(finished()), &loop, SLOT(quit())); + QObject::disconnect(reply, SIGNAL(finished()), &loop, SLOT(quit())); reply->abort(); } diff --git a/core/divesitehelpers.h b/core/divesitehelpers.h index 9227aa5c2..eabb156f4 100644 --- a/core/divesitehelpers.h +++ b/core/divesitehelpers.h @@ -2,18 +2,6 @@ #ifndef DIVESITEHELPERS_H #define DIVESITEHELPERS_H -#include "units.h" -#include - -class ReverseGeoLookupThread : public QThread { -Q_OBJECT -public: - static ReverseGeoLookupThread *instance(); - void lookup(struct dive_site *ds); - void run() override; - -private: - ReverseGeoLookupThread(QObject *parent = 0); -}; +void reverseGeoLookup(); #endif // DIVESITEHELPERS_H diff --git a/desktop-widgets/locationinformation.cpp b/desktop-widgets/locationinformation.cpp index 4118e6c65..67c23510d 100644 --- a/desktop-widgets/locationinformation.cpp +++ b/desktop-widgets/locationinformation.cpp @@ -330,8 +330,7 @@ void LocationInformationWidget::resetPallete() void LocationInformationWidget::reverseGeocode() { - ReverseGeoLookupThread *geoLookup = ReverseGeoLookupThread::instance(); - geoLookup->run(); + reverseGeoLookup(); updateLabels(); } diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 0476dfae8..2b4411387 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -266,9 +266,6 @@ MainWindow::MainWindow() : QMainWindow(), redoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Z)); ui.menu_Edit->addActions({ undoAction, redoAction }); - ReverseGeoLookupThread *geoLookup = ReverseGeoLookupThread::instance(); - connect(geoLookup, SIGNAL(started()),information(), SLOT(disableGeoLookupEdition())); - connect(geoLookup, SIGNAL(finished()), information(), SLOT(enableGeoLookupEdition())); #ifndef NO_PRINTING // copy the bundled print templates to the user path QStringList templateBackupList; diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index d45bc246d..053f4e043 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -195,21 +195,6 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), ui.cylinders->view()->horizontalHeader()->addAction(action); } - ui.waitingSpinner->setRoundness(70.0); - ui.waitingSpinner->setMinimumTrailOpacity(15.0); - ui.waitingSpinner->setTrailFadePercentage(70.0); - ui.waitingSpinner->setNumberOfLines(8); - ui.waitingSpinner->setLineLength(5); - ui.waitingSpinner->setLineWidth(3); - ui.waitingSpinner->setInnerRadius(5); - ui.waitingSpinner->setRevolutionsPerSecond(1); - - connect(ReverseGeoLookupThread::instance(), SIGNAL(finished()), - LocationInformationModel::instance(), SLOT(update())); - - connect(ReverseGeoLookupThread::instance(), &QThread::finished, - this, &MainTab::setCurrentLocationIndex); - connect(ui.diveNotesMessage, &KMessageWidget::showAnimationFinished, ui.location, &DiveLocationLineEdit::fixPopupPosition); @@ -245,16 +230,6 @@ void MainTab::setCurrentLocationIndex() } } -void MainTab::enableGeoLookupEdition() -{ - ui.waitingSpinner->stop(); -} - -void MainTab::disableGeoLookupEdition() -{ - ui.waitingSpinner->start(); -} - void MainTab::toggleTriggeredColumn() { QAction *action = qobject_cast(sender()); diff --git a/desktop-widgets/tab-widgets/maintab.h b/desktop-widgets/tab-widgets/maintab.h index c04a9b267..c38615c93 100644 --- a/desktop-widgets/tab-widgets/maintab.h +++ b/desktop-widgets/tab-widgets/maintab.h @@ -98,8 +98,6 @@ slots: void updateTextLabels(bool showUnits = true); void escDetected(void); void showLocation(); - void enableGeoLookupEdition(); - void disableGeoLookupEdition(); void setCurrentLocationIndex(); EditMode getEditMode() const; private: diff --git a/desktop-widgets/tab-widgets/maintab.ui b/desktop-widgets/tab-widgets/maintab.ui index 7a1be9aed..34ce65186 100644 --- a/desktop-widgets/tab-widgets/maintab.ui +++ b/desktop-widgets/tab-widgets/maintab.ui @@ -230,9 +230,6 @@ - - - @@ -599,12 +596,6 @@ QPlainTextEdit
desktop-widgets/tagwidget.h
- - QtWaitingSpinner - QWidget -
desktop-widgets/qtwaitingspinner.h
- 1 -
DiveLocationLineEdit QLineEdit