Notify.qml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. import QtQuick 1.1
  2. import QtMultimediaKit 1.1
  3. import QtMobility.feedback 1.1
  4. Item {
  5. id: notyfy
  6. SoundEffect {
  7. id: sndEffectRecv
  8. source : "file://"+settings.soundIncomingMessage
  9. }
  10. SoundEffect {
  11. id: sndEffectSent
  12. source : "file://"+settings.soundOutcomingMessage
  13. }
  14. SoundEffect {
  15. id: sndEffectBuddyLogsIn
  16. source : "file://"+settings.soundBuddyLogsIn
  17. }
  18. SoundEffect {
  19. id: sndEffectBuddyLogsOut
  20. source : "file://"+settings.soundBuddyLogsOut
  21. }
  22. SoundEffect {
  23. id: sndEffectSome1SaysYourName
  24. source : "file://"+settings.soundChatSomeoneSaysMyName
  25. }
  26. SoundEffect {
  27. id: sndEffectChatOthersTalk
  28. source : "file://"+settings.soundChatOthersTalk
  29. }
  30. HapticsEffect {
  31. id: hapticsEffectRecvMsg
  32. attackIntensity: 0
  33. attackTime: 250
  34. intensity: 1.0
  35. duration: 800 // set up the duration here, in millisecond
  36. fadeTime: 250
  37. fadeIntensity: 0
  38. running: false
  39. }
  40. HapticsEffect {
  41. id: hapticsEffectSentMsg
  42. attackIntensity: 0
  43. attackTime: 250
  44. intensity: 1.0
  45. duration: 400
  46. fadeTime: 250
  47. fadeIntensity: 0
  48. running: false
  49. }
  50. HapticsEffect {
  51. id: hapticsEffectBuddyLogsIn
  52. attackIntensity: 0.1
  53. attackTime: 500
  54. intensity: 1.0
  55. duration: 400
  56. fadeTime: 0
  57. fadeIntensity: 0
  58. running: false
  59. }
  60. function notifyMessageRecv() {
  61. if( settings.vibrationMessageReceived ) {
  62. hapticsEffectRecvMsg.running = true
  63. }
  64. sndEffectRecv.play()
  65. }
  66. function notifyMessageSent() {
  67. if( settings.vibrationMessageSent ) {
  68. hapticsEffectSentMsg.running = true
  69. }
  70. sndEffectSent.play()
  71. }
  72. function notifyBuddyLogsIn() {
  73. sndEffectBuddyLogsIn.play()
  74. }
  75. function notifyBuddyLogsOut() {
  76. sndEffectBuddyLogsOut.play()
  77. }
  78. function notifyChatSomeoneSaysMyName() {
  79. if( settings.vibrationChatSomeoneSaysMyName ) {
  80. hapticsEffectRecvMsg.running = true
  81. }
  82. sndEffectSome1SaysYourName.play()
  83. }
  84. function notifyChatOthersTalk() {
  85. if( settings.vibrationChatOthersTalk ) {
  86. hapticsEffectSentMsg.running = true
  87. }
  88. sndEffectChatOthersTalk.play()
  89. }
  90. }