#include <QtGui/QApplication>
#include <QtDeclarative>
#include "qmlapplicationviewer.h"
#include "qdeclarativepincharea.h"
#include "coloringcanvas.h"
#include "drmimageprovider.h"
#include "thumbnailimageprovider.h"
#include "FilePathConst.h"

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QmlApplicationViewer viewer;

    viewer.rootContext()->setContextProperty("drmDataRoot", getDrmDataRoot());
    viewer.rootContext()->setContextProperty("thumbnailDataRoot", getThumbnailDataRoot());
    viewer.rootContext()->setContextProperty("freeDataRoot", getFreeDataRoot());
    viewer.rootContext()->setContextProperty("defaultImageFile", getDefaultImageFile());

    qmlRegisterType<ColoringCanvas>("ColoringItems", 1, 0, "ColoringCanvas");
    qmlRegisterType<QDeclarativePinchArea>("ColoringItems", 1, 0, "PinchArea");
    qmlRegisterType<QDeclarativePinchEvent>("ColoringItems", 1, 0, "PinchEvent");
    qmlRegisterType<QDeclarativePinch>("ColoringItems", 1, 0, "Pinch");

    viewer.rootContext()->engine()->addImageProvider(QLatin1String("drm"), new DrmImageProvider);
    viewer.rootContext()->engine()->addImageProvider(QLatin1String("thumbnail"), new ThumbnailImageProvider);

    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape);
    viewer.setMainQmlFile(QLatin1String("qml/ColouringBook/main.qml"));
    viewer.showExpanded();

    return app.exec();
}
