Skip to content

Commit

Permalink
Merge pull request #66 from neochapay/progressbar_up
Browse files Browse the repository at this point in the history
[ProgressBar] Add indication of indeterminate progressbar
  • Loading branch information
locusf authored Jun 26, 2018
2 parents edec39d + 2476ff4 commit 865503d
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 65 deletions.
23 changes: 2 additions & 21 deletions examples/touch/content/ProgressBarPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -82,28 +82,9 @@ Page {

ProgressBar {
anchors.margins: 20
style: touchStyle
value: 1
indeterminate: true
value: 0.85
width: 400
}
}

Component {
id: touchStyle
ProgressBarStyle {
panel: Rectangle {
implicitHeight: 15
implicitWidth: 400
color: "#444"
opacity: 0.8
Rectangle {
antialiasing: true
radius: 1
color: "#468bb7"
height: parent.height
width: parent.width * control.value / control.maximumValue
}
}
}
}
}
1 change: 1 addition & 0 deletions src/controls/controls.pro
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ QML_FILES += \
qml/Checkbox.qml\
qml/ButtonRow.qml \
qml/Header.qml \
qml/ProgressBar.qml \
qml/HeaderToolsLayout.qml \
qml/Slider.qml\
qml/ListView.qml \
Expand Down
7 changes: 7 additions & 0 deletions src/controls/qml/ProgressBar.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import QtQuick 2.6
import QtQuick.Controls 1.0
import QtQuick.Controls.Styles.Nemo 1.0

ProgressBar {
style: ProgressBarStyle{}
}
3 changes: 1 addition & 2 deletions src/controls/qml/qmldir
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ DatePicker 1.0 DatePicker.qml
TimePicker 1.0 TimePicker.qml
ScrollDecorator 1.0 ScrollDecorator.qml
TextField 1.0 TextField.qml
ProgressBar 1.0 ProgressBar.qml

# MIRRORED CONTROLS:
# These are the controls that we take directly from official QQC.
Expand All @@ -41,11 +42,9 @@ TextField 1.0 TextField.qml

ComboBox 1.0 ../ComboBox.qml
GroupBox 1.0 ../GroupBox.qml

MenuBar 1.0 ../MenuBar.qml
Menu 1.0 ../Menu.qml
StackView 1.0 ../StackView.qml
ProgressBar 1.0 ../ProgressBar.qml
RadioButton 1.0 ../RadioButton.qml
ScrollView 1.0 ../ScrollView.qml
SpinBox 1.0 ../SpinBox.qml
Expand Down
37 changes: 0 additions & 37 deletions src/styles/qml/GrooveStyle.qml

This file was deleted.

44 changes: 40 additions & 4 deletions src/styles/qml/ProgressBarStyle.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2013 Andrea Bernabei <[email protected]>
* Copyright (C) 2018 Chupligin Sergey <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
Expand All @@ -18,12 +19,47 @@
*/

import QtQuick 2.6
import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles 1.0

ProgressBarStyle {
GrooveStyle {
id: grooveStyle
}
panel: Rectangle {
implicitHeight: Theme.itemHeightSmall/2
implicitWidth: Theme.itemWidthLarge + Theme.itemWidthSmall
color: Theme.fillDarkColor

Rectangle {
antialiasing: true
radius: 1
visible: !control.indeterminate
color: control.indeterminate ? "transparent" : Theme.accentColor
height: parent.height
width: parent.width * control.value / control.maximumValue
}

panel: grooveStyle;
Item {
anchors.fill: parent
anchors.margins: 1
visible: control.indeterminate
clip: true

Row {
Repeater {
Rectangle {
color: index % 2 ? Theme.fillDarkColor : Theme.accentColor
width: Theme.itemHeightExtraSmall/3
height: control.height*2
rotation: 40
y: -control.height/2
}
model: control.width/Theme.itemHeightExtraSmall*3+4
}
XAnimator on x {
from: -(Theme.itemHeightExtraSmall/3*2) ; to: 0
loops: Animation.Infinite
running: control.indeterminate
}
}
}
}
}
1 change: 0 additions & 1 deletion src/styles/styles.pro
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ QML_FILES = \
qml/CheckBoxStyle.qml \
qml/ComboBoxStyle.qml \
qml/FocusFrameStyle.qml \
qml/GrooveStyle.qml \
qml/GroupBoxStyle.qml \
qml/MenuBarStyle.qml \
qml/MenuStyle.qml \
Expand Down

0 comments on commit 865503d

Please sign in to comment.