Skip to content

Commit

Permalink
Merge pull request #133 from jlarsby/master
Browse files Browse the repository at this point in the history
Sample updates for 10.2 Gold
  • Loading branch information
pkjellberg committed Aug 14, 2013
2 parents 8eee9c0 + 797f72c commit e58f39f
Show file tree
Hide file tree
Showing 308 changed files with 12,988 additions and 6,985 deletions.
198 changes: 77 additions & 121 deletions appshot/.cproject

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions appshot/.device
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Project target device definition.
#Wed Jun 26 10:59:58 CEST 2013
ppi=356
height=1280
kind=PHONE
width=768
5 changes: 0 additions & 5 deletions appshot/Notice

This file was deleted.

2 changes: 2 additions & 0 deletions appshot/appshot.pro
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ APP_NAME = appshot

CONFIG += qt warn_on cascades10

LIBS += -lbbsystem

include(config.pri)
2 changes: 1 addition & 1 deletion appshot/assets/720x720/AlbersWallpaper/AlbersGrid.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import bb.cascades 1.0
import bb.cascades 1.2

Container {
property alias color1: row1.color1
Expand Down
Empty file modified appshot/assets/720x720/images/grit.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.
2 changes: 1 addition & 1 deletion appshot/assets/AlbersWallpaper/AlbersBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import bb.cascades 1.0
import bb.cascades 1.2

Container {
opacity: 0.75
Expand Down
2 changes: 1 addition & 1 deletion appshot/assets/AlbersWallpaper/AlbersGrid.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import bb.cascades 1.0
import bb.cascades 1.2

Container {
property alias color1: row1.color1
Expand Down
2 changes: 1 addition & 1 deletion appshot/assets/AlbersWallpaper/AlbersRow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import bb.cascades 1.0
import bb.cascades 1.2

Container {
property alias color1: box1.color1
Expand Down
2 changes: 1 addition & 1 deletion appshot/assets/AlbersWallpaper/AlbersWallpaper.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import bb.cascades 1.0
import bb.cascades 1.2

// A Container that contain a grid of colored boxes in a semi-random pattern,
// inspired by the legendary Bauhaus artist Josef Albers "Homage to the Square".
Expand Down
2 changes: 1 addition & 1 deletion appshot/assets/Instruction.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import bb.cascades 1.0
import bb.cascades 1.2

// A component that is used the first time the app starts, it
// display a simple instruction so that the use knows how to use the app.
Expand Down
Empty file modified appshot/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.
Empty file modified appshot/assets/images/grit.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.
Empty file modified appshot/assets/images/ic_done.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.
216 changes: 112 additions & 104 deletions appshot/assets/main.qml
Original file line number Diff line number Diff line change
@@ -1,104 +1,112 @@
/* Copyright (c) 2013 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.
*/
import bb.cascades 1.0
import com.appshot 1.0
import "AlbersWallpaper"

// The main purpose of this sample app is to show how one can make
// a programmatic screen shot of a Cascades Application. To illustrate
// how this i done the UI consists of a wallpaper generator.
Page {
actionBarVisibility: ChromeVisibility.Overlay

Container {
layout: DockLayout {
}

// The AlbersWallpaper component with the graphical elements.
AlbersWallpaper {
}

// An instruction screen that is only shown the first time the application
// launches, controlled via the custom _app.showInstruction property
ControlDelegate {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill

sourceComponent: instructionDef
delegateActive: _app.showInstruction
visible: _app.showInstruction

onControlChanged: {
if(control != undefined){
// Connect to the delegate control function custom hide signal, so the _app
// property can be altered after first launch.
if(!control.hideInstruction.connect(setShowInstruction)){
console.debug("Failed to connect to Instruction Screen function");
}
}
}

function setShowInstruction() {
_app.showInstruction = false;
}
}
}

attachedObjects: [
AppShot {
// This is the Object that takes a screen shot of the application.
id: appShot
},
QTimer {
// A timer is needed to delay the screen shot until the ActionBar is hidden.
// Here we use the QTimer, which has to be registered as a type in the application
// constructor to work (see constructor in appshotapp.cpp).
id: hideActionBarTimer
interval: 200
singleShot: true

onTimeout: {
// Take a screen shot by calling the captureScreen function of the AppShot object.
var filePath = appShot.captureScreen("swapimage.jpg");

// Show the screen shot in a pictures card (see invokalble function in appshotapp.cpp).
_app.showPhotoInCard(filePath);

// Show the action bar again, so that more screen shots can be made by the user.
actionBarVisibility = ChromeVisibility.Overlay
}
},
ComponentDefinition {
id: instructionDef;
source: "Instruction.qml"
}
]

actions: [
ActionItem {
title: qsTr("Shoot Screen")
imageSource: "asset:///images/ic_done.png"
ActionBar.placement: ActionBarPlacement.OnBar;
enabled: !_app.showInstruction

onTriggered: {
// Hide the ActionBar and start the timer that will take the screen shot
// once it is no longer visible.
actionBarVisibility = ChromeVisibility.Hidden;
hideActionBarTimer.start();
}
}
]
}
/* Copyright (c) 2013 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.
*/
import bb.cascades 1.2
import bb.system 1.2
import com.appshot 1.0
import "AlbersWallpaper"

// The main purpose of this sample app is to show how one can make
// a programmatic screen shot of a Cascades Application. To illustrate
// how this i done the UI consists of a wallpaper generator.
Page {
actionBarVisibility: ChromeVisibility.Overlay

Container {
layout: DockLayout {
}

// The AlbersWallpaper component with the graphical elements.
AlbersWallpaper {
}

// An instruction screen that is only shown the first time the application
// launches, controlled via the custom _app.showInstruction property
ControlDelegate {
id: instructionDelegate
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill

sourceComponent: instructionDef
delegateActive: false
visible: delegateActive

onControlChanged: {
if(control != undefined){
// Connect to the delegate control function custom hide signal, so the _app
// property can be altered after first launch.
control.hideInstruction.connect(hideAppInstruction);
}
}

function hideAppInstruction() {
_app.showInstruction = false;
delegateActive: false;
}
}

onCreationCompleted: {
if (_app.showInstruction) {
// Activate the Instruction ControlDelegate if its the first time the app launches.
instructionDelegate.delegateActive = true;
}
}
}

attachedObjects: [
Screenshot {
// This is the Object that takes a screen shot of the application.
id: appShot
},
QTimer {
// A timer is needed to delay the screen shot until the ActionBar is hidden.
// Here we use the QTimer, which has to be registered as a type in the application
// constructor to work (see constructor in appshotapp.cpp).
id: hideActionBarTimer
interval: 200
singleShot: true

onTimeout: {
// Take a screen shot by calling the captureScreen function of the AppShot object.
var filePath = appShot.captureWindow( "file:data/screenshot.jpg", Application.mainWindow.handle );

// Show the screen shot in a pictures card (see invokalble function in appshotapp.cpp).
_app.showPhotoInCard(filePath);

// Show the action bar again, so that more screen shots can be made by the user.
actionBarVisibility = ChromeVisibility.Overlay
}
},
ComponentDefinition {
id: instructionDef;
source: "Instruction.qml"
}
]

actions: [
ActionItem {
title: qsTr("Shoot Screen")
imageSource: "asset:///images/ic_done.png"
ActionBar.placement: ActionBarPlacement.OnBar;
enabled: !_app.showInstruction

onTriggered: {
// Hide the ActionBar and start the timer that will take the screen shot
// once it is no longer visible.
actionBarVisibility = ChromeVisibility.Hidden;
hideActionBarTimer.start();
}
}
]
}
6 changes: 2 additions & 4 deletions appshot/bar-descriptor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<!-- A universally unique application identifier. Must be unique across all BlackBerry 10 applications.
Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. -->
<id>com.example.appshot</id>
<id>com.example.appshot2</id>

<!-- The name that is displayed in the BlackBerry 10 application installer.
May have multiple values for each language. See samples or xsd schema file. Optional. -->
Expand Down Expand Up @@ -58,8 +58,7 @@
<!-- <authorId>ABC1234YjsnUk235h</authorId> -->

<initialWindow>
<aspectRatio>portrait</aspectRatio>
<autoOrients>false</autoOrients>
<autoOrients>true</autoOrients>
<systemChrome>none</systemChrome>
<transparent>false</transparent>
</initialWindow>
Expand Down Expand Up @@ -106,7 +105,6 @@

<!-- Request permission to execute native code. Required for native applications. -->
<permission system="true">run_native</permission>
<permission>access_shared</permission>
<env var="LD_LIBRARY_PATH" value="app/native/lib:/usr/lib/qt4/lib"/>

</qnx>
57 changes: 7 additions & 50 deletions appshot/config.pri
Original file line number Diff line number Diff line change
Expand Up @@ -3,73 +3,30 @@ BASEDIR = $$quote($$_PRO_FILE_PWD_)

device {
CONFIG(debug, debug|release) {
INCLUDEPATH += $$quote(${QNX_TARGET}/usr/include/bb/device) \
$$quote(${QNX_TARGET}/usr/include/bb/system)

DEPENDPATH += $$quote(${QNX_TARGET}/usr/include/bb/device) \
$$quote(${QNX_TARGET}/usr/include/bb/system)

LIBS += -lscreen \
-lbbdevice \
-lbbsystem

SOURCES += $$quote($$BASEDIR/src/appshot/appshot.cpp) \
$$quote($$BASEDIR/src/appshot/screensize.cpp) \
$$quote($$BASEDIR/src/appshotapp.cpp) \
SOURCES += $$quote($$BASEDIR/src/appshotapp.cpp) \
$$quote($$BASEDIR/src/main.cpp)

HEADERS += $$quote($$BASEDIR/src/appshot/appshot.h) \
$$quote($$BASEDIR/src/appshot/screensize.h) \
$$quote($$BASEDIR/src/appshotapp.h)
HEADERS += $$quote($$BASEDIR/src/appshotapp.h)
}

CONFIG(release, debug|release) {
INCLUDEPATH += $$quote(${QNX_TARGET}/usr/include/bb/device) \
$$quote(${QNX_TARGET}/usr/include/bb/system)

DEPENDPATH += $$quote(${QNX_TARGET}/usr/include/bb/device) \
$$quote(${QNX_TARGET}/usr/include/bb/system)

LIBS += -lscreen \
-lbbdevice \
-lbbsystem

SOURCES += $$quote($$BASEDIR/src/appshot/appshot.cpp) \
$$quote($$BASEDIR/src/appshot/screensize.cpp) \
$$quote($$BASEDIR/src/appshotapp.cpp) \
SOURCES += $$quote($$BASEDIR/src/appshotapp.cpp) \
$$quote($$BASEDIR/src/main.cpp)

HEADERS += $$quote($$BASEDIR/src/appshot/appshot.h) \
$$quote($$BASEDIR/src/appshot/screensize.h) \
$$quote($$BASEDIR/src/appshotapp.h)
HEADERS += $$quote($$BASEDIR/src/appshotapp.h)
}
}

simulator {
CONFIG(debug, debug|release) {
INCLUDEPATH += $$quote(${QNX_TARGET}/usr/include/bb/device) \
$$quote(${QNX_TARGET}/usr/include/bb/system)

DEPENDPATH += $$quote(${QNX_TARGET}/usr/include/bb/device) \
$$quote(${QNX_TARGET}/usr/include/bb/system)

LIBS += -lscreen \
-lbbdevice \
-lbbsystem

SOURCES += $$quote($$BASEDIR/src/appshot/appshot.cpp) \
$$quote($$BASEDIR/src/appshot/screensize.cpp) \
$$quote($$BASEDIR/src/appshotapp.cpp) \
SOURCES += $$quote($$BASEDIR/src/appshotapp.cpp) \
$$quote($$BASEDIR/src/main.cpp)

HEADERS += $$quote($$BASEDIR/src/appshot/appshot.h) \
$$quote($$BASEDIR/src/appshot/screensize.h) \
$$quote($$BASEDIR/src/appshotapp.h)
HEADERS += $$quote($$BASEDIR/src/appshotapp.h)
}
}

INCLUDEPATH += $$quote($$BASEDIR/src/appshot) \
$$quote($$BASEDIR/src)
INCLUDEPATH += $$quote($$BASEDIR/src)

CONFIG += precompile_header

Expand Down
Empty file modified appshot/icon.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.
Loading

0 comments on commit e58f39f

Please sign in to comment.