weathervalidator.h 2.59 KB
Newer Older
Petri Damstén's avatar
Petri Damstén committed
1
/*
Petri Damstén's avatar
Petri Damstén committed
2
 *   Copyright (C) 2009 Petri Damstén <damu@iki.fi>
Petri Damstén's avatar
Petri Damstén committed
3
 *
Petri Damstén's avatar
Petri Damstén committed
4 5 6 7
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Library General Public License as
 *   published by the Free Software Foundation; either version 2, or
 *   (at your option) any later version.
Petri Damstén's avatar
Petri Damstén committed
8
 *
Petri Damstén's avatar
Petri Damstén committed
9 10 11 12
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details
Petri Damstén's avatar
Petri Damstén committed
13
 *
Petri Damstén's avatar
Petri Damstén committed
14 15 16 17
 *   You should have received a copy of the GNU Library General Public
 *   License along with this program; if not, write to the
 *   Free Software Foundation, Inc.,
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
Petri Damstén's avatar
Petri Damstén committed
18 19 20 21 22 23 24
 */

#ifndef WEATHERVALIDATOR_HEADER
#define WEATHERVALIDATOR_HEADER

#include <Plasma/DataEngine>

Petri Damstén's avatar
Petri Damstén committed
25 26
#include "plasmaweather_export.h"

27 28
namespace Plasma {

Petri Damstén's avatar
Petri Damstén committed
29 30 31 32 33
/**
 * @class WeatherValidator <plasmaweather/weathervalidator.h>
 *
 * @short Weather validator class
 */
Petri Damstén's avatar
Petri Damstén committed
34
class PLASMAWEATHER_EXPORT WeatherValidator : public QObject
Petri Damstén's avatar
Petri Damstén committed
35 36 37
{
    Q_OBJECT
public:
Friedrich W. H. Kossebau's avatar
Friedrich W. H. Kossebau committed
38
    explicit WeatherValidator(QObject *parent = nullptr);
39
    ~WeatherValidator() override;
Petri Damstén's avatar
Petri Damstén committed
40

Petri Damstén's avatar
Petri Damstén committed
41
    /**
42
     * Validate location 
Petri Damstén's avatar
Petri Damstén committed
43 44
     *
     * @param plugin the name of the ion
45
     * @param location the name of the location to find
Petri Damstén's avatar
Petri Damstén committed
46 47
     * @param silent if true don't show any dialogs
     **/
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
    void validate(const QString& plugin, const QString& location, bool silent = true);

    /**
     * Validate location; plugin must already have been set
     *
     * @param location the name of the location to find
     * @param silent if true don't show any dialogs
     */
    void validate(const QString& location, bool silent = false);

    /**
     * Sets the ion to use
     * @arg plugin the name of the ion
     */
    void setIon(const QString &plugin);

    /**
     * @return the ion currently set to validate with
     */
    QString ion() const;

Petri Damstén's avatar
Petri Damstén committed
69 70 71 72 73
    /**
     * Sets dataengine to use
     *
     * @param dataengine use this dataengine
     **/
Petri Damstén's avatar
Petri Damstén committed
74
    void setDataEngine(Plasma::DataEngine* dataengine);
75

Petri Damstén's avatar
Petri Damstén committed
76
Q_SIGNALS:
77 78 79 80 81
    /**
     * Emitted when an error in validation occurs
     **/
    void error(const QString& message);

Petri Damstén's avatar
Petri Damstén committed
82 83
    /**
     * Emitted when validation is done
84
     * @arg sources a mapping of user-friendly names to the DataEngine source
Petri Damstén's avatar
Petri Damstén committed
85
     **/
86 87
    void finished(const QMap<QString, QString> &sources);

Petri Damstén's avatar
Petri Damstén committed
88
public Q_SLOTS:
Petri Damstén's avatar
Petri Damstén committed
89 90 91
    void dataUpdated(const QString &source, const Plasma::DataEngine::Data &data);

private:
92
    const QScopedPointer<class WeatherValidatorPrivate> d;
Petri Damstén's avatar
Petri Damstén committed
93 94
};

95 96
}

Petri Damstén's avatar
Petri Damstén committed
97
#endif