Re: [SailfishDevel] Translate

2015-06-29 Thread coderusinbox
Hi,

Do anyone know how i can translate a JS string ?

I hope there is a easy way ;)


This is the code

function budgetTypeToString(type) {
 var str;

 switch (type) {
 case BUDGET_TYPE_DAILY:
 str = daily;
 break;
 case BUDGET_TYPE_WEEKLY:
 str = weekly;
 break;
 case BUDGET_TYPE_MONTHLY:
 str = monthly;
 break;
 case BUDGET_TYPE_YEARLY:
 str = yearly;
 break;
 default:
 str = unknown;
 break;
 }

 return str;
}

/* budgetTypeNoun
  *
  * Returns the correct noun for the given budget type.
  *
  */
function budgetTypeNoun(type) {
 var str;

 switch (type) {
 case BUDGET_TYPE_DAILY:
 str = day;
 break;
 case BUDGET_TYPE_WEEKLY:
 str = week;
 break;
 case BUDGET_TYPE_MONTHLY:
 str = month;
 break;
 case BUDGET_TYPE_YEARLY:
 str = year;
 break;
 default:
 str = unknown;
 break;
 }

 return str;
}


function budgetTypeValue(type) {
 var retval;

 switch(type) {
 case daily:
 retval = BUDGET_TYPE_DAILY;
 break;
 case weekly:
 retval = BUDGET_TYPE_WEEKLY;
 break;
 case monthly:
 retval = BUDGET_TYPE_MONTHLY;
 break;
 case yearly:
 retval = BUDGET_TYPE_YEARLY;
 break;
 default:
 retval = BUDGET_TYPE_DAILY;
 break;
 }

 return retval;
}

then i read the string as into main main.qml page

lbWalletDetails.text = qsTr(you have) + b  + wallet.currency +   
+ wallet.budget + /b  + qsTr(per) +   + 
Util.budgetTypeNoun(wallet.budget_type) + 

---
Best regards!

Rudi Timmermans.

Op 26/06/15 om 10:16 schreef Rudi Timmermans:
 Hi Lucien,

 Ok thanks this works perfect ;)

 ---
 Best regards!

 Rudi Timmermans.

 Op 26/06/15 om 09:06 schreef Lucien Xu:
 Hi Rudi,

 There are plenty of doc scattered on the internet. The secret is to
 use QT_TR_NOOP in the ListElement because you are not allowed to
 script what's inside a ListElement.

 See for instance this bug report
 https://bugreports.qt.io/browse/QTBUG-11403.

 Especially this example given in the reply.

 ListModel {
 ListElement {
 greeting: QT_TR_NOOP(hello)
 }
 }
 ...
 Text { text: qsTr(greeting) }

 Regards,
 Lucien

 

 *De: *Rudi Timmermans rudi.tim...@gmx.us
 *À: *Sailfish OS Developers devel@lists.sailfishos.org
 *Envoyé: *Vendredi 26 Juin 2015 08:54:47
 *Objet: *Re: [SailfishDevel] compile error

 Hi,

 I like to use into ListElement the qsTr.

 This is my code:

 ListElement{

 page:ManageWalletsPage.qml

 title:Managewallets

 subtitle:Createanewwalletormodifyyourexistingones

 section:Management

 }

 When is use title: qstr(Managewallets) this seems not to work anyone 
 has a solution for this ?

 I like to translate this text string also, that's the resion of it.

 Thanks!



 ---
 Best regards!

 Rudi Timmermans.



 ___
 SailfishOS.org Devel mailing list
 To unsubscribe, please send a mail to
 devel-unsubscr...@lists.sailfishos.org




 ___
 SailfishOS.org Devel mailing list
 To unsubscribe, please send a mail todevel-unsubscr...@lists.sailfishos.org

___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] Provide onLinkActiviated in DetailItem.value?

2015-06-27 Thread coderusinbox
On Sat 27, June 07:20:52 Giuliettasw wrote:
 Onclick?

There is no such slot neither :-(

-- 
Andrea
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] Translation

2015-06-27 Thread coderusinbox
Hi,

I like to translate a the word debug from a section how can i do that ? 
When i use QsTR this dont work

Code:

 }
 ListElement {
 page: ToolsPage.qml
 title: QT_TR_NOOP(Tools)
 subtitle: Misc. tools for testing the application
 section: Debug
 }
 }

 SilicaListView {
 id: listView
 anchors.fill: parent
 model: pagesModel
 header: PageHeader { title: root.title }
 section {
 property: 'section'
 delegate: SectionHeader {
 text: section
 }
 }


---
Best regards!

Rudi Timmermans.
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] ApplicationWindow.activate() does nothing

2015-06-12 Thread coderusinbox
Works for me flawlessly. If you’re using Emulator just ignore bugs you founding.






Sent from Windows Mail





From: Thomas Tanghus
Sent: ‎Friday‎, ‎June‎ ‎12‎, ‎2015 ‎3‎:‎00‎ ‎PM
To: devel@lists.sailfishos.org





It still does nothing. And anyways when being in ApplicationWindow context it 
shouldn't be necessary?

On Friday 12 June 2015 02:20:15 coderusin...@gmail.com wrote:
 you should call app.activate()

 The documentation says:
 
activate()
Brings the application in full-screen mode to the foreground.
 
 But absolutely nothing happens when I call it. Is anybody using it
 successfully?

 https://github.com/tanghus/kitchen-timer-qml/blob/master/qml/harbour-kitchen
 timer.qml#L271

-- 
Med venlig hilsen / Best regards

Thomas Tanghus___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] Problem with playing sounds in first application

2015-06-12 Thread coderusinbox
You check it first. Implementation may vary in different OSes






Sent from Windows Mail





