DEFINES += NEMO
CONFIG += nemo
}
+
+equals(QT_MAJOR_VERSION, 4) {
+ CONFIG += qt4
+ DEFINES += QT4
+}
+
+equals(QT_MAJOR_VERSION, 5) {
+ CONFIG += qt5
+ DEFINES += QT5
+}
#include "qtcammode.h"
#include "qtcamimagemode.h"
#include "qtcamvideomode.h"
-#include "qtcamgraphicsviewfinder.h"
#include "qtcamconfig.h"
#include "sounds.h"
#include "notificationscontainer.h"
#include "sounds.h"
+#if defined(QT4)
#include <QDeclarativeInfo>
-
+#elif defined(QT5)
+#include <QQmlInfo>
+#endif
#include "zoom.h"
#include "flash.h"
#include "scene.h"
#include "cameraconfig.h"
#include "qtcamconfig.h"
+#if defined(QT4)
#include <QDeclarativeInfo>
+#elif defined(QT5)
+#include <QQmlInfo>
+#endif
CameraConfig::CameraConfig(QObject *parent) :
QObject(parent),
#define CAMERA_CONFIG_H
#include <QObject>
+#if defined(QT4)
#include <QDeclarativeParserStatus>
+#elif defined(QT5)
+#include <QQmlParserStatus>
+#endif
class QtCamConfig;
+#if defined(QT4)
class CameraConfig : public QObject, public QDeclarativeParserStatus {
+#elif defined(QT5)
+class CameraConfig : public QObject, public QQmlParserStatus {
+#endif
+
Q_OBJECT
Q_PROPERTY(QString configPath READ configPath WRITE setConfigPath NOTIFY configPathChanged);
LIBS += -L../lib/ -lqtcamera
-QT += declarative dbus
+QT += dbus
+
+qt4:QT += declarative
+qt5:QT += qml quick
HEADERS += plugin.h previewprovider.h camera.h mode.h imagemode.h videomode.h \
zoom.h flash.h scene.h evcomp.h videotorch.h whitebalance.h \
ImageResolutionModel::ImageResolutionModel(QtCamImageSettings *settings, QObject *parent) :
QAbstractListModel(parent), m_settings(settings) {
- QHash<int, QByteArray> roles;
- roles[IdRole] = "resolutionId";
- roles[NameRole] = "resolutionName";
- roles[CaptureRole] = "captureResolution";
- roles[PreviewRole] = "previewResolution";
- roles[FpsRole] = "frameRate";
- roles[NightFpsRole] = "nightFrameRate";
- roles[MegaPixelsRole] = "megaPixels";
- roles[AspectRatioRole] = "resolutionAspectRatio";
-
- setRoleNames(roles);
+ m_roles[IdRole] = "resolutionId";
+ m_roles[NameRole] = "resolutionName";
+ m_roles[CaptureRole] = "captureResolution";
+ m_roles[PreviewRole] = "previewResolution";
+ m_roles[FpsRole] = "frameRate";
+ m_roles[NightFpsRole] = "nightFrameRate";
+ m_roles[MegaPixelsRole] = "megaPixels";
+ m_roles[AspectRatioRole] = "resolutionAspectRatio";
m_resolutions = m_settings->resolutions(m_aspectRatio);
}
emit aspectRatioChanged();
}
}
+
+QHash<int, QByteArray> ImageResolutionModel::roleNames() const {
+ return m_roles;
+}
QString aspectRatio() const;
void setAspectRatio(const QString& aspectRatio);
+ QHash<int, QByteArray> roleNames() const;
+
signals:
void aspectRatioChanged();
QtCamImageSettings *m_settings;
QList<QtCamImageResolution> m_resolutions;
+
+ QHash<int, QByteArray> m_roles;
};
#endif /* IMAGE_RESOLUTION_MODEL_H */
#include "cameraconfig.h"
#include "videoplayer.h"
#include "viewfinder.h"
-#include <QtDeclarative>
+#if defined(QT4)
+#include <QDeclarativeEngine>
+#elif defined(QT5)
+#include <QQmlEngine>
+#endif
#define MAJOR 1
#define MINOR 0
Plugin::Plugin(QObject *parent) :
+#if defined(QT4)
QDeclarativeExtensionPlugin(parent) {
+#elif defined(QT5)
+ QQmlExtensionPlugin(parent) {
+#endif
}
}
+#if defined(QT4)
void Plugin::initializeEngine(QDeclarativeEngine *engine, const char *uri) {
+#elif defined(QT5)
+void Plugin::initializeEngine(QQmlEngine *engine, const char *uri) {
+#endif
Q_UNUSED(uri);
engine->addImageProvider("preview", new PreviewProvider);
qmlRegisterType<Viewfinder>(uri, MAJOR, MINOR, "Viewfinder");
}
+#if defined(QT4)
Q_EXPORT_PLUGIN2(declarativeqtcamera, Plugin);
+#endif
#ifndef PLUGIN_H
#define PLUGIN_H
+#if defined(QT4)
#include <QDeclarativeExtensionPlugin>
+#elif defined(QT5)
+#include <QQmlExtensionPlugin>
+#endif
+#if defined(QT4)
class Plugin : public QDeclarativeExtensionPlugin {
+#elif defined(QT5)
+class Plugin : public QQmlExtensionPlugin {
+#endif
+
Q_OBJECT
+#if defined(QT5)
+ Q_PLUGIN_METADATA(IID "QtCamera");
+#endif
+
public:
Plugin(QObject *parent = 0);
~Plugin();
+#if defined(QT4)
void initializeEngine(QDeclarativeEngine *engine, const char *uri);
+#elif defined(QT5)
+ void initializeEngine(QQmlEngine *engine, const char *uri);
+#endif
+
void registerTypes(const char *uri);
};
PreviewProvider *PreviewProvider::m_instance = 0;
PreviewProvider::PreviewProvider() :
+#if defined(QT4)
QDeclarativeImageProvider(QDeclarativeImageProvider::Image) {
+#elif defined(QT5)
+ QQuickImageProvider(QQuickImageProvider::Image) {
+#endif
m_instance = this;
}
#ifndef PREVIEW_PROVIDER_H
#define PREVIEW_PROVIDER_H
+#if defined(QT4)
#include <QDeclarativeImageProvider>
+#elif defined(QT5)
+#include <QQuickImageProvider>
+#endif
#include <QMutex>
+#if defined(QT4)
class PreviewProvider : public QDeclarativeImageProvider {
+#elif defined(QT5)
+class PreviewProvider : public QQuickImageProvider {
+#endif
+
public:
PreviewProvider();
~PreviewProvider();
#include <QWaitCondition>
#include <QDBusServiceWatcher>
#include <QDBusConnection>
+#if defined(QT4)
#include <QDeclarativeInfo>
+#elif defined(QT5)
+#include <QQmlInfo>
+#endif
#define CAMERA_IMAGE_START_SOUND_ID "camera-image-start"
#define CAMERA_IMAGE_END_SOUND_ID "camera-image-end"
*/
#include "videoplayer.h"
+#if defined(QT4)
#include <QDeclarativeInfo>
-#include "qtcamgraphicsviewfinder.h"
+#elif defined(QT5)
+#include <QQmlInfo>
+#endif
#include "cameraconfig.h"
#include <QTimer>
+#include "qtcamviewfinderrenderer.h"
+#include <QPainter>
+#if defined(QT4)
VideoPlayer::VideoPlayer(QDeclarativeItem *parent) :
QDeclarativeItem(parent),
+#elif defined(QT5)
+VideoPlayer::VideoPlayer(QQuickItem *parent) :
+ QQuickPaintedItem(parent),
+#endif
m_config(0),
- m_vf(0),
+ m_renderer(0),
m_bin(0),
m_state(VideoPlayer::StateStopped),
m_timer(new QTimer(this)),
m_timer->setSingleShot(false);
m_timer->setInterval(500);
QObject::connect(m_timer, SIGNAL(timeout()), this, SIGNAL(positionChanged()));
+
+#if defined(QT4)
+ setFlag(QGraphicsItem::ItemHasNoContents, false);
+#endif
}
VideoPlayer::~VideoPlayer() {
}
void VideoPlayer::componentComplete() {
+ if (!m_config) {
+ qmlInfo(this) << "CameraConfig not set";
+ return;
+ }
+
+ m_renderer = QtCamViewfinderRenderer::create(m_config->config(), this);
+ if (!m_renderer) {
+ qmlInfo(this) << "Failed to create viewfinder renderer";
+ return;
+ }
+ m_renderer->resize(QSizeF(width(), height()));
+ QObject::connect(m_renderer, SIGNAL(updateRequested()), this, SLOT(updateRequested()));
+
+ if (m_bin) {
+ g_object_set(m_bin, "video-sink", m_renderer->sinkElement(), NULL);
+ }
}
void VideoPlayer::classBegin() {
if (m_config != config) {
m_config = config;
- m_vf = new QtCamGraphicsViewfinder(m_config->config(), this);
- m_vf->resize(QSizeF(width(), height()));
emit cameraConfigChanged();
}
-
- if (m_bin) {
- g_object_set(m_bin, "video-sink", m_vf->sinkElement(), NULL);
- }
}
qint64 VideoPlayer::duration() const {
}
void VideoPlayer::geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry) {
+#if defined(QT4)
QDeclarativeItem::geometryChanged(newGeometry, oldGeometry);
+#elif defined(QT5)
+ QQuickPaintedItem::geometryChanged(newGeometry, oldGeometry);
+#endif
+
+ if (m_renderer) {
+ m_renderer->resize(newGeometry.size());
+ }
+}
+
+#if defined(QT4)
+void VideoPlayer::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+ QWidget *widget) {
- if (m_vf) {
- m_vf->resize(newGeometry.size());
+ Q_UNUSED(widget);
+ Q_UNUSED(option);
+#elif defined(QT5)
+void VideoPlayer::paint(QPainter *painter) {
+#endif
+ painter->fillRect(boundingRect(), Qt::black);
+
+ if (!m_renderer) {
+ return;
}
+
+ m_renderer->paint(painter);
}
VideoPlayer::State VideoPlayer::state() const {
return TRUE;
}
+
+void VideoPlayer::updateRequested() {
+ update();
+}
#ifndef VIDEO_PLAYER_H
#define VIDEO_PLAYER_H
+#if defined(QT4)
#include <QDeclarativeItem>
+#elif defined(QT5)
+#include <QQuickPaintedItem>
+#endif
#include <gst/gst.h>
class CameraConfig;
-class QtCamGraphicsViewfinder;
+class QtCamViewfinderRenderer;
+#if defined(QT4)
class VideoPlayer : public QDeclarativeItem {
+#elif defined(QT5)
+class VideoPlayer : public QQuickPaintedItem {
+#endif
+
Q_OBJECT
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged);
Q_ENUMS(State);
public:
+
+#if defined(QT4)
VideoPlayer(QDeclarativeItem *parent = 0);
+#elif defined(QT5)
+ VideoPlayer(QQuickItem *parent = 0);
+#endif
+
~VideoPlayer();
virtual void componentComplete();
virtual void classBegin();
+#if defined(QT4)
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+#elif defined(QT5)
+ void paint(QPainter *painter);
+#endif
+
QUrl source() const;
void setSource(const QUrl& source);
protected:
void geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry);
+private slots:
+ void updateRequested();
+
private:
static gboolean bus_call(GstBus *bus, GstMessage *msg, gpointer data);
bool setState(const State& state);
CameraConfig *m_config;
- QtCamGraphicsViewfinder *m_vf;
+ QtCamViewfinderRenderer *m_renderer;
QUrl m_url;
GstElement *m_bin;
VideoResolutionModel::VideoResolutionModel(QtCamVideoSettings *settings, QObject *parent) :
QAbstractListModel(parent), m_settings(settings) {
- QHash<int, QByteArray> roles;
- roles[IdRole] = "resolutionId";
- roles[NameRole] = "resolutionName";
- roles[CaptureRole] = "captureResolution";
- roles[PreviewRole] = "previewResolution";
- roles[FpsRole] = "frameRate";
- roles[NightFpsRole] = "nightFrameRate";
- roles[ResolutionRole] = "resolution";
- roles[AspectRatioRole] = "resolutionAspectRatio";
-
- setRoleNames(roles);
+ m_roles[IdRole] = "resolutionId";
+ m_roles[NameRole] = "resolutionName";
+ m_roles[CaptureRole] = "captureResolution";
+ m_roles[PreviewRole] = "previewResolution";
+ m_roles[FpsRole] = "frameRate";
+ m_roles[NightFpsRole] = "nightFrameRate";
+ m_roles[ResolutionRole] = "resolution";
+ m_roles[AspectRatioRole] = "resolutionAspectRatio";
m_resolutions = m_settings->resolutions(m_aspectRatio);
}
endResetModel();
}
}
+
+QHash<int, QByteArray> VideoResolutionModel::roleNames() const {
+ return m_roles;
+}
QString aspectRatio() const;
void setAspectRatio(const QString& aspectRatio);
+ QHash<int, QByteArray> roleNames() const;
+
signals:
void aspectRatioChanged();
QtCamVideoSettings *m_settings;
QList<QtCamVideoResolution> m_resolutions;
+
+ QHash<int, QByteArray> m_roles;
};
#endif /* VIDEO_RESOLUTION_MODEL_H */
#include "camera.h"
#include "cameraconfig.h"
#include "qtcamviewfinderrenderer.h"
+#if defined(QT4)
#include <QDeclarativeInfo>
+#elif defined(QT5)
+#include <QQmlInfo>
+#endif
#include <QPainter>
#include "qtcamdevice.h"
+#if defined(QT4)
Viewfinder::Viewfinder(QDeclarativeItem *parent) :
QDeclarativeItem(parent),
+#elif defined(QT5)
+Viewfinder::Viewfinder(QQuickItem *parent) :
+ QQuickPaintedItem(parent),
+#endif
m_renderer(0),
m_cam(0),
m_conf(0),
m_enabled(true) {
+#if defined(QT4)
setFlag(QGraphicsItem::ItemHasNoContents, false);
+#endif
}
Viewfinder::~Viewfinder() {
emit cameraConfigChanged();
}
+#if defined(QT4)
void Viewfinder::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget) {
Q_UNUSED(widget);
Q_UNUSED(option);
-
+#elif defined(QT5)
+void Viewfinder::paint(QPainter *painter) {
+#endif
painter->fillRect(boundingRect(), Qt::black);
if (!m_renderer || !m_enabled) {
}
void Viewfinder::geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry) {
+#if defined(QT4)
QDeclarativeItem::geometryChanged(newGeometry, oldGeometry);
+#elif defined(QT5)
+ QQuickPaintedItem::geometryChanged(newGeometry, oldGeometry);
+#endif
if (m_renderer) {
m_renderer->resize(newGeometry.size());
#ifndef VIEWFINDER_H
#define VIEWFINDER_H
+#if defined(QT4)
#include <QDeclarativeItem>
+#elif defined(QT5)
+#include <QQuickPaintedItem>
+#endif
#include "qtcamviewfinder.h"
class QtCamViewfinderRenderer;
class Camera;
class CameraConfig;
+#if defined(QT4)
class Viewfinder : public QDeclarativeItem, public QtCamViewfinder {
+#elif defined(QT5)
+class Viewfinder : public QQuickPaintedItem, public QtCamViewfinder {
+#endif
+
Q_OBJECT
Q_PROPERTY(QRectF renderArea READ renderArea NOTIFY renderAreaChanged);
Q_PROPERTY(CameraConfig *cameraConfig READ cameraConfig WRITE setCameraConfig NOTIFY cameraConfigChanged);
public:
+#if defined(QT4)
Viewfinder(QDeclarativeItem *parent = 0);
+#elif defined(QT5)
+ Viewfinder(QQuickItem *parent = 0);
+#endif
+
~Viewfinder();
QRectF renderArea() const;
CameraConfig *cameraConfig() const;
void setCameraConfig(CameraConfig *config);
+#if defined(QT4)
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+#elif defined(QT5)
+ void paint(QPainter *painter);
+#endif
GstElement *sinkElement();
bool setDevice(QtCamDevice *device);
HEADERS += qtcamconfig.h qtcamera.h qtcamscanner.h qtcamdevice.h qtcamviewfinder.h \
qtcammode.h qtcamgstreamermessagehandler.h qtcamgstreamermessagelistener.h \
- qtcamgraphicsviewfinder.h qtcamviewfinderrenderer.h \
+ qtcamviewfinderrenderer.h \
qtcamviewfinderrenderergeneric.h qtcamimagesettings.h qtcamvideosettings.h \
qtcamimagemode.h qtcamvideomode.h qtcammetadata.h qtcamcapability.h \
qtcamzoom.h qtcamflash.h qtcamscene.h qtcamevcomp.h qtcamvideotorch.h \
SOURCES += qtcamconfig.cpp qtcamera.cpp qtcamscanner.cpp qtcamdevice.cpp qtcamviewfinder.cpp \
qtcammode.cpp qtcamgstreamermessagehandler.cpp qtcamgstreamermessagelistener.cpp \
- qtcamgraphicsviewfinder.cpp qtcamviewfinderrenderer.cpp \
+ qtcamviewfinderrenderer.cpp \
qtcamviewfinderrenderergeneric.cpp qtcamimagesettings.cpp qtcamvideosettings.cpp \
qtcamimagemode.cpp qtcamvideomode.cpp qtcammetadata.cpp qtcamcapability.cpp \
qtcamzoom.cpp qtcamflash.cpp qtcamscene.cpp qtcamevcomp.cpp qtcamvideotorch.cpp \
harmattan:SOURCES += qtcamviewfinderrenderermeego.cpp
harmattan:HEADERS += qtcamviewfinderrenderermeego.h
+qt4:SOURCES += qtcamgraphicsviewfinder.cpp
+qt4:HEADERS += qtcamgraphicsviewfinder.h
+
target.path = /usr/lib/
INSTALLS += target
#include "batteryinfo.h"
#include <qmbattery.h>
+#if defined(QT4)
#include <QDeclarativeInfo>
+#elif defined(QT5)
+#include <QQmlInfo>
+#endif
BatteryInfo::BatteryInfo(QObject *parent) :
QObject(parent), m_battery(0) {
#include "dbusservice.h"
#include <QDBusInterface>
#include "platformsettings.h"
+#if defined(QT4)
#include <QDeclarativeInfo>
+#elif defined(QT5)
+#include <QQmlInfo>
+#endif
#include <QDBusPendingCall>
// We cannot use ADBusInterface because it will try to introspect the service upon
#include "deletehelper.h"
#include <QUrl>
#include <QFile>
+#if defined(QT4)
#include <QDeclarativeInfo>
+#elif defined(QT5)
+#include <QQmlInfo>
+#endif
DeleteHelper::DeleteHelper(QObject *parent) :
QObject(parent) {
*/
#include "displaystate.h"
-#include <qmsystem2/qmdisplaystate.h>
+#include <qmdisplaystate.h>
#include <QTimer>
#include <QDebug>
#include <QDir>
#include <QDate>
#include <QFile>
+#if defined(QT4)
#include <QDeclarativeInfo>
+#elif defined(QT5)
+#include <QQmlInfo>
+#endif
#define PATH QString("%1%2MyDocs%2DCIM%2").arg(QDir::homePath()).arg(QDir::separator())
#define TEMP_PATH QString("%1%2MyDocs%2.cameraplus%2").arg(QDir::homePath()).arg(QDir::separator())
#include "focusrectangle.h"
#include <QPainter>
-#include <QDebug>
#define WIDTH 4
#define LENGTH 30
+#if defined(QT4)
FocusRectangle::FocusRectangle(QDeclarativeItem *parent) :
QDeclarativeItem(parent),
+#elif defined(QT5)
+FocusRectangle::FocusRectangle(QQuickItem *parent) :
+ QQuickPaintedItem(parent),
+#endif
m_color(Qt::white) {
+#if defined(QT4)
setFlag(QGraphicsItem::ItemHasNoContents, false);
+#endif
}
FocusRectangle::~FocusRectangle() {
}
}
+#if defined(QT4)
void FocusRectangle::paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
QWidget* widget) {
QDeclarativeItem::paint(painter, option, widget);
+#elif defined(QT5)
+void FocusRectangle::paint(QPainter* painter) {
+#endif
painter->save();
}
void FocusRectangle::geometryChanged( const QRectF& newGeometry, const QRectF& oldGeometry) {
+#if defined(QT4)
QDeclarativeItem::geometryChanged(newGeometry, oldGeometry);
+#elif defined(QT5)
+ QQuickPaintedItem::geometryChanged(newGeometry, oldGeometry);
+#endif
qreal w = width();
qreal h = height();
#ifndef FOCUS_RECTANGLE_H
#define FOCUS_RECTANGLE_H
+#if defined(QT4)
#include <QDeclarativeItem>
+#elif defined(QT5)
+#include <QQuickPaintedItem>
+#endif
+#include <QPainterPath>
+#if defined(QT4)
class FocusRectangle : public QDeclarativeItem {
+#elif defined(QT5)
+class FocusRectangle : public QQuickPaintedItem {
+#endif
+
Q_OBJECT
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged);
public:
+#if defined(QT4)
FocusRectangle(QDeclarativeItem *parent = 0);
+#elif defined(QT5)
+ FocusRectangle(QQuickItem *parent = 0);
+#endif
+
~FocusRectangle();
QColor color() const;
void setColor(const QColor& color);
+#if defined(QT4)
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
+#elif defined(QT5)
+ void paint(QPainter* painter);
+#endif
protected:
void geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry);
#include "gridlines.h"
#include <QPainter>
+#if defined(QT4)
GridLines::GridLines(QDeclarativeItem *parent) :
QDeclarativeItem(parent) {
+#elif defined(QT5)
+GridLines::GridLines(QQuickItem *parent) :
+ QQuickPaintedItem(parent) {
+#endif
+#if defined(QT4)
setFlag(QGraphicsItem::ItemHasNoContents, false);
+#endif
}
GridLines::~GridLines() {
}
-void GridLines::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) {
- Q_UNUSED(option);
- Q_UNUSED(widget);
+#if defined(QT4)
+void GridLines::paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
+ QWidget* widget) {
+
+ QDeclarativeItem::paint(painter, option, widget);
+#elif defined(QT5)
+void GridLines::paint(QPainter* painter) {
+#endif
painter->save();
painter->setPen(QPen(Qt::black, 3));
}
void GridLines::geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry) {
+#if defined(QT4)
QDeclarativeItem::geometryChanged(newGeometry, oldGeometry);
+#elif defined(QT5)
+ QQuickPaintedItem::geometryChanged(newGeometry, oldGeometry);
+#endif
qreal width = newGeometry.width();
qreal height = newGeometry.height();
#ifndef GRID_LINES_H
#define GRID_LINES_H
+#if defined(QT4)
#include <QDeclarativeItem>
+#elif defined(QT5)
+#include <QQuickPaintedItem>
+#endif
+#include <QLineF>
+#if defined(QT4)
class GridLines : public QDeclarativeItem {
+#elif defined(QT5)
+class GridLines : public QQuickPaintedItem {
+#endif
+
Q_OBJECT
public:
+#if defined(QT4)
GridLines(QDeclarativeItem *parent = 0);
+#elif defined(QT5)
+ GridLines(QQuickItem *parent = 0);
+#endif
~GridLines();
+#if defined(QT4)
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
+#elif defined(QT5)
+ void paint(QPainter* painter);
+#endif
protected:
void geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry);
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#if defined(QT4)
#include <QApplication>
#include <QDeclarativeView>
#include <QDeclarativeContext>
#include <QDeclarativeEngine>
#include <QtDeclarative>
#include <QGLWidget>
+#elif defined(QT5)
+#include <QGuiApplication>
+#include <QQuickView>
+#endif
#include "settings.h"
#include "filenaming.h"
#include "cameraresources.h"
#include "compass.h"
#include "orientation.h"
+#if defined(QT4) // TODO:
#include "geocode.h"
+#endif
#include "mountprotector.h"
#include "trackerstore.h"
#include "focusrectangle.h"
#include "platformsettings.h"
#include "dbusservice.h"
+#ifdef HAVE_BOOSTER
+#include <MDeclarativeCache>
+#endif
+
#ifdef QMLJSDEBUGGER
#include "qt_private/qdeclarativedebughelper_p.h"
#endif /* QMLJSDEBUGGER */
+#if defined(QT4)
#include <QAbstractFileEngineHandler>
#include "qmlfileengine.h"
return 0;
}
};
+#endif
Q_DECL_EXPORT int main(int argc, char *argv[]) {
+#if defined(QT4)
QApplication::setAttribute(Qt::AA_X11InitThreads, true);
- QApplication app(argc, argv);
+ QApplication *app = new QApplication(argc, argv);
QmlFileEngineHandler handler;
Q_UNUSED(handler);
+ QDeclarativeView *view = new QDeclarativeView;
+#elif defined(HAVE_BOOSTER)
+ QGuiApplication *app = MDeclarativeCache::qApplication(argc, argv);
+ QQuickView *view = MDeclarativeCache::qQuickView();
+#elif defined(QT5)
+ QGuiApplication::setAttribute(Qt::AA_X11InitThreads, true);
+ QGuiApplication *app = new QGuiApplication(argc, argv);
+ QQuickView *view = new QQuickView;
+#endif
+
#ifdef QMLJSDEBUGGER
QDeclarativeDebugHelper::enableDebugging();
#endif /* QMLJSDEBUGGER */
- QDeclarativeView view;
- view.setAttribute(Qt::WA_NoSystemBackground);
- view.setViewport(new QGLWidget);
- view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
- view.setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
- view.viewport()->setAttribute(Qt::WA_NoSystemBackground);
+#if defined(QT4)
+ view->setAttribute(Qt::WA_NoSystemBackground);
+ view->setViewport(new QGLWidget);
+ view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
+ view->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
+ view->viewport()->setAttribute(Qt::WA_NoSystemBackground);
+#endif
+
+#if defined(QT5)
+ view->setResizeMode(QQuickView::SizeRootObjectToView);
+ // TODO:
+#endif
qmlRegisterType<Settings>("CameraPlus", 1, 0, "Settings");
qmlRegisterType<FileNaming>("CameraPlus", 1, 0, "FileNaming");
qmlRegisterType<CameraResources>("CameraPlus", 1, 0, "CameraResources");
qmlRegisterType<Compass>("CameraPlus", 1, 0, "Compass");
qmlRegisterType<Orientation>("CameraPlus", 1, 0, "Orientation");
+#if defined(QT4) // TODO:
qmlRegisterType<Geocode>("CameraPlus", 1, 0, "ReverseGeocode");
+#endif
qmlRegisterType<MountProtector>("CameraPlus", 1, 0, "MountProtector");
qmlRegisterType<TrackerStore>("CameraPlus", 1, 0, "TrackerStore");
qmlRegisterType<FocusRectangle>("CameraPlus", 1, 0, "FocusRectangle");
qmlRegisterType<PostCaptureModel>("CameraPlus", 1, 0, "PostCaptureModel");
qmlRegisterType<BatteryInfo>("CameraPlus", 1, 0, "BatteryInfo");
qmlRegisterType<GridLines>("CameraPlus", 1, 0, "GridLines");
+#if defined(QT4) // TODO:
qmlRegisterType<DeviceInfo>("CameraPlus", 1, 0, "DeviceInfo");
+#endif
qmlRegisterType<DeviceKeys>("CameraPlus", 1, 0, "DeviceKeys");
qmlRegisterType<PlatformSettings>("CameraPlus", 1, 0, "PlatformSettings");
- view.setSource(QUrl("qrc:/qml/main.qml"));
+ view->setSource(QUrl("qrc:/qml/main.qml"));
+
+ view->showFullScreen();
+
+ int ret = app->exec();
- view.showFullScreen();
+ delete view;
+ delete app;
- int ret = app.exec();
return ret;
}
#include "mountprotector.h"
#include <QDir>
#include <QTemporaryFile>
+#if defined(QT4)
#include <QDeclarativeInfo>
+#elif defined(QT5)
+#include <QQmlInfo>
+#endif
MountProtector::MountProtector(QObject *parent) :
QObject(parent), m_file(0) {
PKGCONFIG +=
-HEADERS += soundvolumecontrol.h
-SOURCES += soundvolumecontrol.cpp
+HEADERS += nemo/soundvolumecontrol.h
+SOURCES += nemo/soundvolumecontrol.cpp
#include <QSparqlQuery>
#include <QSparqlResult>
#include <QSparqlError>
+#if defined(QT4)
#include <QDeclarativeInfo>
+#elif defined(QT5)
+#include <QQmlInfo>
+#endif
#include <QDateTime>
#include <QDBusConnection>
#include <QStringList>
m_connection(0),
m_connected(false) {
- QHash<int, QByteArray> roles;
- roles.insert(Item, "item");
- setRoleNames(roles);
-
qDBusRegisterMetaType<Quad>();
qDBusRegisterMetaType<QList<Quad> >();
}
delete m_connection; m_connection = 0;
}
+QHash<int, QByteArray> PostCaptureModel::roleNames() const {
+ QHash<int, QByteArray> roles;
+ roles.insert(Item, "item");
+ return roles;
+}
+
void PostCaptureModel::reload() {
delete m_connection; m_connection = 0;
QString model() const;
void setModel(const QString& model);
+ QHash<int, QByteArray> roleNames() const;
+
signals:
void error(const QString& msg);
INCLUDEPATH += . ../
include(../cameraplus.pri)
-QT += declarative opengl dbus
-
-CONFIG += link_pkgconfig mobility qtsparql
-
-MOBILITY += location systeminfo
+QT += dbus
+CONFIG += link_pkgconfig
+
+qt4 {
+ QT += declarative opengl
+ CONFIG += mobility
+ MOBILITY += location systeminfo
+ PKGCONFIG += qtsparql qmsystem2 libresourceqt1
+}
-PKGCONFIG = qmsystem2 libresourceqt1
+qt5 {
+ QT += qml quick
+ PKGCONFIG += Qt5Sparql qmsystem2-qt5 libresourceqt5 qdeclarative5-boostable
+ DEFINES += HAVE_BOOSTER
+}
SOURCES += main.cpp settings.cpp filenaming.cpp displaystate.cpp fsmonitor.cpp \
- cameraresources.cpp compass.cpp orientation.cpp geocode.cpp mountprotector.cpp \
+ cameraresources.cpp compass.cpp orientation.cpp mountprotector.cpp \
trackerstore.cpp focusrectangle.cpp sharehelper.cpp deletehelper.cpp galleryhelper.cpp \
- postcapturemodel.cpp batteryinfo.cpp gridlines.cpp deviceinfo.cpp devicekeys.cpp \
- platformsettings.cpp dbusservice.cpp qmlfileengine.cpp
+ postcapturemodel.cpp batteryinfo.cpp gridlines.cpp devicekeys.cpp \
+ platformsettings.cpp dbusservice.cpp
HEADERS += settings.h filenaming.h displaystate.h fsmonitor.h \
- cameraresources.h compass.h orientation.h geocode.h mountprotector.h \
+ cameraresources.h compass.h orientation.h mountprotector.h \
trackerstore.h focusrectangle.h sharehelper.h deletehelper.h galleryhelper.h \
- postcapturemodel.h batteryinfo.h gridlines.h deviceinfo.h devicekeys.h \
- platformsettings.h dbusservice.h qmlfileengine.h
+ postcapturemodel.h batteryinfo.h gridlines.h devicekeys.h \
+ platformsettings.h dbusservice.h
RESOURCES += ../qml/qml.qrc
RESOURCES += ../qml/harmattan/harmattan.qrc
}
+qt4 {
+# TODO: geocode.*
+ SOURCES += qmlfileengine.cpp geocode.cpp deviceinfo.cpp
+ HEADERS += qmlfileengine.h geocode.h deviceinfo.h
+}
+
target.path = /usr/bin/
INSTALLS += target
#include <QSparqlConnection>
#include <QSparqlQuery>
#include <QUrl>
+#if defined(QT4)
#include <QDeclarativeInfo>
+#elif defined(QT5)
+#include <QQmlInfo>
+#endif
#include <QSparqlResult>
#include <QScopedPointer>
#include <QSparqlError>