Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Rename of project to cordova-qt
  • Loading branch information
Viras- committed Feb 13, 2012
1 parent a72e4b3 commit 3b96e41f9c6341e4e5e9f9ed63850c7cf606115a
Show file tree
Hide file tree
Showing 33 changed files with 995 additions and 63 deletions.
@@ -1,7 +1,7 @@
Callback/Qt
Cordova/Qt
===

Callback/Qt is the Qt port of the phonegap (Callback) framework. It should compile on any platform which is compatible with Qt & Qt mobility.
Cordova/Qt is the Qt port of the cordova (formerly phonegap) framework. It should compile on any platform which is compatible with Qt & Qt mobility.

Requires
---
@@ -0,0 +1,11 @@
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Name=cordova-qt
Exec=/opt/cordova-qt/bin/cordova-qt
Icon=cordova-qt64
X-Window-Icon=
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable
@@ -0,0 +1,120 @@
# Add files and directories to ship with the application
# by adapting the examples below.
# file1.source = myfile
# dir1.source = mydir
wwwDir.source = www
xmlDir.source = xml

DEPLOYMENTFOLDERS = wwwDir xmlDir # file1 dir1

symbian:TARGET.UID3 = 0xE3522943

# Smart Installer package's UID
# This UID is from the protected range
# and therefore the package will fail to install if self-signed
# By default qmake uses the unprotected range value if unprotected UID is defined for the application
# and 0x2002CCCF value if protected UID is given to the application
#symbian:DEPLOYMENT.installer_header = 0x2002CCCF

# Allow network access on Symbian
symbian:TARGET.CAPABILITY += NetworkServices

# If your application uses the Qt Mobility libraries, uncomment
# the following lines and add the respective components to the
# MOBILITY variable.
CONFIG += mobility
MOBILITY += feedback location systeminfo

SOURCES += main.cpp mainwindow.cpp \
src/plugins/notification.cpp \
src/plugins/geolocation.cpp \
src/plugins/fileapi.cpp \
src/plugins/device.cpp \
src/pluginregistry.cpp \
src/plugins/console.cpp \
src/plugins/connection.cpp \
src/cordova.cpp \
src/cplugin.cpp \
src/cwebpage.cpp
HEADERS += mainwindow.h \
src/plugins/notification.h \
src/plugins/geolocation.h \
src/plugins/fileapi.h \
src/plugins/device.h \
src/pluginregistry.h \
src/plugins/console.h \
src/plugins/connection.h \
src/cordova.h \
src/cplugin.h \
src/cwebpage.h
FORMS += mainwindow.ui

QT += webkit

# Please do not modify the following two lines. Required for deployment.
include(deployment.pri)
qtcAddDeployment()

OTHER_FILES +=






























































Large diffs are not rendered by default.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN +5.52 KB cordovaqt64.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN +6.45 KB cordovaqt80.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,11 @@
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Name=cordova-qt
Exec=/usr/bin/single-instance /opt/cordova-qt/bin/cordova-qt
Icon=/usr/share/icons/hicolor/80x80/apps/cordova-qt80.png
X-Window-Icon=
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable
@@ -24,7 +24,7 @@ MainWindow::MainWindow(QWidget *parent)
{
ui->setupUi(this);

m_phoneGap = new PhoneGap(ui->webView);
m_cordova = new Cordova(ui->webView);
}

MainWindow::~MainWindow()
@@ -17,7 +17,7 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "src/phonegap.h"
#include "src/cordova.h"

#include <QtGui/QMainWindow>

@@ -45,7 +45,7 @@ class MainWindow : public QMainWindow

private:
Ui::MainWindow *ui;
PhoneGap *m_phoneGap;
Cordova *m_cordova;
};

#endif // MAINWINDOW_H
@@ -14,14 +14,14 @@
* limitations under the License.
*/

#include "phonegap.h"
#include "cordova.h"
#include "pluginregistry.h"
#include "pgwebpage.h"
#include "cwebpage.h"

#include <QDebug>
#include <QXmlStreamReader>