From: Thomas Tanghus
Sent: ‎Friday‎, ‎June‎ ‎12‎, ‎2015 ‎3‎:‎10‎ ‎PM
To: devel@lists.sailfishos.org





On Friday 12 June 2015 02:21:10 coderusin...@gmail.com wrote:
 Please use SoundEffect class for that:

I did that originally, but on request I have added the option to select a 
custom sound file, and I don't wanna limit users to wav files.

Also the SoundEffect docs says:

If low latency is not important, consider using the MediaPlayer or Audio 
types instead, since they support a wider variety of media formats and are 
less resource intensive.

  On Tuesday 03 February 2015 23:13:44 Luis Manuel Ramos Da Costa wrote:
   Audio {
   
   id  : whipSound
   loops   : Audio.Infinite
   source:qrc:/sounds/resources/sounds/whipSound.flac
   
   }
  
  That can teach me to read the ml regularly ;)
  
  The loops property isn't documented in the documentation in the SDK, so I
  
  made  an ugly hack to emulate it:
 Audio {
 
  id: alarm;
  source: Qt.resolvedUrl(selectedSound);
  
  property bool forceStopped: false;
  
  function forceStop() {
  
  forceStopped = true;
  stop();
  
  }
  
  onStopped: {
  
  if(loopSound  !forceStopped) {
  
  play();
  
  } else {
  
  forceStopped = false;
  
  }
  
  }
  
  } 

-- 
Med venlig hilsen / Best regards

Thomas Tanghus___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] ApplicationWindow.activate() does nothing

2015-06-12 Thread coderusinbox
check mce dbus. There is should be a method bot unblanking screen.






Sent from Windows Mail





From: Thomas Tanghus
Sent: ‎Friday‎, ‎June‎ ‎12‎, ‎2015 ‎5‎:‎32‎ ‎PM
To: devel@lists.sailfishos.org





Firstly:

*Sorry for the noise*

On Friday 12 June 2015 10:46:56 coderusin...@gmail.com wrote:
 What example you want? For me just appWindow.activate() works.

Forget it. I haven't touched the code for over a year, so I had forgotten that 
there are two places where the alarm could be triggered depending on the 
precision of libiphb.

Sadly it only works when the display is on, not when waking up from deep 
sleep. I wonder if there's a way to activate the display?

Again, sorry for bothering you with my own bad memory :P

 And I have no idea what wrong with my mail. Using builtin Win8.1 mail
 client.
 
The HTML mails doesn't support proper quoting as seen in this reply. I can 
probably get around that by setting my MUA up to only show HTML for certain 
addresses. I recently had to do a fresh install on a new PC, as my cheap ALDI 
PC decided to die an untimely death; just haven't gotten around to do the final 
setup.

 
 
 
 
 
 Sent from Windows Mail
 
 
 
 
 
 From: Thomas Tanghus
 Sent: ‎Friday‎, ‎June‎ ‎12‎, ‎2015 ‎3‎:‎17‎ ‎PM
 To: devel@lists.sailfishos.org
 
 
 
 
 
 On Friday 12 June 2015 10:04:18 coderusin...@gmail.com wrote:
 
  Works for me flawlessly.
 
 
 Weird. Do you have a link to an example?
 
 
  If you’re using Emulator just ignore bugs you founding.
 
 
 I always deploy as RPM on the phone.
 
 
  Sent from Windows Mail
 
 
 It's really not good for mailing lists. I spend more time formatting the
 reply 
 than actually replying :P
  
 
   It still does nothing. And anyways when being in ApplicationWindow
   context
   it  shouldn't be necessary?
   
   On Friday 12 June 2015 02:20:15 coderusin...@gmail.com wrote:
   
you should call app.activate() 
 
 
 -- 
 Med venlig hilsen / Best regards
 
 Thomas Tanghus

-- 
Med venlig hilsen / Best regards

Thomas Tanghus___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] Problem with playing sounds in first application

2015-06-11 Thread coderusinbox
Please use SoundEffect class for that: 
http://doc.qt.io/qt-5/qml-qtmultimedia-soundeffect.html






Sent from Windows Mail





From: Thomas Tanghus
Sent: ‎Thursday‎, ‎June‎ ‎11‎, ‎2015 ‎11‎:‎06‎ ‎PM
To: devel@lists.sailfishos.org





On Tuesday 03 February 2015 23:13:44 Luis Manuel Ramos Da Costa wrote:
 Audio {
 id  : whipSound
 loops   : Audio.Infinite
 source:qrc:/sounds/resources/sounds/whipSound.flac
 }

That can teach me to read the ml regularly ;)

The loops property isn't documented in the documentation in the SDK, so I made 
an ugly hack to emulate it:

   Audio {
id: alarm;
source: Qt.resolvedUrl(selectedSound);

property bool forceStopped: false;

function forceStop() {
forceStopped = true;
stop();
}

onStopped: {
if(loopSound  !forceStopped) {
play();
} else {
forceStopped = false;
}
}
}


-- 
Med venlig hilsen / Best regards

Thomas Tanghus___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] ApplicationWindow.activate() does nothing

2015-06-11 Thread coderusinbox
you should call app.activate()






Sent from Windows Mail





From: Thomas Tanghus
Sent: ‎Friday‎, ‎June‎ ‎12‎, ‎2015 ‎4‎:‎51‎ ‎AM
To: devel@lists.sailfishos.org





Hi

The documentation says:

   activate()
   Brings the application in full-screen mode to the foreground.

But absolutely nothing happens when I call it. Is anybody using it successfully?

https://github.com/tanghus/kitchen-timer-qml/blob/master/qml/harbour-kitchentimer.qml#L271

-- 
Med venlig hilsen / Best regards

Thomas Tanghus___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org