diff --git a/main.qml b/main.qml index ef689e9..ebe02f6 100644 --- a/main.qml +++ b/main.qml @@ -1,220 +1,240 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import org.kde.kirigami 2.4 as Kirigami import org.kde.mauikit 1.0 as Maui import "src/widgets" import "src/views/notes" import "src/views/links" import "src/views/books" Maui.ApplicationWindow { id: root title: qsTr("Buho") /***** PROPS *****/ floatingBar: true footBarOverlap: true allowRiseContent: false // altToolBars: false /**** BRANDING COLORS ****/ menuButton.colorScheme.highlightColor: accentColor searchButton.colorScheme.highlightColor: accentColor headBarBGColor: viewBackgroundColor headBarFGColor: textColor accentColor : "#ff9494" // highlightColor: accentColor altColorText : "white"/*Qt.darker(accentColor, 2.5)*/ about.appDescription: qsTr("Buho allows you to take quick notes, collect links and take long notes organized by chapters.") about.appIcon: "qrc:/buho.svg" property int currentView : views.notes readonly property var views : ({ notes: 0, links: 1, books: 2, tags: 3, search: 4 }) property color headBarTint : Qt.lighter(headBarBGColor, 1.25) headBar.middleContent: [ Maui.ToolButton { onClicked: currentView = views.notes - iconColor: currentView === views.notes? accentColor : textColor + iconColor: active ? accentColor : textColor colorScheme.highlightColor: accentColor iconName: "view-notes" text: qsTr("Notes") + active: currentView === views.notes + showIndicator: true }, Maui.ToolButton { onClicked: currentView = views.links - iconColor: currentView === views.links? accentColor : textColor + iconColor: active ? accentColor : textColor colorScheme.highlightColor: accentColor iconName: "view-links" text: qsTr("Links") + active: currentView === views.links + showIndicator: true }, Maui.ToolButton { onClicked: currentView = views.books - iconColor: currentView === views.books? accentColor : textColor + iconColor: active? accentColor : textColor colorScheme.highlightColor: accentColor iconName: "view-books" text: qsTr("Books") + active: currentView === views.books + showIndicator: true }, Maui.ToolButton { - iconColor: currentView === views.tags? accentColor : textColor + iconColor: active ? accentColor : textColor colorScheme.highlightColor: accentColor iconName: "tag" text: qsTr("Tags") + active: currentView === views.tags + showIndicator: true } ] // headBar.colorScheme.borderColor: Qt.darker(accentColor, 1.4) headBar.drawBorder: false headBar.implicitHeight: toolBarHeight * 1.5 - footBar.colorScheme.backgroundColor: accentColor - footBar.colorScheme.borderColor: Qt.darker(accentColor, 1.4) - footBarMargins: space.huge - footBarAligment: Qt.AlignRight - footBar.middleContent: [ + + + Rectangle + { + z: 999 + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.margins: space.medium + anchors.bottomMargin: toolBarHeight + height: toolBarHeight + width: height + + color: accentColor + radius: radiusV + Maui.PieButton { id: addButton + anchors.fill : parent iconName: "list-add" iconColor: altColorText - barHeight: footBar.height + barHeight: parent.height alignment: Qt.AlignLeft content: [ Maui.ToolButton { iconName: "view-notes" onClicked: newNote() }, Maui.ToolButton { iconName: "view-links" onClicked: newLink() }, Maui.ToolButton { iconName: "view-books" } ] } - ] - + } Maui.SyncDialog { id: syncDialog } mainMenu: [ Maui.MenuItem { text: qsTr("Syncing") onTriggered: syncDialog.open() } ] // /***** COMPONENTS *****/ NewNoteDialog { id: newNoteDialog onNoteSaved: notesView.list.insert(note) } NewNoteDialog { id: editNote onNoteSaved: notesView.list.update(note, notesView.currentIndex) } NewLinkDialog { id: newLinkDialog onLinkSaved: linksView.list.insert(link) } // /***** VIEWS *****/ SwipeView { id: swipeView anchors.fill: parent currentIndex: currentView onCurrentIndexChanged: { currentView = currentIndex if(currentView === views.notes) accentColor = "#ff9494" else if(currentView === views.links) accentColor = "#25affb" else if(currentView === views.books) accentColor = "#6bc5a5" } interactive: isMobile NotesView { id: notesView onNoteClicked: setNote(note) + altToolBars: !isMobile } LinksView { id: linksView onLinkClicked: previewLink(link) + altToolBars: !isMobile } BooksView { id: booksView } } function newNote() { currentView = views.notes newNoteDialog.open() } function newLink() { currentView = views.links newLinkDialog.open() } function setNote(note) { var tags = notesView.list.getTags(notesView.currentIndex) note.tags = tags notesView.currentNote = note editNote.fill(note) } function previewLink(link) { var tags = linksView.list.getTags(linksView.currentIndex) link.tags = tags linksView.previewer.show(link) } } diff --git a/src/views/links/LinksView.qml b/src/views/links/LinksView.qml index 9035a59..dc1f5fe 100644 --- a/src/views/links/LinksView.qml +++ b/src/views/links/LinksView.qml @@ -1,214 +1,214 @@ import QtQuick 2.9 import QtQuick.Controls 2.3 import org.kde.mauikit 1.0 as Maui import org.kde.kirigami 2.2 as Kirigami import BuhoModel 1.0 import Links 1.0 import OWL 1.0 import "../../widgets" Maui.Page { id: control property alias cardsView : cardsView property alias previewer : previewer property alias model : linksModel property alias list : linksList property alias currentIndex : cardsView.currentIndex property var currentLink : ({}) signal linkClicked(var link) headBar.visible: !cardsView.holder.visible - + headBar.drawBorder: false margins: space.big headBarExit: false headBarTitle : cardsView.count + " links" headBar.leftContent: [ Maui.ToolButton { iconName: cardsView.gridView ? "view-list-icons" : "view-list-details" onClicked: cardsView.gridView = !cardsView.gridView }, Maui.ToolButton { iconName: "view-sort" onClicked: sortMenu.open(); Menu { id: sortMenu Maui.MenuItem { text: qsTr("Ascedent") checkable: true checked: linksList.order === Links.ASC onTriggered: linksList.order = Links.ASC } Maui.MenuItem { text: qsTr("Descendent") checkable: true checked: linksList.order === Links.DESC onTriggered: linksList.order = Links.DESC } MenuSeparator{} Maui.MenuItem { text: qsTr("Title") onTriggered: KEY.TITLE } Maui.MenuItem { text: qsTr("Color") onTriggered: linksList.sortBy = KEY.COLOR } Maui.MenuItem { text: qsTr("Add date") onTriggered: linksList.sortBy = KEY.ADD_DATE } Maui.MenuItem { text: qsTr("Updated") onTriggered: linksList.sortBy = KEY.UPDATED } Maui.MenuItem { text: qsTr("Fav") onTriggered: linksList.sortBy = KEY.FAV } } } ] headBar.rightContent: [ Maui.ToolButton { iconName: "tag-recents" }, Maui.ToolButton { iconName: "edit-pin" }, Maui.ToolButton { iconName: "view-calendar" } ] Previewer { id: previewer onLinkSaved: linksList.update(link, linksView.currentIndex) } Links { id: linksList } BuhoModel { id: linksModel list: linksList } CardsView { id: cardsView anchors.fill: parent holder.emoji: "qrc:/Astronaut.png" holder.isMask: false holder.title : "No Links!" holder.body: "Click here to save a new link" holder.emojiSize: iconSizes.huge itemHeight: unit * 250 model: linksModel delegate: LinkCardDelegate { id: delegate cardWidth: Math.min(cardsView.cellWidth, cardsView.itemWidth) - Kirigami.Units.largeSpacing * 2 cardHeight: cardsView.itemHeight anchors.left: parent.left anchors.leftMargin: cardsView.width <= cardsView.itemWidth ? 0 : (index % 2 === 0 ? Math.max(0, cardsView.cellWidth - cardsView.itemWidth) : cardsView.cellWidth) onClicked: { currentIndex = index currentLink = linksList.get(index) linkClicked(linksList.get(index)) } onRightClicked: { currentIndex = index currentLink = linksList.get(index) cardsView.menu.popup() } onPressAndHold: { currentIndex = index currentLink = linksList.get(index) cardsView.menu.popup() } } Connections { target: cardsView.holder onActionTriggered: newLink() } Connections { target: cardsView.menu onDeleteClicked: linksList.remove(cardsView.currentIndex) onOpened: { cardsView.menu.isFav = currentLink.fav == 1 ? true : false cardsView.menu.isPin = currentLink.pin == 1 ? true : false } onColorClicked: { linksList.update(({"color": color}), cardsView.currentIndex) } onFavClicked: { linksList.update(({"fav": fav}), cardsView.currentIndex) } onPinClicked: { linksList.update(({"pin": pin}), cardsView.currentIndex) } onCopyClicked: { Maui.Handy.copyToClipboard(currentLink.title+"\n"+currentLink.link) } } } }