Remove harmattan specific bits from Sounds
[harmattan/cameraplus] / src / main.cpp
index 178c116..e0556b7 100644 (file)
@@ -1,7 +1,7 @@
 /*!
  * This file is part of CameraPlus.
  *
- * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
+ * Copyright (C) 2012-2013 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
 #include <QDeclarativeEngine>
 #include <QtDeclarative>
 #include <QGLWidget>
-#include <QuillFile>
 
 #include "settings.h"
 #include "filenaming.h"
+#ifdef HARMATTAN
 #include "quillitem.h"
+#include "soundvolumecontrol.h"
+#endif
 #include "displaystate.h"
 #include "fsmonitor.h"
 #include "cameraresources.h"
 #include "gridlines.h"
 #include "deviceinfo.h"
 #include "devicekeys.h"
+#include "platformsettings.h"
+#include "dbusservice.h"
 
 #ifdef QMLJSDEBUGGER
 #include "qt_private/qdeclarativedebughelper_p.h"
 #endif /* QMLJSDEBUGGER */
 
-static void initQuill() {
-  // TODO: All these are hardcoded.
-  Quill::setPreviewLevelCount(1);
-  Quill::setPreviewSize(0, QSize(854, 480));
-  Quill::setMinimumPreviewSize(0, QSize(854, 480));
-  Quill::setThumbnailExtension("jpeg");
-  Quill::setThumbnailFlavorName(0, "screen");
-  Quill::setBackgroundRenderingColor(Qt::black);
-  QString tempPath(QDir::homePath() +  QDir::separator() + ".config" +
-                  QDir::separator() + "quill" + QDir::separator() + "tmp");
-  QDir().mkpath(tempPath);
-  Quill::setTemporaryFilePath(tempPath);
-  Quill::setDBusThumbnailingEnabled(true);
-  Quill::setThumbnailCreationEnabled(true);
-}
+#include <QAbstractFileEngineHandler>
+#include "qmlfileengine.h"
+
+class QmlFileEngineHandler : public QAbstractFileEngineHandler {
+  QAbstractFileEngine *create(const QString& fileName) const {
+    QString fn = fileName.toLower();
+    if (fn.startsWith(':') && fn.endsWith(".qml")) {
+      return new QmlFileEngine(fileName);
+    }
+
+    return 0;
+  }
+};
 
 Q_DECL_EXPORT int main(int argc, char *argv[]) {
   QApplication::setAttribute(Qt::AA_X11InitThreads, true);
   QApplication app(argc, argv);
 
+  QmlFileEngineHandler handler;
+  Q_UNUSED(handler);
+
 #ifdef QMLJSDEBUGGER
   QDeclarativeDebugHelper::enableDebugging();
 #endif /* QMLJSDEBUGGER */
 
-  // Let's initialize Quill:
-  initQuill();
-
   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);
 
   qmlRegisterType<Settings>("CameraPlus", 1, 0, "Settings");
   qmlRegisterType<FileNaming>("CameraPlus", 1, 0, "FileNaming");
+#ifdef HARMATTAN
   qmlRegisterType<QuillItem>("CameraPlus", 1, 0, "QuillItem");
+  qmlRegisterType<SoundVolumeControl>("CameraPlus", 1, 0, "SoundVolumeControl");
+#endif
   qmlRegisterType<DisplayState>("CameraPlus", 1, 0, "DisplayState");
   qmlRegisterType<FSMonitor>("CameraPlus", 1, 0, "FSMonitor");
   qmlRegisterType<CameraResources>("CameraPlus", 1, 0, "CameraResources");
@@ -103,6 +110,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) {
   qmlRegisterType<GridLines>("CameraPlus", 1, 0, "GridLines");
   qmlRegisterType<DeviceInfo>("CameraPlus", 1, 0, "DeviceInfo");
   qmlRegisterType<DeviceKeys>("CameraPlus", 1, 0, "DeviceKeys");
+  qmlRegisterType<PlatformSettings>("CameraPlus", 1, 0, "PlatformSettings");
 
   view.setSource(QUrl("qrc:/qml/main.qml"));