From 64114bd3bf98a8d79bfcc7bb7690c810338316e1 Mon Sep 17 00:00:00 2001 From: Mohammed Sameer Date: Wed, 31 Jul 2013 23:16:19 +0300 Subject: [PATCH] Move all icon ids used in .qml files into CameraTheme and create a harmattan theme --- qml/CameraToolBar.qml | 2 +- qml/ImageEvCompButton.qml | 2 +- qml/ImageOverlay.qml | 6 +-- qml/MainPage.qml | 4 ++ qml/ModeButton.qml | 3 +- qml/PostCaptureItem.qml | 2 +- qml/PostCaptureView.qml | 8 ++-- qml/RecordingDurationLabel.qml | 2 +- qml/Standby.qml | 2 +- qml/VideoEvCompButton.qml | 2 +- qml/VideoMuteButton.qml | 3 +- qml/VideoOverlay.qml | 4 +- qml/VideoPlayerPage.qml | 5 +-- qml/VideoTorchButton.qml | 2 +- qml/harmattan/CameraTheme.qml | 74 ++++++++++++++++++++++++++++++++++ qml/harmattan/harmattan.qrc | 1 + 16 files changed, 99 insertions(+), 23 deletions(-) create mode 100644 qml/harmattan/CameraTheme.qml diff --git a/qml/CameraToolBar.qml b/qml/CameraToolBar.qml index 143bc98..52b50ee 100644 --- a/qml/CameraToolBar.qml +++ b/qml/CameraToolBar.qml @@ -48,7 +48,7 @@ Rectangle { visible: !parent.hideBack id: menu anchors.verticalCenter: parent.verticalCenter - iconId: "icon-m-toolbar-back-white" + iconId: cameraTheme.cameraToolBarMenuIcon onClicked: { if (tools.manualBack) { tools.clicked() diff --git a/qml/ImageEvCompButton.qml b/qml/ImageEvCompButton.qml index 2dbaf33..0f6ba56 100644 --- a/qml/ImageEvCompButton.qml +++ b/qml/ImageEvCompButton.qml @@ -26,7 +26,7 @@ import QtCamera 1.0 CameraToolIcon { id: button - iconId: settings.imageEvComp == 0 ? "icon-m-camera-manual-exposure" : "" + iconId: settings.imageEvComp == 0 ? cameraTheme.cameraManualExposureIconId : "" CameraLabel { anchors.fill: parent diff --git a/qml/ImageOverlay.qml b/qml/ImageOverlay.qml index c016cc4..fe01b37 100644 --- a/qml/ImageOverlay.qml +++ b/qml/ImageOverlay.qml @@ -73,7 +73,7 @@ Item { anchors.right: parent.right anchors.rightMargin: 20 anchors.verticalCenter: parent.verticalCenter - iconId: "icon-m-camera-shutter" + iconId: cameraTheme.captureButtonImageIconId width: 75 height: 75 opacity: 0.5 @@ -193,7 +193,7 @@ Item { Indicator { id: gpsIndicator visible: settings.useGps - source: "image://theme/icon-m-camera-location" + source: cameraTheme.gpsIndicatorIcon PropertyAnimation on opacity { easing.type: Easing.OutSine @@ -209,7 +209,7 @@ Item { Indicator { id: faceDetectionIndicator visible: settings.faceDetectionEnabled - source: "image://theme/icon-m-camera-face-detection-screen" + source: cameraTheme.faceDetectionIndicatorIcon } } diff --git a/qml/MainPage.qml b/qml/MainPage.qml index c1ca7bc..3b51009 100644 --- a/qml/MainPage.qml +++ b/qml/MainPage.qml @@ -29,6 +29,10 @@ import CameraPlus 1.0 CameraPage { id: root + CameraTheme { + id: cameraTheme + } + VisualItemModel { id: mainModel diff --git a/qml/ModeButton.qml b/qml/ModeButton.qml index f25664c..74dcde3 100644 --- a/qml/ModeButton.qml +++ b/qml/ModeButton.qml @@ -29,8 +29,7 @@ CaptureButton { height: 55 opacity: 0.5 - iconId: settings.mode == Camera.VideoMode ? "icon-m-viewfinder-camera" : "icon-m-camera-video" - + iconId: settings.mode == Camera.VideoMode ? cameraTheme.cameraImageIconId : cameraTheme.cameraVideoIconId onClicked: { if (settings.mode == Camera.VideoMode) { settings.mode = Camera.ImageMode diff --git a/qml/PostCaptureItem.qml b/qml/PostCaptureItem.qml index cc0e2f9..c190075 100644 --- a/qml/PostCaptureItem.qml +++ b/qml/PostCaptureItem.qml @@ -92,7 +92,7 @@ Item { CameraToolIcon { id: playIcon anchors.horizontalCenter: parent.horizontalCenter - iconId: "icon-m-toolbar-mediacontrol-play-white" + iconId: cameraTheme.videoPlayIconId visible: isVideo onClicked: startPlayback() } diff --git a/qml/PostCaptureView.qml b/qml/PostCaptureView.qml index de8c016..603798b 100644 --- a/qml/PostCaptureView.qml +++ b/qml/PostCaptureView.qml @@ -119,28 +119,28 @@ Item { items: [ CameraToolIcon { - iconId: !available ? "icon-m-toolbar-favorite-mark-dimmed-white" : view.currentItem.itemData.favorite ? "icon-m-toolbar-favorite-mark-white" : "icon-m-toolbar-favorite-unmark-white" + iconId: !available ? cameraTheme.favoriteDisabledIconId : view.currentItem.itemData.favorite ? cameraTheme.favoriteMarkIconId : cameraTheme.favoriteUnmarkIconId onClicked: { addOrRemoveFavorite() restartTimer() } }, CameraToolIcon { - iconId: available ? "icon-m-toolbar-share-white" : "icon-m-toolbar-share-dimmed-white" + iconId: available ? cameraTheme.shareEnabledIconId : cameraTheme.shareDisabledIconId onClicked: { shareCurrentItem() restartTimer() } }, CameraToolIcon { - iconId: available ? "icon-m-toolbar-delete-white" : "icon-m-toolbar-delete-dimmed-white" + iconId: available ? cameraTheme.deleteEnabledIconId : cameraTheme.deleteDisabledIconId onClicked: { deleteCurrentItem() restartTimer() } }, CameraToolIcon { - iconId: "icon-m-toolbar-view-menu-white" + iconId: cameraTheme.menuIconId onClicked: { menu.open() restartTimer() diff --git a/qml/RecordingDurationLabel.qml b/qml/RecordingDurationLabel.qml index 8362195..274d266 100644 --- a/qml/RecordingDurationLabel.qml +++ b/qml/RecordingDurationLabel.qml @@ -37,7 +37,7 @@ Rectangle { Image { id: recordingIcon - source: "image://theme/icon-m-camera-ongoing-recording" + source: cameraTheme.recordingDurationIcon width: 20 height: 20 anchors.verticalCenter: parent.verticalCenter diff --git a/qml/Standby.qml b/qml/Standby.qml index f3f0229..757f1c7 100644 --- a/qml/Standby.qml +++ b/qml/Standby.qml @@ -46,7 +46,7 @@ Rectangle { Image { id: icon - source: "image://theme/icon-l-camera-standby" + source: cameraTheme.standbyIcon anchors.centerIn: parent } diff --git a/qml/VideoEvCompButton.qml b/qml/VideoEvCompButton.qml index a799f67..50cdaeb 100644 --- a/qml/VideoEvCompButton.qml +++ b/qml/VideoEvCompButton.qml @@ -26,7 +26,7 @@ import QtCamera 1.0 CameraToolIcon { id: button - iconId: settings.videoEvComp == 0 ? "icon-m-camera-manual-exposure" : "" + iconId: settings.videoEvComp == 0 ? cameraTheme.cameraManualExposureIconId : "" CameraLabel { anchors.fill: parent diff --git a/qml/VideoMuteButton.qml b/qml/VideoMuteButton.qml index dafe895..c480dc6 100644 --- a/qml/VideoMuteButton.qml +++ b/qml/VideoMuteButton.qml @@ -23,7 +23,6 @@ import QtQuick 2.0 CameraToolIcon { - iconId: settings.videoMuted ? "icon-m-toolbar-volume-off-white-selected" - : "icon-m-toolbar-volume-white-selected" + iconId: settings.videoMuted ? cameraTheme.soundMuteOnIconId : cameraTheme.soundMuteOffIconId onClicked: settings.videoMuted = !settings.videoMuted } diff --git a/qml/VideoOverlay.qml b/qml/VideoOverlay.qml index 9e9add1..b8274e9 100644 --- a/qml/VideoOverlay.qml +++ b/qml/VideoOverlay.qml @@ -80,7 +80,7 @@ Item { anchors.right: parent.right anchors.rightMargin: 20 anchors.verticalCenter: parent.verticalCenter - iconId: overlay.recording ? "icon-m-camera-video-record" : "icon-m-camera-video-record" + iconId: overlay.recording ? cameraTheme.captureButtonRecordingIconId : cameraTheme.captureButtonVideoIconId width: 75 height: 75 opacity: 0.5 @@ -162,7 +162,7 @@ Item { Indicator { id: gpsIndicator visible: settings.useGps - source: "image://theme/icon-m-camera-location" + source: cameraTheme.gpsIndicatorIcon PropertyAnimation on opacity { easing.type: Easing.OutSine diff --git a/qml/VideoPlayerPage.qml b/qml/VideoPlayerPage.qml index 9b6ec4f..5e80ffa 100644 --- a/qml/VideoPlayerPage.qml +++ b/qml/VideoPlayerPage.qml @@ -105,7 +105,7 @@ Item { items: [ CameraToolIcon { - iconId: "icon-m-toolbar-mediacontrol-stop-white" + iconId: cameraTheme.videoStopIconId onClicked: video.stop() }, CameraSlider { @@ -131,8 +131,7 @@ Item { }, CameraToolIcon { id: control - iconId: !video.paused ? "icon-m-toolbar-mediacontrol-pause-white" - : "icon-m-toolbar-mediacontrol-play-white" + iconId: !video.paused ? cameraTheme.videoPauseIconId : cameraTheme.videoPlayIconId onClicked: { video.toggle() hideTimer.restart() diff --git a/qml/VideoTorchButton.qml b/qml/VideoTorchButton.qml index 1f91966..1392bad 100644 --- a/qml/VideoTorchButton.qml +++ b/qml/VideoTorchButton.qml @@ -27,7 +27,7 @@ CameraToolIcon { id: button property Camera camera: null - iconId: settings.videoTorchOn ? "icon-m-camera-torch-on" : "icon-m-camera-torch-off" + iconId: settings.videoTorchOn ? cameraTheme.cameraTorchOnIconId : cameraTheme.cameraTorchOffIconId onClicked: settings.videoTorchOn = !settings.videoTorchOn Binding { diff --git a/qml/harmattan/CameraTheme.qml b/qml/harmattan/CameraTheme.qml new file mode 100644 index 0000000..3ab34d2 --- /dev/null +++ b/qml/harmattan/CameraTheme.qml @@ -0,0 +1,74 @@ +// -*- qml -*- + +/*! + * This file is part of CameraPlus. + * + * Copyright (C) 2012-2013 Mohammed Sameer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +import QtQuick 1.1 + +QtObject { + property string standbyIcon: "image://theme/icon-l-camera-standby" + + property string gpsIndicatorIcon: "image://theme/icon-m-camera-location" + property string faceDetectionIndicatorIcon: "image://theme/icon-m-camera-face-detection-screen" + + property string recordingDurationIcon: "image://theme/icon-m-camera-ongoing-recording" + property string cameraTorchOnIconId: "icon-m-camera-torch-on" + property string cameraTorchOffIconId: "icon-m-camera-torch-off" + property string soundMuteOnIconId: "icon-m-toolbar-volume-off-white-selected" + property string soundMuteOffIconId: "icon-m-toolbar-volume-white-selected" + property string videoStopIconId: "icon-m-toolbar-mediacontrol-stop-white" + property string videoPauseIconId: "icon-m-toolbar-mediacontrol-pause-white" + property string videoPlayIconId: "icon-m-toolbar-mediacontrol-play-white" + property string cameraManualExposureIconId: "icon-m-camera-manual-exposure" + property string cameraVideoIconId: "icon-m-camera-video" + property string cameraImageIconId: "icon-m-viewfinder-camera" + property string captureButtonImageIconId: "icon-m-camera-shutter" + property string captureButtonVideoIconId: "icon-m-camera-video-record" + property string captureButtonRecordingIconId: "icon-m-camera-video-record" + property string cameraToolBarMenuIcon: "icon-m-toolbar-back-white" + property string deleteEnabledIconId: "icon-m-toolbar-delete-white" + property string deleteDisabledIconId: "icon-m-toolbar-delete-dimmed-white" + property string shareEnabledIconId: "icon-m-toolbar-share-white" + property string shareDisabledIconId: "icon-m-toolbar-share-dimmed-white" + property string favoriteDisabledIconId: "icon-m-toolbar-favorite-mark-dimmed-white" + property string favoriteMarkIconId: "icon-m-toolbar-favorite-mark-white" + property string favoriteUnmarkIconId: "icon-m-toolbar-favorite-unmark-white" + property string menuIconId: "icon-m-toolbar-view-menu-white" + +/* + + property string + property string + property string + property string + property string + property string + property string + property string + property string + property string + property string + property string + property string + property string + property string + property string +*/ +} \ No newline at end of file diff --git a/qml/harmattan/harmattan.qrc b/qml/harmattan/harmattan.qrc index acfe87f..c5c2b34 100644 --- a/qml/harmattan/harmattan.qrc +++ b/qml/harmattan/harmattan.qrc @@ -17,5 +17,6 @@ FullScreenThumbnail.qml CameraPositionSource.qml CameraPage.qml + CameraTheme.qml -- 2.25.1