Skip to content
This repository has been archived by the owner on Sep 4, 2019. It is now read-only.

Commit

Permalink
added no sample socialinvocation; formatting fixes for barcodeinvoker…
Browse files Browse the repository at this point in the history
…,barcodescanner
  • Loading branch information
CodeHoarder committed Feb 15, 2013
1 parent d4cb62d commit a051076
Show file tree
Hide file tree
Showing 46 changed files with 1,584 additions and 326 deletions.
6 changes: 3 additions & 3 deletions barcodeinvoker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ all: Makefile $(QMAKE_TARGET)

clean:
$(MAKE) -C ./arm -f Makefile sureclean
$(MAKE) -C ./x86 -f Makefile sureclean
$(MAKE) -C ./x86 -f Makefile sureclean


Makefile: FORCE
Makefile: FORCE
$(QMAKE) -spec blackberry-armv7le-qcc -o arm/Makefile $(QMAKE_TARGET).pro CONFIG+=device
$(QMAKE) -spec blackberry-x86-qcc -o x86/Makefile $(QMAKE_TARGET).pro CONFIG+=simulator
$(MAKE) -C ./translations -f Makefile update release
Expand All @@ -24,7 +24,7 @@ device:

Device-Debug: Makefile
$(MAKE) -C ./arm -f Makefile debug

Device-Release: Makefile
$(MAKE) -C ./arm -f Makefile release

Expand Down
Empty file modified barcodeinvoker/assets/images/background.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions barcodeinvoker/assets/main.qml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* Copyright (c) 2012 Research In Motion Limited.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -39,15 +39,15 @@ Page {

text: qsTr("Scan Barcode")
onClicked: {
barcodeInvoker.onInvokeButtonClicked()
_barcodeInvoker.onInvokeButtonClicked()
}
}
//displays barcode data
Label {
horizontalAlignment: HorizontalAlignment.Left
verticalAlignment: VerticalAlignment.Bottom

text: qsTr("Barcode: " + barcodeInvoker.barcode)
text: qsTr("Barcode: %1").arg(_barcodeInvoker.barcode)
textStyle.color: Color.White
}
}
Expand Down
32 changes: 16 additions & 16 deletions barcodeinvoker/bar-descriptor.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!--
Copyright (c) 2011, 2012 Research In Motion Limited.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<qnx xmlns="http://www.qnx.com/schemas/application/1.0">

Expand All @@ -28,19 +28,19 @@
Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. -->
<id>com.example.bb10samples.barcodeinvoker</id>

<!-- The name that is displayed in the BlackBerry Tablet OS application installer.
<!-- The name that is displayed in the BlackBerry Tablet OS application installer.
May have multiple values for each language. See samples or xsd schema file. Optional. -->
<name>barcodeinvoker</name>
<!-- A string value of the format <0-999>.<0-999>.<0-999> that represents application version which can be used to check for application upgrade.

<!-- A string value of the format <0-999>.<0-999>.<0-999> that represents application version which can be used to check for application upgrade.
Values can also be 1-part or 2-part. It is not necessary to have a 3-part value.
An updated version of application must have a versionNumber value higher than the previous version. Required. -->
<versionNumber>1.0.0</versionNumber>

<!-- Fourth digit segment of the package version. First three segments are taken from the
<!-- Fourth digit segment of the package version. First three segments are taken from the
<versionNumber> element. Must be an integer from 0 to 2^16-1 -->
<buildId>1</buildId>

<!-- A string value (such as "v1", "2.5", or "Alpha 1") that represents the version of the application, as it should be shown to users. Optional. -->
<!-- <versionLabel></versionLabel> -->

Expand All @@ -53,15 +53,15 @@

<!-- Name of author which is used for signing. Must match the developer name of your development certificate. -->
<author>RIM</author>

<!-- Unique author ID assigned by signing authority. Required if using debug tokens. -->
<!-- <authorId>ABC1234YjsnUk235h</authorId> -->

<initialWindow>
<systemChrome>none</systemChrome>
<transparent>false</transparent>
</initialWindow>

