[weather] Use non-nested class and QScopedPointer for pimpl object

parent 537afd72
......@@ -21,10 +21,10 @@
#include "weathervalidator.h"
class WeatherLocation::Private
class WeatherLocationPrivate
{
public:
Private(WeatherLocation *location)
WeatherLocationPrivate(WeatherLocation *location)
: q(location),
locationEngine(nullptr)
{}
......@@ -46,16 +46,13 @@ public:
WeatherLocation::WeatherLocation(QObject *parent)
: QObject(parent)
, d(new Private(this))
, d(new WeatherLocationPrivate(this))
{
QObject::connect(&d->validator, SIGNAL(finished(QMap<QString,QString>)),
this, SLOT(validatorFinished(QMap<QString,QString>)));
}
WeatherLocation::~WeatherLocation()
{
delete d;
}
WeatherLocation::~WeatherLocation() = default;
void WeatherLocation::setDataEngines(Plasma::DataEngine* location, Plasma::DataEngine* weather)
{
......
......@@ -57,8 +57,7 @@ public Q_SLOTS:
void dataUpdated(const QString &source, const Plasma::DataEngine::Data &data);
private:
class Private;
Private * const d;
const QScopedPointer<class WeatherLocationPrivate> d;
Q_PRIVATE_SLOT(d, void validatorFinished(const QMap<QString, QString> &results))
};
......
......@@ -31,10 +31,10 @@
using namespace KUnitConversion;
class Q_DECL_HIDDEN WeatherPopupApplet::Private
class WeatherPopupAppletPrivate
{
public:
Private(WeatherPopupApplet *weatherapplet)
WeatherPopupAppletPrivate(WeatherPopupApplet *weatherapplet)
: q(weatherapplet)
, updateInterval(0)
, location(nullptr)
......@@ -206,14 +206,11 @@ public:
WeatherPopupApplet::WeatherPopupApplet(QObject *parent, const QVariantList &args)
: Plasma::Applet(parent, args)
, d(new Private(this))
, d(new WeatherPopupAppletPrivate(this))
{
}
WeatherPopupApplet::~WeatherPopupApplet()
{
delete d;
}
WeatherPopupApplet::~WeatherPopupApplet() = default;
void WeatherPopupApplet::init()
{
......
......@@ -110,9 +110,9 @@ class PLASMAWEATHER_EXPORT WeatherPopupApplet : public Plasma::Applet, public Pl
void connectToEngine();
private:
class Private;
Private * const d;
const QScopedPointer<class WeatherPopupAppletPrivate> d;
friend class WeatherPopupAppletPrivate;
Q_PRIVATE_SLOT(d, void locationReady(const QString &source))
Q_PRIVATE_SLOT(d, void giveUpBeingBusy())
Q_PRIVATE_SLOT(d, void onTimeoutNotificationClosed())
......
......@@ -22,10 +22,10 @@
#include <KLocalizedString>
#include <KMessageBox>
class WeatherValidator::Private
class WeatherValidatorPrivate
{
public:
Private()
WeatherValidatorPrivate()
: dataengine(nullptr)
{}
......@@ -37,14 +37,11 @@ public:
WeatherValidator::WeatherValidator(QObject *parent)
: QObject(parent)
, d(new Private())
, d(new WeatherValidatorPrivate())
{
}
WeatherValidator::~WeatherValidator()
{
delete d;
}
WeatherValidator::~WeatherValidator() = default;
QString WeatherValidator::ion() const
{
......
......@@ -87,8 +87,7 @@ public Q_SLOTS:
void dataUpdated(const QString &source, const Plasma::DataEngine::Data &data);
private:
class Private;
Private * const d;
const QScopedPointer<class WeatherValidatorPrivate> d;
};
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment