From 1a4835dd8a0e21b0d15d1ee918f1e08a122f865d Mon Sep 17 00:00:00 2001 From: Dusko Angirevic Date: Thu, 6 Jul 2017 16:15:12 +0200 Subject: [PATCH] v 0.1.9 Candidate - Image Upload added [#9] - Emoji pannel added --- harbour-tooter.pro.user | 34 ++-- qml/pages/Conversation.qml | 234 ++++++++++++++++++++++- qml/pages/components/MyList.qml | 2 +- qml/pages/components/VisualContainer.qml | 2 +- rpm/harbour-tooter.changes.in | 1 + src/harbour-tooter.cpp | 3 +- translations/harbour-tooter-es.ts | 16 +- translations/harbour-tooter-fr.ts | 12 ++ translations/harbour-tooter-nl.ts | 12 ++ translations/harbour-tooter-oc.ts | 12 ++ translations/harbour-tooter.ts | 22 ++- 11 files changed, 321 insertions(+), 29 deletions(-) diff --git a/harbour-tooter.pro.user b/harbour-tooter.pro.user index 9306f93..6609cda 100644 --- a/harbour-tooter.pro.user +++ b/harbour-tooter.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -63,7 +63,7 @@ MerSDK-SailfishOS-i486 {f49c1b5a-d715-401a-9a10-0e5fe9e5b72a} 0 - 0 + 2 0 C:/Users/dysko/SF/build-harbour-tooter-MerSDK_SailfishOS_i486-Debug @@ -401,14 +401,16 @@ 10234 3 - 2 + 1 - - - %{buildDir} - Custom Executable + harbour-tooter (on Mer Device) - ProjectExplorer.CustomExecutableRunConfiguration + QmakeProjectManager.MerRunConfiguration:harbour-tooter + + harbour-tooter + + false + 3768 false true @@ -426,7 +428,7 @@ MerSDK-SailfishOS-armv7hl {588087e2-ecc1-41aa-b652-86f16cba9351} 0 - 0 + 2 0 C:/Users/dysko/SF/build-harbour-tooter-MerSDK_SailfishOS_armv7hl-Debug @@ -764,14 +766,16 @@ 10234 3 - -1 + 1 - - - %{buildDir} - Custom Executable + harbour-tooter (on Mer Device) - ProjectExplorer.CustomExecutableRunConfiguration + QmakeProjectManager.MerRunConfiguration:harbour-tooter + + harbour-tooter + + false + 3768 false true diff --git a/qml/pages/Conversation.qml b/qml/pages/Conversation.qml index b1adb82..a9dd559 100644 --- a/qml/pages/Conversation.qml +++ b/qml/pages/Conversation.qml @@ -14,6 +14,9 @@ Page { property ListModel mdl; ListModel { id: mediaModel + onCountChanged: { + btnAddImage.enabled = mediaModel.count < 4 + } } WorkerScript { @@ -73,7 +76,7 @@ Page { } width: parent.width - height: toot.height + btnContentWarning.height + Theme.paddingMedium + (warningContent.visible ? warningContent.height : 0) + height: toot.height + (mediaModel.count ? uploadedImages.height : 0) + btnContentWarning.height + Theme.paddingMedium + (warningContent.visible ? warningContent.height : 0) dock: Dock.Bottom TextField { id: warningContent @@ -100,6 +103,7 @@ Page { topMargin: Theme.paddingMedium left: parent.left right: parent.right + rightMargin: Theme.paddingMedium } autoScrollEnabled: true labelVisible: false @@ -112,6 +116,60 @@ Page { } } IconButton { + id: btnSmileys + property string selection + onSelectionChanged: { + console.log(selection) + } + + anchors { + bottom: bottom.top + right: parent.right + rightMargin: Theme.paddingSmall + } + icon.source: "image://theme/icon-s-mms?" + (pressed + ? Theme.highlightColor + : (warningContent.visible ? Theme.secondaryHighlightColor : Theme.primaryColor)) + onClicked: pageStack.push(firstWizardPage) + } + SilicaGridView { + id: uploadedImages + width: parent.width + anchors.bottom: parent.bottom + height: mediaModel.count ? Theme.itemSizeSmall : 0 + model: mediaModel + cellWidth: uploadedImages.width / 4 + cellHeight: Theme.itemSizeSmall + delegate: BackgroundItem { + id: myDelegate + width: uploadedImages.cellWidth + height: uploadedImages.cellHeight + RemorseItem { id: remorse } + Image { + anchors.fill: parent + source: model.preview_url + } + + onClicked: { + var idx = index + console.log(idx) + //mediaModel.remove(idx) + remorse.execute(myDelegate, qsTr("Delete"), function() { mediaModel.remove(idx) } ) + } + } + add: Transition { + NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 800 } + } + + remove: Transition { + NumberAnimation { property: "opacity"; from: 1.0; to: 0; duration: 800 } + } + displaced: Transition { + NumberAnimation { properties: "x,y"; duration: 800; easing.type: Easing.InOutBack } + } + } + IconButton { + id: btnContentWarning anchors { verticalCenter: privacy.verticalCenter @@ -125,6 +183,7 @@ Page { } IconButton { id: btnAddImage + enabled: mediaModel.count < 4 anchors { verticalCenter: privacy.verticalCenter left: btnContentWarning.right @@ -135,8 +194,6 @@ Page { : (warningContent.visible ? Theme.secondaryHighlightColor : Theme.primaryColor)) onClicked: { btnAddImage.enabled = false; - //receiver.receiveFromQml(42); - //imageUploader.run() var once = true; // MultiImagePickerDialog var imagePicker = pageStack.push("Sailfish.Pickers.ImagePickerPage", { "allowedOrientations" : Orientation.All }); @@ -167,16 +224,20 @@ Page { onProgressChanged: { console.log("progress "+progress) + uploadProgress.width = parent.width*progress } onSuccess: { + uploadProgress.width =0 console.log(replyData); + mediaModel.append(JSON.parse(replyData)) - btnAddImage.enabled = true; + } onFailure: { + uploadProgress.width =0 btnAddImage.enabled = true; console.log(status) console.log(statusText) @@ -252,6 +313,16 @@ Page { toot.text = "" } } + + + + Rectangle { + id: uploadProgress + color: Theme.highlightBackgroundColor + anchors.bottom: parent.bottom + anchors.left: parent.left + height: 3 + } } Component.onCompleted: { toot.cursorPosition = toot.text.length @@ -263,4 +334,159 @@ Page { 'conf' : Logic.conf }); } + Component { + id: firstWizardPage + + Dialog { + id: emoticonsDialog + canAccept: false; //selector.currentIndex >= 0 + //acceptDestination: conversationPage + + onAcceptPendingChanged: { + if (acceptPending) { + // Tell the destination page what the selected category is + // acceptDestinationInstance.category = selector.value + } + } + + SilicaGridView { + id: gridView + anchors.fill: parent + cellWidth: gridView.width / 6 + cellHeight: cellWidth + header: PageHeader { + title: qsTr("Emojis") + description: qsTr("Tap to insert") + } + model: ListModel { + ListElement { section: "smileys"; glyph: "😁" } + ListElement { section: "smileys"; glyph: "πŸ˜‚" } + ListElement { section: "smileys"; glyph: "πŸ˜ƒ" } + ListElement { section: "smileys"; glyph: "πŸ˜„" } + ListElement { section: "smileys"; glyph: "πŸ˜…" } + ListElement { section: "smileys"; glyph: "πŸ˜†" } + ListElement { section: "smileys"; glyph: "πŸ˜‰" } + ListElement { section: "smileys"; glyph: "😊" } + ListElement { section: "smileys"; glyph: "πŸ˜‹" } + ListElement { section: "smileys"; glyph: "😌" } + ListElement { section: "smileys"; glyph: "😍" } + ListElement { section: "smileys"; glyph: "😏" } + ListElement { section: "smileys"; glyph: "πŸ˜’" } + ListElement { section: "smileys"; glyph: "πŸ˜“" } + ListElement { section: "smileys"; glyph: "πŸ˜”" } + ListElement { section: "smileys"; glyph: "πŸ˜–" } + ListElement { section: "smileys"; glyph: "😘" } + ListElement { section: "smileys"; glyph: "😚" } + ListElement { section: "smileys"; glyph: "😜" } + ListElement { section: "smileys"; glyph: "😝" } + ListElement { section: "smileys"; glyph: "😞" } + ListElement { section: "smileys"; glyph: "😠" } + ListElement { section: "smileys"; glyph: "😑" } + ListElement { section: "smileys"; glyph: "😒" } + ListElement { section: "smileys"; glyph: "😣" } + ListElement { section: "smileys"; glyph: "😀" } + ListElement { section: "smileys"; glyph: "πŸ˜₯" } + ListElement { section: "smileys"; glyph: "😨" } + ListElement { section: "smileys"; glyph: "😩" } + ListElement { section: "smileys"; glyph: "πŸ˜ͺ" } + ListElement { section: "smileys"; glyph: "😫" } + ListElement { section: "smileys"; glyph: "😭" } + ListElement { section: "smileys"; glyph: "😰" } + ListElement { section: "smileys"; glyph: "😱" } + ListElement { section: "smileys"; glyph: "😲" } + ListElement { section: "smileys"; glyph: "😳" } + ListElement { section: "smileys"; glyph: "😡" } + ListElement { section: "smileys"; glyph: "😷" } + ListElement { section: "smileys"; glyph: "😸" } + ListElement { section: "smileys"; glyph: "😹" } + ListElement { section: "smileys"; glyph: "😺" } + ListElement { section: "smileys"; glyph: "😻" } + ListElement { section: "smileys"; glyph: "😼" } + ListElement { section: "smileys"; glyph: "😽" } + ListElement { section: "smileys"; glyph: "😾" } + ListElement { section: "smileys"; glyph: "😿" } + ListElement { section: "smileys"; glyph: "πŸ™€" } + ListElement { section: "smileys"; glyph: "πŸ™…" } + ListElement { section: "smileys"; glyph: "πŸ™†" } + ListElement { section: "smileys"; glyph: "πŸ™‡" } + ListElement { section: "smileys"; glyph: "πŸ™ˆ" } + ListElement { section: "smileys"; glyph: "πŸ™‰" } + ListElement { section: "smileys"; glyph: "πŸ™Š" } + ListElement { section: "smileys"; glyph: "πŸ™‹" } + ListElement { section: "smileys"; glyph: "πŸ™Œ" } + ListElement { section: "smileys"; glyph: "πŸ™" } + ListElement { section: "smileys"; glyph: "πŸ™Ž" } + ListElement { section: "smileys"; glyph: "πŸ™" } + + + ListElement { section: "Transport and map"; glyph: "πŸš€" } + ListElement { section: "Transport and map"; glyph: "πŸšƒ" } + ListElement { section: "Transport and map"; glyph: "πŸš€" } + ListElement { section: "Transport and map"; glyph: "πŸš„" } + ListElement { section: "Transport and map"; glyph: "πŸš…" } + ListElement { section: "Transport and map"; glyph: "πŸš‡" } + ListElement { section: "Transport and map"; glyph: "πŸš‰" } + ListElement { section: "Transport and map"; glyph: "🚌" } + ListElement { section: "Transport and map"; glyph: "🚏" } + ListElement { section: "Transport and map"; glyph: "πŸš‘" } + ListElement { section: "Transport and map"; glyph: "πŸš’" } + ListElement { section: "Transport and map"; glyph: "πŸš“" } + ListElement { section: "Transport and map"; glyph: "πŸš•" } + ListElement { section: "Transport and map"; glyph: "πŸš—" } + ListElement { section: "Transport and map"; glyph: "πŸš™" } + ListElement { section: "Transport and map"; glyph: "🚚" } + ListElement { section: "Transport and map"; glyph: "🚒" } + ListElement { section: "Transport and map"; glyph: "🚨" } + ListElement { section: "Transport and map"; glyph: "🚩" } + ListElement { section: "Transport and map"; glyph: "πŸšͺ" } + ListElement { section: "Transport and map"; glyph: "🚫" } + ListElement { section: "Transport and map"; glyph: "🚬" } + ListElement { section: "Transport and map"; glyph: "🚭" } + ListElement { section: "Transport and map"; glyph: "🚲" } + ListElement { section: "Transport and map"; glyph: "🚢" } + ListElement { section: "Transport and map"; glyph: "🚹" } + ListElement { section: "Transport and map"; glyph: "🚺" } + ListElement { section: "Transport and map"; glyph: "🚻" } + ListElement { section: "Transport and map"; glyph: "🚼" } + ListElement { section: "Transport and map"; glyph: "🚽" } + ListElement { section: "Transport and map"; glyph: "🚾" } + ListElement { section: "Transport and map"; glyph: "πŸ›€" } + + ListElement { section: "Horoscope Signs"; glyph: "β™ˆ" } + ListElement { section: "Horoscope Signs"; glyph: "♉" } + ListElement { section: "Horoscope Signs"; glyph: "β™Š" } + ListElement { section: "Horoscope Signs"; glyph: "β™‹" } + ListElement { section: "Horoscope Signs"; glyph: "β™Œ" } + ListElement { section: "Horoscope Signs"; glyph: "♍" } + ListElement { section: "Horoscope Signs"; glyph: "β™Ž" } + ListElement { section: "Horoscope Signs"; glyph: "♏" } + ListElement { section: "Horoscope Signs"; glyph: "♐" } + ListElement { section: "Horoscope Signs"; glyph: "β™‘" } + ListElement { section: "Horoscope Signs"; glyph: "β™’" } + ListElement { section: "Horoscope Signs"; glyph: "β™“" } + + + + + + } + delegate: BackgroundItem { + width: gridView.cellWidth + height: gridView.cellHeight + Label { + anchors.centerIn: parent + color: (highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor) + font.pixelSize: Theme.fontSizeLarge + text: glyph + } + onClicked: { + toot.text = toot.text + model.glyph + emoticonsDialog.canAccept = true; + emoticonsDialog.accept() + + } + } + } + } + } } diff --git a/qml/pages/components/MyList.qml b/qml/pages/components/MyList.qml index b013d10..ae57c38 100644 --- a/qml/pages/components/MyList.qml +++ b/qml/pages/components/MyList.qml @@ -101,7 +101,7 @@ SilicaListView { NumberAnimation { property: "x"; duration: 800; easing.type: Easing.InOutBack } } - displaced: Transition { + remove: Transition { NumberAnimation { properties: "x,y"; duration: 800; easing.type: Easing.InOutBack } } diff --git a/qml/pages/components/VisualContainer.qml b/qml/pages/components/VisualContainer.qml index 3867089..cbf1bb4 100644 --- a/qml/pages/components/VisualContainer.qml +++ b/qml/pages/components/VisualContainer.qml @@ -161,7 +161,7 @@ BackgroundItem { topMargin: Theme.paddingSmall bottomMargin: Theme.paddingLarge } - model: typeof attachments !== "undefined" ? attachments : [] + model: typeof attachments !== "undefined" ? attachments : Qt.createQmlObject('import QtQuick 2.0; ListModel { }', Qt.application, 'InternalQmlObject'); height: 100 } ContextMenu { diff --git a/rpm/harbour-tooter.changes.in b/rpm/harbour-tooter.changes.in index 947c9da..ea18678 100644 --- a/rpm/harbour-tooter.changes.in +++ b/rpm/harbour-tooter.changes.in @@ -32,3 +32,4 @@ * Thu July 7 2017 Dusko Angirevic 0.1.9-0 - Image Upload added [#9] +- Emoji pannel added diff --git a/src/harbour-tooter.cpp b/src/harbour-tooter.cpp index 6d6e4b6..31b5754 100644 --- a/src/harbour-tooter.cpp +++ b/src/harbour-tooter.cpp @@ -2,6 +2,7 @@ #include #endif + #include #include "imageuploader.h" @@ -10,7 +11,7 @@ int main(int argc, char *argv[]) { QScopedPointer app(SailfishApp::application(argc, argv)); QScopedPointer view(SailfishApp::createView()); - QQmlContext *context = view.data()->rootContext(); + //QQmlContext *context = view.data()->rootContext(); qmlRegisterType("harbour.tooter.Uploader", 1, 0, "ImageUploader"); diff --git a/translations/harbour-tooter-es.ts b/translations/harbour-tooter-es.ts index 9a05c21..53e790b 100644 --- a/translations/harbour-tooter-es.ts +++ b/translations/harbour-tooter-es.ts @@ -61,6 +61,18 @@ direct + + Delete + + + + Emojis + + + + Tap to insert + + ImageUploader @@ -122,11 +134,11 @@ Logout - Cerrar sesiΓ³n + Cerrar sesiΓ³n Login - Iniciar sesiΓ³n + Iniciar sesiΓ³n diff --git a/translations/harbour-tooter-fr.ts b/translations/harbour-tooter-fr.ts index d48e262..2c3cd29 100644 --- a/translations/harbour-tooter-fr.ts +++ b/translations/harbour-tooter-fr.ts @@ -61,6 +61,18 @@ direct + + Delete + + + + Emojis + + + + Tap to insert + + ImageUploader diff --git a/translations/harbour-tooter-nl.ts b/translations/harbour-tooter-nl.ts index fc3131f..6dba369 100644 --- a/translations/harbour-tooter-nl.ts +++ b/translations/harbour-tooter-nl.ts @@ -61,6 +61,18 @@ direct + + Delete + + + + Emojis + + + + Tap to insert + + ImageUploader diff --git a/translations/harbour-tooter-oc.ts b/translations/harbour-tooter-oc.ts index 64798b6..2397ea7 100644 --- a/translations/harbour-tooter-oc.ts +++ b/translations/harbour-tooter-oc.ts @@ -61,6 +61,18 @@ direct + + Delete + + + + Emojis + + + + Tap to insert + + ImageUploader diff --git a/translations/harbour-tooter.ts b/translations/harbour-tooter.ts index b3243fe..2d56f2a 100644 --- a/translations/harbour-tooter.ts +++ b/translations/harbour-tooter.ts @@ -39,7 +39,7 @@ Conversation Conversation - Conversation + Content warning! @@ -47,19 +47,31 @@ public - Content warning! + unlisted - unlisted + followers only - followers only + direct - direct + + + + Delete + + + + Emojis + + + + Tap to insert +