Commit fdfd9d3d authored by camilo higuita's avatar camilo higuita

work done for the books feature

parent 366f6471
......@@ -45,6 +45,7 @@ set(buho_SRCS
src/utils/htmlparser.cpp
src/models/notes/notes.cpp
src/models/links/links.cpp
src/models/books/books.cpp
src/providers/nextnote.cpp
src/syncing/syncer.cpp
)
......@@ -57,6 +58,7 @@ set(buho_HDRS
src/utils/htmlparser.h
src/models/notes/notes.h
src/models/links/links.h
src/models/books/books.h
src/providers/nextnote.h
src/providers/abstractnotesprovider.h
src/syncing/syncer.h
......
......@@ -12,5 +12,6 @@
<file>buho72.png</file>
<file>buho96.png</file>
<file>buho.svg</file>
<file>booklet.svg</file>
</qresource>
</RCC>
This diff is collapsed.
This diff is collapsed.
......@@ -130,6 +130,7 @@ Maui.ApplicationWindow
ToolButton
{
icon.name: "view-pim-journal"
onClicked: newBook()
}
]
}
......@@ -168,6 +169,12 @@ Maui.ApplicationWindow
onLinkSaved: linksView.list.insert(link)
}
NewBookDialog
{
id: newBookDialog
onBookSaved: console.log("saving new vbook", title)
}
// /***** VIEWS *****/
SwipeView
......@@ -219,6 +226,12 @@ Maui.ApplicationWindow
newLinkDialog.open()
}
function newBook()
{
currentView = views.books
newBookDialog.open()
}
function setNote(note)
{
var tags = notesView.list.getTags(notesView.currentIndex)
......
......@@ -17,5 +17,7 @@
<file>src/widgets/CardsList.qml</file>
<file>src/widgets/CardMenu.qml</file>
<file>src/widgets/LinkCardDelegate.qml</file>
<file>src/views/books/NewBookDialog.qml</file>
<file>src/views/books/BookletPage.qml</file>
</qresource>
</RCC>
#include "books.h"
Books::Books(QObject *parent) : MauiList(parent)
{
}
#ifndef BOOKS_H
#define BOOKS_H
#include <QObject>
#include "owl.h"
#ifdef STATIC_MAUIKIT
#include "fmh.h"
#include "mauilist.h"
#else
#include <MauiKit/fmh.h>
#include <MauiKit/mauilist.h>
#endif
class Books : public MauiList
{
public:
Books(QObject *parent = nullptr);
};
#endif // BOOKS_H
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import org.kde.mauikit 1.0 as Maui
import org.kde.kirigami 2.7 as Kirigami
Maui.Page
{
id: control
signal exit()
headBar.leftContent: ToolButton
{
icon.name: "go-previous"
onClicked: control.exit()
}
Kirigami.OverlayDrawer
{
edge: Qt.RightEdge
width: Kirigami.Units.gridUnit * 16
height: parent.height - headBar.height
y: headBar.height
modal: true
}
}
import QtQuick 2.9
import "../../widgets"
import QtQuick.Controls 2.3
import org.kde.mauikit 1.0 as Maui
import org.kde.kirigami 2.7 as Kirigami
Maui.Page
StackView
{
id: control
property alias cardsView : cardsView
headBar.visible: false
padding: isMobile ? space.big : space.enormous
property bool showDetails: false
CardsView
StackView
{
id: cardsView
id: _stackView
anchors.fill: parent
// onItemClicked: linkClicked(cardsView.model.get(index))
// holder.emoji: "qrc:/E-reading.png"
// holder.isMask: false
// holder.title : "No Books!"
// holder.body: "Click here to save a new link"
// holder.emojiSize: iconSizes.huge
initialItem: _booksPage
}
Component
{
id: _bookletComponent
BookletPage
{
onExit: _stackView.pop()
}
}
Maui.Page
{
id: _booksPage
padding: showDetails ? 0 : space.big
title : cardsView.count + " books"
// headBar.leftContent: [
// ToolButton
// {
// icon.name: showDetails ? "view-list-icons" : "view-list-details"
// onClicked:
// {
// showDetails = !showDetails
// }
// }
// ]
headBar.rightContent: [
ToolButton
{
icon.name: "view-sort"
}
]
Maui.GridView
{
id: cardsView
anchors.fill: parent
adaptContent: !showDetails
itemSize: showDetails ? iconSizes.big : iconSizes.huge
// centerContent: true
spacing: space.big
cellWidth: showDetails ? parent.width : itemSize * 1.5
cellHeight: itemSize * 1.5
model: ListModel
{
ListElement {label: "test"; thumbnail:"qrc:/booklet.svg"; mime: "image"; count: 0}
ListElement {label: "test"; thumbnail:"qrc:/booklet.svg"; mime: "image"; count: 3}
ListElement {label: "test"; thumbnail:"qrc:/booklet.svg"; mime: "image"; count: 10}
ListElement {label: "test"; thumbnail:"qrc:/booklet.svg"; mime: "image"; count: 2}
ListElement {label: "test"; thumbnail:"qrc:/booklet.svg"; mime: "image"; count: 9}
ListElement {label: "test"; thumbnail:"qrc:/booklet.svg"; mime: "image"; count: 2}
ListElement {label: "test"; thumbnail:"qrc:/booklet.svg"; mime: "image"; count: 3}
ListElement {label: "test"; thumbnail:"qrc:/booklet.svg"; mime: "image"; count: 1}
ListElement {label: "test"; thumbnail:"qrc:/booklet.svg"; mime: "image"; count: 0}
}
delegate: Maui.IconDelegate
{
id: _delegate
isDetails: control.showDetails
folderSize: cardsView.itemSize
showThumbnails: true
showEmblem: false
width: cardsView.cellWidth
height: cardsView.cellHeight * 0.9
Maui.Badge
{
anchors
{
left: parent.left
top: parent.top
margins: space.small
}
Kirigami.Theme.backgroundColor: Kirigami.Theme.neutralTextColor
Kirigami.Theme.textColor: Qt.darker(Kirigami.Theme.neutralTextColor, 2.4)
text: model.count
}
Connections
{
target:_delegate
onClicked:
{
console.log("BOOKLET CLICKED", index)
_stackView.push(_bookletComponent)
}
}
}
}
}
}
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import org.kde.mauikit 1.0 as Maui
import org.kde.kirigami 2.7 as Kirigami
Maui.Dialog
{
id: control
signal bookSaved(string title)
entryField: true
title: qsTr("New Book")
message: qsTr("Give a title to your new book. Your new book can contain many notes grouped together")
textEntry.placeholderText: qsTr("My Book...")
acceptButton.text: qsTr("Create")
rejectButton.text: qsTr("Cancel")
onAccepted:
{
control.bookSaved(textEntry.text)
close()
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment