[Merge] lp:~phablet-team/messaging-app/load-components-on-demand into lp:messaging-app

Gustavo Pichorim Boiko gustavo.boiko at canonical.com
Mon Dec 14 21:36:49 UTC 2015


Review: Needs Fixing

Just one remark

Diff comments:

> 
> === modified file 'src/qml/AudioRecordingBar.qml'
> --- src/qml/AudioRecordingBar.qml	2015-12-14 20:22:52 +0000
> +++ src/qml/AudioRecordingBar.qml	2015-12-14 20:22:52 +0000
> @@ -41,32 +41,51 @@
>          audioRecorder.stop()
>      }
>  
> -    AudioRecorder {
> +    Loader {
>          id: audioRecorder
> -
> -        readonly property bool recording: recorderState == AudioRecorder.RecordingState
> -
> -        onRecorderStateChanged: {
> -            if (recorderState == AudioRecorder.StoppedState && actualLocation != "") {
> -                var filePath = actualLocation
> -
> -                if (application.fileMimeType(filePath).toLowerCase().indexOf("audio/") <= -1) {
> -                    //If the recording process is too quick the generated file is not an audio one and should be ignored
> -                    return;
> +        readonly property bool ready: status == Loader.Ready
> +        readonly property bool recording: ready ? item.recorderState == AudioRecorder.RecordingState : false
> +        readonly property int duration: ready ? item.duration : false

I think you mean item.duration : 0, right?

> +        function record() {
> +            audioRecorder.active = true
> +            item.record()
> +        }
> +        function stop() {
> +            item.stop()
> +            audioRecorder.active = false
> +        }
> + 
> +        active: false
> +        sourceComponent: audioRecorderComponent
> +    }
> +
> +    Component {
> +        id: audioRecorderComponent
> +        AudioRecorder {
> +            readonly property bool recording: recorderState == AudioRecorder.RecordingState
> +
> +            onRecorderStateChanged: {
> +                if (recorderState == AudioRecorder.StoppedState && actualLocation != "") {
> +                    var filePath = actualLocation
> +
> +                    if (application.fileMimeType(filePath).toLowerCase().indexOf("audio/") <= -1) {
> +                        //If the recording process is too quick the generated file is not an audio one and should be ignored
> +                        return;
> +                    }
> +
> +                    var attachment = {}
> +                    attachment["contentType"] = application.fileMimeType(filePath)
> +                    attachment["name"] = filePath.split('/').reverse()[0]
> +                    attachment["filePath"] = filePath
> +                    recordingBar.audioRecorded(attachment)
> +
> +                    recordingBar.duration = duration
>                  }
> -
> -                var attachment = {}
> -                attachment["contentType"] = application.fileMimeType(filePath)
> -                attachment["name"] = filePath.split('/').reverse()[0]
> -                attachment["filePath"] = filePath
> -                recordingBar.audioRecorded(attachment)
> -
> -                recordingBar.duration = duration
>              }
> +
> +            codec: "audio/vorbis"
> +            quality: AudioRecorder.VeryHighQuality
>          }
> -
> -        codec: "audio/vorbis"
> -        quality: AudioRecorder.VeryHighQuality
>      }
>  
>      TransparentButton {


-- 
https://code.launchpad.net/~phablet-team/messaging-app/load-components-on-demand/+merge/280513
Your team Ubuntu Phablet Team is subscribed to branch lp:~phablet-team/messaging-app/enable_other_attachments.



More information about the Ubuntu-reviews mailing list