02-widgets #274

Merged
erinn merged 1 commits from :02-widgets into master 2020-04-02 21:55:09 +00:00
21 changed files with 60 additions and 345 deletions

View File

@ -2,8 +2,6 @@
<qresource prefix="/">
<file>qml/overlays/BulletinOverlay.qml</file>
<file>qml/overlays/ChatOverlay.qml</file>
<file>qml/overlays/Game1Overlay.qml</file>
<file>qml/overlays/Game2Overlay.qml</file>
<file>qml/overlays/ListOverlay.qml</file>
<file>qml/overlays/MembershipOverlay.qml</file>
<file>qml/main.qml</file>
@ -30,7 +28,7 @@
<file>qml/widgets/MyProfile.qml</file>
<file>qml/widgets/ProfileList.qml</file>
<file>qml/widgets/RadioButton.qml</file>
<file>qml/widgets/SimpleButton.qml</file>
<file>qml/widgets/Button.qml</file>
<file>qml/widgets/StackToolbar.qml</file>
<file>qml/widgets/TextField.qml</file>
<file>qml/widgets/controls/Loader.qml</file>

View File

@ -175,7 +175,7 @@ ColumnLayout {
width: parent.width - 50
}
Widgets.SimpleButton {
Widgets.Button {
id: replybtn
visible: selected
text: "reply"
@ -230,7 +230,7 @@ ColumnLayout {
}
Widgets.SimpleButton { // SEND MESSAGE BUTTON
Widgets.Button { // SEND MESSAGE BUTTON
id: btnSend
icon: "regular/paper-plane"
text: "post"

View File

@ -4,7 +4,7 @@ import QtQuick.Controls 2.4
import QtQuick.Controls.Material 2.0
import QtQuick.Layouts 1.3
import "../widgets"
import "../widgets" as Widgets
import "../widgets/controls" as Awesome
import "../fonts/Twemoji.js" as T
import "../utils.js" as Utils
@ -29,7 +29,7 @@ Item {
ScrollBar.vertical: ScrollBar {}
maximumFlickVelocity: 1250
delegate: Message {
delegate: Widgets.Message {
handle: _handle
from: _from
displayName: _displayName
@ -128,7 +128,7 @@ Item {
}
}
EmojiDrawer {
Widgets.EmojiDrawer {
id: emojiDrawer
anchors.left: parent.left
anchors.right: parent.right
@ -265,7 +265,7 @@ Item {
spacing: 1
SimpleButton { // SEND MESSAGE BUTTON
Widgets.Button { // SEND MESSAGE BUTTON
id: btnSend
icon: "regular/paper-plane"
text: "send"
@ -301,7 +301,7 @@ Item {
spacing: 1
SimpleButton { // EMOJI DRAWER BUTTON
Widgets.Button { // EMOJI DRAWER BUTTON
id: btnEmoji
icon: "regular/smile"
anchors.right: btnAttach.left
@ -310,7 +310,7 @@ Item {
onClicked: emojiDrawer.visible ? emojiDrawer.slideclosed() : emojiDrawer.slideopen()
}
SimpleButton {
Widgets.Button {
id: btnAttach
icon: "solid/paperclip"
anchors.right: parent.right

View File

@ -1,262 +0,0 @@
import QtGraphicalEffects 1.0
import QtQuick 2.7
import QtQuick.Controls 2.4
import QtQuick.Controls 1.4
import QtQuick.Controls.Material 2.0
import QtQuick.Layouts 1.3
import "../widgets"
import "../widgets/controls" as Awesome
import "../fonts/Twemoji.js" as T
import "../utils.js" as Utils
ColumnLayout {
Layout.fillWidth: true
width:parent.width
anchors.horizontalCenter: parent.horizontalCenter
id: puzzleGame
Connections {
target: gcd
onClearMessages: function() {
}
onAppendMessage: function(handle, from, displayName, message, image, mid, fromMe, ts, ack, error) {
handler(handle, from, displayName, message, image, mid, fromMe, ts, ack, error)
}
onPrependMessage: function(handle, from, displayName, message, image, mid, fromMe, ts, ack, error) {
handler(handle, from, displayName, message, image, mid, fromMe, ts, ack, error)
}
function handler(handle, from, displayName, message, image, mid, fromMe, ts) {
var msg
try {
msg = JSON.parse(message)
} catch (e) {
return
}
if (msg.o != 3) return
if (msg.p != undefined && msg.s != undefined) {
var points = JSON.stringify(msg.s)
var path = JSON.stringify(msg.p)
var remove = -1
for(var i=0;i<solutions.count;i++) {
var puzzleName = "Puzzle " + points
//console.log("Checking Solution " + puzzleName)
if (puzzleName == solutions.get(i).text) {
if (Utils.scorePath(JSON.parse(path)) < Utils.scorePath(JSON.parse(solutions.get(i).path))) {
remove = i
} else {
return
}
}
}
if (remove > -1) {
solutions.remove(remove)
//console.log("Better solution found for Puzzle " + "Puzzle " + JSON.stringify(msg.s))
}
solutions.insert(0,{
"text": "Puzzle " + JSON.stringify(msg.s),
"points":points,
"path": path,
"from": from,
"displayName": displayName,
"timestamp": ts
})
}
}
}
ListModel {
id: solutions
}
RowLayout {
anchors.right: parent.right
anchors.rightMargin: 2
ComboBox {
width: 200
textRole: "text"
model: solutions
onActivated: {
//console.log("Loading puzzle " + index)
var solution = solutions.get(index)
//console.log("Loading puzzle " + JSON.parse(solution.path))
canvas.points = JSON.parse(solution.points)
canvas.path = JSON.parse(solution.path)
gameScore.text = Utils.scorePath(canvas.path)
canvas.requestPaint()
}
}
Slider {
id: gameDifficulty
value: 5
stepSize: 1.0
minimumValue: 4.0
maximumValue: 16.0
anchors.rightMargin: 2
}
SimpleButton { // New Game
id: btnNewGame
icon: "regular/paper-plane"
text: "new game"
anchors.rightMargin: 2
property int nextMessageID: 1
onClicked: {
canvas.points = []
canvas.path = []
gameScore.text = 0
for(var i=0;i<gameDifficulty.value;i++) {
canvas.points.push(Utils.getRandomInt(0,256))
}
canvas.requestPaint()
}
}
}
Canvas {
id: canvas
width: 640
height: 640
anchors.horizontalCenter: parent.horizontalCenter
property var points : []
property var path : []
Component.onCompleted: {
for(var i=0;i<5;i++) {
points.push(Utils.getRandomInt(0,256))
}
}
onPaint: {
var context = getContext("2d")
var gridSize = 40
context.beginPath()
context.fillStyle = "#FFFFFFFF"
context.fillRect(0,0,1000,1000)
context.fill()
context.beginPath()
context.strokeStyle = "#000000"
context.fillStyle = "#800880"
context.lineWidth = 1
for(var x=0; x< 16;x++ ){
for(var y=0; y< 16;y++ ){
var inPoints = Utils.isGridOccupied(x,y,points)
if (inPoints == true) {
context.fillRect(x*gridSize,y*gridSize,gridSize, gridSize)
} else {
context.rect(x*gridSize,y*gridSize, gridSize, gridSize)
}
}
}
context.stroke()
context.beginPath()
context.strokeStyle = "#FFFFFFFF"
context.font = "20px sans-serif"
for(var i=0;i<=path.length;i++) {
context.strokeText(i, (Math.floor(path[i]/16) * gridSize)+15, ((path[i] % 16)*gridSize) + 25)
}
context.stroke()
context.beginPath()
//context.strokeStyle = "#000000"
//var point = (mymouse.arrpoints["x"]*16)+mymouse.arrpoints["y"]
//context.strokeText(mymouse.arrpoints["x"] + " , " + mymouse.arrpoints["y"] + " = " + point, 10,560)
context.stroke()
}
MouseArea {
id: mymouse
anchors.fill: parent
property var arrpoints : {"x": 1, "y": 1}
onClicked: {
arrpoints = Utils.mouseToGrid(mouseX, mouseY)
var point = (mymouse.arrpoints["x"]*16)+mymouse.arrpoints["y"]
var inPoints = Utils.isGridOccupied(mymouse.arrpoints["x"], mymouse.arrpoints["y"], canvas.points)
//console.log("Checking Point " + point + " in path " + inPoints + " path length is " + canvas.path.length)
if (inPoints == true) {
var alreadyInPath = false
for(var i=0;i<canvas.path.length;i++) {
if (canvas.path[i] == point) {
//console.log("Point already in path!!")
alreadyInPath = true
}
}
if (alreadyInPath == false) {
canvas.path.push(point)
//console.log("Pushing " + point + " to path" + canvas.path)
}
} else {
canvas.path = []
}
gameScore.text = Utils.scorePath(canvas.path)
canvas.requestPaint()
}
}
}
RowLayout {
anchors.right: parent.right
anchors.rightMargin: 2
Text {
id: gameScoreLabel
text: "Sequence Score: "
}
Text {
id: gameScore
text: Utils.scorePath(canvas.path)
}
SimpleButton { // New Game
id: btnSubmitSolution
icon: "regular/paper-plane"
text: "submit solution"
anchors.rightMargin: 2
property int nextMessageID: 1
onClicked: {
if (canvas.path.length == canvas.points.length) {
var msg = JSON.stringify({"o":3, "p":canvas.path, "s":canvas.points})
gcd.sendMessage(msg, nextMessageID++)
}
}
}
}
}

View File

@ -1,18 +0,0 @@
import QtGraphicalEffects 1.0
import QtQuick 2.7
import QtQuick.Controls 2.4
import QtQuick.Controls.Material 2.0
import QtQuick.Layouts 1.3
import "../widgets"
import "../widgets/controls" as Awesome
import "../fonts/Twemoji.js" as T
ColumnLayout {
Layout.fillWidth: true
ScalingLabel {
text: "rock paper scissors. or chess? basically the same thing"
}
}

View File

@ -204,7 +204,7 @@ ColumnLayout {
style: CwtchTextFieldStyle{}
}
Widgets.SimpleButton { // SEND MESSAGE BUTTON
Widgets.Button { // SEND MESSAGE BUTTON
id: btnSend
icon: "regular/paper-plane"
text: "add"

View File

@ -60,7 +60,7 @@ ColumnLayout { // settingsPane
text: qsTr("default-group-name")
}
Widgets.SimpleButton {
Widgets.Button {
//: create group button
text: qsTr("create-group-btn")

View File

@ -48,7 +48,7 @@ ColumnLayout { // groupSettingsPane
readOnly: true
}
Widgets.SimpleButton {
Widgets.Button {
icon: "regular/clipboard"
text: qsTr("copy-btn")
@ -69,7 +69,7 @@ ColumnLayout { // groupSettingsPane
readOnly: true
}
Widgets.SimpleButton {
Widgets.Button {
icon: "regular/clipboard"
text: qsTr("copy-btn")
@ -89,7 +89,7 @@ ColumnLayout { // groupSettingsPane
style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 }
}
Widgets.SimpleButton {
Widgets.Button {
text: qsTr("save-btn")
onClicked: {
@ -110,7 +110,7 @@ ColumnLayout { // groupSettingsPane
style: CwtchComboBoxStyle{}
}
Widgets.SimpleButton {
Widgets.Button {
text: qsTr("invite-btn")
onClicked: {
@ -118,7 +118,7 @@ ColumnLayout { // groupSettingsPane
}
}
Widgets.SimpleButton {
Widgets.Button {
icon: "regular/trash-alt"
text: qsTr("delete-btn")

View File

@ -4,7 +4,7 @@ import QtQuick.Controls 2.4
import QtQuick.Controls.Material 2.0
import QtQuick.Layouts 1.3
import "../widgets"
import "../widgets" as Widgets
import "../overlays"
ColumnLayout {
@ -16,7 +16,7 @@ ColumnLayout {
property bool inGroup
StackToolbar {
Widgets.StackToolbar {
id: toolbar
membership.visible: gcd.selectedConversation.length == 32
@ -44,7 +44,7 @@ ColumnLayout {
text: qsTr("accept-group-invite-label") + " " + overlay.name + "?"
}
SimpleButton {
Widgets.Button {
//: Accept group invite button
text: qsTr("accept-group-btn")
icon: "regular/heart"
@ -54,7 +54,7 @@ ColumnLayout {
}
}
SimpleButton {
Widgets.Button {
//: Reject Group invite button
text: qsTr("reject-group-btn")
icon: "regular/trash-alt"
@ -69,34 +69,27 @@ ColumnLayout {
id: switcher
SimpleButton {
Widgets.Button {
text: qsTr("chat-btn")
onClicked: overlayStack.overlay = overlayStack.chatOverlay
}
SimpleButton {
Widgets.Button {
text: qsTr("lists-btn")
onClicked: overlayStack.overlay = overlayStack.listOverlay
}
SimpleButton {
Widgets.Button {
text: qsTr("bulletins-btn")
onClicked: overlayStack.overlay = overlayStack.bulletinOverlay
}
SimpleButton {
text: qsTr("puzzle-game-btn")
onClicked: overlayStack.overlay = overlayStack.game1Overlay
}
}
StackLayout {
@ -112,8 +105,7 @@ ColumnLayout {
readonly property int chatOverlay: 0
readonly property int listOverlay: 1
readonly property int bulletinOverlay: 2
readonly property int game1Overlay: 3
readonly property int membershipOverlay: 4
readonly property int membershipOverlay: 3
ChatOverlay { //0
@ -131,12 +123,7 @@ ColumnLayout {
Layout.maximumWidth: overlayStack.width
}
Game1Overlay{ //3
Layout.maximumHeight: overlayStack.height
Layout.maximumWidth: overlayStack.width
}
MembershipOverlay { //4
MembershipOverlay { //3
Layout.maximumHeight: overlayStack.height
Layout.maximumWidth: overlayStack.width
}

View File

@ -48,7 +48,7 @@ ColumnLayout { // peerSettingsPane
readOnly: true
}
Widgets.SimpleButton {
Widgets.Button {
icon: "regular/clipboard"
text: qsTr("copy-btn")
@ -69,7 +69,7 @@ ColumnLayout { // peerSettingsPane
style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 }
}
Widgets.SimpleButton {
Widgets.Button {
text: qsTr("save-btn")
onClicked: {
@ -80,7 +80,7 @@ ColumnLayout { // peerSettingsPane
}
Widgets.SimpleButton {
Widgets.Button {
icon: "solid/hand-paper"
text: root.blocked ? qsTr("unblock-btn") : qsTr("block-btn")
@ -94,7 +94,7 @@ ColumnLayout { // peerSettingsPane
}
}
Widgets.SimpleButton {
Widgets.Button {
icon: "regular/trash-alt"
text: qsTr("delete-btn")

View File

@ -186,7 +186,7 @@ ColumnLayout { // Add Profile Pane
visible: radioUsePassword.checked
}
Widgets.SimpleButton { // ADD or SAVE button
Widgets.Button { // ADD or SAVE button
//: Create Profile || Save Profile
text: mode == "add" ? qsTr("create-profile-btn") : qsTr("save-profile-btn")
@ -235,7 +235,7 @@ ColumnLayout { // Add Profile Pane
// ***** Delete button and confirm flow *****
Widgets.SimpleButton {
Widgets.Button {
//: Delete Profile
text: qsTr("delete-profile-btn")
icon: "regular/trash-alt"
@ -261,7 +261,7 @@ ColumnLayout { // Add Profile Pane
visible: deleting
}
Widgets.SimpleButton {
Widgets.Button {
id: confirmDeleteBtn
icon: "regular/trash-alt"

View File

@ -44,7 +44,7 @@ ColumnLayout {
visible: false
}
Widgets.SimpleButton {
Widgets.Button {
id: "button"
anchors.horizontalCenter: parent.horizontalCenter

View File

@ -6,11 +6,12 @@ ThemeType {
readonly property color purple: "#DFB9DE"
readonly property color whitePurple: "#FFFDFF"
readonly property color softPurple: "#FDF3FC"
readonly property color hotPink: "#775F84"
readonly property color hotPink: "#d01972"
backgroundMainColor: darkGrayPurple
backgroundPaneColor: mauvePurple
mainTextColor: whitePurple
defaultButtonColor: hotPink
defaultButtonTextColor: whitePurple
}

View File

@ -6,11 +6,12 @@ ThemeType {
readonly property color brightPurple: "#760388"
readonly property color darkPurple: "#350052"
readonly property color greyPurple: "#775F84"
readonly property color hotPink: "#775F84"
readonly property color hotPink: "#d01972"
backgroundMainColor: whitePurple
backgroundPaneColor: purple
mainTextColor: darkPurpke
mainTextColor: darkPurple
defaultButtonColor: hotPink
defaultButtonTextColor: whitePurple
}

View File

@ -8,6 +8,7 @@ Item {
readonly property color mainTextColor: theme.mainTextColor
readonly property color defaultButtonColor: theme.defaultButtonColor
readonly property color defaultButtonTextColor: theme.defaultButtonTextColor
property ThemeType theme: CwtchLight { }
}

View File

@ -6,6 +6,7 @@ QtObject {
property color mainTextColor: "red"
property color defaultButtonColor: "red"
property color defaultButtonTextColor: "red"
// ... more to come

View File

@ -5,6 +5,7 @@ import QtQuick.Controls.Material 2.0
import QtQuick.Layouts 1.3
import "../fonts/Twemoji.js" as T
import "../theme"
Rectangle {
id: button
@ -14,10 +15,10 @@ Rectangle {
height: 20 * gcd.themeScale
Layout.minimumHeight: height
Layout.maximumHeight: height
color: mousedown ? "#B09CBC" : "#4B3557"
border.color: "#4B3557"
color: mousedown ? Qt.lighter(Theme.defaultButtonColor, 1.5) : Theme.defaultButtonColor
border.color: Theme.defaultButtonColor
border.width: 1
radius: 2
radius: (height / 2.0)
antialiasing: true
property bool checked: false
@ -43,7 +44,7 @@ Rectangle {
Label {
id: buttonText
font.pixelSize: button.height / 2
color: "#FFFFFF"
color: Theme.defaultButtonTextColor
anchors.left: ico.right
anchors.leftMargin: 6
visible: button.text != "" && button.text != undefined

View File

@ -5,6 +5,7 @@ import QtQuick.Controls.Material 2.0
import QtQuick.Layouts 1.3
import CustomQmlTypes 1.0
import "../styles"
import "../widgets" as Widgets
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
@ -197,7 +198,7 @@ Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
}
}
SimpleButton {// Edit BUTTON
Widgets.Button {// Edit BUTTON
id: btnEdit
icon: "solid/user-edit"

View File

@ -3,6 +3,8 @@ import QtQuick 2.7
import QtQuick.Controls 2.4
import QtQuick.Controls.Material 2.0
import QtQuick.Layouts 1.3
import "../widgets" as Widgets
Item {
@ -76,7 +78,7 @@ Item {
}
}
SimpleButton {
Widgets.Button {
id: btn
anchors.top: txt.bottom
anchors.topMargin: 3

View File

@ -7,6 +7,7 @@ import QtQuick.Layouts 1.3
import QtQuick.Window 2.11
import QtQuick.Controls 1.4
import "." as Widgets
import "../styles"
ColumnLayout {
@ -19,7 +20,7 @@ ColumnLayout {
property string onion
SimpleButton {// BACK BUTTON
Widgets.Button {// BACK BUTTON
id: btnBack
icon: "solid/arrow-circle-left"
anchors.left: parent.left
@ -180,7 +181,7 @@ ColumnLayout {
visible: false
}
SimpleButton { // COPY ONION ADDRESS BUTTON
Widgets.Button { // COPY ONION ADDRESS BUTTON
icon: "regular/clipboard"
//: Button for copying profile onion address to clipboard
text: qsTr("copy-btn")
@ -194,13 +195,13 @@ ColumnLayout {
}
}
SimpleButton { // SETTINGS BUTTON
Widgets.Button { // SETTINGS BUTTON
icon: "solid/cog"
onClicked: theStack.pane = theStack.settingsPane
}
SimpleButton { // SIGN OUT BUTTON
Widgets.Button { // SIGN OUT BUTTON
icon: "solid/sign-out-alt"
onClicked: {
@ -214,7 +215,7 @@ ColumnLayout {
spacing: gcd.themeScale * 2
SimpleButton { // CREATE GROUP BUTTON
Widgets.Button { // CREATE GROUP BUTTON
icon: "regular/clipboard"
//: create new group button
text: qsTr("new-group-btn")

View File

@ -5,6 +5,7 @@ import QtQuick.Controls.Material 2.0
import QtQuick.Layouts 1.3
import "../fonts/Twemoji.js" as T
import "." as Widgets
Rectangle { // OVERHEAD BAR ON STACK PANE
id: toolbar
@ -23,7 +24,7 @@ Rectangle { // OVERHEAD BAR ON STACK PANE
property string stack: "profile" // profile(theStack) or management(parentStack)
SimpleButton {// BACK BUTTON
Widgets.Button {// BACK BUTTON
id: btnBack
icon: "solid/arrow-circle-left"
anchors.left: parent.left
@ -51,14 +52,14 @@ Rectangle { // OVERHEAD BAR ON STACK PANE
anchors.rightMargin: 6
anchors.verticalCenter: parent.verticalCenter
SimpleButton { // Membership Button
Widgets.Button { // Membership Button
id: btnMembership
icon: "solid/users"
//: View Group Membership
tooltip: qsTr("view-group-membership-tooltip")
}
SimpleButton { // COG BUTTON
Widgets.Button { // COG BUTTON
id: btnAux
icon: "solid/cog"
}