Skip to content

Commit

Permalink
Merge pull request #230 from rainemak/optimizePickerCompilation
Browse files Browse the repository at this point in the history
Optimize picker compilations
  • Loading branch information
Raine Mäkeläinen committed Nov 7, 2014
2 parents f81db4f + 6c1859c commit 1ceaafc
Show file tree
Hide file tree
Showing 10 changed files with 192 additions and 90 deletions.
98 changes: 8 additions & 90 deletions src/pages/components/PickerCreator.qml
Original file line number Diff line number Diff line change
Expand Up @@ -62,113 +62,31 @@ Item {
if (mode == FileUploadMode.OpenMultiple) {
switch (filter) {
case FileUploadFilter.Image:
pageStack.push(multiImagePickerComponent)
pageStack.push(Qt.resolvedUrl("pickers/MultiImagePicker.qml"), {"creator": pickerCreator})
break
case FileUploadFilter.Audio:
pageStack.push(multiMusicPickerComponent)
pageStack.push(Qt.resolvedUrl("pickers/MultiMusicPicker.qml"), {"creator": pickerCreator})
break
case FileUploadFilter.Video:
pageStack.push(multiVideoPickerComponent)
pageStack.push(Qt.resolvedUrl("pickers/MultiVideoPicker.qml"), {"creator": pickerCreator})
break
default:
pageStack.push(multiContentPickerComponent)
pageStack.push(Qt.resolvedUrl("pickers/MultiContentPicker.qml"), {"creator": pickerCreator})
}
} else {
switch (filter) {
case FileUploadFilter.Image:
pageStack.push(imagePickerComponent)
pageStack.push(Qt.resolvedUrl("pickers/ImagePicker.qml"), {"creator": pickerCreator})
break
case FileUploadFilter.Audio:
pageStack.push(musicPickerComponent)
pageStack.push(Qt.resolvedUrl("pickers/MusicPicker.qml"), {"creator": pickerCreator})
break
case FileUploadFilter.Video:
pageStack.push(videoPickerComponent)
pageStack.push(Qt.resolvedUrl("pickers/VideoPicker.qml"), {"creator": pickerCreator})
break
default:
pageStack.push(contentPickerComponent)
pageStack.push(Qt.resolvedUrl("pickers/ContentPicker.qml"), {"creator": pickerCreator})
}
}
}


Component {
id: imagePickerComponent
ImagePickerPage {
//: For choosing image to send to the website from the device
//% "Upload image"
title: qsTrId("sailfish_browser-he-upload_image")
Component.onDestruction: sendResponse(selectedContent)
}
}

Component {
id: multiImagePickerComponent
MultiImagePickerDialog {
//: For choosing images to send to the website from the device
//% "Upload images"
title: qsTrId("sailfish_browser-he-upload_images")
Component.onDestruction: sendResponseList(selectedContent)
}
}


Component {
id: contentPickerComponent
ContentPickerPage {
//: For choosing any file (document/image/video/audio) to send to the website from the device
//% "Upload file"
title: qsTrId("sailfish_browser-he-upload_file")
Component.onDestruction: sendResponse(selectedContent)
}
}

Component {
id: multiContentPickerComponent
MultiContentPickerDialog {
//: For choosing files (document/image/video/audio) to send to the website from the device
//% "Upload files"
title: qsTrId("sailfish_browser-he-upload_files")
Component.onDestruction: sendResponseList(selectedContent)
}
}

Component {
id: videoPickerComponent
VideoPickerPage {
//: For choosing video to send to the website from the device
//% "Upload video"
title: qsTrId("sailfish_browser-he-upload_video")
Component.onDestruction: sendResponse(selectedContent)
}
}

Component {
id: multiVideoPickerComponent
MultiVideoPickerDialog {
//: For choosing videos to send to the website from the device
//% "Upload videos"
title: qsTrId("sailfish_browser-he-upload_videos")
Component.onDestruction: sendResponseList(selectedContent)
}
}

Component {
id: musicPickerComponent
MusicPickerPage {
//: For choosing audio file to send to the website from the device
//% "Upload audio file"
title: qsTrId("sailfish_browser-he-upload_audio")
Component.onDestruction: sendResponse(selectedContent)
}
}

Component {
id: multiMusicPickerComponent
MultiMusicPickerDialog {
//: For choosing audio files to send to the website from the device
//% "Upload audio files"
title: qsTrId("sailfish_browser-he-upload_audio_files")
Component.onDestruction: sendResponseList(selectedContent)
}
}
}
22 changes: 22 additions & 0 deletions src/pages/components/pickers/ContentPicker.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Contact: Raine Makelainen <[email protected]>
**
****************************************************************************/

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