<!-- The category where the application appears. Either core.games or core.media. -->
<category>core.games</category>
<configuration id="com.qnx.qcc.toolChain.1094190268" name="Default">
Expand All @@ -82,20 +82,20 @@
<platformArchitecture>x86</platformArchitecture>
<asset path="x86/o-g/barcodeinvoker" entry="true" type="Qnx/Elf">barcodeinvoker</asset>
</configuration>

<!-- The icon for the application, which should be 86x86. -->
<icon>
<image>icon.png</image>
</icon>

<asset path="icon.png">icon.png</asset>
<asset path="assets">assets</asset>

<!-- Locale support -->
<asset path="translations" dest="qm">
<include name="*.qm"/>
</asset>

<!-- Request permission to execute native code. Required for native applications. -->
<permission system="true">run_native</permission>
<env var="LD_LIBRARY_PATH" value="app/native/lib:/usr/lib/qt4/lib"/>
Expand Down
28 changes: 14 additions & 14 deletions barcodeinvoker/barcodeinvoker.pro
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ lupdate_inclusion {
}

device {
CONFIG(release, debug|release) {
DESTDIR = o.le-v7
TEMPLATE = lib
CONFIG(release, debug|release) {
DESTDIR = o.le-v7
TEMPLATE = lib
QMAKE_CXXFLAGS_RELEASE += -fvisibility=hidden -mthumb
}
CONFIG(debug, debug|release) {
DESTDIR = o.le-v7-g
}
}
CONFIG(debug, debug|release) {
DESTDIR = o.le-v7-g
}
}

simulator {
CONFIG(release, debug|release) {
DESTDIR = o
}
CONFIG(debug, debug|release) {
DESTDIR = o-g
}
CONFIG(release, debug|release) {
DESTDIR = o
}
CONFIG(debug, debug|release) {
DESTDIR = o-g
}
}

OBJECTS_DIR = $${DESTDIR}/.obj
Expand All @@ -46,7 +46,7 @@ QMAKE_EXTRA_TARGETS += suredelete
TRANSLATIONS = \
$${TARGET}_en_GB.ts \
$${TARGET}_fr.ts \
$${TARGET}_it.ts \
$${TARGET}_it.ts \
$${TARGET}_de.ts \
$${TARGET}_es.ts \
$${TARGET}.ts
Expand Down
2 changes: 1 addition & 1 deletion barcodeinvoker/device-assets.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<assets>
<target-device width="768" height="1280" ppi="356" class="phone"/>
</assets>
22 changes: 13 additions & 9 deletions barcodeinvoker/src/BarcodeInvoker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,27 @@

using namespace bb::system;
//! [0]
BarcodeInvoker::BarcodeInvoker(QObject* obj)
: QObject(obj)
BarcodeInvoker::BarcodeInvoker(QObject* parent)
: QObject(parent)
{
QObject::connect(new InvokeManager(this),
SIGNAL(childCardDone(const bb::system::CardDoneMessage&)), this,
SLOT(onChildCardDone(const bb::system::CardDoneMessage&)));
connect(new InvokeManager(this), SIGNAL(childCardDone(const bb::system::CardDoneMessage&)),
this, SLOT(onChildCardDone(const bb::system::CardDoneMessage&)));
}
//! [0]

//! [1]
void BarcodeInvoker::onInvokeButtonClicked() const
{
InvokeManager* imanager = qobject_cast<InvokeManager*>(sender());

InvokeRequest invokeRequest;
invokeRequest.setTarget("com.example.BarcodeScanner");
invokeRequest.setAction("community.action.SCANBARCODE");
InvokeTargetReply *invokeReply = imanager->invoke(invokeRequest);

if (0 == invokeReply) {
qDebug() << "failed to sent invoke request message";
}
const InvokeTargetReply *invokeReply = imanager->invoke(invokeRequest);

if (!invokeReply)
qWarning() << "failed to sent invoke request message";
}

void BarcodeInvoker::onChildCardDone(const bb::system::CardDoneMessage &message)
Expand All @@ -57,6 +58,9 @@ QString BarcodeInvoker::barcode() const

