QGCImageProvider.h 1.91 KB
Newer Older
dogmaphobic's avatar
dogmaphobic committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
/*=====================================================================

 QGroundControl Open Source Ground Control Station

 (c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>

 This file is part of the QGROUNDCONTROL project

 QGROUNDCONTROL is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 QGROUNDCONTROL 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.

 You should have received a copy of the GNU General Public License
 along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.

 ======================================================================*/

/**
 * @file
dogmaphobic's avatar
dogmaphobic committed
26
 *   @brief Image Provider
dogmaphobic's avatar
dogmaphobic committed
27
 *
dogmaphobic's avatar
dogmaphobic committed
28
 *   @author Gus Grubba <mavlink@grubba.com>
dogmaphobic's avatar
dogmaphobic committed
29 30 31 32
 *
 */


dogmaphobic's avatar
dogmaphobic committed
33 34
#ifndef QGCIMAGEPROVIDER_H
#define QGCIMAGEPROVIDER_H
dogmaphobic's avatar
dogmaphobic committed
35 36

#include <QObject>
dogmaphobic's avatar
dogmaphobic committed
37 38
#include <QQmlListProperty>
#include <QQuickImageProvider>
dogmaphobic's avatar
dogmaphobic committed
39

dogmaphobic's avatar
dogmaphobic committed
40 41 42
#include "QGCToolbox.h"

class QGCImageProvider : public QGCTool, public QQuickImageProvider
dogmaphobic's avatar
dogmaphobic committed
43 44
{
public:
dogmaphobic's avatar
dogmaphobic committed
45 46 47 48 49 50 51 52 53 54 55
    QGCImageProvider        (QGCApplication* app);
    ~QGCImageProvider       ();
    QImage  requestImage    (const QString & id, QSize * size, const QSize & requestedSize);
    void    setImage        (QImage* pImage, int id = 0);
    void    setToolbox      (QGCToolbox *toolbox);
private:
    //-- TODO: For now this is holding a single image. If you happen to have two
    //   or more vehicles with flow, it will not work. To properly manage that condition
    //   this should be a map between each vehicle and its image. The URL provided
    //   for the image request would contain the vehicle identification.
    QImage _pImage;
dogmaphobic's avatar
dogmaphobic committed
56 57
};

dogmaphobic's avatar
dogmaphobic committed
58 59

#endif // QGCIMAGEPROVIDER_H