${QT_QTDBUS}
${QT_QTGUI}
${QT_QTDECLARATIVE_INCLUDE_DIR}
+ /usr/include/meegotouch
)
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/proxy.cpp ${CMAKE_CURRENT_SOURCE_DIR}/proxy.h PROPERTIES GENERATED 1)
SET(MOC_HEADERS
+ ./MainPageHandler.h
./models/QDeclarativeDownloadListModel.h
./models/QDeclarativeDownloadListModel_p.h
-# ./DownloadView.h
-# ./models/Plugin.h
-# ./MainWindow.h
-# ./PreferencesDialog.h
-# ./proxy.h
-# ./SeedView.h
-# ./ColumnSelectorDialog.h
)
SET(SRC
-# ./DownloadView.cpp
./main.cpp
+ ./MainPageHandler.cpp
./models/QDeclarativeDownloadListModel.cpp
-# ./MainWindow.cpp
-# ./PreferencesDialog.cpp
-# ./proxy.cpp
-# ./SeedView.cpp
-# ./ColumnSelectorDialog.cpp
)
${QT_QTTEST_LIBRARY}
${QT_QTDECLARATIVE_LIBRARY}
-lboost_system-mt
+ -lmeegotouchcore
)
# Check if we are building under scratchbox and link with QtMaemo5 only in that case.
--- /dev/null
+/*
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 2012 Ixonos Plc
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+#include <QtCore/QString>
+#include <QtCore/QDebug>
+#include <QFileDialog>
+#include <meegotouch/mwindow.h>
+
+#include "MainPageHandler.h"
+
+
+namespace qtrapids
+{
+
+MainPageHandler::MainPageHandler(QObject *parent) :
+ QObject(parent)
+{
+}
+
+MainPageHandler::~MainPageHandler()
+{
+}
+
+void MainPageHandler::fileSelectorOpen()
+{
+ qDebug() << Q_FUNC_INFO;
+ QWidget* widget = qobject_cast<QWidget*>(MApplication::activeWindow());
+ QString filename = QFileDialog::getOpenFileName(widget, tr("Open torrent file"), QString(), tr("Torrent files (*.torrent)") );
+ on_torrentFileSelected(filename);
+}
+
+
+void MainPageHandler::on_torrentFileSelected(const QString& file)
+{
+ qDebug() << Q_FUNC_INFO << " file selected: " << file;
+
+ // Torrent filename empty, do nothing.
+ if (file == "") {
+ return;
+ }
+
+ // Otherwise add torrent
+ // For params, see: http://www.rasterbar.com/products/libtorrent/manual.html#add-torrent
+ // save_path is the only mandatory parameter, rest are optional.
+ //addParams.storage_mode = libtorrent::storage_mode_allocate;
+ try {
+ // TODO: Enable this once server_ is in place
+// server_.addTorrent(file,
+// settings_.value("download/directory").toString(),
+// ParamsMap_t());
+ } catch (...) {
+ qDebug() << Q_FUNC_INFO << "Exception adding torrent";
+ }
+}
+
+} //namespace qtrapids
--- /dev/null
+/*
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 2012 <copyright holder> <email>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+
+#ifndef MAINPAGEHANDLER_H
+#define MAINPAGEHANDLER_H
+
+// Used in this class and main.cpp, so include here
+#include <meegotouch/mapplication.h>
+#include <QtCore/QObject>
+
+namespace qtrapids
+{
+
+class MainPageHandler : public QObject
+{
+ Q_OBJECT
+public:
+ MainPageHandler(QObject *parent = 0);
+ virtual ~MainPageHandler();
+
+ Q_INVOKABLE void fileSelectorOpen();
+
+private slots:
+ void on_torrentFileSelected(const QString& file);
+
+private:
+ Q_DISABLE_COPY(MainPageHandler);
+};
+
+} // namespace qtrapids
+
+
+#endif // MAINPAGEHANDLER_H
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
-#include <QApplication>
#include <QtDeclarative>
#include <QDeclarativeContext>
#include <QTest>
#include <QDebug>
-//#include <QDesktopWidget>
-//#include "DownloadView.h"
#include <QtDeclarative/qdeclarative.h>
-#include "models/QDeclarativeDownloadListModel.h"
+#include <meegotouch/mapplicationpage.h>
+#include <meegotouch/mapplicationwindow.h>
-#include "MainWindow.h"
+#include "models/QDeclarativeDownloadListModel.h"
+#include "MainPageHandler.h"
#include "../include/qtrapids/dbus.hpp"
-using qtrapids::MainWindow;
-
int main(int argc, char *argv[])
{
-
-
+ // TODO: Check: could we use MApplication:: instead?
QCoreApplication::setOrganizationName("Ixonos");
QCoreApplication::setOrganizationDomain("ixonos.com");
QCoreApplication::setApplicationName("QtRapids");
QApplication app(argc, argv);
//MainWindow mainWindow;
app.setProperty("NoMStyle", true);
-
- // Register our types:
+
+ // Register our types (e.g. models and stuff):
qmlRegisterType<qtrapids::QDeclarativeDownloadListModel>("QtRapids", 1, 0, "DownloadListModel");
QDir::setCurrent(app.applicationDirPath());
QDeclarativeView window;
- //QDeclarativeEngine engine;
+ // Setting the root context properties. Create an QObject-derived
+ // object:
qtrapids::QDeclarativeDownloadListModel downloadModel;
+ qtrapids::MainPageHandler mainPageHandler;
+ // ... and add to QML context. This can then be used in QML context.
QDeclarativeContext *context = window.rootContext();
context->setContextProperty("downloadModel", &downloadModel);
+ context->setContextProperty("mainPageHandler", &mainPageHandler);
+
+ // Initial QML file/resource:
window.setSource(QUrl("qrc:/main.qml"));
window.showFullScreen();
-// window.show();
-
+
/* TODO: Enable this once we have the views up & running
+ * TODO: We can add this to mainPageHandler now...
QDBusConnection dbus = QDBusConnection::sessionBus();
dbus.registerObject("/qtrapids_gui", &mainWindow);
dbus.registerService("com.ixonos.qtrapids_gui");
import com.nokia.meego 1.0
import com.meego 1.0
import com.nokia.extras 1.0
+import Qt 4.7
import QtRapids 1.0
Page {
- id: tabbarPage
+ id: mainPage
property bool busy: Boolean(tabGroup.currentTab.busy)
anchors.margins: rootWindow.pageMargin
tab: seeds
}
}
- ToolIcon { iconId: "toolbar-view-menu"; onClicked: (myMenu.status == DialogStatus.Closed) ? myMenu.open() : myMenu.close() }
+ ToolIcon {
+ iconId: "toolbar-view-menu"
+ onClicked: (myMenu.status == DialogStatus.Closed) ? myMenu.open() : myMenu.close()
+ }
}
// Text {
// text: "Hello World!"
}
}
}
-
+ Menu {
+ id: myMenu
+ visualParent: mainPage
+ MenuLayout {
+ MenuItem {
+ id: menuItemOpenFile
+ text: "Open"
+ onClicked: { console.log("opening torrent picker"); pageStack.push(torrentPickerComp); }
+ }
+ }
+ }
+ Component {
+ id: torrentPickerComp
+ TorrentPickerPage { }
+ }
}
\ No newline at end of file
--- /dev/null
+import QtQuick 1.1
+import Qt.labs.components 1.0
+import com.nokia.meego 1.0
+import com.meego 1.0
+import com.nokia.extras 1.0
+
+import QtMobility.gallery 1.1
+import QtRapids 1.0
+
+Page {
+
+ id: torrentPickerPage
+ Component.onCompleted: console.log("TorrentPicker Running!")
+ DocumentGalleryModel {
+ id: torrentFileModel
+
+ rootType: DocumentGallery.File
+ properties: ["url"]
+ filter: GalleryWildcardFilter {
+ property: "fileName";
+ value: "*.torrent";
+ }
+
+ onProgressChanged: console.log("Width has changed to: ", progress)
+
+// onCountChanged: {
+// selection.clear()
+// for (var i = 0; i < count; i++)
+// selection.append({"selected": false})
+// }
+ }
+ // TODO: Don't really need this, we can only select one file, I guess?
+// ListModel {
+// id: selection
+// }
+ ListView {
+ width: 200; height: 400
+ model: torrentFileModel
+ delegate: torrentFileDelegate
+ }
+ Component {
+ id: torrentFileDelegate
+
+ Item {
+ height: 60
+ width: parent.width
+ Text {
+ text: "Torrent"
+ }
+ Text {
+ text: url
+ }
+ }
+ }
+}
\ No newline at end of file
<qresource prefix="/">
<file>main.qml</file>
<file>MainPage.qml</file>
+ <file>TorrentPickerPage.qml</file>
</qresource>
</RCC>
\ No newline at end of file