<commit_before>// -*- qml -*-

/*!
 * This file is part of CameraPlus.
 *
 * Copyright (C) 2012 <NAME> <<EMAIL>>
 *
 * 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
import com.nokia.meego 1.1
import com.nokia.extras 1.1
import QtCamera 1.0
import CameraPlus 1.0
import QtMobility.systeminfo 1.2
import QtMobility.location 1.2

// TODO: postcapture
// TODO: flash not ready
// TODO: focus, caf, ...
// TODO: portrait/landscape
// TODO: record video in a hidden directory and then copy the video to avoid tracker indexing it.
// TODO: stop viewfinder in settings pages ?
// TODO: prevent going to mass storage while recording and capturing
// TODO: grid lines, face tracking, ambr
// TODO: complete settings pages
// TODO: stop camera properly when we get closed.
// TODO: select primary/secondary camera.
// TODO: disable debug builds.
// TODO: a way to get buffers to the application
// TODO: fcam like functionality (precise control over capture parameters).

PageStackWindow {
        id: root

        property alias dimmer: camDimmer

        showStatusBar: false

        Component.onCompleted: {
                theme.inverted = true;
                if (settings.mode == 0) {
                        openFile("ImagePage.qml");
                }
                else {
                        openFile("VideoPage.qml");
                }
        }

        function showError(msg) {
                error.text = msg;
                error.show();
        }

        PositionSource {
                // NOTE: The source will not reset the position when we lose the signal.
                // This shouldn't be a big problem as we are course enough.
                // If we ever need street level updates then this will be an issue.
                id: positionSource
                active: settings.useGps
                // TODO: we cannot bind to cam.running because camera will stop
                // when the connection dialog pops up and we end up with an infinite loop
                // active: cam.running && settings.useGps
                onPositionChanged: geocode.search(position.coordinate.longitude, position.coordinate.latitude);
        }

        MetaData {
                id: metaData
                camera: cam
                manufacturer: deviceInfo.manufacturer
                model: deviceInfo.model
                country: geocode.country
                city: geocode.city
                suburb: geocode.suburb
                longitude: positionSource.position.coordinate.longitude<commit_msg>Use replacePage() for the initial page setting to prevent having 2 video pages<commit_after>// -*- qml -*-

/*!
 * This file is part of CameraPlus.
 *
 * Copyright (C) 2012 <NAME> <<EMAIL>>
 *
 * 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
import com.nokia.meego 1.1
import com.nokia.extras 1.1
import QtCamera 1.0
import CameraPlus 1.0
import QtMobility.systeminfo 1.2
import QtMobility.location 1.2

// TODO: postcapture
// TODO: flash not ready
// TODO: focus, caf, ...
// TODO: portrait/landscape
// TODO: record video in a hidden directory and then copy the video to avoid tracker indexing it.
// TODO: stop viewfinder in settings pages ?
// TODO: prevent going to mass storage while recording and capturing
// TODO: grid lines, face tracking, ambr
// TODO: complete settings pages
// TODO: stop camera properly when we get closed.
// TODO: select primary/secondary camera.
// TODO: disable debug builds.
// TODO: a way to get buffers to the application
// TODO: fcam like functionality (precise control over capture parameters).

PageStackWindow {
        id: root

        property alias dimmer: camDimmer

        showStatusBar: false

        Component.onCompleted: {
                theme.inverted = true;
                if (settings.mode == Camera.VideoMode) {
                        // TODO: We will use replacePage for now.
                        // If we use openPage() then we end up with 2 video pages
                        // stacked on top of each other.
                        // The first one is created when the camera mode gets
                        // changed to video upon startup and this becomes the 2nd one.
                        replacePage("VideoPage.qml");
                }
                else {
                        replacePage("ImagePage.qml");
                }
        }

        function showError(msg) {
                error.text = msg;
                error.show();
        }

        PositionSource {
                // NOTE: The source will not reset the position when we lose the signal.
                // This shouldn't be a big problem as we are course enough.
                // If we ever need street level updates then this will be an issue.
                id: positionSource
                active: settings.useGps
                // TODO: we cannot bind to cam.running because camera will stop
                // when the connection dialog pops up and we end up with an infinite loop
                // active: cam.running && settings.useGps
                onPositionChanged: geocode.search(position.coordinate.longitude, position.coordinate.latitude);
        }

        MetaData {
                id: metaData
                camera: cam
                manufacturer: deviceInfo.manufacturer
                model: deviceInfo.model
                country: geocode.country
                city: geocode.city
                suburb: geocode.suburb
                longitude: positionSource.position.coordinate.longitude
{'fraction_non_alphanumeric': 0.0700517836593786, 'fraction_numerical': 0.00949367088607595, 'mean_word_length': 2.0073529411764706, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4349240', 'n_tokens_mistral': 1777, 'n_tokens_neox': 1642, 'n_words': 759}