fix: select library screen skipped even we have 2+ libraries
This commit is contained in:
@@ -11,16 +11,27 @@ Item {
|
|||||||
width: Math.min(0.66 * parent.width, 320)
|
width: Math.min(0.66 * parent.width, 320)
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
|
||||||
ListView {
|
ColumnLayout {
|
||||||
id: listView
|
|
||||||
clip: true
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
model: AppController.foldersModel
|
ListView {
|
||||||
delegate: ItemDelegate {
|
id: listView
|
||||||
text: model.display
|
clip: true
|
||||||
width: listView.width
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
model: AppController.foldersModel
|
||||||
|
delegate: ItemDelegate {
|
||||||
|
text: model.display
|
||||||
|
width: listView.width
|
||||||
|
onClicked: function() {
|
||||||
|
AppController.updateComicsInFolder(model.folderId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Button {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: "Select Library"
|
||||||
onClicked: function() {
|
onClicked: function() {
|
||||||
AppController.updateComicsInFolder(model.folderId)
|
AppController.selectedLibraryId = -1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,11 +25,6 @@ Control {
|
|||||||
AppController.selectedLibraryId = model.libraryId
|
AppController.selectedLibraryId = model.libraryId
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onCountChanged: function() {
|
|
||||||
if (count == 1) {
|
|
||||||
AppController.selectedLibraryId = model.data(modelIndex(0), LibraryItem.IdRole)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,4 +32,13 @@ Control {
|
|||||||
AppController.updateLibraries()
|
AppController.updateLibraries()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: AppController
|
||||||
|
onLibrariesLoaded: function(count) {
|
||||||
|
if (count === 1) {
|
||||||
|
AppController.selectedLibraryId = model.data(modelIndex(0), LibraryItem.IdRole)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ void AppController::updateLibraries()
|
|||||||
libraryObj["name"].toString(),
|
libraryObj["name"].toString(),
|
||||||
libraryObj["uuid"].toString()));
|
libraryObj["uuid"].toString()));
|
||||||
}
|
}
|
||||||
|
emit librariesLoaded(array.count());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ public:
|
|||||||
Q_INVOKABLE QString comicImageSource(int page);
|
Q_INVOKABLE QString comicImageSource(int page);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
void librariesLoaded(int count);
|
||||||
void connectionStateChanged(ConnectionState newState);
|
void connectionStateChanged(ConnectionState newState);
|
||||||
void currentLibraryIdChanged(int newLibraryId);
|
void currentLibraryIdChanged(int newLibraryId);
|
||||||
void currentComicIdChanged(QString newComicId);
|
void currentComicIdChanged(QString newComicId);
|
||||||
|
|||||||
Reference in New Issue
Block a user