[app] Tweaking folder UI
This commit is contained in:
parent
89f79e2492
commit
8a4e131452
6 changed files with 34 additions and 11 deletions
|
@ -130,10 +130,7 @@ MouseArea {
|
||||||
}
|
}
|
||||||
onPressAndHold: {
|
onPressAndHold: {
|
||||||
if (!shelfView.editMode) {
|
if (!shelfView.editMode) {
|
||||||
var index = gridView.indexAt(mouseX + gridView.contentX, mouseY + currentShelfView.contentY)
|
shelfView.startEditing()
|
||||||
if (index === pressedItemIndex) {
|
|
||||||
shelfView.startEditing()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onPositionChanged: {
|
onPositionChanged: {
|
||||||
|
|
|
@ -47,7 +47,7 @@ Item {
|
||||||
|
|
||||||
//% "No books"
|
//% "No books"
|
||||||
text: qsTrId("shelf-view-no-books")
|
text: qsTrId("shelf-view-no-books")
|
||||||
visible: footerState == 2
|
visible: footerState == 2 && !editMode
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,10 +32,14 @@
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import Sailfish.Silica 1.0
|
import Sailfish.Silica 1.0
|
||||||
|
|
||||||
BackgroundItem {
|
MouseArea {
|
||||||
id: root
|
id: root
|
||||||
implicitHeight: column.implicitHeight
|
implicitHeight: column.implicitHeight
|
||||||
property alias text: label.text
|
property alias text: label.text
|
||||||
|
property bool currentFolder
|
||||||
|
property bool _highlighted: pressed
|
||||||
|
property color _highlightedColor: Theme.rgba(Theme.highlightBackgroundColor, Theme.highlightBackgroundOpacity)
|
||||||
|
property bool _showPress: !currentFolder && (_highlighted || pressTimer.running)
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: column
|
id: column
|
||||||
|
@ -74,7 +78,7 @@ BackgroundItem {
|
||||||
leftMargin: Theme.paddingMedium
|
leftMargin: Theme.paddingMedium
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
color: (!root.enabled || pressed) ? Theme.highlightColor : Theme.primaryColor
|
color: (currentFolder || pressed) ? Theme.highlightColor : Theme.primaryColor
|
||||||
Behavior on color { ColorAnimation { duration: 100 } }
|
Behavior on color { ColorAnimation { duration: 100 } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,4 +133,17 @@ BackgroundItem {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onPressed: pressTimer.start()
|
||||||
|
onCanceled: pressTimer.stop()
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: _showPress ? _highlightedColor : "transparent"
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: pressTimer
|
||||||
|
interval: 50
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,10 +175,16 @@ SilicaFlickable {
|
||||||
BooksShelfTitle {
|
BooksShelfTitle {
|
||||||
width: grid.width
|
width: grid.width
|
||||||
text: model.name
|
text: model.name
|
||||||
enabled: model.index < (pathModel.count-1)
|
currentFolder: model.index === (pathModel.count-1)
|
||||||
onClicked: {
|
onClicked: {
|
||||||
console.log("switching to", model.path)
|
if (currentFolder) {
|
||||||
shelfModel.relativePath = model.path
|
if (editMode) {
|
||||||
|
console.log("how about renaming", model.name)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log("switching to", model.path)
|
||||||
|
shelfModel.relativePath = model.path
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -519,6 +519,7 @@ void BooksShelf::Counts::emitSignals(BooksShelf* aShelf)
|
||||||
|
|
||||||
BooksShelf::BooksShelf(QObject* aParent) :
|
BooksShelf::BooksShelf(QObject* aParent) :
|
||||||
QAbstractListModel(aParent),
|
QAbstractListModel(aParent),
|
||||||
|
iLoadBookList(true),
|
||||||
iLoadTask(NULL),
|
iLoadTask(NULL),
|
||||||
iDummyItemIndex(-1),
|
iDummyItemIndex(-1),
|
||||||
iEditMode(false),
|
iEditMode(false),
|
||||||
|
@ -531,6 +532,7 @@ BooksShelf::BooksShelf(QObject* aParent) :
|
||||||
}
|
}
|
||||||
|
|
||||||
BooksShelf::BooksShelf(BooksStorage aStorage, QString aRelativePath) :
|
BooksShelf::BooksShelf(BooksStorage aStorage, QString aRelativePath) :
|
||||||
|
iLoadBookList(false),
|
||||||
iLoadTask(NULL),
|
iLoadTask(NULL),
|
||||||
iRelativePath(aRelativePath),
|
iRelativePath(aRelativePath),
|
||||||
iStorage(aStorage),
|
iStorage(aStorage),
|
||||||
|
@ -614,7 +616,7 @@ void BooksShelf::updatePath()
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
}
|
}
|
||||||
iDummyItemIndex = -1;
|
iDummyItemIndex = -1;
|
||||||
if (!iPath.isEmpty()) loadBookList();
|
if (!iPath.isEmpty() && iLoadBookList) loadBookList();
|
||||||
Q_EMIT pathChanged();
|
Q_EMIT pathChanged();
|
||||||
if (oldDummyItemIndex != iDummyItemIndex) {
|
if (oldDummyItemIndex != iDummyItemIndex) {
|
||||||
Q_EMIT dummyItemIndexChanged();
|
Q_EMIT dummyItemIndexChanged();
|
||||||
|
|
|
@ -165,6 +165,7 @@ private:
|
||||||
class DeleteTask;
|
class DeleteTask;
|
||||||
friend class Counts;
|
friend class Counts;
|
||||||
|
|
||||||
|
bool iLoadBookList;
|
||||||
QList<Data*> iList;
|
QList<Data*> iList;
|
||||||
QList<DeleteTask*> iDeleteTasks;
|
QList<DeleteTask*> iDeleteTasks;
|
||||||
LoadTask* iLoadTask;
|
LoadTask* iLoadTask;
|
||||||
|
|
Loading…
Reference in a new issue