QGCImageProvider.h 1.36 KB
Newer Older
1 2 3 4 5 6 7 8
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/
dogmaphobic's avatar
dogmaphobic committed
9 10 11 12


/**
 * @file
dogmaphobic's avatar
dogmaphobic committed
13
 *   @brief Image Provider
dogmaphobic's avatar
dogmaphobic committed
14
 *
dogmaphobic's avatar
dogmaphobic committed
15
 *   @author Gus Grubba <mavlink@grubba.com>
dogmaphobic's avatar
dogmaphobic committed
16 17 18 19
 *
 */


dogmaphobic's avatar
dogmaphobic committed
20 21
#ifndef QGCIMAGEPROVIDER_H
#define QGCIMAGEPROVIDER_H
dogmaphobic's avatar
dogmaphobic committed
22 23

#include <QObject>
dogmaphobic's avatar
dogmaphobic committed
24 25
#include <QQmlListProperty>
#include <QQuickImageProvider>
dogmaphobic's avatar
dogmaphobic committed
26

dogmaphobic's avatar
dogmaphobic committed
27 28 29
#include "QGCToolbox.h"

class QGCImageProvider : public QGCTool, public QQuickImageProvider
dogmaphobic's avatar
dogmaphobic committed
30 31
{
public:
32
    QGCImageProvider        (QGCApplication* app, QGCToolbox* toolbox);
dogmaphobic's avatar
dogmaphobic committed
33 34 35 36 37 38 39 40 41 42
    ~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
43 44
};

dogmaphobic's avatar
dogmaphobic committed
45 46

#endif // QGCIMAGEPROVIDER_H