mirror of https://github.com/KDE/kasts.git
And more work on queue
This commit is contained in:
parent
f75c29dda6
commit
d3107dc096
|
@ -49,7 +49,8 @@ bool Database::migrateTo1()
|
|||
TRUE_OR_RETURN(execute(QStringLiteral("CREATE TABLE IF NOT EXISTS Feeds (name TEXT, url TEXT, image TEXT, link TEXT, description TEXT, deleteAfterCount INTEGER, deleteAfterType INTEGER, subscribed INTEGER, lastUpdated INTEGER, notify BOOL);")));
|
||||
TRUE_OR_RETURN(execute(QStringLiteral("CREATE TABLE IF NOT EXISTS Entries (feed TEXT, id TEXT UNIQUE, title TEXT, content TEXT, created INTEGER, updated INTEGER, link TEXT, read bool, hasEnclosure BOOL);")));
|
||||
TRUE_OR_RETURN(execute(QStringLiteral("CREATE TABLE IF NOT EXISTS Authors (feed TEXT, id TEXT, name TEXT, uri TEXT, email TEXT);")));
|
||||
TRUE_OR_RETURN(execute(QStringLiteral("CREATE TABLE IF NOT EXISTS Enclosures (feed TEXT, id TEXT, duration INTEGER, size INTEGER, title TEXT, type STRING, url STRING);")));
|
||||
TRUE_OR_RETURN(execute(QStringLiteral("CREATE TABLE IF NOT EXISTS Enclosures (feed TEXT, id TEXT, duration INTEGER, size INTEGER, title TEXT, type TEXT, url TEXT);"))); //, playposition INTEGER, filename TEXT);")));
|
||||
TRUE_OR_RETURN(execute(QStringLiteral("CREATE TABLE IF NOT EXISTS Queue (listnr INTEGER, feed TEXT, id TEXT);")));
|
||||
TRUE_OR_RETURN(execute(QStringLiteral("PRAGMA user_version = 1;")));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ Kirigami.ScrollablePage {
|
|||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
onLinkActivated: Qt.openUrlExternally(link)
|
||||
onWidthChanged: entry.adjustedContent(width, font.pixelSize)
|
||||
//onWidthChanged: { text = entry.adjustedContent(width, font.pixelSize) }
|
||||
}
|
||||
//}
|
||||
actions.main: Kirigami.Action {
|
||||
|
|
|
@ -20,6 +20,12 @@ Item {
|
|||
//margins.bottom: miniprogressbar.height
|
||||
visible: (audio.entry !== undefined) && !audio.playerOpen
|
||||
|
||||
// Set background
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Kirigami.Theme.backgroundColor
|
||||
}
|
||||
|
||||
// progress bar for limited width (phones)
|
||||
Rectangle {
|
||||
id: miniprogressbar
|
||||
|
|
|
@ -23,7 +23,7 @@ Kirigami.ScrollablePage {
|
|||
Kirigami.ListItemDragHandle {
|
||||
listItem: listItem
|
||||
listView: mainList
|
||||
onMoveRequested: queueModel.moveRows(oldIndex, newIndex, 1)
|
||||
onMoveRequested: queueModel.move(oldIndex, newIndex)
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
|
@ -55,26 +55,12 @@ Kirigami.ScrollablePage {
|
|||
}
|
||||
}
|
||||
|
||||
QueueModel { id: queueModel }
|
||||
|
||||
ListView {
|
||||
id: mainList
|
||||
Timer {
|
||||
id: refreshRequestTimer
|
||||
interval: 3000
|
||||
onTriggered: page.refreshing = false
|
||||
}
|
||||
|
||||
/*model: ListModel {
|
||||
id: listModel
|
||||
Component.onCompleted: {
|
||||
for (var i = 0; i < 200; ++i) {
|
||||
listModel.append({"title": "Item " + i,
|
||||
"actions": [{text: "Action 1", icon: "document-decrypt"},
|
||||
{text: "Action 2", icon: "mail-reply-sender"}]
|
||||
})
|
||||
}
|
||||
}
|
||||
}*/
|
||||
model: QueueModel { id: queueModel }
|
||||
model: queueModel
|
||||
|
||||
moveDisplaced: Transition {
|
||||
YAnimator {
|
||||
|
@ -83,7 +69,7 @@ Kirigami.ScrollablePage {
|
|||
}
|
||||
}
|
||||
delegate: Kirigami.DelegateRecycler {
|
||||
width: parent ? parent.width : implicitWidth
|
||||
width: mainList.width
|
||||
sourceComponent: delegateComponent
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,14 +27,18 @@ Kirigami.ApplicationWindow {
|
|||
Kirigami.Action {
|
||||
text: i18n("Feed List")
|
||||
iconName: "rss"
|
||||
onTriggered: root.pageStack.clear(), root.pageStack.push(feedList)
|
||||
enabled: pageStack.layers.currentItem.title !== i18n("Feed List")
|
||||
onTriggered: {
|
||||
pageStack.clear()
|
||||
pageStack.push(feedList)
|
||||
}
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Podcast Queue")
|
||||
iconName: "source-playlist"
|
||||
onTriggered: root.pageStack.clear(), root.pageStack.push(queuelist)
|
||||
enabled: pageStack.layers.currentItem.title !== i18n("Podcast Queue")
|
||||
onTriggered: {
|
||||
pageStack.clear()
|
||||
pageStack.push(queuelist)
|
||||
}
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Settings")
|
||||
|
@ -97,7 +101,7 @@ Kirigami.ApplicationWindow {
|
|||
}
|
||||
*/
|
||||
|
||||
footer: MinimizedPlayerControls {}
|
||||
footer: MinimizedPlayerControls { }
|
||||
/*Item {
|
||||
visible: (audio.entry !== undefined)
|
||||
height: footerLoader.minimizedSize
|
||||
|
|
|
@ -32,8 +32,6 @@ QueueModel::QueueModel(QObject *parent)
|
|||
|
||||
void QueueModel::updateQueue()
|
||||
{
|
||||
qDebug() << "Begin create queuemodel object";
|
||||
|
||||
QSqlQuery query;
|
||||
query.prepare(QStringLiteral("SELECT * FROM Enclosures"));
|
||||
Database::instance().execute(query);
|
||||
|
@ -120,24 +118,23 @@ int QueueModel::rowCount(const QModelIndex &parent) const
|
|||
return m_entries.size();
|
||||
}
|
||||
|
||||
bool QueueModel::move(int from, int to)
|
||||
{
|
||||
return moveRows(QModelIndex(), from, 1, QModelIndex(), to);
|
||||
}
|
||||
|
||||
bool QueueModel::moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild)
|
||||
{
|
||||
if (sourceParent != destinationParent) {
|
||||
Q_ASSERT(count == 1); // Only implemented the case of moving one row at a time
|
||||
Q_ASSERT(sourceParent == destinationParent); // No moving between lists
|
||||
|
||||
int to = (sourceRow < destinationChild) ? destinationChild + 1 : destinationChild;
|
||||
|
||||
if (!beginMoveRows(sourceParent, sourceRow, sourceRow, destinationParent, to)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!beginMoveRows(sourceParent, sourceRow, sourceRow + count - 1, destinationParent, destinationChild)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto cptItem = 0; cptItem < count; ++cptItem) {
|
||||
if (sourceRow < destinationChild) {
|
||||
m_entries.move(sourceRow, destinationChild - 1);
|
||||
} else {
|
||||
m_entries.move(sourceRow, destinationChild);
|
||||
}
|
||||
}
|
||||
m_entries.move(sourceRow, destinationChild);
|
||||
|
||||
endMoveRows();
|
||||
|
||||
|
|
|
@ -24,7 +24,8 @@ public:
|
|||
QHash<int, QByteArray> roleNames() const override;
|
||||
int rowCount(const QModelIndex &parent) const override;
|
||||
|
||||
bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) override;
|
||||
Q_INVOKABLE bool move(int from, int to);
|
||||
Q_INVOKABLE bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) override;
|
||||
|
||||
private:
|
||||
void updateQueue();
|
||||
|
|
Loading…
Reference in New Issue