diff --git a/buho.pro.user~23672cb823df82d9dca49151fe84208282a88239 b/buho.pro.user~23672cb823df82d9dca49151fe84208282a88239 deleted file mode 100644 index b25db7e..0000000 --- a/buho.pro.user~23672cb823df82d9dca49151fe84208282a88239 +++ /dev/null @@ -1,652 +0,0 @@ - - - - - - EnvironmentId - {415a6c17-06fa-4d4e-973e-41bbf4031d43} - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - - ProjectExplorer.Project.Target.0 - - Desktop - Desktop - {891e8f4a-3093-4399-8ec9-9373da7aca35} - 0 - 0 - 0 - - /home/camilo/Coding/qml/build-buho-Desktop-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - /home/camilo/Coding/qml/build-buho-Desktop-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - - /home/camilo/Coding/qml/build-buho-Desktop-Profile - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 3 - - - 0 - Deploy - - ProjectExplorer.BuildSteps.Deploy - - 1 - Deploy Configuration - - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - buho - - Qt4ProjectManager.Qt4RunConfiguration:/home/camilo/Coding/qml/buho/buho.pro - true - - buho.pro - false - - /home/camilo/Coding/qml/build-buho-Desktop-Debug - 3768 - false - true - false - false - true - - 1 - - - - ProjectExplorer.Project.Target.1 - - Android for armeabi-v7a (GCC 4.9, Qt 5.11.1 (android_armv7)) - Android for armeabi-v7a (GCC 4.9, Qt 5.11.1 (android_armv7)) - {ed729225-da45-4c84-94a3-2313df7be654} - 0 - 0 - 0 - - /home/camilo/Coding/qml/build-buho-Android_for_armeabi_v7a_GCC_4_9_Qt_5_11_1_android_armv7-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - - true - Copy application data - - Qt4ProjectManager.AndroidPackageInstallationStep - - - android-27 - - true - Build Android APK - - QmakeProjectManager.AndroidBuildApkStep - false - false - - 4 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - /home/camilo/Coding/qml/build-buho-Android_for_armeabi_v7a_GCC_4_9_Qt_5_11_1_android_armv7-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - - true - Copy application data - - Qt4ProjectManager.AndroidPackageInstallationStep - - - android-27 - - true - Build Android APK - - QmakeProjectManager.AndroidBuildApkStep - false - false - - 4 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - - /home/camilo/Coding/qml/build-buho-Android_for_armeabi_v7a_GCC_4_9_Qt_5_11_1_android_armv7-Profile - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - - true - Copy application data - - Qt4ProjectManager.AndroidPackageInstallationStep - - - android-27 - - true - Build Android APK - - QmakeProjectManager.AndroidBuildApkStep - false - false - - 4 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 3 - - - - true - Deploy to Android device - - Qt4ProjectManager.AndroidDeployQtStep - false - - 1 - Deploy - - ProjectExplorer.BuildSteps.Deploy - - 1 - Deploy to Android device - - Qt4ProjectManager.AndroidDeployConfiguration2 - - 1 - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - - - buho - buho - Qt4ProjectManager.AndroidRunConfiguration:/home/camilo/Coding/qml/buho/buho.pro - buho.pro - 3768 - false - true - false - false - true - - 1 - - - - ProjectExplorer.Project.TargetCount - 2 - - - ProjectExplorer.Project.Updater.FileVersion - 18 - - - Version - 18 - - diff --git a/main.qml b/main.qml index 86b97d6..ef522f4 100644 --- a/main.qml +++ b/main.qml @@ -1,126 +1,125 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import org.kde.kirigami 2.0 as Kirigami import org.kde.maui 1.0 as Maui import "src/widgets" import "src/views/notes" Maui.ApplicationWindow { id: root title: qsTr("Buho") /***** PROPS *****/ property var views : ({ notes: 0, links: 1, books: 2 }) headBar.middleContent: Row { spacing: space.medium Maui.ToolButton { display: root.isWide ? ToolButton.TextBesideIcon : ToolButton.IconOnly iconName: "draw-text" text: qsTr("Notes") } Maui.ToolButton { display: root.isWide ? ToolButton.TextBesideIcon : ToolButton.IconOnly iconName: "link" text: qsTr("Links") } Maui.ToolButton { display: root.isWide ? ToolButton.TextBesideIcon : ToolButton.IconOnly iconName: "document-new" text: qsTr("Books") } } footBar.middleContent: Maui.PieButton { id: addButton iconName: "list-add" model: ListModel { ListElement {iconName: "document-new"; mid: "page"} ListElement {iconName: "link"; mid: "link"} ListElement {iconName: "draw-text"; mid: "note"} } onItemClicked: { if(item.mid === "note") newNoteDialog.open() } } footBar.leftContent: Maui.ToolButton { iconName: "document-share" } footBar.rightContent: Maui.ToolButton { iconName: "archive-remove" } /***** COMPONENTS *****/ NewNoteDialog { id: newNoteDialog onNoteSaved: { if(owl.insertNote(note.title, note.body, note.color, note.tags)) notesView.append(note) } } NewNoteDialog { id: editNote onNoteSaved: { - console.log("BAHABHABH", notesView.currentNote.id) owl.updateNote(notesView.currentNote.id, note.title, note.body, note.color, note.tags) } } /***** VIEWS *****/ SwipeView { anchors.fill: parent currentIndex: views.notes NotesView { id: notesView onNoteClicked: setNote(note) } } Component.onCompleted: { notesView.populate() } function setNote(note) { notesView.currentNote = note editNote.fill(note) } } diff --git a/src/views/notes/NotesView.qml b/src/views/notes/NotesView.qml index 397c436..2d554b2 100644 --- a/src/views/notes/NotesView.qml +++ b/src/views/notes/NotesView.qml @@ -1,29 +1,32 @@ import QtQuick 2.9 import "../../widgets" import org.kde.maui 1.0 as Maui Maui.Page { property var currentNote : ({}) signal noteClicked(var note) headBarVisible: false CardsView { id: cardsView anchors.fill: parent onItemClicked: noteClicked(cardsView.model.get(index)) } function populate() { var data = owl.getNotes() for(var i in data) + { + console.log("OCLOR", data[i].color) append(data[i]) + } } function append(note) { cardsView.model.append(note) } } diff --git a/src/widgets/CardDelegate.qml b/src/widgets/CardDelegate.qml index 26e5a2e..196a5bf 100644 --- a/src/widgets/CardDelegate.qml +++ b/src/widgets/CardDelegate.qml @@ -1,75 +1,82 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 import QtGraphicalEffects 1.0 import org.kde.kirigami 2.2 as Kirigami ItemDelegate { id: control + property string noteColor : color ? color : "pink" property int cardWidth: Kirigami.Units.devicePixelRatio*200 property int cardHeight: Kirigami.Units.devicePixelRatio*120 width: cardWidth - height: cardHeight + height: cardHeight background: Rectangle { color: "transparent" - } DropShadow { anchors.fill: card visible: card.visible horizontalOffset: 0 verticalOffset: 3 radius: 8.0 samples: 17 color: "#80000000" source: card } Rectangle { id: card z: -999 anchors.centerIn: control anchors.fill: control - color: model.color || viewBackgroundColor + color: noteColor radius: Kirigami.Units.devicePixelRatio*3 } ColumnLayout { anchors.fill: parent spacing: 0 + Label { - Layout.margins: space.medium + Layout.leftMargin: space.medium + Layout.topMargin: space.medium + Layout.rightMargin: space.medium Layout.fillWidth: true - text: title + text: model.title font.weight: Font.Bold font.bold: true } TextArea { - Layout.margins: space.medium + Layout.leftMargin: space.medium + Layout.bottomMargin: space.medium + Layout.rightMargin: space.medium + Layout.fillHeight: true Layout.fillWidth: true enabled: false - text: body + text: model.body + textFormat: TextEdit.RichText background: Rectangle { color: "transparent" } } } } diff --git a/src/widgets/CardsView.qml b/src/widgets/CardsView.qml index 5d81255..6923276 100644 --- a/src/widgets/CardsView.qml +++ b/src/widgets/CardsView.qml @@ -1,55 +1,48 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import org.kde.kirigami 2.2 as Kirigami import org.kde.maui 1.0 as Maui GridView { property alias holder : holder property int itemWidth : Kirigami.Units.devicePixelRatio * 200 property int itemHeight: Kirigami.Units.devicePixelRatio * 120 property int itemSpacing: space.huge signal itemClicked(int index) cellWidth: itemWidth + itemSpacing cellHeight: itemHeight + itemSpacing Maui.Holder { id: holder visible: count < 1 message: "

No notes!

You can create new notes from the add button

" } - model: ListModel - { - ListElement {title: "Hteu"; body: "lalajsjsjdjdjdjd djdjdjdj sjsjsjsj"} - ListElement {title: "Hteu"; body: "lalajsjsjdjdjdjd djdjdjdj sjsjsjsj"} - ListElement {title: "Hteu"; body: "lalajsjsjdjdjdjd djdjdjdj sjsjsjsj"} - ListElement {title: "Hteu"; body: "lalajsjsjdjdjdjd djdjdjdj sjsjsjsj"} - - } + model: ListModel { } delegate: CardDelegate { id: delegate cardWidth: itemWidth cardHeight: itemHeight onClicked: itemClicked(index) } onWidthChanged: adaptGrid() function adaptGrid() { var amount = parseInt(width/(itemWidth + itemSpacing),10) var leftSpace = parseInt(width-(amount*(itemWidth + itemSpacing)), 10) var size = parseInt((itemWidth + itemSpacing)+(parseInt(leftSpace/amount, 10)), 10) size = size > itemWidth + itemSpacing ? size : itemWidth + itemSpacing cellWidth = size } } diff --git a/src/widgets/NewNoteDialog.qml b/src/widgets/NewNoteDialog.qml index 7634e06..490fb29 100644 --- a/src/widgets/NewNoteDialog.qml +++ b/src/widgets/NewNoteDialog.qml @@ -1,237 +1,246 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.0 import org.kde.maui 1.0 as Maui Popup { parent: ApplicationWindow.overlay height: parent.height * (isMobile ? 0.8 : 0.7) width: parent.width * (isMobile ? 0.9 : 0.7) property string selectedColor : "#ffffe6" signal noteSaved(var note) x: (parent.width / 2) - (width / 2) y: (parent.height /2 ) - (height / 2) padding: 1 Rectangle { id: bg color: selectedColor z: -1 anchors.fill: parent } ColumnLayout { anchors.fill: parent Maui.ToolBar { Layout.fillWidth: true leftContent: [ Maui.ToolButton { iconName: "format-text-bold" }, Maui.ToolButton { iconName: "format-text-italic-symbolic" }, Maui.ToolButton { iconName: "format-text-underline-symbolic" }, Maui.ToolButton { iconName: "format-text-uppercase" } ] rightContent: Row { spacing: space.medium Rectangle { color:"#ffded4" anchors.verticalCenter: parent.verticalCenter height: iconSizes.medium width: height radius: Math.max(height, width) border.color: borderColor MouseArea { anchors.fill: parent onClicked: selectedColor = parent.color } } Rectangle { color:"#d3ffda" anchors.verticalCenter: parent.verticalCenter height: iconSizes.medium width: height radius: Math.max(height, width) border.color: borderColor MouseArea { anchors.fill: parent onClicked: selectedColor = parent.color } } Rectangle { color:"#caf3ff" anchors.verticalCenter: parent.verticalCenter height: iconSizes.medium width: height radius: Math.max(height, width) border.color: borderColor MouseArea { anchors.fill: parent onClicked: selectedColor = parent.color } } Rectangle { color:"#ccc1ff" anchors.verticalCenter: parent.verticalCenter height: iconSizes.medium width: height radius: Math.max(height, width) border.color: borderColor MouseArea { anchors.fill: parent onClicked: selectedColor = parent.color } } Rectangle { color:"#ffcdf4" anchors.verticalCenter: parent.verticalCenter height: iconSizes.medium width: height radius: Math.max(height, width) border.color: borderColor MouseArea { anchors.fill: parent onClicked: selectedColor = parent.color } } Maui.ToolButton { iconName: "overflow-menu" } } } TextField { id: title Layout.fillWidth: true Layout.margins: space.medium height: 24 placeholderText: qsTr("Title") font.weight: Font.Bold font.bold: true background: Rectangle { color: "transparent" } } ScrollView { Layout.fillHeight: true Layout.fillWidth: true Layout.margins: space.medium TextArea { id: body placeholderText: qsTr("Body") + selectByKeyboard :!isMobile + selectByMouse : !isMobile + textFormat : TextEdit.RichText background: Rectangle { color: "transparent" } } } Row { Layout.fillWidth: true width: parent.width Layout.margins: space.medium Layout.alignment: Qt.AlignRight spacing: space.medium Button { id: save text: qsTr("Save") onClicked: { close() noteSaved({ title: title.text, body: body.text, color: selectedColor, tags: "" }) clearNote() } } Button { id: discard text: qsTr("Discard") onClicked: { close() clearNote() } } } } function clearNote() { title.clear() body.clear() } function fill(note) { title.text = note.title body.text = note.body + selectedColor = note.color open() } + + function bold() + { +// body.sele + } }