// TODO: losing resources while playback won't show an error
// TODO: show something if we have no files.
// TODO: favorites
-// TODO: menu
+
CameraPage {
id: page
return new Date(dates[0], dates[1], dates[2], times[0], times[1], times[2]);
}
+
+ function launchGallery() {
+ if (!gallery.launch()) {
+ showError(qsTr("Failed to launch gallery"));
+ }
+ }
+
+ function showInGallery() {
+ if (!available) {
+ return;
+ }
+
+ if (!gallery.show(currentItem.itemUrl)) {
+ showError(qsTr("Failed to launch gallery"));
+ }
+ }
+
+ Menu {
+ id: menu
+ MenuLayout {
+ MenuItem {text: qsTr("Captures in gallery"); onClicked: launchGallery(); }
+ MenuItem {text: qsTr("View in gallery"); enabled: available; onClicked: showInGallery(); }
+ }
+ }
+
function deleteCurrentItem() {
if (!available) {
return;
id: share
}
+ GalleryHelper {
+ id: gallery
+ }
+
Rectangle {
color: "black"
anchors.fill: parent
ToolIcon { iconId: available ? "icon-m-toolbar-favorite-mark-white" : "icon-m-toolbar-favorite-mark-dimmed-white"}
ToolIcon { iconId: available ? "icon-m-toolbar-share-white" : "icon-m-toolbar-share-dimmed-white"; onClicked: shareCurrentItem(); }
ToolIcon { iconId: available ? "icon-m-toolbar-delete-white" : "icon-m-toolbar-delete-dimmed-white"; onClicked: deleteCurrentItem(); }
- ToolIcon { iconId: "icon-m-toolbar-view-menu-white" }
+ ToolIcon { iconId: "icon-m-toolbar-view-menu-white"; onClicked: menu.open(); }
}
}
--- /dev/null
+/*!
+ * This file is part of CameraPlus.
+ *
+ * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "galleryhelper.h"
+#include <maemo-meegotouch-interfaces/galleryinterface.h>
+#include <QStringList>
+#include <QUrl>
+#include <QDeclarativeInfo>
+
+GalleryHelper::GalleryHelper(QObject *parent) :
+ QObject(parent),
+ m_iface(new GalleryInterface) {
+
+}
+
+GalleryHelper::~GalleryHelper() {
+ delete m_iface;
+}
+
+bool GalleryHelper::show(const QUrl& path) {
+ if (!m_iface->isValid()) {
+ qmlInfo(this) << "Failed to get gallery interface";
+ return false;
+ }
+
+ return m_iface->showMediaInFullScreen(QStringList() << path.toLocalFile());
+}
+
+bool GalleryHelper::launch() {
+ if (!m_iface->isValid()) {
+ qmlInfo(this) << "Failed to get gallery interface";
+ return false;
+ }
+
+ return m_iface->showCameraRoll();
+}
--- /dev/null
+// -*- c++ -*-
+
+/*!
+ * This file is part of CameraPlus.
+ *
+ * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef GALLERY_HELPER_H
+#define GALLERY_HELPER_H
+
+#include <QObject>
+
+class QUrl;
+class GalleryInterface;
+
+class GalleryHelper : public QObject {
+ Q_OBJECT
+
+public:
+ GalleryHelper(QObject *parent = 0);
+ ~GalleryHelper();
+
+ Q_INVOKABLE bool show(const QUrl& path);
+ Q_INVOKABLE bool launch();
+
+private:
+ GalleryInterface *m_iface;
+};
+
+#endif /* GALLERY_HELPER_H */
#include "focusrectangle.h"
#include "sharehelper.h"
#include "deletehelper.h"
+#include "galleryhelper.h"
static void initQuill() {
// TODO: All these are hardcoded.
qmlRegisterType<FocusRectangle>("CameraPlus", 1, 0, "FocusRectangle");
qmlRegisterType<ShareHelper>("CameraPlus", 1, 0, "ShareHelper");
qmlRegisterType<DeleteHelper>("CameraPlus", 1, 0, "DeleteHelper");
+ qmlRegisterType<GalleryHelper>("CameraPlus", 1, 0, "GalleryHelper");
QUrl sourceUrl = QUrl::fromLocalFile(QDir::currentPath() + "/main.qml");
view.setSource(sourceUrl);
QT += declarative opengl dbus
-CONFIG += link_pkgconfig debug static mobility qtsparql
+CONFIG += link_pkgconfig debug static mobility qtsparql galleryinterface-maemo-meegotouch \
+ shareuiinterface-maemo-meegotouch
MOBILITY += location
PKGCONFIG = gstreamer-0.10 gstreamer-interfaces-0.10 gstreamer-video-0.10 gstreamer-tag-0.10 \
- gstreamer-pbutils-0.10 meego-gstreamer-interfaces-0.10 quill qmsystem2 libresourceqt1 \
- ShareUiInterface-maemo-meegotouch
+ gstreamer-pbutils-0.10 meego-gstreamer-interfaces-0.10 quill qmsystem2 libresourceqt1
LIBS += -L../imports/ -limports -L../lib/ -lqtcamera
SOURCES += main.cpp settings.cpp filenaming.cpp quillitem.cpp displaystate.cpp fsmonitor.cpp \
cameraresources.cpp compass.cpp orientation.cpp geocode.cpp mountprotector.cpp \
- trackerstore.cpp focusrectangle.cpp sharehelper.cpp deletehelper.cpp
+ trackerstore.cpp focusrectangle.cpp sharehelper.cpp deletehelper.cpp galleryhelper.cpp
HEADERS += settings.h filenaming.h quillitem.h displaystate.h fsmonitor.h \
cameraresources.h compass.h orientation.h geocode.h mountprotector.h \
- trackerstore.h focusrectangle.h sharehelper.h deletehelper.h
+ trackerstore.h focusrectangle.h sharehelper.h deletehelper.h galleryhelper.h