Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #11 from faenil/qt5
[port] Port to QtQuick2/Qt5
  • Loading branch information
faenil committed Jul 30, 2013
2 parents ad76208 + d4e1522 commit adb01d0
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 44 deletions.
2 changes: 1 addition & 1 deletion CalcButton.qml
Expand Up @@ -39,7 +39,7 @@
**
****************************************************************************/

import QtQuick 1.1
import QtQuick 2.0

MouseArea {
id: button
Expand Down
4 changes: 2 additions & 2 deletions Display.qml
Expand Up @@ -39,8 +39,8 @@
**
****************************************************************************/

import QtQuick 1.1
import "qrc:/js/calculator.js" as CalcEngine
import QtQuick 2.0
import "calculator.js" as CalcEngine

Item {
Text {
Expand Down
4 changes: 2 additions & 2 deletions HistoryDisplay.qml
@@ -1,5 +1,5 @@
import QtQuick 1.1
import "qrc:/js/calculator.js" as CalcEngine
import QtQuick 2.0
import "calculator.js" as CalcEngine

Flickable {
id: scrollArea
Expand Down
21 changes: 9 additions & 12 deletions main.cpp
@@ -1,6 +1,6 @@
#include <QDeclarativeView>
#include <QDeclarativeEngine>
#include <QApplication>
#include <QQuickView>
#include <QQmlEngine>
#include <QGuiApplication>

#ifdef HAS_BOOSTER
#include <MDeclarativeCache>
Expand All @@ -9,20 +9,17 @@
Q_DECL_EXPORT int main(int argc, char **argv)
{
#ifdef HAS_BOOSTER
QScopedPointer<QApplication> a(MDeclarativeCache::qApplication(argc, argv));
QScopedPointer<QDeclarativeView> view(MDeclarativeCache::qDeclarativeView());
QScopedPointer<QGuiApplication> a(MDeclarativeCache::qApplication(argc, argv));
QScopedPointer<QQuickView> view(MDeclarativeCache::qQuickView());
#else
QScopedPointer<QApplication> a(new QApplication(argc, argv));
QScopedPointer<QDeclarativeView> view(new QDeclarativeView);
QScopedPointer<QGuiApplication> a(new QGuiApplication(argc, argv));
QScopedPointer<QQuickView> view(new QQuickView);
#endif

QObject::connect(view->engine(), SIGNAL(quit()), a.data(), SLOT(quit()));
view->setAttribute(Qt::WA_OpaquePaintEvent);
view->setAttribute(Qt::WA_NoSystemBackground);
view->viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
view->viewport()->setAttribute(Qt::WA_NoSystemBackground);

view->setSource(QUrl("qrc:/qml/main.qml"));

view->setSource(QUrl("/usr/share/qmlcalc/main.qml"));
view->showFullScreen();
return a->exec();
}
6 changes: 3 additions & 3 deletions main.qml
Expand Up @@ -39,9 +39,9 @@
**
****************************************************************************/

import QtQuick 1.1
import com.nokia.meego 1.0
import "qrc:/js/calculator.js" as CalcEngine
import QtQuick 2.0
import com.nokia.meego 2.0
import "calculator.js" as CalcEngine

PageStackWindow {
id: calcwindow
Expand Down
2 changes: 1 addition & 1 deletion qmlcalc.desktop
Expand Up @@ -2,6 +2,6 @@
Type=Application
Name=Calculator
Categories=Applications
Exec=invoker --type=qtcomponents -s /usr/bin/qmlcalc
Exec=invoker --type=qtcomponents-qt5 -s /usr/bin/qmlcalc
Icon=icon-l-calculator

19 changes: 11 additions & 8 deletions qmlcalc.pro
Expand Up @@ -2,18 +2,16 @@
# Automatically generated by qmake (2.01a) Fri Sep 9 22:39:33 2011
######################################################################

QT += declarative
QT += qml quick

TEMPLATE = app
TARGET =
TARGET = qmlcalc
DEPENDPATH += .
INCLUDEPATH += .

# Input
SOURCES += main.cpp

RESOURCES += \
res.qrc

OTHER_FILES += \
calculator.js \
Expand All @@ -30,11 +28,16 @@ desktop.path = /usr/share/applications
desktop.files = qmlcalc.desktop
INSTALLS += desktop

qml.path = $${INSTAL_ROOT}/usr/share/qmlcalc
qml.files = *.qml *.js
INSTALLS += qml

CONFIG += link_pkgconfig
packagesExist(qdeclarative-boostable) {
message("Building with qdeclarative-boostable support")

packagesExist(qdeclarative5-boostable) {
message("Building with qdeclarative5-boostable support")
DEFINES += HAS_BOOSTER
PKGCONFIG += qdeclarative-boostable
PKGCONFIG += qdeclarative5-boostable
} else {
warning("qdeclarative-boostable not available; startup times will be slower")
warning("qdeclarative5-boostable not available; startup times will be slower")
}
15 changes: 8 additions & 7 deletions rpm/qmlcalc.spec
Expand Up @@ -16,12 +16,12 @@ License: LGPL v2.1
URL: http://github.com/nemomobile/qmlcalc
Source0: %{name}-%{version}.tar.bz2
Source100: qmlcalc.yaml
Requires: qt-components
Requires: mapplauncherd-booster-qtcomponents
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(QtDeclarative)
BuildRequires: pkgconfig(QtGui)
BuildRequires: pkgconfig(qdeclarative-boostable)
Requires: qt-components-qt5
Requires: mapplauncherd-booster-qtcomponents-qt5
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Quick)
BuildRequires: pkgconfig(Qt5Qml)
BuildRequires: pkgconfig(qdeclarative5-boostable)
BuildRequires: desktop-file-utils

%description
Expand All @@ -38,7 +38,7 @@ Calculator application written using QML
# >> build pre
# << build pre

%qmake
%qmake5

make %{?jobs:-j%jobs}

Expand All @@ -62,5 +62,6 @@ desktop-file-install --delete-original \
%defattr(-,root,root,-)
%{_bindir}/qmlcalc
%{_datadir}/applications/qmlcalc.desktop
%{_datadir}/qmlcalc/*
# >> files
# << files
16 changes: 8 additions & 8 deletions rpm/qmlcalc.yaml
Expand Up @@ -11,18 +11,18 @@ Description: |
Calculator application written using QML
PkgConfigBR:
- x11
- QtDeclarative
- QtGui
- qdeclarative-boostable
- Qt5Core
- Qt5Quick
- Qt5Qml
- qdeclarative5-boostable

Requires:
- qt-components
- mapplauncherd-booster-qtcomponents
- qt-components-qt5
- mapplauncherd-booster-qtcomponents-qt5

Configure: none
Builder: qmake
Builder: qmake5
Files:
- "%{_bindir}/qmlcalc"
- "%{_datadir}/applications/qmlcalc.desktop"

- "%{_datadir}/qmlcalc/*"

0 comments on commit adb01d0

Please sign in to comment.