void BarcodeInvoker::setBarcode(const QString &barcode)
{
if (m_barcode == barcode)
return;

m_barcode = barcode;
Q_EMIT barcodeChanged();
}
Expand Down
25 changes: 12 additions & 13 deletions barcodeinvoker/src/BarcodeInvoker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef BarcodeInvoker_HPP_
#define BarcodeInvoker_HPP_
#ifndef BARCODEINVOKER_HPP
#define BARCODEINVOKER_HPP

#include <QObject>

Expand All @@ -37,17 +37,9 @@ class BarcodeInvoker: public QObject
Q_PROPERTY(QString barcode READ barcode NOTIFY barcodeChanged)

public:
BarcodeInvoker(QObject* obj);
virtual ~BarcodeInvoker()
{
}
BarcodeInvoker(QObject* parent = 0);

public Q_SLOTS:
/**
* Retrieves the message upon receiving car done signal from invoke manager.
*/
void onChildCardDone(const bb::system::CardDoneMessage &message);

/**
* Send the request to the barcodescanner card via invoke manager.
*/
Expand All @@ -57,10 +49,17 @@ public Q_SLOTS:
// The change notification signal for the property
void barcodeChanged();

private Q_SLOTS:
/**
* Retrieves the message upon receiving car done signal from invoke manager.
*/
void onChildCardDone(const bb::system::CardDoneMessage &message);

private:
QString m_barcode;
QString barcode() const;
void setBarcode(const QString &barcode);

QString m_barcode;
};

#endif /* BarcodeInvoker_HPP_ */
#endif
18 changes: 7 additions & 11 deletions barcodeinvoker/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "BarcodeInvoker.hpp"

#include <bb/cascades/AbstractPane>
#include <bb/cascades/Application>
#include <bb/cascades/QmlDocument>
#include <bb/cascades/AbstractPane>

#include <QLocale>
#include <QTranslator>
#include "BarcodeInvoker.hpp"

using namespace bb::cascades;

Expand All @@ -29,23 +30,18 @@ int main(int argc, char **argv)

// localization support
QTranslator translator;
QString locale_string = QLocale().name();
QString filename = QString("BarcodeInvoker_%1").arg(locale_string);
if (translator.load(filename, "app/native/qm")) {
const QString filename = QString::fromLatin1("barcodeinvoker_%1").arg(QLocale().name());
if (translator.load(filename, "app/native/qm"))
app.installTranslator(&translator);
}

// create scene document from main.qml asset
// set parent to created document to ensure it exists for the whole application lifetime
QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(&app);

qml->setContextProperty("barcodeInvoker", new BarcodeInvoker(&app));
// create root object for the UI
qml->setContextProperty("_barcodeInvoker", new BarcodeInvoker(&app));

AbstractPane *root = qml->createRootObject<AbstractPane>();
// set created root object as a scene
Application::instance()->setScene(root);

// we complete the transaction started in the app constructor and start the client event loop here
return Application::exec();
// when loop is exited the Application deletes the scene which deletes all its children (per qt rules for children)
}
6 changes: 3 additions & 3 deletions barcodescanner/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ all: Makefile $(QMAKE_TARGET)

clean:
$(MAKE) -C ./arm -f Makefile sureclean
$(MAKE) -C ./x86 -f Makefile sureclean
$(MAKE) -C ./x86 -f Makefile sureclean


Makefile: FORCE
Makefile: FORCE
$(QMAKE) -spec blackberry-armv7le-qcc -o arm/Makefile $(QMAKE_TARGET).pro CONFIG+=device
$(QMAKE) -spec blackberry-x86-qcc -o x86/Makefile $(QMAKE_TARGET).pro CONFIG+=simulator
$(MAKE) -C ./translations -f Makefile update release
Expand All @@ -24,7 +24,7 @@ device:

Device-Debug: Makefile
$(MAKE) -C ./arm -f Makefile debug

Device-Release: Makefile
$(MAKE) -C ./arm -f Makefile release

Expand Down
Loading

0 comments on commit a051076

Please sign in to comment.