Skip to content

Commit

Permalink
huge update to qml
Browse files Browse the repository at this point in the history
  • Loading branch information
xerxes2 committed Jun 18, 2011
1 parent f922161 commit 8155b30
Show file tree
Hide file tree
Showing 31 changed files with 1,224 additions and 208 deletions.
1 change: 1 addition & 0 deletions data/panucci-all.conf
Expand Up @@ -27,6 +27,7 @@ main_height = 285
button_color = 633
button_border_color = 559
button_border_width = 6
button_radius = 10
progress_color = 559
progress_background_color = 222
font_size = 14
1 change: 1 addition & 0 deletions data/panucci.conf
Expand Up @@ -20,6 +20,7 @@ main_height = 285
button_color = 633
button_border_color = 559
button_border_width = 6
button_radius = 10
progress_color = 559
progress_background_color = 222
font_size = 14
2 changes: 1 addition & 1 deletion data/ui/qml/AboutDialog.qml
Expand Up @@ -70,7 +70,7 @@ Item {
Image {
anchors.centerIn: parent
smooth: true
source: "gtk-close.png"
source: "close.png"
}
MouseArea {
anchors.fill: parent
Expand Down
27 changes: 17 additions & 10 deletions data/ui/qml/ContextMenu.qml
@@ -1,8 +1,6 @@

import Qt 4.7

import 'config.js' as Config

Item {
id: contextMenuArea
property variant items: []
Expand All @@ -13,32 +11,41 @@ Item {
anchors.fill: parent
}
Rectangle {
color: "black"
color: "#" + config.background
anchors.fill: parent
opacity: .9
}
ListView {
model: contextMenuArea.items
anchors.fill: parent
header: Item { height: Config.headerHeight * 2 }
footer: Item { height: Config.headerHeight }
header: Item { height: config.font_size * 5
width: parent.width
MouseArea { anchors.fill: parent
onClicked: contextMenuArea.close()
}
}
footer: Item { height: config.font_size * 5
width: parent.width
MouseArea { anchors.fill: parent
onClicked: contextMenuArea.close()
}
}

delegate: SelectableItem {
ShadowText {
anchors.leftMargin: Config.switcherWidth
anchors {
left: parent.left
right: parent.right
verticalCenter: parent.verticalCenter
leftMargin: config.font_size * 5
}
color: "white"
color: "#" + config.foreground
font.pixelSize: parent.height * .3
text: items[index].text
text: modelData.text
}
onSelected: {
contextMenuArea.response(index)
contextMenuArea.close()
items[index].trigger()
modelData.trigger()
}
}
}
Expand Down
219 changes: 219 additions & 0 deletions data/ui/qml/Filechooser.qml
@@ -0,0 +1,219 @@

import Qt 4.7

Item {
id: filechooserArea
signal close
property variant items: []
property variant path: ""
property variant action: ""

MouseArea {
anchors.fill: parent
}
Rectangle {
color: "#" + config.background
anchors.fill: parent
opacity: .9
}
ListView {
id: filechooserView
width: root.width
height: root.height - config.button_height - config.button_border_width - config.font_size + 4
model: filechooserArea.items
clip: true
currentIndex: -1
header: Item { height: config.font_size }
footer: Item { height: config.font_size }

highlight: Rectangle { color: "#" + config.progress_color
width: filechooserView.width
height: config.font_size * 3
y: filechooserView.currentItem?filechooserView.currentItem.y:root.height
}
highlightFollowsCurrentItem: false

delegate: FilechooserItem {
property variant item: modelData
Image {
x: 10
source: modelData.directory ? "folder.png" : "file.png"
anchors {
verticalCenter: parent.verticalCenter
}
}
Text {
anchors {
left: parent.left
right: parent.right
verticalCenter: parent.verticalCenter
leftMargin: 40
}
color: "#" + config.foreground
font.pixelSize: config.font_size
text: modelData.caption
}
onSelected: {
filechooserView.currentIndex = index
filechooserArea.path = modelData.path + "/" + modelData.caption
if (modelData.directory == true) {
filechooserView.currentIndex = -1
main.filechooser_callback("open", filechooserArea.path)

}
}
}
}
Rectangle {
width: root.width
height: config.font_size * 1.1
x: 0
y: root.height - config.button_height - textinput.height - config.button_border_width
color: "#" + config.progress_bg_color
}
TextInput {
id: textinput
width: root.width
x: 5
y: root.height - config.button_height - textinput.height - config.button_border_width
color: "#" + config.foreground
font.pixelSize: config.font_size
text: filechooserArea.path
}
Rectangle {
x: 0
y: root.height - config.button_height
color: "#" + config.button_color
width: config.button_width
height: config.button_height
border.color: "#" + config.button_border_color
border.width: config.button_border_width
radius: config.button_radius
smooth: true

Image {
anchors.centerIn: parent
smooth: true
source: "home.png"
}
MouseArea {
anchors.fill: parent
onClicked: { filechooserView.currentIndex = -1
main.filechooser_callback("open", "~")
}
}
}
Rectangle {
x: (config.button_width + config.button_border_width + 2)
y: root.height - config.button_height
color: "#" + config.button_color
width: config.button_width
height: config.button_height
border.color: "#" + config.button_border_color
border.width: config.button_border_width
radius: config.button_radius
smooth: true

Image {
anchors.centerIn: parent
smooth: true
source: "left.png"
}
MouseArea {
anchors.fill: parent
}
}
Rectangle {
x: (config.button_width + config.button_border_width + 2) * 2
y: root.height - config.button_height
color: "#" + config.button_color
width: config.button_width
height: config.button_height
border.color: "#" + config.button_border_color
border.width: config.button_border_width
radius: config.button_radius
smooth: true

Image {
anchors.centerIn: parent
smooth: true
source: "right.png"
}
MouseArea {
anchors.fill: parent
}
}
Rectangle {
x: (config.button_width + config.button_border_width + 2) * 3
y: root.height - config.button_height
color: "#" + config.button_color
width: config.button_width
height: config.button_height
border.color: "#" + config.button_border_color
border.width: config.button_border_width
radius: config.button_radius
smooth: true

Image {
anchors.centerIn: parent
smooth: true
source: "up.png"
}
MouseArea {
anchors.fill: parent
onClicked: { filechooserView.currentIndex = -1
if (filechooserView.currentItem)
main.filechooser_callback("up", filechooserView.currentItem.item.path)
else
main.filechooser_callback("up", filechooserArea.path)
}
}
}
Rectangle {
x: (config.button_width + config.button_border_width + 2) * 4
y: root.height - config.button_height
color: "#" + config.button_color
width: config.button_width
height: config.button_height
border.color: "#" + config.button_border_color
border.width: config.button_border_width
radius: config.button_radius
smooth: true

Image {
anchors.centerIn: parent
smooth: true
source: "cancel.png"
}
MouseArea {
anchors.fill: parent
onClicked: { filechooserView.currentIndex = -1
filechooserArea.close()
}
}
}
Rectangle {
x: (config.button_width + config.button_border_width + 2) * 5
y: root.height - config.button_height
color: "#" + config.button_color
width: config.button_width
height: config.button_height
border.color: "#" + config.button_border_color
border.width: config.button_border_width
radius: config.button_radius
smooth: true

Image {
anchors.centerIn: parent
smooth: true
source: "apply.png"
}
MouseArea {
anchors.fill: parent
onClicked: { filechooserArea.close()
filechooserView.currentIndex = -1
main.filechooser_callback(filechooserArea.action, textinput.text)
}
}
}
}
20 changes: 20 additions & 0 deletions data/ui/qml/FilechooserItem.qml
@@ -0,0 +1,20 @@

import Qt 4.7

Item {
id: filechooserItem
height: config.font_size * 3
width: parent.width
signal selected()

MouseArea {
id: mouseArea
acceptedButtons: Qt.LeftButton | Qt.RightButton
anchors.fill: parent
onClicked: {
if (mouse.button == Qt.LeftButton) {
filechooserItem.selected()
}
}
}
}

0 comments on commit 8155b30

Please sign in to comment.