import QtQuick 2.1
import Sailfish.Pickers 1.0

ContentPickerPage {
property var creator

//: For choosing any file (document/image/video/audio) to send to the website from the device
//% "Upload file"
title: qsTrId("sailfish_browser-he-upload_file")
Component.onDestruction: creator.sendResponse(selectedContent)
}
22 changes: 22 additions & 0 deletions src/pages/components/pickers/ImagePicker.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Contact: Raine Makelainen <[email protected]>
**
****************************************************************************/

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

import QtQuick 2.1
import Sailfish.Pickers 1.0

ImagePickerPage {
property var creator

//: For choosing image to send to the website from the device
//% "Upload image"
title: qsTrId("sailfish_browser-he-upload_image")
Component.onDestruction: creator.sendResponse(selectedContent)
}
22 changes: 22 additions & 0 deletions src/pages/components/pickers/MultiContentPicker.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Contact: Raine Makelainen <[email protected]>
**
****************************************************************************/

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

import QtQuick 2.1
import Sailfish.Pickers 1.0

MultiContentPickerDialog {
property var creator

//: For choosing files (document/image/video/audio) to send to the website from the device
//% "Upload files"
title: qsTrId("sailfish_browser-he-upload_files")
Component.onDestruction: creator.sendResponseList(selectedContent)
}
22 changes: 22 additions & 0 deletions src/pages/components/pickers/MultiImagePicker.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Contact: Raine Makelainen <[email protected]>
**
****************************************************************************/

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

import QtQuick 2.1
import Sailfish.Pickers 1.0

MultiImagePickerDialog {
property var creator

//: For choosing images to send to the website from the device
//% "Upload images"
title: qsTrId("sailfish_browser-he-upload_images")
Component.onDestruction: creator.sendResponseList(selectedContent)
}
22 changes: 22 additions & 0 deletions src/pages/components/pickers/MultiMusicPicker.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Contact: Raine Makelainen <[email protected]>
**
****************************************************************************/

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

import QtQuick 2.1
import Sailfish.Pickers 1.0

MultiMusicPickerDialog {
property var creator

//: For choosing audio files to send to the website from the device
//% "Upload audio files"
title: qsTrId("sailfish_browser-he-upload_audio_files")
Component.onDestruction: creator.sendResponseList(selectedContent)
}
22 changes: 22 additions & 0 deletions src/pages/components/pickers/MultiVideoPicker.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Contact: Raine Makelainen <[email protected]>
**
****************************************************************************/

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

import QtQuick 2.1
import Sailfish.Pickers 1.0

MultiVideoPickerDialog {
property var creator

//: For choosing videos to send to the website from the device
//% "Upload videos"
title: qsTrId("sailfish_browser-he-upload_videos")
Component.onDestruction: creator.sendResponseList(selectedContent)
}
22 changes: 22 additions & 0 deletions src/pages/components/pickers/MusicPicker.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Contact: Raine Makelainen <[email protected]>
**
****************************************************************************/

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

import QtQuick 2.1
import Sailfish.Pickers 1.0

MusicPickerPage {
property var creator

//: For choosing audio file to send to the website from the device
//% "Upload audio file"
title: qsTrId("sailfish_browser-he-upload_audio")
Component.onDestruction: creator.sendResponse(selectedContent)
}
22 changes: 22 additions & 0 deletions src/pages/components/pickers/VideoPicker.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Contact: Raine Makelainen <[email protected]>
**
****************************************************************************/

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

import QtQuick 2.1
import Sailfish.Pickers 1.0

VideoPickerPage {
property var creator

//: For choosing video to send to the website from the device
//% "Upload video"
title: qsTrId("sailfish_browser-he-upload_video")
Component.onDestruction: creator.sendResponse(selectedContent)
}
8 changes: 8 additions & 0 deletions src/sailfish-browser.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@
<file>pages/components/FavoriteList.qml</file>
<file>pages/components/HistoryList.qml</file>
<file>pages/components/ResourceController.qml</file>
<file>pages/components/pickers/ContentPicker.qml</file>
<file>pages/components/pickers/ImagePicker.qml</file>
<file>pages/components/pickers/MultiContentPicker.qml</file>
<file>pages/components/pickers/MultiImagePicker.qml</file>
<file>pages/components/pickers/MultiMusicPicker.qml</file>
<file>pages/components/pickers/MultiVideoPicker.qml</file>
<file>pages/components/pickers/MusicPicker.qml</file>
<file>pages/components/pickers/VideoPicker.qml</file>
<file>pages/components/graphic-radial-mask.png</file>
</qresource>
</RCC>

0 comments on commit 1ceaafc

Please sign in to comment.