Skip to content
This repository was archived by the owner on Sep 26, 2022. It is now read-only.

Commit 30f5ae4

Browse files
alexandraB990x-r4bbit
authored andcommitted
feat(StatusQ.Popups) Adding SearchPopup component
Closes #264
1 parent 90aa9d7 commit 30f5ae4

19 files changed

+1085
-230
lines changed

sandbox/DemoApp.qml

Lines changed: 63 additions & 200 deletions
Original file line numberDiff line numberDiff line change
@@ -299,14 +299,14 @@ Rectangle {
299299
StatusChatList {
300300
anchors.horizontalCenter: parent.horizontalCenter
301301

302-
chatListItems.model: demoChatListItems
302+
chatListItems.model: models.demoChatListItems
303303
selectedChatId: "0"
304304
onChatItemSelected: selectedChatId = id
305305
onChatItemUnmuted: {
306-
for (var i = 0; i < demoChatListItems.count; i++) {
307-
let item = demoChatListItems.get(i);
306+
for (var i = 0; i < models.demoChatListItems.count; i++) {
307+
let item = models.demoChatListItems.get(i);
308308
if (item.chatId === id) {
309-
demoChatListItems.setProperty(i, "muted", false)
309+
models.demoChatListItems.setProperty(i, "muted", false)
310310
}
311311
}
312312
}
@@ -412,7 +412,7 @@ Rectangle {
412412
handle: Rectangle {
413413
implicitWidth: 5
414414
color: SplitHandle.pressed ? Theme.palette.baseColor2
415-
: (SplitHandle.hovered ? Qt.darker(Theme.palette.baseColor5, 1.1) : "transparent")
415+
: (SplitHandle.hovered ? Qt.darker(Theme.palette.baseColor5, 1.1) : "transparent")
416416
}
417417
leftPanel: Item {
418418
id: leftPanel
@@ -467,8 +467,8 @@ Rectangle {
467467
width: leftPanel.width
468468
height: implicitHeight > (leftPanel.height - 64) ? implicitHeight + 8 : leftPanel.height - 64
469469

470-
chatList.model: demoCommunityChatListItems
471-
categoryList.model: demoCommunityCategoryItems
470+
chatList.model: models.demoCommunityChatListItems
471+
categoryList.model: models.demoCommunityCategoryItems
472472

473473
showCategoryActionButtons: true
474474
onChatItemSelected: selectedChatId = id
@@ -557,19 +557,69 @@ Rectangle {
557557

558558
centerPanel: Item {
559559
StatusChatToolBar {
560+
id: statusChatToolBar
560561
anchors.top: parent.top
561562
width: parent.width
562563

563564
chatInfoButton.title: "general"
564565
chatInfoButton.subTitle: "Community Chat"
565566
chatInfoButton.icon.color: Theme.palette.miscColor6
566567
chatInfoButton.type: StatusChatInfoButton.Type.CommunityChat
567-
searchButton.onClicked: searchButton.highlighted = !searchButton.highlighted
568+
onSearchButtonClicked: {
569+
searchButton.highlighted = !searchButton.highlighted;
570+
searchPopup.searchSelectionButton.primaryText = demoCommunityDetailModal.header.title;
571+
searchPopup.searchSelectionButton.image.source = demoCommunityDetailModal.header.image.source;
572+
searchPopup.open();
573+
}
568574
membersButton.onClicked: membersButton.highlighted = !membersButton.highlighted
569575
onMembersButtonClicked: {
570576
root.showRightPanel = !root.showRightPanel;
571577
}
572578
}
579+
580+
StatusSearchPopup {
581+
id: searchPopup
582+
searchOptionsPopupMenu: searchPopupMenu
583+
onAboutToHide: {
584+
if (searchPopupMenu.visible) {
585+
searchPopupMenu.close();
586+
}
587+
//clear menu
588+
for (var i = 2; i < searchPopupMenu.count; i++) {
589+
searchPopupMenu.removeItem(searchPopupMenu.takeItem(i));
590+
}
591+
}
592+
onClosed: {
593+
statusChatToolBar.searchButton.highlighted = false
594+
searchPopupMenu.dismiss();
595+
}
596+
onSearchTextChanged: {
597+
if (searchPopup.searchText !== "") {
598+
searchPopup.loading = true;
599+
searchModelSimTimer.start();
600+
} else {
601+
searchPopup.searchResults = [];
602+
searchModelSimTimer.stop();
603+
}
604+
}
605+
Timer {
606+
id: searchModelSimTimer
607+
interval: 500
608+
onTriggered: {
609+
if (searchPopup.searchText.startsWith("c")) {
610+
searchPopup.searchResults = models.searchResultsA;
611+
} else {
612+
searchPopup.searchResults = models.searchResultsB;
613+
}
614+
searchPopup.loading = false;
615+
}
616+
}
617+
}
618+
StatusSearchLocationMenu {
619+
id: searchPopupMenu
620+
searchPopup: searchPopup
621+
locatioModel: models.optionsModel
622+
}
573623
}
574624

575625
rightPanel: Item {
@@ -654,7 +704,7 @@ Rectangle {
654704
spacing: 4
655705

656706
Repeater {
657-
model: demoProfileGeneralMenuItems
707+
model: models.demoProfileGeneralMenuItems
658708
delegate: StatusNavigationListItem {
659709
title: model.title
660710
icon.name: model.icon
@@ -664,7 +714,7 @@ Rectangle {
664714
StatusListSectionHeadline { text: "Settings" }
665715

666716
Repeater {
667-
model: demoProfileSettingsMenuItems
717+
model: models.demoProfileSettingsMenuItems
668718
delegate: StatusNavigationListItem {
669719
title: model.title
670720
icon.name: model.icon
@@ -678,7 +728,7 @@ Rectangle {
678728
}
679729

680730
Repeater {
681-
model: demoProfileOtherMenuItems
731+
model: models.demoProfileOtherMenuItems
682732
delegate: StatusNavigationListItem {
683733
title: model.title
684734
icon.name: model.icon
@@ -833,194 +883,7 @@ Rectangle {
833883
}
834884
}
835885

836-
ListModel {
837-
id: demoChatListItems
838-
ListElement {
839-
chatId: "0"
840-
name: "#status"
841-
chatType: StatusChatListItem.Type.PublicChat
842-
muted: false
843-
unreadMessagesCount: 0
844-
mentionsCount: 0
845-
color: "blue"
846-
}
847-
ListElement {
848-
chatId: "1"
849-
name: "status-desktop"
850-
chatType: StatusChatListItem.Type.PublicChat
851-
muted: false
852-
color: "red"
853-
unreadMessagesCount: 1
854-
mentionsCount: 1
855-
}
856-
ListElement {
857-
chatId: "2"
858-
name: "Amazing Funny Squirrel"
859-
chatType: StatusChatListItem.Type.OneToOneChat
860-
muted: false
861-
color: "green"
862-
identicon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAlklEQVR4nOzW0QmDQBAG4SSkl7SUQlJGCrElq9F3QdjjVhh/5nv3cFhY9vUIYQiNITSG0Bh
863-
CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2ImYgiNITTlTdG1nUZ5a92VITQxITFiJmIIjSE0htAYQrMHAAD//+wwFVpz+yqXAAAAAElFTkSuQmCC"
864-
unreadMessagesCount: 0
865-
}
866-
ListElement {
867-
chatId: "3"
868-
name: "Black Ops"
869-
chatType: StatusChatListItem.Type.GroupChat
870-
muted: false
871-
color: "purple"
872-
unreadMessagesCount: 0
873-
}
874-
ListElement {
875-
chatId: "4"
876-
name: "Spectacular Growing Otter"
877-
chatType: StatusChatListItem.Type.OneToOneChat
878-
muted: true
879-
color: "Orange"
880-
unreadMessagesCount: 0
881-
}
882-
ListElement {
883-
chatId: "5"
884-
name: "channel-with-a-super-duper-long-name"
885-
chatType: StatusChatListItem.Type.PublicChat
886-
muted: false
887-
color: "green"
888-
unreadMessagesCount: 0
889-
}
890-
}
891-
892-
ListModel {
893-
id: demoCommunityChatListItems
894-
ListElement {
895-
chatId: "0"
896-
name: "general"
897-
chatType: StatusChatListItem.Type.CommunityChat
898-
muted: false
899-
unreadMessagesCount: 0
900-
color: "orange"
901-
}
902-
ListElement {
903-
chatId: "1"
904-
name: "random"
905-
chatType: StatusChatListItem.Type.CommunityChat
906-
muted: false
907-
unreadMessagesCount: 0
908-
color: "orange"
909-
categoryId: "public"
910-
}
911-
ListElement {
912-
chatId: "2"
913-
name: "watercooler"
914-
chatType: StatusChatListItem.Type.CommunityChat
915-
muted: false
916-
unreadMessagesCount: 0
917-
color: "orange"
918-
categoryId: "public"
919-
}
920-
ListElement {
921-
chatId: "3"
922-
name: "language-design"
923-
chatType: StatusChatListItem.Type.CommunityChat
924-
muted: false
925-
unreadMessagesCount: 0
926-
color: "orange"
927-
categoryId: "dev"
928-
}
929-
}
930-
931-
ListModel {
932-
id: demoCommunityCategoryItems
933-
ListElement {
934-
categoryId: "public"
935-
name: "Public"
936-
}
937-
ListElement {
938-
categoryId: "dev"
939-
name: "Development"
940-
}
941-
}
942-
943-
ListModel {
944-
id: demoProfileGeneralMenuItems
945-
946-
ListElement {
947-
title: "My Profile"
948-
icon: "profile"
949-
}
950-
951-
ListElement {
952-
title: "Contacts"
953-
icon: "contact"
954-
}
955-
956-
ListElement {
957-
title: "ENS Usernames"
958-
icon: "username"
959-
}
960-
961-
}
962-
963-
ListModel {
964-
id: demoProfileSettingsMenuItems
965-
966-
ListElement {
967-
title: "Privacy & Security"
968-
icon: "security"
969-
}
970-
971-
ListElement {
972-
title: "Appearance"
973-
icon: "appearance"
974-
}
975-
976-
ListElement {
977-
title: "Browser"
978-
icon: "browser"
979-
}
980-
981-
ListElement {
982-
title: "Sounds"
983-
icon: "sound"
984-
}
985-
986-
ListElement {
987-
title: "Language"
988-
icon: "language"
989-
}
990-
991-
ListElement {
992-
title: "Notifications"
993-
icon: "notification"
994-
}
995-
996-
ListElement {
997-
title: "Sync settings"
998-
icon: "mobile"
999-
}
1000-
1001-
ListElement {
1002-
title: "Advanced"
1003-
icon: "settings"
1004-
}
1005-
1006-
}
1007-
1008-
ListModel {
1009-
id: demoProfileOtherMenuItems
1010-
1011-
ListElement {
1012-
title: "Need help?"
1013-
icon: "help"
1014-
}
1015-
1016-
ListElement {
1017-
title: "About"
1018-
icon: "info"
1019-
}
1020-
1021-
ListElement {
1022-
title: "Sign out & Quit"
1023-
icon: "logout"
1024-
}
886+
Models {
887+
id: models
1025888
}
1026889
}

sandbox/ListItems.qml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,27 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I
295295
type: StatusListItem.Type.Danger
296296
}
297297

298+
StatusListItem {
299+
title: "List Item with Badge"
300+
subTitle: "Subtitle"
301+
image.source: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAlklEQVR4nOzW0QmDQBAG4SSkl7SUQlJGCrElq9F3QdjjVhh/5nv3cFhY9vUIYQiNITSG0Bh
302+
CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2ImYgiNITTlTdG1nUZ5a92VITQxITFiJmIIjSE0htAYQrMHAAD//+wwFVpz+yqXAAAAAElFTkSuQmCC"
303+
image.isIdenticon: true
304+
badge.image.source: "https://pbs.twimg.com/profile_images/1369221718338895873/T_5fny6o_400x400.jpg"
305+
badge.primaryText: "CryptoKitties"
306+
badge.secondaryText: "#test"
307+
}
308+
309+
StatusListItem {
310+
title: "List Item with Badge 2"
311+
subTitle: "Subtitle"
312+
icon.isLetterIdenticon: true
313+
badge.primaryText: "CryptoKitties"
314+
badge.secondaryText: "#test"
315+
badge.icon.color: "orange"
316+
badge.icon.isLetterIdenticon: true
317+
}
318+
298319
StatusDescriptionListItem {
299320
title: "Title"
300321
subTitle: "Subtitle"

0 commit comments

Comments
 (0)