removed stuff from other project

master
Tobi Sim 2015-02-21 16:15:01 +01:00
parent 97a6a6924d
commit 5f08a5d453
5 changed files with 3 additions and 312 deletions

View File

@ -3,6 +3,6 @@ import Sailfish.Silica 1.0
CoverBackground { CoverBackground {
CoverPlaceholder { CoverPlaceholder {
text: "Sailfish Scanner" text: "Sailfish Python"
} }
} }

View File

@ -1,204 +0,0 @@
/*
* FileChooser.qml
* Copyright (C) Damien Caliste 2013-2014 <dcaliste@free.fr>
*
* FileChooser.qml is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
import Qt.labs.folderlistmodel 1.0
Item {
id: chooser_item
property string selection
property string entry
property bool saveMode: false
property alias saveText: chooser_entry.text
Row {
width: parent.width
anchors.top: parent.top
TextField {
id: chooser_entry
width: parent.width - chooser_adddir.width
placeholderText: "enter a new file name"
validator: RegExpValidator { regExp: /^[^/]+$/ }
inputMethodHints: Qt.ImhNoPredictiveText
EnterKey.text: "save"
EnterKey.onClicked: { if (acceptableInput) { chooser_item.entry = folderModel.folder + "/" + text } }
onFocusChanged: { if (focus) { selectAll() } }
}
IconButton {
id: chooser_adddir
icon.source: "image://theme/icon-m-folder"
enabled: chooser_entry.acceptableInput
onClicked: { }
}
visible: chooser_item.saveMode
}
Label {
width: parent.width
visible: chooser_item.saveMode
text: "or select an existing one"
font.pixelSize: Theme.fontSizeSmall
color: Theme.secondaryColor
horizontalAlignment: Text.AlignHCenter
}
Row {
id: chooser_head
height: Theme.itemSizeSmall
width: parent.width
IconButton {
id: chooser_back
icon.source: "image://theme/icon-header-back"
enabled: folderModel.dirname().length > 0
onClicked: { folderModel.navigateUp() }
}
Button {
width: parent.width - chooser_back.width - chooser_options.width
text: folderModel.basename()
visible: folderModel.dirname().length > 0
enabled: false
}
IconButton {
id: chooser_options
height: Theme.itemSizeSmall
icon.source: "image://theme/icon-m-levels"
onClicked: { chooser_controls.open = !chooser_controls.open }
}
}
}
FolderListModel {
id: folderModel
folder: StandardPaths.documents
function basename() {
var url = folder.toString()
if (url == "file:///home/nemo") {
return "My Jolla"
} else if (url == "file:///sdcard") {
return "My Android"
} else {
return url.substring(url.lastIndexOf("/") + 1)
}
}
function dirname() {
var url = parentFolder.toString()
if (url == "file:///home") {
return "file:///media/sdcard"
} else if (url == "file:///media") {
return "file:///sdcard"
} else if (url == "file:///") {
return "file:///home/nemo"
} else {
return url
}
}
function navigateUp() {
var url = dirname()
folder = url
if (url == "file:///media") {
append({"fileName": "My Jolla", "filePath": "file:///home/nemo"})
}
}
}
SilicaListView {
id: chooser_list
header: Item {
id: header
width: chooser_header.width
height: chooser_header.height
Component.onCompleted: chooser_header.parent = header
onHeightChanged: chooser_list.contentY = - height
}
anchors {
fill: parent
rightMargin: page.isPortrait ? 0 : chooser_controls.visibleSize
bottomMargin: page.isPortrait ? chooser_controls.visibleSize + Theme.paddingLarge: 0
}
model: folderModel
Formatter {
id: formatter
}
ViewPlaceholder {
enabled: folderModel.count == 0
text: "No files"
}
delegate: ListItem {
contentHeight: Theme.itemSizeSmall
Image {
id: chooser_icon
source: fileIsDir ? "image://theme/icon-m-folder" : "image://theme/icon-m-document"
//visible: fileIsDir
anchors.left: parent.left
anchors.leftMargin: Theme.paddingSmall
anchors.rightMargin: Theme.paddingSmall
anchors.verticalCenter: parent.verticalCenter
}
Label {
text: fileName
truncationMode: TruncationMode.Fade
font.pixelSize: Theme.fontSizeSmall
anchors.topMargin: Theme.paddingSmall
anchors.right: img_go.left
anchors.left: chooser_icon.right
color: highlighted ? Theme.highlightColor : Theme.primaryColor
}
Label {
font.pixelSize: Theme.fontSizeExtraSmall
text: formatter.formatDate(fileModified, Formatter.Timepoint) + " - " + formatter.formatFileSize(fileSize)
color: Theme.secondaryColor
anchors.right: img_go.left
anchors.bottom: parent.bottom
}
Image {
id: img_go
source: "image://theme/icon-m-right"
anchors.right: parent.right
anchors.leftMargin: Theme.paddingSmall
anchors.rightMargin: Theme.paddingSmall
anchors.verticalCenter: parent.verticalCenter
}
onClicked: { fileIsDir ? folderModel.folder = filePath : selection = filePath }
}
}
VerticalScrollDecorator { flickable: chooser_list }
DockedPanel {
id: chooser_controls
open: false
width: parent.width
height: parent.height
dock: Dock.Bottom
Flow {
anchors.fill: parent
anchors.centerIn: parent
ComboBox {
width: parent.width / 2
label: "sort by"
menu: ContextMenu {
MenuItem { text: "name"; onClicked: { folderModel.sortField = FolderListModel.Name } }
MenuItem { text: "date"; onClicked: { folderModel.sortField = FolderListModel.Time } }
MenuItem { text: "type"; onClicked: { folderModel.sortField = FolderListModel.Type } }
}
}
TextSwitch {
width: page.isPortrait ? parent.width / 2 : parent.width
text: "reversed"
onCheckedChanged: { folderModel.sortReversed = checked }
}
}
}
}

View File

@ -1,96 +0,0 @@
/*
* FileChooser.qml
* Copyright (C) Damien Caliste 2013-2014 <dcaliste@free.fr>
*
* FileChooser.qml is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
import Qt.labs.folderlistmodel 1.0
Item {
id: chooser_item
function getEntry() {
}
Column {
id: chooser_header
width: parent.width
Label {
width: parent.width
text: "Picture Chooser"
font.pixelSize: Theme.fontSizeSmall
color: Theme.secondaryColor
horizontalAlignment: Text.AlignHCenter
}
Row {
id: chooser_head
width: parent.width
IconButton {
id: chooser_back
icon.source: "image://theme/icon-header-back"
onClicked: { folderModel.navigateUp() }
}
Label {
width: parent.width - chooser_back.width
text: folderModel.folder
}
}
}
FolderListModel {
id: folderModel
folder: Qt.resolvedUrl('~')
showDirsFirst: true
rootFolder: Qt.resolvedUrl('/')
function navigateUp(){
if (folderModel.folder == "file:///") {
return
} else {
folderModel.folder = folderModel.parentFolder
}
}
function fileSelected(fileName,filePath){
py.call("main.helloMyWorld",[filePath],function(ret){
pageStack.push(Qt.resolvedUrl("ImageView.qml"))
})
}
}
SilicaListView {
id: chooser_list
anchors.top: chooser_header.bottom
width: parent.width
anchors.bottom: parent.bottom
model: folderModel
Formatter {
id: formatter
}
delegate: ListItem {
id: listItems
Label {
anchors.fill: parent
anchors.topMargin: Theme.paddingSmall
color: fileIsDir ? Theme.primaryColor : Theme.secondaryColor
text: fileName
}
Label {
font.pixelSize: Theme.fontSizeExtraSmall
text: formatter.formatDate(fileModified, Formatter.Timepoint) + " - " + formatter.formatFileSize(fileSize)
color: Theme.secondaryColor
anchors.rightMargin: Theme.paddingSmall
anchors.bottom: parent.bottom
}
onClicked: { fileIsDir ? folderModel.folder = filePath : folderModel.fileSelected(fileName,filePath)}
}
}
}

View File

@ -1,10 +0,0 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
Image {
anchors.fill: parent
source: "image://python/loadedImage"
}
}

View File

@ -3,6 +3,7 @@ import Sailfish.Silica 1.0
Page { Page {
id: main id: main
Button{ Label{
text:"qml example"
} }
} }