QTimer and qmlRegisterType
I think it's time for me to consult the world forum on my problem. It seems so simple and yet I could not find the cause of the problem. I started having problems after you install the SDK version Gold
I use QTimer on stunts.
In my
qmlRegisterType
In main.qml, I imported as: import my.library 1.0 and fixed on a label as follows: attachedObjects:] Thanks for any help! After trying several scenarios and working on your suggestions, I've finally found what is causing the problem. In the original code, it could save the object and reached the import statement, but he has never run the attachedObjects part. What I did is I renamed my main.qml in another (timeTrial.qml) and created a new main.qml. Can I access timeTrial.qml through navigationPane. It worked without any code changes. Can someone give an overview of how's done it? It goes like this: CPC (save the object) file-> main.qml-> timeTrial.qml (import my.library 1.0) Thank you very much! Tags: BlackBerry Developers Hi all In short duration without a head it can work in the BlackBerry version 10.2.0 10 operating system? I use example notifications how to send notifications without head like using 'QTime' and every 12 hours send notifications when close app? I have read the documents , but I don't know how to do this? Thank you! Concerning The outbreak of the timer is new in BlackBerry OS 10.3, so you won't be able to use it at the point 10.2. I will request documentation update for the version to avoid this kind of confusion in the future triggers added in the list. Help me build Chess Clock/Timer Hello guys, I want to create chess clock/timer for blackberry app. can you give me sugestions how to create chess clock/timer with QML mode. to create applications for BFB, I can do it! Please help me! On the QML side simply using two buttons to start and stop each player enough to... http://developer.BlackBerry.com/native/reference/Cascades/bb__cascades__button.html So for a timer you attach a QTimer and update a label or later something more graphically sophisticated... http://developer.BlackBerry.com/native/reference/Cascades/bb__cascades__label.html Fire is a good example of use a QTimer in QML with a countdown similar to what you need, I recommend working through it, once you understand it, it should be trivial to adapt it to your needs... <>and problems QImage qmlRegisterType I put in work of a custom control cascade but my command does not display I register my control in qml qmlRegisterType
in the qml file, I call my control as Constructor for my control Update for my opinion Problem solved. It was a problem of getters and setters. found a work around but will need to read the style getters and setters of Qt. Question: Poor quality after rotation and can not play on QTime/RealPlayer I use EPA, 11 that I just bought and installed. I imported a file (about 600 MB) .avi created on my camera and then turned after the scaling. I also applied Smart Fix. Two problems: 1. the quality is distinctly inferior to the original and 2. For editing, I don't have an option to select a format that can be played by Qucktime or Real Player. The published file is only about 110 MB. I'm new on this and can't find the answer yet. Thanks Julienl57 Return on what asked hunting... Read Bill Hunt on a file type as WRAPPER http://forums.adobe.com/thread/440037 What is a CODEC... a primer http://forums.adobe.com/thread/546811 What CODEC is inside of this file? http://forums.Adobe.com/thread/440037 . A report with the codec of your file details, use the programs below... a screen capture works well for people to SHOW what you do http://forums.Adobe.com/thread/592070?TSTART=30 . For PC http://mediainfo.sourceforge.net/en or http://www.headbands.com/gspot/ For Mac http://mediainspector.massanti.com/ And some general reading... Http://help.adobe.com/en_US/premiereelements/using/index.html user's Guide online -Download PDF page current http://helpx.adobe.com/premiere-elements.html Import video http://forums.adobe.com/thread/1065281 - and http://forums.adobe.com/thread/1112086 of the project settings Shared savings & http://forums.adobe.com/thread/1137128 -Sharing of DVD or BluRay http://forums.adobe.com/thread/1137645 -Sharing for movies http://forums.adobe.com/thread/1051093 -Sharing of computer http://forums.adobe.com/thread/1058237 Steve tutorials... basic training steps are the same for several versions -http://forums.adobe.com/thread/537685 -v11 http://www.amazon.com/Muvipix-Guide-Premiere-Elements-version/dp/1479311200/ FAQ http://forums.adobe.com/community/premiere_elements/premiere_elements_faq ADVICE http://forums.adobe.com/community/premiere_elements/premiere_elements_tips Hi I have a problem with qmlRegister for the use of an onFarenheitChanged signal for my weather app, when I build and run, has no problem except that when the application starts, the accident with a message like this and this is the code CPP HPP and the qml the qml missing changes to the label and that, but it does not even withouth code in there, so this isn't a problem on the internal code, suggestions? SIGSEGV error basically tells you that your application's RAM that does not belong to her or trying to run a class via an invalid pointer method. Do I have reason to assume that the WeatherNowApp class is the UI of your main application class? If Yes, I am confused why you would be save with QML, then by attaching to a page in QML. It is not normal to save the UI class main QML in the constructor of this class even with qmlRegisterType(). I think that maybe what you really do is pass the instance of the main application to QML as a context property. If you try to respond to a signal of your main UI in QML class, then you should do so with the connect() function. Something like this instead: BTW, it makes no difference to the code, but you poorly spelled fahrenheit. How can I download itunes and quicktime for windows 7 (64 bit) I'm trying to download the most recent, or any other version of itunes on my PC which has Windows 7 (64-bit). I don't have Quicktime and looking to download or install Itunes or each, quicktime and itunes, separately (everything is better and market). The problem is that my PC with Windows 7 is 64-bit and I can't find the right version/s download. Facts: firstly - I downloaded itunes and received an error that I need to download QuickTime, then I downloaded quicktime with itunes and and received an error message that qtime was for 32 not 64 bit and I need the 64-bit version. I can't find the combo of the two download requests or quicktime on its own compatible for windows 7 64 bit. Help, please... You can find good download here:http://www.apple.com/itunes/download/ you want to check the box at the bottom (64-bit) (circle). iTunes and Quicktime are installed as part of the same package. I cannot register a QML type. The first time I did it with the DataModel PrayerModel type I managed to do the work. However, I get errors with the PrayerBBMManager now. It is based on the example of Battambang, but I simplified the entire BBM feature heavily. Real errors are: Here's my PrayerJournal.cpp file: Thanks to all that refers to BBM files qml commenting regularly and working backward in this file I can identify the problem happening to qmlRegisterType statement. Here's the prayerbbmmanager.h: And the prayerbbmmanager.cpp: Any help would be appreciated. Yes it could be My money is also on the sources of PrayerBBMManager is not THAT MOC would be because they were transferred in a directory that is not referenced in the .pro project file Native of filebrowse using and the cascading Save dialog box In my application I need to open file and file save dialog box when a specific button is clicked. I looked at the docs of stunts, but I found that the native options. Tried the native alert dialog, change of filebrowse dialog type. It displays well on Simulator, but could not get any output file that will be used in the Qt code. I pass these parameters int * num = NULL; char * folder [1024]; to dialog_event_get_filebrowse_filepaths(event,file,num), but it always returns BPS_FAILURE. In addition, Here is my code: Native Subforums have no useful information on this subject. Any help is greatly appreciated Hello again, here's the example as promised. To use the native filebrowse dialog box, the native code must run in its own thread to prevent the user interface in the Cascades to block. This is achieved by encapsulating all the dialog box code in a class derived from QThread. The class I wrote is called FileBrowseDialog FileBrowseDialog.hpp FileBrowseDialog.cpp This class derives from QObject (by QThread) which means that it can be used by QML when it exposes properties and signals. The FileBrowseDialog class has 3 properties -multiple selection: a Boolean flag indicating if single or multiple selection is allowed -filepaths: a read only value that returns the list of files selected -Filters: a read/write value is where you can specify one or more filters to file (for example, ".doc", "*.jpg") etc. The next part is how you call the FileBrowseDialog through the QML. To do this, we must inform the QML of the FileBrowseDialog page. This is done in the App class via the qmlregistertype code. App.cpp The QML is now ready to be able to use the FileBrowseDialog. The example below is a page complete qml which has a button and a label. When we click on the FileBrowseDialog button is open, and all selected files will appear in the label. Main.QML And it's pretty much just invoke the native dialog file navigation in stunts. Please note save the file would follow a similar model, but I found that this dialog box was not particularly useful because it displays only a simple dialogbox with a text file name entry. See you soon Swann ListView with TextField inside the component and requestFocus() Hello I'm trying to implement the logical: when the page with ListView is indicated - start editing (see the keyboard) in the field of specific text that is part of the agenda of the ListView. TextField.requestFocus () works very well if it is called some time later, after loading the page (assuming that when ListView load model and created the UI elements). How to identify when requestFocus() is success? onCreationCompleted for TextField/ListView does not work. It can be done with QTimer but I want to keep it as a backup plan. Thank you Can you try to add to your Page (or your ListView): Issue of RouteInvoker and LocationInvoker with 10.2 Hey guys,. I'm trying to update my application for 10.2 and for a reason that my RouteInvoker function seems to not work with the new OS. Here's my QML code for the function: Here are my main CPP: what Miss me? or what I need to add? It worked very well in 10.1. Thanks in advance for your help. Tastes and solutions will give answers. Solution was to change: attachedObjects:] centerLatitude: 27.74949 }, Use fixed coordinates for the starting position. ... and Center the view card around them. TO: attachedObjects:] }, } Why connecttng signals and slots of an element of action gets segfault I add an action item to a page. For some reasong I had to disconnect the item, delete and re-create, and then reconnect it. But I am getting exception when I try to pull the plug. If I omit the disconnection then I get exception when connecting. My code is below Have you tried cleaning and reconstruction project? You will need to find the exact location of the crash using a debugger or newspapers, or analyze a dump core after accident. This can also occur due to memory corruption. If the memory is damaged from somewhere, the accident can happen in completely independent place. In this case, try commenting on most of the features of the application until the QTimer started working restaurant then step by step. Writing EXIF data (and how to define the side of the photo) Anyone had luck writing EXIF data in photos? Reading EXIF data are fairly easy, as demonstrated by "photobomber. Writing EXIF data seems to be more painful, however. In particular, I'm trying the face value of the photo. I found mention on the web page of its existence in EXIF, with the code: 0 x 4746 That said, when I check the exif - tag.h, apparently not be listed. It is clear to me that this is a deal breaker or not. The tags are listed in the exif - tag.h the only ones that can be used? Or are they simply definitions of convenience tag codes most commonly used? Thank you Daniel Incase others are reading this in the future and ask yourself how: my conclusion is that the best way to define metadata such as: -Photo rating -Tags -Description ... does NOT use EXIF. On the contrary, it seems that XMP is a much better choice: http://en.Wikipedia.org/wiki/Extensible_Metadata_Platform Ideally, BB10 comes with the XMP library, and it can be easily added to your project. (right-click on the project node in "Project Explorer", go to the context menu item 'Configure', then 'add the library') Here's the code I added bo my main.cpp: ... and here's what I added to the .h file that I wanted to use XMP in: (it does not include the XMP.incl_cpp at the top of the notice) And finally, here's a big copy and paste part of the key code that I adapted to the code example in the XMP SDK I downloaded separately for read/write some common tags. Feel free to use this code in your own applications, or to adapt it, if that's helpful. Note that the code above makes use of some class member variables: One final note: there is a code that deals with the MicrosoftPhoto:Rating XMP tag. It's because I'm on Windows and I noticed that if you click on a photo in Windows Explorer, it allows you to display/change some meta (such as star ratings) data directly in Explorer. When you do so, it sets the MicrosoftPhoto:Rating tag (as well as the tag xmp:Rating, I believe). Once, he put that, if your application updates the xmp:Rating tag but don't update the MicrosoftPhoto:Rating tag and the file returns on Windows, then he continues to use the old notation before your update app. (he seems to ignore xmp:Rating if MicrosoftPhoto:Rating is present) qmlRegisterType - Main Class? I am trying to record a signal that I created in the main class of the application; I added this to the app.cpp; App is the main class file and is defined by I now have in my QML file. And I'm not trying to call it as follows; However, I get an EXCEPTION of NULL POINTER. Not very well what to do here thank you What you try to do will look something like this... Where _app is defined in applicationui.cpp and passed as a property... [Edit] Get rid of all the lines you wrote that they are not necessary, apart from the obvious signal. QTimer connect misfortunes on Z10 Hello I have an application that uses the QTimer class to plan stuff. It allows to set the interval in seconds / minutes / hours. This works very well in the Simulator, but fails in some(many?) Z10. An app update released today, which allows logging. 2 people tested and gave newspapers. 1 guy blackberry Support confirmed to me that setting the timer interval to Provided by the two newspapers, it resembles QTimer connection with callback fails sometimes This is the code I am using If (interval_timer == 0) {/ / allocate and configure the timer once} bool connected = false; Log2 ("connected: ' related); The timer eventually gets set up correctly (interval and isActive) but because registration reminder is not called Reminder slot is defined as follows: Sub ChangeWallpaper Q_SLOT (bool is_next_clicked = true); Now, I think the problem is the use of the default settings, but it works every time in the Simulator. Someone would be willing to test my application in a Z10? I do not have a camera. I can create two bars before and after correction. (I guess we can push a file in output mode bar in the device). Any help would be appreciated as app approvals can take a long time. Thank you Hello Q_ASSERT (connected = QObject::connect (interval_timer, SIGNAL (timeout ()), this, SLOT (changeWallpaper()));) This line will be omitted when compiling in release mode and the signal will not be connected. Try to replace it with: connected = QObject::connect (interval_timer, SIGNAL (timeout ()), this, SLOT (changeWallpaper())); Q_ASSERT (connected); Impossible to import all bookmarks in the IE 11, only some. How to do it. When you import IE 9 or 11 IE only a few bookmarks are imported. Why? The format for the imported bookmarks has folders alphabetically with individual bookmarks. The desire of records that are in front of individual bookmarks. videos of 50i are interpreted as 25i on FCPX Hello I have a Samsung hmx - t10 cam recorder that shoot Full HD 1080i (50i) When I import the files on Final cut pro X it shows 25i and I don't understand why? I create a new project and add files when exporting am not able to choose 50i (like the s CRIO-9073 is compatible with LabVIEW 8.5.1? I just got a cRIO-9073 and a cRIO-9074. When I set up, both of them appear correctly in MAX. When I add them to a project LabVIEW, the cRIO-9073 does not show the target FPGA. The cRIO-9074 shows. I'm using LabVIEW 8.5.1, is compatible with the cRIO- I downloaded a movie with utorrent. I was not able to watch it on Windows Media Player. I can only hear it. I was our VLC media player. It is a lot of work but still impossible to burn to CD. Any suggestions? Has anyone else has this error message and resolved? Please, I'm out of solutions Printer c6380 error 0xc19a0007
{QTimer
ID: timer
property int f: 0
interval: 1000
onTimeout: {}
f += 1;
timerLabel.text = "duration:"+ f; ". timerLabel is the id of the tag that is fixed QTimer
}
}
]Similar Questions
View{
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Center
}
View::View(Container *parent)
: CustomControl(parent)
, m_Image( )
{
// Create the image view for the handle using the image for
// the inactive handle
m_ImageView = ImageView::create()
.image(m_Image)
.horizontal(HorizontalAlignment::Center)
.vertical(VerticalAlignment::Center).preferredSize(400.0, 300.0);
// Create a scrollView for our view
m_ScrollView = ScrollView::create(m_ImageView).scrollMode(ScrollMode::Both);
//m_rootContainer->add(m_ImageView);
// Set the root of the custom control.
setRoot(m_ScrollView);
}
void View::updateImage()
{
QImage image;
tile.load( QString::fromLatin1("app/native/assets/images/t2.png") );
//draw the image
QImage qImage(400.0, 300.0, QImage::Format_RGB32);
QPainter painter(&qImage);
painter.drawImage(0, 0, tile);
qImage.rgbSwapped();
const bb::ImageData imageData = bb::ImageData::fromPixels(qImage.bits(), bb::PixelFormat::RGBX, 400.0, 300.0, qImage.bytesPerLine());
m_Image = bb::cascades::Image(imageData);
emit imageChanged(m_Image);
}
Process 2016309487 (WeatherNow) terminated SIGSEGV code=2 fltno=11 ip=7844f196(/base/usr/lib/qt4/lib/libQtDeclarative.so.4.8.5@_ZN36QDeclarativePropertyValueInterceptorC1Ev+0x711) mapaddr=0014f196. ref=07a4f2f8 bdslot=1
WeatherNowApp::WeatherNowApp()
{
QCoreApplication::setOrganizationName("conias media");
QCoreApplication::setApplicationName("WeatherNow");
qmlRegisterUncreatableType
#ifndef WEATHERNOWAPP_HPP_
#define WEATHERNOWAPP_HPP_
#include
import Weather.Now 1.0
attachedObjects: [
WeatherNowApp {
onUseFarenheitChanged: {
}
}
]
WeatherNowApp::WeatherNowApp()
{
QCoreApplication::setOrganizationName("conias media");
QCoreApplication::setApplicationName("WeatherNow");
qmlRegisterUncreatableType
Page {
id: myPage
function onUseFarenheitChanged() {
if (_WeatherNow.useFarenheit == true)
weatherDataTemperature.text = Math.round((jsonweather.temp)*1.8+32);
else {
weatherDataTemperature.text = Math.round(jsonweather.temp);
}
}
onCreationCompleted: {
app.useFarenheitChanged.connect(myPage.onUseFarenheitChanged);
}
}
Description Resource Path Location Type
undefined reference to `prayerbbm::PrayerBBMManager::~PrayerBBMManager()' PrayerJournal line 86, external location: f:\bbndk\target_10_0_9_2318\qnx6\usr\include\qt4\QtDeclarative\qdeclarativeprivate.h C/C++ Problem
Description Resource Path Location Type
undefined reference to `prayerbbm::PrayerBBMManager::PrayerBBMManager(QObject*)' PrayerJournal line 82, external location: f:\bbndk\target_10_0_9_2318\qnx6\usr\include\qt4\QtDeclarative\qdeclarativeprivate.h C/C++ Problem
Description Resource Path Location Type
undefined reference to `prayerbbm::PrayerBBMManager::staticMetaObject' PrayerJournal line 163, external location: f:\bbndk\target_10_0_9_2318\qnx6\usr\include\qt4\QtDeclarative\qdeclarative.h C/C++ Problem
Description Resource Path Location Type
undefined reference to `prayerbbm::PrayerBBMManager::staticMetaObject' PrayerJournal line 189, external location: f:\bbndk\target_10_0_9_2318\qnx6\usr\include\qt4\QtDeclarative\qdeclarative.h C/C++ Problem
#include "PrayerJournal.h"
#include "prayermodel.h"
#include "prayerbbm/prayerbbmmanager.h"
#include
namespace prayerbbm
{
/**
* PrayerBBMManager Description:
*
* This manager takes care of registering the application with BBM
*/
class PrayerBBMManager: public QObject
{
Q_OBJECT
public:
PrayerBBMManager(QObject *parent = 0);
virtual ~PrayerBBMManager();
namespace prayerbbm
{
PrayerBBMManager::PrayerBBMManager(QObject *parent) :
QObject(parent)
{
m_uuid = QString::fromUtf8("d8484b8d-bed5-4cde-8c11-462c6a04bc35");
if (mSettings.value("connectToBBM").isNull()) {
mSettings.setValue("connectToBBM", QVariant(false));
}
}
PrayerBBMManager::~PrayerBBMManager()
{
}
dialog_update (alert_dialog);
//slot function
void App::fileOpen(){
//===========================
dialog_instance_t alert_dialog = 0;
bps_initialize();
dialog_request_events(0); //0 indicates that all events are requested
if (dialog_create_filebrowse(&alert_dialog) != BPS_SUCCESS) {
fprintf(stderr, "Failed to create alert dialog.");
return ;
}
const char* extensions[] = {"*.*","*.jpg","*.jpeg","*.mp3","*.wav","*.mp4","*.txt","*.doc","*.pdf"};
int items = 9;
if(dialog_set_filebrowse_filter(alert_dialog, extensions,items) != BPS_SUCCESS){
fprintf(stderr, "Failed to set alert dialog message text.");
dialog_destroy(alert_dialog);
alert_dialog = 0;
return ;
}
if( dialog_set_filebrowse_multiselect(alert_dialog,FALSE)!=BPS_SUCCESS){
fprintf(stderr, "Failed to set alert dialog message text.");
dialog_destroy(alert_dialog);
alert_dialog = 0;
return ;
}
if (dialog_show(alert_dialog) != BPS_SUCCESS) {
fprintf(stderr, "Failed to show alert dialog.");
dialog_destroy(alert_dialog);
alert_dialog = 0;
return ;
}
int shutdown =0;
while (!shutdown) {
bps_event_t *event = NULL;
bps_get_event(&event, -1); // -1 means that the function waits
// for an event before returning
if (event) {
if (bps_event_get_domain(event) == dialog_get_domain()) {
int selectedIndex =
dialog_event_get_selected_index(event);
const char* label =
dialog_event_get_selected_label(event);
const char* context =
dialog_event_get_selected_context(event);
char **fileArray[]={};
int *numFiles = NULL;
//
if(selectedIndex == 0){
shutdown = 1;//user press the cancel button on dialog; close the dialog
}
else if(selectedIndex == 1){
if(dialog_event_get_filebrowse_filepaths(event,file,num)!=BPS_SUCCESS){
fprintf(stderr,"File open fail");
}
else{
//debug purposes
fprintf(stderr,"File array: %d/n",sizeof(file)*1024);
fprintf(stderr,"Num files: %n",num);
//fprintf(stderr,"Files int: %d",files);
}
}
}
}
}
if (alert_dialog) {
dialog_destroy(alert_dialog);
}
//===========================
}
#ifndef FILEBROWSEDIALOG_HPP_
#define FILEBROWSEDIALOG_HPP_
#include
#include "FileBrowseDialog.hpp"
#include
#include
import bb.cascades 1.0
import Dialog.FileBrowse 1.0
Page {
content: Container {
Label { id: filebrowseDialogLabel }
Button {
text : "File Browse Dialog"
onClicked: {
filebrowseDialog.show();
}
}
attachedObjects: [
FileBrowseDialog {
id: filebrowseDialog
multiselect : true
filters : ["*.doc","*.jpg","*.txt"]
onSelectionCompleted: {
if(filebrowseDialog.filepaths.length>0)
filebrowseDialogLabel.text = filebrowseDialog.filepaths[0];
else
filebrowseDialogLabel.text = "no file selected";
}
onSelectionCancelled: {
filebrowseDialogLabel.text = "file browse dialog was cancelled";
}
}
]
}
}
attachedObjects:]
{RenderFence}
raised: true
onReached: textFieldName.requestFocus)
}
]
import bb.cascades 1.0import PersistenObjectsLib 1.0import QtMonility.sensors 1.2import bb.cascades.maps 1.0import QtMobilitySubset.location 1.1import bb.platform 1.0import bb.data 1.0import bb.system 1.0
Tab {
title: qsTr("Saved Locations") + Retranslate.onLanguageChanged
imageSource: "asset:///images/url.png"
Page {
onCreationCompleted: {
_app.setStorageLocation.App.StoreInFile;
}
actions: [
ActionItem {
title: qsTr("Get Route") + Retranslate.onLocaleOrLanguageChanged
imageSource: "asset:///images/ic_nav_to.png"
ActionBar.placement: ActionBarPlacement.OnBar
onTriggered: routeInvoker.go()
},
ActionItem {
title: qsTr("See Map") + Retranslate.onLocaleOrLanguageChanged
imageSource: "asset:///images/pin.png"
ActionBar.placement: ActionBarPlacement.OnBar
onTriggered: locationInvoker.go()
}
]
titleBar: TitleBar {
title: qsTr("Saved Locations") + Retranslate.onLanguageChanged
}
ListView {
function getApp() { // 1
return _app
}
id: listView
property string selectedItemID
dataModel: _app.dataModel
listItemComponents: [ // 2
ListItemComponent {
type: "item"
StandardListItem {
id: rootItem // 3
title: ListItemData.name
description: ListItemData.description
status: ListItemData.datefield
imageSource: "asset:///images/pin.png"
contextActions: [
...
]
}
}
]
onTriggered: {
clearSelection()
select(indexPath)
locationInvoker.locationLatitude = dataModel.data(indexPath).lat
locationInvoker.locationLongitude = dataModel.data(indexPath).lon
routeInvoker.endLatitude = dataModel.data(indexPath).lat
routeInvoker.endLongitude = dataModel.data(indexPath).lon
}
}
}
attachedObjects: [
LocationMapInvoker {
id: locationInvoker
centerLatitude: 27.74949
centerLongitude: -97.41918
},
RouteMapInvoker {
id: routeInvoker
// Use fixed coordinates for start position ...
// Note: This does not work with current BB10 version but will work with future ones
startLatitude: 42.814513
startLongitude: -73.94206
// ... and center the map view around them.
centerLatitude: startLatitude
centerLongitude: startLongitude
}
]
//! [0]
}
}
#include "app.hpp"
#include "ActiveFrame.h"
#include
{LocationMapInvoker}
ID: locationInvoker
centerLongitude:-97.41918
{RouteMapInvoker}
ID: routeInvoker
Note: This does not work with the current version of BB10 but will work with future generations
startLatitude: 42.814513
startLongitude:-73.94206
centerLatitude: startLatitude
centerLongitude: startLongitude
}
]
{LocationMapInvoker}
ID: locationInvoker
{RouteMapInvoker}
ID: routeInvoker
]
if(addAllRules)
{
disconnect(addAllRules,SIGNAL(triggered()),this,SLOT(onTriggeredAddRuleActionAllRules()));
delete(addAllRules);
}
addAllRules = ActionItem::create().title("Add Rule").enabled(true);
allRulesPage->addAction(addAllRules, ActionBarPlacement::OnBar);
connect(addAllRules,SIGNAL(triggered()),this,SLOT(onTriggeredAddRuleActionAllRules()));
//-----------------------------------------------------------------------------
// XMP
//-----------------------------------------------------------------------------
// Must be defined to instantiate template classes
#define TXMP_STRING_TYPE std::string
// Must be defined to give access to XMPFiles
#define XMP_INCLUDE_XMPFILES 1
#define UNIX_ENV 1
#include "xmp/XMP.incl_cpp"
#include "xmp/XMP.hpp"
#include
//-----------------------------------------------------------------------------
// XMP
//-----------------------------------------------------------------------------
#define TXMP_STRING_TYPE std::string
#define XMP_INCLUDE_XMPFILES 1
#define UNIX_ENV 1
#include "xmp/XMP.hpp"
#include
int ImageViewContainer::xmpWrite()
{
qDebug() << "xmpWrite()";
string filename = file.toStdString();
if (!SXMPMeta::Initialize())
{
qDebug() << "XMP: An error occurred initializing XMP.";
return -1;
}
XMP_OptionBits options = 0;
#if UNIX_ENV
options |= kXMPFiles_ServerMode;
#endif
if (!SXMPFiles::Initialize(options))
{
qDebug() << "XMP: An error occurred initializing SXMPFiles.";
return -1;
}
try
{
// Try using the smart handler.
XMP_OptionBits opts = kXMPFiles_OpenForUpdate | kXMPFiles_OpenUseSmartHandler;
bool ok;
SXMPFiles myFile;
// Open the file.
ok = myFile.OpenFile(filename, kXMP_UnknownFile, opts);
if (!ok)
{
qDebug() << "XMP: No smart handler available for " + file + ". Trying packet scanning.";
// Now try using packet scanning.
opts = kXMPFiles_OpenForUpdate | kXMPFiles_OpenUsePacketScanning;
ok = myFile.OpenFile(filename, kXMP_UnknownFile, opts);
}
// If the file is open then read the metadata.
if (ok)
{
qDebug() << "XMP: Opened: " << file;
// Create the xmp object and get the xmp data.
SXMPMeta meta;
myFile.GetXMP(&meta);
// Should we be doing this?
meta.SetProperty(kXMP_NS_XMP, "CreatorTool", "Updated by PhotoStar", 0);
int ratingToSet = rating;
if (ratingToSet == -1) { ratingToSet = 0; }
meta.SetProperty(kXMP_NS_XMP, "Rating", QString::number(ratingToSet).toStdString(), 0);
// Required before we can call other functions that refer to this namespace
// without getting an exception.
std::string tmp;
meta.RegisterNamespace("http://ns.microsoft.com/photo/1.0/", "MicrosoftPhoto", &tmp);
if (ratingToSet == -1)
{
meta.DeleteProperty("http://ns.microsoft.com/photo/1.0/", "Rating");
}
else
{
int microsoftRating;
// Mapping:
// xmp:Rating=1 -> MicrosoftPhoto:Rating=1
// xmp:Rating=2 -> MicrosoftPhoto:Rating=25
// xmp:Rating=3 -> MicrosoftPhoto:Rating=50
// xmp:Rating=4 -> MicrosoftPhoto:Rating=75
// xmp:Rating=5 -> MicrosoftPhoto:Rating=100
if (ratingToSet == 1)
{
microsoftRating = 1;
}
else
{
microsoftRating = (ratingToSet - 1) * 25;
}
qDebug() << "MicrosoftPhoto:Rating: " << QString::number(microsoftRating);
meta.SetProperty("http://ns.microsoft.com/photo/1.0/", "Rating", QString::number(microsoftRating).toStdString(), 0);
}
// Delete old tags. (?)
meta.DeleteProperty(kXMP_NS_DC, "subject");
// Tags
for (int i = 0; i < tags.size(); ++i)
{
string value = tags[i].toStdString();
meta.AppendArrayItem(kXMP_NS_DC, "subject", kXMP_PropArrayIsOrdered, value, 0);
//meta.SetArrayItem(kXMP_NS_DC, "subject", i + 1, value, 0);
}
meta.SetLocalizedText(kXMP_NS_XMP, "Description", "en", "en-US", description.toStdString(), NULL);
// Update the Metadata Date
XMP_DateTime updatedTime;
// Get the current time. This is a UTC time automatically adjusted for the local time.
SXMPUtils::CurrentDateTime(&updatedTime);
//if (meta.DoesPropertyExist(kXMP_NS_XMP, "MetadataDate"))
//{
meta.SetProperty_Date(kXMP_NS_XMP, "MetadataDate", updatedTime, 0);
//}
// Now update alt-text properties
//meta.SetLocalizedText(kXMP_NS_DC, "title", "en", "en-US", "Kind of pretty");
// For debugging
if (false)
{
// Serialize the packet and write the buffer to a file.
// Let the padding be computed and use the default linefeed and indents without limits.
string metaBuffer;
meta.SerializeToBuffer(&metaBuffer, 0, 0, "", "", 0);
//qDebug() << QString::fromStdString(metaBuffer);
// Write the packet to a file as RDF
writeRDFToFile(&metaBuffer, filename + "_XMP_RDF.txt");
}
// Check we can put the XMP packet back into the file.
if (myFile.CanPutXMP(meta))
{
// If so then update the file with the modified XMP.
myFile.PutXMP(meta);
}
else
{
// Silent for now. TODO: Should this be indicated in
// the UI somehow?
qDebug() << "XMP: Can't write to file.";
}
// Close the SXMPFile. This *must* be called. The XMP is not actually written and the
// disk file is not closed until this call is made.
myFile.CloseFile();
}
else
{
qDebug() << "XMP: Unable to open " << file;
}
}
catch(XMP_Error & e)
{
qDebug() << "XMP ERROR: " << QString::fromStdString(e.GetErrMsg());
}
// Terminate the toolkit
SXMPFiles::Terminate();
SXMPMeta::Terminate();
return 0;
}
int ImageViewContainer::xmpRead()
{
qDebug() << "xmpRead()";
string filename = file.toStdString();
if (!SXMPMeta::Initialize())
{
qDebug() << "XMP: An error occurred initializing XMP.";
return -1;
}
XMP_OptionBits options = 0;
#if UNIX_ENV
options |= kXMPFiles_ServerMode;
#endif
if (!SXMPFiles::Initialize(options))
{
qDebug() << "XMP: An error occurred initializing SXMPFiles.";
return -1;
}
try
{
// Try using the smart handler.
XMP_OptionBits opts = kXMPFiles_OpenForRead | kXMPFiles_OpenUseSmartHandler;
bool ok;
SXMPFiles myFile;
// Open the file.
ok = myFile.OpenFile(filename, kXMP_UnknownFile, opts);
if (!ok)
{
qDebug() << "XMP: No smart handler available for " + file + ". Trying packet scanning.";
// Now try using packet scanning.
opts = kXMPFiles_OpenForUpdate | kXMPFiles_OpenUsePacketScanning;
ok = myFile.OpenFile(filename, kXMP_UnknownFile, opts);
}
// If the file is open then read the metadata.
if (ok)
{
qDebug() << "XMP: Opened: " << file;
// Create the xmp object and get the xmp data.
SXMPMeta meta;
myFile.GetXMP(&meta);
bool exists;
// Stores the value for the property.
string value;
// XMP Rating
exists = meta.GetProperty(kXMP_NS_XMP, "Rating", &value, NULL);
if (exists)
{
rating = QString::fromStdString(value).toInt(&ok);
if (!ok)
{
rating = -1;
}
}
else
{
rating = -1;
}
// Microsoft Rating (only look for this if xmp:Rating is missing)
if (rating == -1)
{
// Required before we can call other functions that refer to this namespace
// without getting an exception.
std::string tmp;
meta.RegisterNamespace("http://ns.microsoft.com/photo/1.0/", "MicrosoftPhoto", &tmp);
exists = meta.GetProperty("http://ns.microsoft.com/photo/1.0/", "MicrosoftPhoto:Rating", &value, NULL);
//exists = meta.GetProperty(kXMP_NS_XMP, "Rating", &value, NULL);
if (exists)
{
rating = QString::fromStdString(value).toInt(&ok);
if (!ok)
{
rating = -1;
}
else
{
// The Microsoft rating is 0, 25, 50, 75, 100.
rating /= 25;
}
}
else
{
rating = -1;
}
}
value.clear();
qDebug() << "XMP Rating: " << rating;
// Tags
tags.clear();
int arraySize = meta.CountArrayItems(kXMP_NS_DC, "subject");
for (int i = 1; i <= arraySize; i++)
{
meta.GetArrayItem(kXMP_NS_DC, "subject", i, &value, 0);
qDebug() << "XMP Tag[" << i << "]: " << QString::fromStdString(value);
tags.append(QString::fromStdString(value));
}
value.clear();
// Description
meta.GetLocalizedText(kXMP_NS_XMP, "Description", "en", "en-US", NULL, &value, NULL);
description = QString::fromStdString(value);
qDebug() << "XMP Description: " << description;
timestamp = QDateTime();
XMP_DateTime updatedTime;
// Get the current time. This is a UTC time automatically adjusted for the local time.
SXMPUtils::CurrentDateTime(&updatedTime);
if (meta.DoesPropertyExist(kXMP_NS_XMP, "MetadataDate"))
{
meta.GetProperty_Date(kXMP_NS_XMP, "MetadataDate", &updatedTime, 0);
if (updatedTime.hasDate)
{
if (updatedTime.hasTime)
{
timestamp = QDateTime(QDate(updatedTime.year, updatedTime.month, updatedTime.day), QTime(updatedTime.hour, updatedTime.minute, updatedTime.second));
}
else
{
timestamp = QDateTime(QDate(updatedTime.year, updatedTime.month, updatedTime.day), QTime(0, 0, 0));
}
}
}
// Close the SXMPFile. The resource file is already closed if it was
// opened as read only but this call must still be made.
myFile.CloseFile();
}
else
{
qDebug() << "XMP: Unable to open " << file;
}
}
catch(XMP_Error & e)
{
qDebug() << "XMP ERROR: " << QString::fromStdString(e.GetErrMsg());
}
// Terminate the toolkit
SXMPFiles::Terminate();
SXMPMeta::Terminate();
return 0;
}
int rating;
QList
Q_SIGNALS:
void completed(const int ®Success, const QString &loginUsername);
qmlRegisterType
class App : public QObject
import Core.TheApp 1.0
attachedObjects: [
App {
onCompleted {
//Do stuff
}
}
]
import bb.cascades 1.0
NavigationPane {
Page {
}
onCreationCompleted: {
_app.completed.connect(outputBoo);
}
function outputBoo(success, username) {
console.debug("Boo!");
}
}
QmlDocument *qml = QmlDocument::create("asset:///main.qml")
.parent(this)
.property("_app", this);
seconds doesn't work, but setting say works for 1 minute.
However, a customer has confirmed that neither works for him.
interval_timer = new QTimer();
Q_ASSERT (connected = QObject::connect (interval_timer, SIGNAL (timeout ()), this, SLOT (changeWallpaper()));)
}Maybe you are looking for