PhoneGap::PhoneGap(QWebView *webView) : QObject(webView) {
Cordova::Cordova(QWebView *webView) : QObject(webView) {
m_webView = webView;
// Configure web view
m_webView->settings()->enablePersistentStorage();
@@ -33,7 +33,7 @@ PhoneGap::PhoneGap(QWebView *webView) : QObject(webView) {
QObject::connect( m_webView, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)) );

// Set our own WebPage class
m_webView->setPage( new PGWebPage() );
m_webView->setPage( new CWebPage() );

// Determine index file path
m_workingDir = QDir::current();
@@ -48,7 +48,7 @@ PhoneGap::PhoneGap(QWebView *webView) : QObject(webView) {
/**
* Called when the webview finished loading a new page
*/
void PhoneGap::loadFinished( bool ok ) {
void Cordova::loadFinished( bool ok ) {
Q_UNUSED(ok)

// Change into the xml-directory
@@ -84,7 +84,7 @@ void PhoneGap::loadFinished( bool ok ) {

qDebug() << "Adding Plugin " << attribName << " with " << attribValue;
// Check for such a plugin
PGPlugin *currPlugin = PluginRegistry::getRegistry()->getPlugin( attribValue );
CPlugin *currPlugin = PluginRegistry::getRegistry()->getPlugin( attribValue );
if( currPlugin != NULL ) {
currPlugin->setWebFrame( webFrame );
webFrame->addToJavaScriptWindowObject( objectName, currPlugin );
@@ -14,21 +14,21 @@
* limitations under the License.
*/

#ifndef PHONEGAP_H
#define PHONEGAP_H
#ifndef CORDOVA_H
#define CORDOVA_H

#include <QObject>
#include <QWebView>
#include <QMap>
#include <QDir>

#include "pgplugin.h"
#include "cplugin.h"

class PhoneGap : public QObject
class Cordova : public QObject
{
Q_OBJECT
public:
explicit PhoneGap(QWebView *webView);
explicit Cordova(QWebView *webView);

signals:

@@ -40,4 +40,4 @@ public slots:
QDir m_workingDir;
};

#endif // PHONEGAP_H
#endif // CORDOVA_H
@@ -14,17 +14,17 @@
* limitations under the License.
*/

#include "pgplugin.h"
#include "cplugin.h"

#include <QDebug>

PGPlugin::PGPlugin() : QObject(0) {
CPlugin::CPlugin() : QObject(0) {
}

/**
* Receive a reference to the currently active webframe
*/
void PGPlugin::setWebFrame(QWebFrame *p_webFrame) {
void CPlugin::setWebFrame(QWebFrame *p_webFrame) {
m_webFrame = p_webFrame;

// Initialize the plugin
@@ -34,13 +34,13 @@ void PGPlugin::setWebFrame(QWebFrame *p_webFrame) {
/**
* Override this function if your plugin requires startup initialisation
*/
void PGPlugin::init() {
void CPlugin::init() {
}

/**
* Execute a callback on the javascript end
*/
void PGPlugin::callback( int p_callbackId, QString p_jsParameters ) {
void CPlugin::callback( int p_callbackId, QString p_jsParameters ) {
QString javascript;

if( p_jsParameters.length() > 0 ) {
@@ -14,17 +14,17 @@
* limitations under the License.
*/

#ifndef PGPLUGIN_H
#define PGPLUGIN_H
#ifndef CPLUGIN_H
#define CPLUGIN_H

#include <QObject>
#include <QWebFrame>

class PGPlugin : public QObject
class CPlugin : public QObject
{
Q_OBJECT
public:
explicit PGPlugin();
explicit CPlugin();

void setWebFrame(QWebFrame *p_webFrame);

@@ -41,4 +41,4 @@ public slots:
QWebFrame *m_webFrame;
};

#endif // PGPLUGIN_H
#endif // CPLUGIN_H
@@ -14,15 +14,15 @@
* limitations under the License.
*/

#include "pgwebpage.h"
#include "cwebpage.h"

#include <QDebug>

PGWebPage::PGWebPage(QObject *parent) :
CWebPage::CWebPage(QObject *parent) :
QWebPage(parent)
{
}

void PGWebPage::javaScriptConsoleMessage( const QString & message, int lineNumber, const QString & sourceID ) {
void CWebPage::javaScriptConsoleMessage( const QString & message, int lineNumber, const QString & sourceID ) {
qDebug() << sourceID << lineNumber << message;
}
@@ -14,16 +14,16 @@
* limitations under the License.
*/

#ifndef PGWEBPAGE_H
#define PGWEBPAGE_H
#ifndef CWEBPAGE_H
#define CWEBPAGE_H

#include <QWebPage>

class PGWebPage : public QWebPage
class CWebPage : public QWebPage
{
Q_OBJECT
public:
explicit PGWebPage(QObject *parent = 0);
explicit CWebPage(QObject *parent = 0);

protected:
void javaScriptConsoleMessage( const QString & message, int lineNumber, const QString & sourceID );
@@ -34,4 +34,4 @@ public slots:

};

#endif // PGWEBPAGE_H
#endif // CWEBPAGE_H
@@ -19,7 +19,7 @@
PluginRegistry* PluginRegistry::m_pluginRegistry = NULL;

PluginRegistry::PluginRegistry() {
m_plugins = new QMap<QString,PGPlugin*>();
m_plugins = new QMap<QString,CPlugin*>();
}

PluginRegistry *PluginRegistry::getRegistry() {
@@ -30,10 +30,10 @@ PluginRegistry *PluginRegistry::getRegistry() {
return PluginRegistry::m_pluginRegistry;
}

void PluginRegistry::registerPlugin( QString p_name, PGPlugin *p_plugin ) {
void PluginRegistry::registerPlugin( QString p_name, CPlugin *p_plugin ) {
m_plugins->insert( p_name, p_plugin );
}

PGPlugin* PluginRegistry::getPlugin( QString p_name ) {
CPlugin* PluginRegistry::getPlugin( QString p_name ) {
return m_plugins->value( p_name, NULL );
}

0 comments on commit 3b96e41

Please sign in to comment.