fix(StatusPopupMenu): Refactoring

This commit is contained in:
Igor Sirotin 2022-12-01 19:58:37 +03:00 committed by Igor Sirotin
parent f49190e47b
commit e3bfdc0f09
78 changed files with 971 additions and 1042 deletions

View File

@ -10,6 +10,7 @@ type
IconName
IconColor
SubItems
HasSubItems
QtObject:
type
@ -39,7 +40,8 @@ QtObject:
ModelRole.ImageSource.int:"imageSource",
ModelRole.IconName.int:"iconName",
ModelRole.IconColor.int:"iconColor",
ModelRole.SubItems.int:"subItems"
ModelRole.SubItems.int:"subItems",
ModelRole.HasSubItems.int:"hasSubItems"
}.toTable
method data(self: Model, index: QModelIndex, role: int): QVariant =
@ -65,6 +67,8 @@ QtObject:
result = newQVariant(item.iconColor)
of ModelRole.SubItems:
result = newQVariant(item.subItems)
of ModelRole.HasSubItems:
result = newQVariant(not isNil(item.subItems) and item.subItems.rowCount(nil) > 0)
proc setItems*(self: Model, items: seq[Item]) =
self.beginResetModel()

View File

@ -29,16 +29,16 @@ class CommunityScreenComponents(Enum):
COMMUNITY_HEADER_BUTTON = "mainWindow_communityHeader_StatusChatInfoButton"
COMMUNITY_HEADER_NAME_TEXT= "community_ChatInfo_Name_Text"
COMMUNITY_CREATE_CHANNEL_OR_CAT_BUTTON = "mainWindow_createChannelOrCategoryBtn_StatusBaseText"
COMMUNITY_CREATE_CHANNEL_MENU_ITEM = "create_channel_StatusMenuItemDelegate"
COMMUNITY_CREATE_CATEGORY_MENU_ITEM = "create_category_StatusMenuItemDelegate"
COMMUNITY_EDIT_CATEGORY_MENU_ITEM = "edit_сategory_StatusMenuItemDelegate"
COMMUNITY_DELETE_CATEGORY_MENU_ITEM = "delete_сategory_StatusMenuItemDelegate"
COMMUNITY_CREATE_CHANNEL_MENU_ITEM = "create_channel_StatusMenuItem"
COMMUNITY_CREATE_CATEGORY_MENU_ITEM = "create_category_StatusMenuItem"
COMMUNITY_EDIT_CATEGORY_MENU_ITEM = "edit_сategory_StatusMenuItem"
COMMUNITY_DELETE_CATEGORY_MENU_ITEM = "delete_сategory_StatusMenuItem"
COMMUNITY_CONFIRM_DELETE_CATEGORY_BUTTON = "confirmDeleteCategoryButton_StatusButton"
CHAT_IDENTIFIER_CHANNEL_ICON = "mainWindow_chatInfoBtnInHeader_StatusChatInfoButton"
CHAT_MORE_OPTIONS_BUTTON = "chat_moreOptions_menuButton"
EDIT_CHANNEL_MENU_ITEM = "edit_Channel_StatusMenuItemDelegate"
EDIT_CHANNEL_MENU_ITEM = "edit_Channel_StatusMenuItem"
COMMUNITY_COLUMN_VIEW = "mainWindow_communityColumnView_CommunityColumnView"
DELETE_CHANNEL_MENU_ITEM = "delete_Channel_StatusMenuItemDelegate"
DELETE_CHANNEL_MENU_ITEM = "delete_Channel_StatusMenuItem"
DELETE_CHANNEL_CONFIRMATION_DIALOG_DELETE_BUTTON = "delete_Channel_ConfirmationDialog_DeleteButton"
NOT_CATEGORIZED_CHAT_LIST = "mainWindow_communityColumnView_statusChatList"
COMMUNITY_CHAT_LIST_CATEGORIES = "communityChatListCategories_Repeater"

View File

@ -22,12 +22,12 @@ class MainScreenComponents(Enum):
PUBLIC_CHAT_ICON = "mainWindow_public_chat_icon_StatusIcon"
CHAT_NAVBAR_ICON = "navBarListView_Chat_navbar_StatusNavBarTabButton"
COMMUNITY_PORTAL_BUTTON = "navBarListView_Communities_Portal_navbar_StatusNavBarTabButton"
JOIN_PUBLIC_CHAT = "join_public_chat_StatusMenuItemDelegate"
JOIN_PUBLIC_CHAT = "join_public_chat_StatusMenuItem"
SETTINGS_BUTTON = "navBarListView_Settings_navbar_StatusNavBarTabButton"
WALLET_BUTTON = "wallet_navbar_wallet_icon_StatusIcon"
START_CHAT_BTN = "mainWindow_startChat"
CHAT_LIST = "chatList"
MARK_AS_READ_BUTTON = "mark_as_Read_StatusMenuItemDelegate"
MARK_AS_READ_BUTTON = "mark_as_Read_StatusMenuItem"
COMMUNITY_NAVBAR_BUTTONS = "navBarListView_All_Community_Buttons"
SECURE_SEEDPHRASE_BANNER = "secureSeedPhrase_Banner"
CONNECTION_INFO_BANNER = "connectionInfo_Banner"

View File

@ -22,10 +22,10 @@ mainWindow_emptyChatPanelImage = {"container": statusDesktop_mainWindow, "object
mainWindow_RighPanel= {"container": statusDesktop_mainWindow, "type": "ColumnLayout", "objectName": "mainRightView", "visible": True}
# User Status Profile Menu
userContextmenu_AlwaysActiveButton= {"container": statusDesktop_mainWindow_overlay, "objectName": "userStatusMenuAlwaysOnlineAction", "type": "StatusMenuItemDelegate", "visible": True}
userContextmenu_InActiveButton= {"container": statusDesktop_mainWindow_overlay, "objectName": "userStatusMenuInactiveAction", "type": "StatusMenuItemDelegate", "visible": True}
userContextmenu_AutomaticButton= {"container": statusDesktop_mainWindow_overlay, "objectName": "userStatusMenuAutomaticAction", "type": "StatusMenuItemDelegate", "visible": True}
userContextMenu_ViewMyProfileAction = {"container": statusDesktop_mainWindow_overlay, "objectName": "userStatusViewMyProfileAction", "type": "StatusMenuItemDelegate", "visible": True}
userContextmenu_AlwaysActiveButton= {"container": statusDesktop_mainWindow_overlay, "objectName": "userStatusMenuAlwaysOnlineAction", "type": "StatusMenuItem", "visible": True}
userContextmenu_InActiveButton= {"container": statusDesktop_mainWindow_overlay, "objectName": "userStatusMenuInactiveAction", "type": "StatusMenuItem", "visible": True}
userContextmenu_AutomaticButton= {"container": statusDesktop_mainWindow_overlay, "objectName": "userStatusMenuAutomaticAction", "type": "StatusMenuItem", "visible": True}
userContextMenu_ViewMyProfileAction = {"container": statusDesktop_mainWindow_overlay, "objectName": "userStatusViewMyProfileAction", "type": "StatusMenuItem", "visible": True}
# popups
modal_Close_Button = {"container": statusDesktop_mainWindow_overlay, "objectName": "modalCloseButtonRectangle", "type": "Rectangle", "visible": True}
@ -38,7 +38,7 @@ mainWindow_public_chat_icon_StatusIcon = {"container": statusDesktop_mainWindow,
chatList_Repeater = {"container": statusDesktop_mainWindow, "objectName": "chatListItems", "type": "Repeater"}
chatList = {"container": statusDesktop_mainWindow, "objectName": "ContactsColumnView_chatList", "type": "StatusChatList"}
mainWindow_startChat = {"checkable": True, "container": statusDesktop_mainWindow, "objectName": "startChatButton", "type": "StatusIconTabButton"}
join_public_chat_StatusMenuItemDelegate = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "text": "Join public chat", "type": "StatusMenuItemDelegate", "unnamed": 1, "visible": True}
join_public_chat_StatusMenuItem = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "text": "Join public chat", "type": "StatusMenuItem", "unnamed": 1, "visible": True}
chatView_messageInput = {"container": statusDesktop_mainWindow, "objectName": "messageInputField", "type": "TextArea", "visible": True}
chatView_StatusChatInfoButton = {"container": statusDesktop_mainWindow, "objectName": "chatInfoBtnInHeader", "type": "StatusChatInfoButton", "visible": True}
chatInfoButton_Pin_Text = {"container": chatView_StatusChatInfoButton, "objectName": "StatusChatInfo_pinText", "type": "StatusBaseText", "visible": True}

View File

@ -135,9 +135,9 @@ backup_seed_phrase_popup_ConfirmStoringSeedPhrasePanel_storeCheck = {"container"
backup_seed_phrase_popup_BackupSeedModal_completeAndDeleteSeedPhraseButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "BackupSeedModal_completeAndDeleteSeedPhraseButton", "type": "StatusButton", "visible": True}
# User Status Profile Menu
userContextmenu_AlwaysActiveButton= {"container": statusDesktop_mainWindow_overlay, "objectName": "userStatusMenuAlwaysOnlineAction", "type": "StatusMenuItemDelegate", "visible": True}
userContextmenu_InActiveButton= {"container": statusDesktop_mainWindow_overlay, "objectName": "userStatusMenuInactiveAction", "type": "StatusMenuItemDelegate", "visible": True}
userContextmenu_AutomaticButton= {"container": statusDesktop_mainWindow_overlay, "objectName": "userStatusMenuAutomaticAction", "type": "StatusMenuItemDelegate", "visible": True}
userContextmenu_AlwaysActiveButton= {"container": statusDesktop_mainWindow_overlay, "objectName": "userStatusMenuAlwaysOnlineAction", "type": "StatusMenuItem", "visible": True}
userContextmenu_InActiveButton= {"container": statusDesktop_mainWindow_overlay, "objectName": "userStatusMenuInactiveAction", "type": "StatusMenuItem", "visible": True}
userContextmenu_AutomaticButton= {"container": statusDesktop_mainWindow_overlay, "objectName": "userStatusMenuAutomaticAction", "type": "StatusMenuItem", "visible": True}
# Change Password Menu
change_password_menu_current_password = {"container": statusDesktop_mainWindow_overlay, "objectName": "passwordViewCurrentPassword", "type": "StatusPasswordInput", "visible": True}

View File

@ -5,14 +5,14 @@ mainWindow_communityColumnView_CommunityColumnView = {"container": statusDesktop
mainWindow_communityHeader_StatusChatInfoButton = {"container": statusDesktop_mainWindow, "objectName": "communityHeaderButton", "type": "StatusChatInfoButton", "visible": True}
community_ChatInfo_Name_Text = {"container": mainWindow_communityHeader_StatusChatInfoButton, "objectName": "statusChatInfoButtonNameText", "type": "StatusBaseText", "visible": True}
mainWindow_createChannelOrCategoryBtn_StatusBaseText = {"container": statusDesktop_mainWindow, "objectName": "createChannelOrCategoryBtn", "type": "StatusBaseText", "visible": True}
create_channel_StatusMenuItemDelegate = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "createCommunityChannelBtn", "type": "StatusMenuItemDelegate", "visible": True}
create_category_StatusMenuItemDelegate = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "createCommunityCategoryBtn", "type": "StatusMenuItemDelegate", "visible": True}
edit_сategory_StatusMenuItemDelegate = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "editCategoryMenuItem", "type": "StatusMenuItemDelegate", "visible": True}
delete_сategory_StatusMenuItemDelegate = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "deleteCategoryMenuItem", "type": "StatusMenuItemDelegate", "visible": True}
create_channel_StatusMenuItem = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "createCommunityChannelBtn", "type": "StatusMenuItem", "visible": True}
create_category_StatusMenuItem = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "createCommunityCategoryBtn", "type": "StatusMenuItem", "visible": True}
edit_сategory_StatusMenuItem = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "editCategoryMenuItem", "type": "StatusMenuItem", "visible": True}
delete_сategory_StatusMenuItem = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "deleteCategoryMenuItem", "type": "StatusMenuItem", "visible": True}
confirmDeleteCategoryButton_StatusButton = {"container": statusDesktop_mainWindow, "objectName": "confirmDeleteCategoryButton", "type": "StatusButton"}
chat_moreOptions_menuButton = {"container": statusDesktop_mainWindow, "objectName": "chatToolbarMoreOptionsButton", "type": "StatusFlatRoundButton", "visible": True}
edit_Channel_StatusMenuItemDelegate = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "editChannelMenuItem", "type": "StatusMenuItemDelegate", "visible": True}
delete_Channel_StatusMenuItemDelegate = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "deleteOrLeaveMenuItem", "type": "StatusMenuItemDelegate", "visible": True}
edit_Channel_StatusMenuItem = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "editChannelMenuItem", "type": "StatusMenuItem", "visible": True}
delete_Channel_StatusMenuItem = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "deleteOrLeaveMenuItem", "type": "StatusMenuItem", "visible": True}
mainWindow_communityColumnView_statusChatList = {"container": mainWindow_communityColumnView_CommunityColumnView, "objectName": "statusChatListAndCategoriesChatList", "type": "StatusChatList"}
mainWindow_chatInfoBtnInHeader_StatusChatInfoButton = {"container": statusDesktop_mainWindow, "objectName": "chatInfoBtnInHeader", "type": "StatusChatInfoButton", "visible": True}
communityChatListCategories_Repeater = {"container": statusDesktop_mainWindow, "objectName": "communityChatListCategories", "type": "Repeater"}

View File

@ -7,7 +7,7 @@ chatView_lastChatText_Text = {"container": chatView_chatLogView_lastMsg_MessageV
chatView_editMessageInputComponent = {"container": statusDesktop_mainWindow, "objectName": "editMessageInput", "type": "StatusChatInput", "visible": True}
chatView_editMessageInputTextArea = {"container": chatView_editMessageInputComponent, "objectName": "messageInputField", "type": "TextArea", "visible": True}
chatButtonsPanelConfirmDeleteMessageButton_StatusButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "chatButtonsPanelConfirmDeleteMessageButton", "type": "StatusButton"}
mark_as_Read_StatusMenuItemDelegate = {"container": statusDesktop_mainWindow_overlay, "objectName": "chatMarkAsReadMenuItem", "type": "StatusMenuItemDelegate", "visible": True}
mark_as_Read_StatusMenuItem = {"container": statusDesktop_mainWindow_overlay, "objectName": "chatMarkAsReadMenuItem", "type": "StatusMenuItem", "visible": True}
chat_Input_Stickers_Button = {"container": statusDesktop_mainWindow, "objectName": "statusChatInputStickersButton", "type": "StatusFlatRoundButton", "visible": True}
chatView_SuggestionBoxPanel ={"container": statusDesktop_mainWindow, "objectName": "suggestionsBox", "type": "SuggestionBoxPanel"}
chatView_suggestion_ListView ={"container": chatView_SuggestionBoxPanel, "objectName": "suggestionBoxList", "type": "StatusListView"}
@ -22,9 +22,9 @@ chatView_unfurledLinkComponent_linkImage = {"container": chatView_log, "objectNa
chatView_LinksMessageView_enableBtn = {"container": chatView_log, "objectName": "LinksMessageView_enableBtn", "type": "StatusFlatButton", "visible": True}
# More options menu
clearHistoryMenuItem = {"container": statusDesktop_mainWindow_overlay, "objectName": "clearHistoryMenuItem", "type": "StatusMenuItemDelegate", "visible": True}
editNameAndImageMenuItem = {"container": statusDesktop_mainWindow_overlay, "objectName": "editNameAndImageMenuItem", "type": "StatusMenuItemDelegate", "visible": True}
leaveChatMenuItem = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "deleteOrLeaveMenuItem", "type": "StatusMenuItemDelegate", "visible": True}
clearHistoryMenuItem = {"container": statusDesktop_mainWindow_overlay, "objectName": "clearHistoryMenuItem", "type": "StatusMenuItem", "visible": True}
editNameAndImageMenuItem = {"container": statusDesktop_mainWindow_overlay, "objectName": "editNameAndImageMenuItem", "type": "StatusMenuItem", "visible": True}
leaveChatMenuItem = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "deleteOrLeaveMenuItem", "type": "StatusMenuItem", "visible": True}
# group chat edit popup
groupChatEdit_main = {"container": statusDesktop_mainWindow_overlay, "objectName": "groupChatEdit_main", "type": "StatusDialog", "visible": True}

View File

@ -70,8 +70,8 @@ mainWallet_Add_Account_Popup_Footer_Add_Account = {"container": mainWallet_Add_A
# saved address view
mainWallet_Saved_Addreses_Add_Buttton = {"container": statusDesktop_mainWindow, "objectName": "addNewAddressBtn", "type": "StatusButton"}
mainWallet_Saved_Addreses_List = {"container": statusDesktop_mainWindow, "objectName": "SavedAddressesView_savedAddresses", "type": "StatusListView"}
mainWallet_Saved_Addreses_More_Edit = {"container": statusDesktop_mainWindow, "objectName": "editroot", "type": "StatusMenuItemDelegate"}
mainWallet_Saved_Addreses_More_Delete = {"container": statusDesktop_mainWindow, "objectName": "deleteSavedAddress", "type": "StatusMenuItemDelegate"}
mainWallet_Saved_Addreses_More_Edit = {"container": statusDesktop_mainWindow, "objectName": "editroot", "type": "StatusMenuItem"}
mainWallet_Saved_Addreses_More_Delete = {"container": statusDesktop_mainWindow, "objectName": "deleteSavedAddress", "type": "StatusMenuItem"}
mainWallet_Saved_Addreses_More_Confirm_Delete = {"container": statusDesktop_mainWindow, "objectName": "confirmDeleteSavedAddress", "type": "StatusButton"}
# saved address add popup

View File

@ -116,19 +116,19 @@ Rectangle {
}
}
popupMenu: StatusPopupMenu {
popupMenu: StatusMenu {
StatusMenuItem {
StatusAction {
text: qsTr("Invite People")
icon.name: "share-ios"
}
StatusMenuItem {
StatusAction {
text: qsTr("View Community")
icon.name: "group"
}
StatusMenuItem {
StatusAction {
text: qsTr("Edit Community")
icon.name: "edit"
enabled: false
@ -136,10 +136,10 @@ Rectangle {
StatusMenuSeparator {}
StatusMenuItem {
StatusAction {
text: qsTr("Leave Community")
icon.name: "arrow-left"
type: StatusMenuItem.Type.Danger
type: StatusAction.Type.Danger
}
}
}

View File

@ -201,33 +201,7 @@ Column {
badge.visible: model.hasNotification
badge.border.color: hovered ? Theme.palette.statusBadge.hoverBorderColor : Theme.palette.statusBadge.borderColor
badge.border.width: 2
popupMenu: StatusPopupMenu {
StatusMenuItem {
text: qsTr("Invite People")
icon.name: "share-ios"
}
StatusMenuItem {
text: qsTr("View Community")
icon.name: "group"
}
StatusMenuItem {
text: qsTr("Edit Community")
icon.name: "edit"
enabled: false
}
StatusMenuSeparator {}
StatusMenuItem {
text: qsTr("Leave Community")
icon.name: "arrow-left"
type: StatusMenuItem.Type.Danger
}
}
popupMenu: communityPopupMenu
}
}
@ -284,33 +258,7 @@ Column {
badge.visible: model.hasNotification
badge.border.color: hovered ? Theme.palette.statusBadge.hoverBorderColor : Theme.palette.statusBadge.borderColor
badge.border.width: 2
popupMenu: StatusPopupMenu {
StatusMenuItem {
text: qsTr("Invite People")
icon.name: "share-ios"
}
StatusMenuItem {
text: qsTr("View Community")
icon.name: "group"
}
StatusMenuItem {
text: qsTr("Edit Community")
icon.name: "edit"
enabled: false
}
StatusMenuSeparator {}
StatusMenuItem {
text: qsTr("Leave Community")
icon.name: "arrow-left"
type: StatusMenuItem.Type.Danger
}
}
popupMenu: communityPopupMenu
}
}
@ -372,33 +320,7 @@ Column {
badge.visible: model.hasNotification
badge.border.color: hovered ? Theme.palette.statusBadge.hoverBorderColor : Theme.palette.statusBadge.borderColor
badge.border.width: 2
popupMenu: StatusPopupMenu {
StatusMenuItem {
text: qsTr("Invite People")
icon.name: "share-ios"
}
StatusMenuItem {
text: qsTr("View Community")
icon.name: "group"
}
StatusMenuItem {
text: qsTr("Edit Community")
icon.name: "edit"
enabled: false
}
StatusMenuSeparator {}
StatusMenuItem {
text: qsTr("Leave Community")
icon.name: "arrow-left"
type: StatusMenuItem.Type.Danger
}
}
popupMenu: communityPopupMenu
}
}
@ -465,33 +387,38 @@ Column {
badge.visible: model.hasNotification
badge.border.color: hovered ? Theme.palette.statusBadge.hoverBorderColor : Theme.palette.statusBadge.borderColor
badge.border.width: 2
popupMenu: communityPopupMenu
}
}
}
popupMenu: StatusPopupMenu {
Component {
id: communityPopupMenu
StatusMenuItem {
text: qsTr("Invite People")
icon.name: "share-ios"
}
StatusMenu {
StatusMenuItem {
text: qsTr("View Community")
icon.name: "group"
}
StatusAction {
text: qsTr("Invite People")
icon.name: "share-ios"
}
StatusMenuItem {
text: qsTr("Edit Community")
icon.name: "edit"
enabled: false
}
StatusAction {
text: qsTr("View Community")
icon.name: "group"
}
StatusMenuSeparator {}
StatusAction {
text: qsTr("Edit Community")
icon.name: "edit"
enabled: false
}
StatusMenuItem {
text: qsTr("Leave Community")
icon.name: "arrow-left"
type: StatusMenuItem.Type.Danger
}
}
StatusMenuSeparator {}
StatusAction {
text: qsTr("Leave Community")
icon.name: "arrow-left"
type: StatusAction.Type.Danger
}
}
}

View File

@ -70,11 +70,6 @@ Column {
onClicked: modalWithHeaderPopupMenu.open()
}
StatusButton {
text: "Spellchecking menu"
onClicked: spellMenu.open()
}
StatusButton {
text: "Modal with Editable Title"
onClicked: editTitleModal.open()
@ -336,21 +331,20 @@ Column {
anchors.centerIn: parent
header.title: "helloworld.eth"
header.subTitle: "Basic address"
header.popupMenu: StatusPopupMenu {
header.popupMenu: StatusMenu {
id: popupMenu
Repeater {
StatusMenuInstantiator {
model: dummyAccountsModel
delegate: Loader {
sourceComponent: popupMenu.delegate
onLoaded: {
item.action.text = model.name
item.action.assetSettings.name = model.iconName
menu: popupMenu
delegate: StatusAction {
text: model.name
assetSettings.name: model.iconName
onTriggered: {
popupMenu.dismiss()
}
}
}
onMenuItemClicked: {
popupMenu.dismiss()
}
}
}
@ -407,12 +401,14 @@ Column {
hasFloatingButtons: true
advancedHeaderComponent: StatusFloatingButtonsSelector {
id: floatingHeader
model: dummyAccountsModel
delegate: Rectangle {
width: button.width
height: button.height
radius: 8
visible: visibleIndices.includes(index)
visible: floatingHeader.visibleIndices.includes(index)
color: Theme.palette.statusAppLayout.backgroundColor
StatusButton {
id: button
@ -431,29 +427,23 @@ Column {
}
}
}
popupMenuDelegate: StatusListItem {
implicitWidth: 272
title: name
onClicked: floatingHeader.itemSelected(index)
visible: !visibleIndices.includes(index)
onClicked: floatingHeader.selectItem(index)
}
}
}
ListModel {
id: dummyAccountsModel
ListElement{name: "Account 1"; iconName: "filled-account"; emoji: "🥑"}
ListElement{name: "Account 2"; iconName: "filled-account"}
ListElement{name: "Account 1"; iconName: "filled-account"; emoji: "🥑" }
ListElement{name: "Account 2"; iconName: "filled-account"; emoji: "🚀" }
ListElement{name: "Account 3"; iconName: "filled-account"}
ListElement{name: "Account 4"; iconName: "filled-account"}
ListElement{name: "Account 5"; iconName: "filled-account"}
ListElement{name: "Account 6"; iconName: "filled-account"}
ListElement{name: "Account 7"; iconName: "filled-account"}
}
StatusSpellcheckingMenuItems {
id: spellMenu
anchors.centerIn: parent
suggestions: ["suggestion1", "suggestion2", "suggestion3", "suggestion4"]
}
}

View File

@ -81,28 +81,28 @@ StatusSectionLayout {
contextMenu.openHandler = originalOpenHandler
contextMenu.popup(-contextMenu.width + menuButton.width, menuButton.height + 4)
}
StatusPopupMenu {
StatusMenu {
id: contextMenu
StatusMenuItem {
StatusAction {
text: "Mute Chat"
icon.name: "notification"
}
StatusMenuItem {
StatusAction {
text: "Mark as Read"
icon.name: "checkmark-circle"
}
StatusMenuItem {
StatusAction {
text: "Clear History"
icon.name: "close-circle"
}
StatusMenuSeparator {}
StatusMenuItem {
StatusAction {
text: "Leave Chat"
icon.name: "arrow-left"
type: StatusMenuItem.Type.Danger
type: StatusAction.Type.Danger
}
}
}
@ -210,7 +210,7 @@ StatusSectionLayout {
}
}
popupMenu: StatusPopupMenu {
popupMenu: StatusMenu {
property string chatId
@ -218,34 +218,34 @@ StatusSectionLayout {
chatId = id
}
StatusMenuItem {
StatusAction {
text: "View Profile"
icon.name: "group-chat"
}
StatusMenuSeparator {}
StatusMenuItem {
StatusAction {
text: "Mute chat"
icon.name: "notification"
}
StatusMenuItem {
StatusAction {
text: "Mark as Read"
icon.name: "checkmark-circle"
}
StatusMenuItem {
StatusAction {
text: "Clear history"
icon.name: "close-circle"
}
StatusMenuSeparator {}
StatusMenuItem {
StatusAction {
text: "Delete chat"
icon.name: "delete"
type: StatusMenuItem.Type.Danger
type: StatusAction.Type.Danger
}
}
}

View File

@ -113,8 +113,23 @@ StatusSectionLayout {
}
StatusSearchLocationMenu {
id: searchPopupMenu
searchPopup: searchPopup
locationModel: Models.optionsModel
onResetSearchSelection: {
searchPopup.resetSearchSelection()
}
onSetSearchSelection: {
searchPopup.setSearchSelection(text,
secondaryText,
imageSource,
isIdenticon,
iconName,
iconColor,
isUserIcon,
colorId,
colorHash)
}
}
}
@ -134,21 +149,21 @@ StatusSectionLayout {
chatInfoButton.asset.color: Theme.palette.miscColor6
chatInfoButton.onClicked: { chatInfoButtonClicked(); }
popupMenu: StatusPopupMenu {
popupMenu: StatusMenu {
StatusMenuItem {
StatusAction {
text: "Create channel"
icon.name: "channel"
}
StatusMenuItem {
StatusAction {
text: "Create category"
icon.name: "channel-category"
}
StatusMenuSeparator {}
StatusMenuItem {
StatusAction {
text: "Invite people"
icon.name: "share-ios"
}
@ -178,7 +193,7 @@ StatusSectionLayout {
showCategoryActionButtons: true
categoryPopupMenu: StatusPopupMenu {
categoryPopupMenu: StatusMenu {
property string categoryId
@ -186,72 +201,72 @@ StatusSectionLayout {
categoryId = id
}
StatusMenuItem {
StatusAction {
text: "Mute Category"
icon.name: "notification"
}
StatusMenuItem {
StatusAction {
text: "Mark as Read"
icon.name: "checkmark-circle"
}
StatusMenuItem {
StatusAction {
text: "Edit Category"
icon.name: "edit"
}
StatusMenuSeparator {}
StatusMenuItem {
StatusAction {
text: "Delete Category"
icon.name: "delete"
type: StatusMenuItem.Type.Danger
type: StatusAction.Type.Danger
}
}
chatListPopupMenu: StatusPopupMenu {
chatListPopupMenu: StatusMenu {
property string chatId
StatusMenuItem {
StatusAction {
text: "Mute chat"
icon.name: "notification"
}
StatusMenuItem {
StatusAction {
text: "Mark as Read"
icon.name: "checkmark-circle"
}
StatusMenuItem {
StatusAction {
text: "Clear history"
icon.name: "close-circle"
}
StatusMenuSeparator {}
StatusMenuItem {
StatusAction {
text: "Delete chat"
icon.name: "delete"
type: StatusMenuItem.Type.Danger
type: StatusAction.Type.Danger
}
}
popupMenu: StatusPopupMenu {
StatusMenuItem {
popupMenu: StatusMenu {
StatusAction {
text: "Create channel"
icon.name: "channel"
}
StatusMenuItem {
StatusAction {
text: "Create category"
icon.name: "channel-category"
}
StatusMenuSeparator {}
StatusMenuItem {
StatusAction {
text: "Invite people"
icon.name: "share-ios"
}

View File

@ -22,6 +22,7 @@ QtObject {
active: false
position: 0
isCategory: false
hasSubItems: false
subItems: []
}
ListElement {
@ -40,6 +41,7 @@ QtObject {
active: false
position: 1
isCategory: false
hasSubItems: false
subItems: []
}
ListElement {
@ -59,6 +61,7 @@ QtObject {
active: true
position: 2
isCategory: false
hasSubItems: false
subItems: []
}
ListElement {
@ -77,6 +80,7 @@ QtObject {
active: false
position: 3
isCategory: false
hasSubItems: false
subItems: []
}
ListElement {
@ -95,6 +99,7 @@ QtObject {
active: false
position: 4
isCategory: false
hasSubItems: false
subItems: []
}
ListElement {
@ -113,6 +118,7 @@ QtObject {
active: false
position: 5
isCategory: false
hasSubItems: false
subItems: []
}
}
@ -133,6 +139,7 @@ QtObject {
active: false
position: 0
isCategory: true
hasSubItems: false
subItems: []
}
ListElement {
@ -149,6 +156,7 @@ QtObject {
active: false
position: 0
isCategory: false
hasSubItems: false
subItems: []
}
ListElement {
@ -165,6 +173,7 @@ QtObject {
active: true
position: 1
isCategory: true
hasSubItems: true
subItems: [
ListElement {
itemId: "x012340002"
@ -210,6 +219,7 @@ QtObject {
active: false
position: 2
isCategory: true
hasSubItems: true
subItems: [
ListElement {
itemId: "x012340005"
@ -357,6 +367,8 @@ QtObject {
imageSource: ""
iconName: "chat"
iconColor: ""
isIdenticon: false
hasSubItems: true
subItems: [
ListElement {
value: "sub_item_1_1"
@ -373,12 +385,23 @@ QtObject {
iconName: ""
iconColor: ""
}]}
ListElement {
value: "item_1"
title: "No submenu"
imageSource: ""
iconName: "airdrop"
isIdenticon: false
hasSubItems: false
subItems: []
}
ListElement {
value: "item_2"
title: "Community item";
imageSource: "qrc:/demoapp/data/profile-image-1.jpeg"
iconName: ""
iconColor: ""
isIdenticon: false
hasSubItems: true
subItems: [
ListElement {
value: "sub_item_2_1"
@ -407,6 +430,8 @@ QtObject {
imageSource: "";
iconName: "info"
iconColor: ""
isIdenticon: false
hasSubItems: true
subItems: [
ListElement {
value: "sub_item_3_1"
@ -421,6 +446,8 @@ QtObject {
imageSource: "";
iconName: ""
iconColor: "red"
isIdenticon: false
hasSubItems: true
subItems: [
ListElement {
value: "sub_item_4_1"

View File

@ -312,7 +312,7 @@ StatusWindow {
}
StatusListSectionHeadline { text: "StatusQ.Popup" }
StatusNavigationListItem {
title: "StatusPopupMenu"
title: "StatusMenu"
selected: viewLoader.source.toString().includes(title)
onClicked: mainPageView.page(title);
}

View File

@ -18,21 +18,21 @@ GridLayout {
chatInfoButton.asset.name: "qrc:/demoapp/data/profile-image-1.jpeg"
chatInfoButton.asset.color: Theme.palette.miscColor6
popupMenu: StatusPopupMenu {
popupMenu: StatusMenu {
StatusMenuItem {
StatusAction {
text: "Create channel"
icon.name: "channel"
}
StatusMenuItem {
StatusAction {
text: "Create category"
icon.name: "channel-category"
}
StatusMenuSeparator {}
StatusMenuItem {
StatusAction {
text: "Invite people"
icon.name: "share-ios"
}

View File

@ -249,7 +249,7 @@ ColumnLayout {
implicitWidth: customHeaderText.width * 2
border.width: 2
color: Theme.palette.statusPopupMenu.hoverBackgroundColor
color: Theme.palette.statusMenu.hoverBackgroundColor
StatusBaseText {
id: customHeaderText
@ -263,7 +263,7 @@ ColumnLayout {
implicitWidth: customHeaderText.width * 2
border.width: 2
color: Theme.palette.statusPopupMenu.hoverBackgroundColor
color: Theme.palette.statusMenu.hoverBackgroundColor
StatusBaseText {
id: customFooter

View File

@ -2,11 +2,15 @@ import QtQuick 2.14
import QtQuick.Layouts 1.14
import QtQuick.Controls 2.13
import Qt.labs.qmlmodels 1.0
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import StatusQ.Popups 0.1
import "../demoapp/data" 1.0
GridLayout {
columns: 1
columnSpacing: 5
@ -22,8 +26,8 @@ GridLayout {
onClicked: complexMenu.popup()
}
StatusButton {
id: customPopupButton
text: "Menu with custom images and icons"
onClicked: customMenu.popup()
}
@ -33,103 +37,124 @@ GridLayout {
onClicked: differentFontMenu.popup()
}
StatusButton {
text: "StatusSearchLocationMenu"
onClicked: searchPopupMenu.popup()
StatusPopupMenu {
StatusSearchLocationMenu {
id: searchPopupMenu
locationModel: Models.optionsModel
}
}
StatusMenu {
id: simpleMenu
StatusMenuItem {
StatusAction {
text: "One"
}
StatusMenuItem {
StatusAction {
text: "Two"
}
StatusMenuItem {
StatusAction {
text: "Three"
}
}
StatusPopupMenu {
StatusMenu {
id: complexMenu
subMenuItemIcons: [{ icon: 'info' }]
hideDisabledItems: false
StatusMenuItem {
StatusAction {
text: "One"
assetSettings.name: "info"
}
StatusMenuSeparator {}
StatusMenuItem {
StatusAction {
text: "Two"
assetSettings.name: "info"
}
StatusMenuItem {
text: "Three"
StatusMenu {
title: "Two"
assetSettings.name: "info"
}
StatusPopupMenu {
title: "Four"
StatusMenuItem {
StatusAction {
text: "One"
assetSettings.name: "info"
}
StatusMenuItem {
StatusAction {
text: "Three"
assetSettings.name: "info"
}
}
StatusAction {
text: "Disabled"
assetSettings.name: "info"
enabled: false
}
StatusAction {
text: "Danger"
type: StatusAction.Type.Danger
}
}
StatusPopupMenu {
StatusMenu {
id: customMenu
subMenuItemIcons: [
{ icon: "chat" },
{
source: "qrc:/demoapp/data/profile-image-1.jpeg"
},
{
isLetterIdenticon: true,
color: "red"
}
]
StatusMenuItem {
StatusAction {
text: "Anywhere"
}
StatusMenuSeparator {}
StatusPopupMenu {
title: "Chat"
StatusMenu {
title: "Chat"
assetSettings.name: "chat"
StatusMenuItem {
StatusAction {
text: "vitalik.eth"
assetSettings.isImage: true
assetSettings.imgIsIdenticon: true
assetSettings.name: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAlklEQVR4nOzW0QmDQBAG4SSkl7SUQlJGCrElq9F3QdjjVhh/5nv3cFhY9vUIYQiNITSG0Bh
CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2ImYgiNITTlTdG1nUZ5a92VITQxITFiJmIIjSE0htAYQrMHAAD//+wwFVpz+yqXAAAAAElFTkSuQmCC"
assetSettings.imgIsIdenticon: true
}
StatusMenuItem {
StatusAction {
text: "Pascal"
assetSettings.isImage: true
assetSettings.name: "qrc:/demoapp/data/profile-image-1.jpeg"
ringSettings.ringSpecModel:
ListModel {
ListElement { colorId: 13; segmentLength: 5 }
ListElement { colorId: 31; segmentLength: 5 }
ListElement { colorId: 10; segmentLength: 1 }
ListElement { colorId: 2; segmentLength: 5 }
ListElement { colorId: 26; segmentLength: 2 }
ListElement { colorId: 19; segmentLength: 4 }
ListElement { colorId: 28; segmentLength: 3 }
}
ringSettings.distinctiveColors: Theme.palette.identiconRingColors
}
}
StatusPopupMenu {
StatusMenu {
title: "Cryptokitties"
assetSettings.isImage: true
assetSettings.name: "qrc:/demoapp/data/profile-image-1.jpeg"
StatusMenuItem {
StatusAction {
text: "welcome"
assetSettings.name: "channel"
assetSettings.color: Theme.palette.directColor1
}
StatusMenuItem {
StatusAction {
text: "support"
assetSettings.name: "channel"
assetSettings.color: Theme.palette.directColor1
@ -137,37 +162,39 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I
StatusMenuHeadline { text: "Public" }
StatusMenuItem {
StatusAction {
text: "news"
assetSettings.name: "channel"
assetSettings.color: Theme.palette.directColor1
}
}
StatusPopupMenu {
StatusMenu {
title: "Another community"
assetSettings.isLetterIdenticon: true
assetSettings.color: "red"
StatusMenuItem {
StatusAction {
text: "welcome"
assetSettings.isLetterIdenticon: true
assetSettings.bgColor: "red"
assetSettings.color: "blue"
}
}
}
StatusPopupMenu {
StatusMenu {
id: differentFontMenu
StatusMenuItem {
StatusAction {
text: "Bold"
fontSettings.bold: true
}
StatusMenuItem {
StatusAction {
text: "Italic"
fontSettings.italic: true
}
StatusMenuItem {
StatusAction {
text: "16px"
fontSettings.pixelSize: 16
}

View File

@ -40,27 +40,18 @@ Column {
label: "Some label"
model: commmonModel
selectMenu.delegate: StatusMenuItemDelegate {
statusPopupMenu: select
action: StatusMenuItem {
assetSettings.name: "filled-account"
text: name
onTriggered: {
selectedItem.text = name
}
menuDelegate: StatusAction {
assetSettings.name: "filled-account"
text: name
onTriggered: {
selectedItem.text = name
}
}
selectedItemComponent: Item {
selectedItemComponent: StatusBaseText {
id: selectedItem
anchors.fill: parent
property string text: ""
StatusBaseText {
text: selectedItem.text
anchors.centerIn: parent
color: Theme.palette.directColor1
}
Layout.alignment: Qt.AlignCenter
color: Theme.palette.directColor1
}
}
}

View File

@ -61,7 +61,7 @@
<file>pages/StatusMacNotificationPage.qml</file>
<file>pages/StatusPasswordStrengthIndicatorPage.qml</file>
<file>pages/StatusPinInputPage.qml</file>
<file>pages/StatusPopupMenuPage.qml</file>
<file>pages/StatusMenuPage.qml</file>
<file>pages/StatusSelectPage.qml</file>
<file>pages/StatusTabBarButtonPage.qml</file>
<file>pages/StatusTabBarIconButtonPage.qml</file>

View File

@ -238,7 +238,7 @@ Item {
anchors.top: btn.bottom
anchors.topMargin: 4
visible: false
color: Theme.palette.statusPopupMenu.backgroundColor
color: Theme.palette.statusMenu.backgroundColor
radius: 8
layer.enabled: true
layer.effect: DropShadow {
@ -281,7 +281,7 @@ Item {
id: header
width: content.itemWidth
height: searchInput.height + 24
color: Theme.palette.statusPopupMenu.backgroundColor
color: Theme.palette.statusMenu.backgroundColor
z: 3 // Above delegate (z=1) and above section.delegate (z = 2)
StatusInput {

View File

@ -19,7 +19,7 @@ Loader {
property StatusIdenticonRingSettings ringSettings: StatusIdenticonRingSettings {
initalAngleRad: 0
ringPxSize: Math.max(1.5, root.asset.width/ 24.0)
ringPxSize: root.asset.ringPxSize
distinctiveColors: Theme.palette.identiconRingColors
}
@ -28,9 +28,12 @@ Loader {
Component {
id: roundedImage
Item {
width: root.asset.width
height: root.asset.height
StatusRoundedImage {
id: statusRoundImage
width: parent.width

View File

@ -367,7 +367,7 @@ Item {
anchors.fill: parent
anchors.margins: 8
visible: (root.sortedList.count > 0)
color: Theme.palette.statusPopupMenu.backgroundColor
color: Theme.palette.statusMenu.backgroundColor
radius: 8
layer.enabled: true
layer.effect: DropShadow {

View File

@ -32,7 +32,7 @@ QC.Popup {
closePolicy: QC.Popup.CloseOnPressOutside | QC.Popup.CloseOnEscape
background: Rectangle {
id: border
color: Theme.palette.statusPopupMenu.backgroundColor
color: Theme.palette.statusMenu.backgroundColor
radius: 8
border.color: "transparent"
layer.enabled: true

View File

@ -7,6 +7,8 @@ import StatusQ.Components 0.1
import StatusQ.Controls 0.1
import StatusQ.Popups 0.1
import SortFilterProxyModel 0.2
/*!
\qmltype StatusModalFloatingButtonsSelector
\inherits Row
@ -40,7 +42,7 @@ import StatusQ.Popups 0.1
For a list of components available see StatusQ.
*/
Row {
id: floatingButtons
id: root
/*!
\qmlproperty repeater
@ -63,7 +65,7 @@ Row {
Can be used to assign delegate to the popupmenu
\endqml
*/
property alias popupMenuDelegate: popupMenuSelectionRepeater.delegate
property alias popupMenuDelegate: popupMenuSelectionInstantiator.delegate
/*!
\qmlproperty model
@ -87,9 +89,9 @@ Row {
*/
property int currentIndex: 0
function itemSelected(index) {
visibleIndices = [0,1,index]
floatingButtons.currentIndex = index
function selectItem(index) {
visibleIndices = [0, 1, visibleIndices.length + index]
root.currentIndex = index
popupMenu.close()
}
@ -97,16 +99,29 @@ Row {
spacing: 12
clip: true
SortFilterProxyModel {
id: menuModel
sourceModel: root.model
filters: [
ExpressionFilter {
enabled: root.visibleIndices.length > 0
expression: !root.visibleIndices.includes(index)
}
]
}
Repeater {
id: itemSelectionRepeater
model: floatingButtons.model
model: root.model
}
Rectangle {
width: button.width
height: button.height
radius: 8
visible: floatingButtons.model.count > 3
visible: root.model.count > 3
color: Theme.palette.statusAppLayout.backgroundColor
StatusButton {
id: button
@ -118,7 +133,7 @@ Row {
normalColor: Theme.palette.baseColor3
asset.name: "more"
asset.bgColor: "transparent"
onClicked: popupMenu.popup(parent.x, y + height + 8)
onClicked: popupMenu.popup(parent.x + 4, y + height + 4)
}
}
@ -128,15 +143,14 @@ Row {
Layout.fillWidth: true
}
StatusPopupMenu {
StatusMenu {
id: popupMenu
width: layout.width
ColumnLayout {
id: layout
Repeater {
id: popupMenuSelectionRepeater
model: floatingButtons.model
}
width: implicitWidth
StatusMenuInstantiator {
id: popupMenuSelectionInstantiator
model: menuModel
menu: popupMenu
}
}
}

View File

@ -42,7 +42,7 @@ ItemDelegate {
background: Rectangle {
color: root.highlighted
? Theme.palette.statusPopupMenu.hoverBackgroundColor
? Theme.palette.statusMenu.hoverBackgroundColor
: "transparent"
MouseArea {

View File

@ -196,14 +196,14 @@ Item {
anchors.topMargin: 4
visible: ((seedSuggestionsList.count > 0) && seedWordInput.input.edit.activeFocus)
Rectangle {
id: statusPopupMenuBackgroundContent
id: statusMenuBackgroundContent
anchors.fill: parent
color: Theme.palette.statusPopupMenu.backgroundColor
color: Theme.palette.statusMenu.backgroundColor
radius: 8
layer.enabled: true
layer.effect: DropShadow {
anchors.fill: parent
source: statusPopupMenuBackgroundContent
source: statusMenuBackgroundContent
horizontalOffset: 0
verticalOffset: 4
radius: 12

View File

@ -22,6 +22,7 @@ Item {
readonly property int labelMargin: 7
property var model
property alias selectMenu: selectMenu
property alias menuDelegate: menuInstantiator.delegate
property color bgColorHover: bgColor
// TODO: Fix the indirect handling of children
property alias selectedItemComponent: selectedItemContainer.children
@ -53,10 +54,9 @@ Item {
}
Rectangle {
property bool hovered: false
id: inputRectangle
height: selectedItemContainer.implicitHeight
color: hovered ? bgColorHover : bgColor
height: Math.max(56, selectedItemContainer.implicitHeight)
color: mouseArea.containsMouse ? bgColorHover : bgColor
radius: 8
anchors.top: root.hasLabel ? inputLabel.bottom : parent.top
anchors.topMargin: root.hasLabel ? root.labelMargin : 0
@ -103,26 +103,31 @@ Item {
}
}
StatusPopupMenu {
StatusMenu {
id: selectMenu
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
width: parent.width
Repeater {
id: menuItems
model: root.model
StatusMenuInstantiator {
id: menuInstantiator
property int zeroItemsViewHeight
delegate: selectMenu.delegate
onItemAdded: {
menu: selectMenu
model: root.model
onObjectAdded: {
root.zeroItemsView.visible = false
root.zeroItemsView.height = 0
}
onItemRemoved: {
onObjectRemoved: {
if (count === 0) {
root.zeroItemsView.visible = true
root.zeroItemsView.height = zeroItemsViewHeight
}
}
Component.onCompleted: {
zeroItemsViewHeight = root.zeroItemsView.height
root.zeroItemsView.visible = count === 0
@ -152,12 +157,6 @@ Item {
anchors.fill: inputRectangle
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
onEntered: {
inputRectangle.hovered = true
}
onExited: {
inputRectangle.hovered = false
}
onClicked: {
if (selectMenu.opened) {
selectMenu.close()

View File

@ -34,4 +34,7 @@ QtObject {
property bool isImage: false
property int imgStatus
property bool imgIsIdenticon: false
// ring settings hints
readonly property real ringPxSize: Math.max(1.5, root.width / 24.0)
}

View File

@ -55,8 +55,9 @@ QtObject {
/*!
\qmlproperty real StatusIdenticonRingSettings::initalAngleRad
This property provides the initial angle, in radians, the identicon ring will start rendering the line.
Defaults to 0.
*/
property real initalAngleRad
property real initalAngleRad: 0
/*!
\qmlproperty real StatusIdenticonRingSettings::ringPxSize

View File

@ -3,6 +3,7 @@ import StatusQ.Core.Theme 0.1
QtObject {
id: root
property int width
property int height
property bool isIdenticon: false
@ -28,7 +29,7 @@ QtObject {
readonly property StatusIdenticonRingSettings ringSettings: StatusIdenticonRingSettings {
initalAngleRad: 0
ringPxSize: Math.max(1.5, root.width / 24.0)
ringPxSize: root.assetSettings.ringPxSize
ringSpecModel: root.showRing ? root.colorHash : undefined
distinctiveColors: Theme.palette.identiconRingColors
}

View File

@ -126,7 +126,7 @@ ThemePalette {
property color backgroundColor: baseColor3
}
property QtObject statusPopupMenu: QtObject {
property QtObject statusMenu: QtObject {
property color backgroundColor: baseColor2
property color hoverBackgroundColor: directColor7
property color separatorColor: directColor7

View File

@ -124,7 +124,7 @@ ThemePalette {
property color backgroundColor: white
}
property QtObject statusPopupMenu: QtObject {
property QtObject statusMenu: QtObject {
property color backgroundColor: white
property color hoverBackgroundColor: baseColor2
property color separatorColor: baseColor2

View File

@ -213,7 +213,7 @@ QtObject {
property color hoverBackgroundColor
}
property QtObject statusPopupMenu: QtObject {
property QtObject statusMenu: QtObject {
property color backgroundColor
property color hoverBackgroundColor
property color separatorColor

View File

@ -0,0 +1,42 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
Action {
id: root
enum Type {
Normal,
Danger
}
property int type: StatusAction.Type.Normal
property StatusAssetSettings assetSettings: StatusAssetSettings {
width: 18
height: 18
rotation: 0
isLetterIdenticon: false
imgIsIdenticon: false
color: root.icon.color
name: root.icon.name
}
property StatusFontSettings fontSettings: StatusFontSettings {}
property StatusIdenticonRingSettings ringSettings: StatusIdenticonRingSettings {
initalAngleRad: 0
ringPxSize: root.assetSettings.ringPxSize
distinctiveColors: Theme.palette.identiconRingColors
}
icon.color: {
if (!root.enabled)
return Theme.palette.baseColor1
if (type === StatusAction.Type.Danger)
return Theme.palette.dangerColor1
return Theme.palette.primaryColor1
}
}

View File

@ -0,0 +1,111 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtGraphicalEffects 1.13
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Components 0.1
import StatusQ.Popups 0.1
/*!
To create menu elements from a model, use Instantiator:
\qml
StatusMenu {
id: myMenu
StatusMenuInstantiator {
model: myModel
menu: myMenu
delegate: StatusAction {
text: model.text
assetSettings.name: model.iconName
onTriggered: {
popupMenu.dismiss()
}
}
}
}
\endqml
*/
Menu {
id: root
readonly property color defaultIconColor: Theme.palette.primaryColor1
property StatusAssetSettings assetSettings: StatusAssetSettings {
width: 18
height: 18
rotation: 0
isLetterIdenticon: false
isImage: false
color: root.defaultIconColor
}
property StatusFontSettings fontSettings: StatusFontSettings {}
property StatusIdenticonRingSettings ringSettings: StatusIdenticonRingSettings {
ringPxSize: root.assetSettings.ringPxSize
distinctiveColors: Theme.palette.identiconRingColors
}
property bool hideDisabledItems: true
property var openHandler
property var closeHandler
signal menuItemClicked(int menuIndex)
dim: false
closePolicy: Popup.CloseOnPressOutside | Popup.CloseOnEscape
topPadding: 8
bottomPadding: 8
bottomMargin: 16
onOpened: {
if (typeof openHandler === "function") {
openHandler()
}
}
onClosed: {
if (typeof closeHandler === "function") {
closeHandler()
}
}
delegate: StatusMenuItem {
visible: root.hideDisabledItems ? enabled : true
height: visible ? implicitHeight : 0
}
contentItem: StatusListView {
currentIndex: root.currentIndex
implicitHeight: contentHeight
implicitWidth: contentWidth
interactive: contentHeight > availableHeight
model: root.contentModel
}
background: Rectangle {
id: backgroundContent
implicitWidth: 176
color: Theme.palette.statusMenu.backgroundColor
radius: 8
layer.enabled: true
layer.effect: DropShadow {
width: backgroundContent.width
height: backgroundContent.height
x: backgroundContent.x
visible: backgroundContent.visible
source: backgroundContent
horizontalOffset: 0
verticalOffset: 4
radius: 12
samples: 25
spread: 0.2
color: Theme.palette.dropShadow
}
}
}

View File

@ -0,0 +1,27 @@
import QtQuick 2.14
import QtQuick.Controls 2.14
import QtQml.Models 2.14
Instantiator {
id: root
property Menu menu
onObjectAdded: {
if (object instanceof Menu)
menu.addMenu(object)
else if (object instanceof Action)
menu.addAction(object)
else
menu.addItem(object)
}
onObjectRemoved: {
if (object instanceof Menu)
menu.removeMenu(object)
else if (object instanceof Action)
menu.removeAction(object)
else
menu.removeItem(object)
}
}

View File

@ -1,25 +1,171 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Components 0.1
import StatusQ.Popups 0.1
Action {
id: statusMenuItem
MenuItem {
id: root
enum Type {
Normal,
Danger
implicitWidth: parent ? parent.width : 0
implicitHeight: 38
objectName: action ? action.objectName : "StatusMenuItemDelegate"
spacing: 4
horizontalPadding: 8
QtObject {
id: d
readonly property bool isSubMenu: !!root.subMenu
readonly property bool isStatusSubMenu: isSubMenu && (root.subMenu instanceof StatusMenu)
readonly property bool subMenuOpened: isSubMenu && root.subMenu.opened
readonly property bool hasAction: !!root.action
readonly property bool isStatusAction: d.hasAction && (root.action instanceof StatusAction)
readonly property bool isStatusDangerAction: d.isStatusAction && root.action.type === StatusAction.Type.Danger
readonly property StatusAssetSettings originalAssetSettings: d.isStatusSubMenu && root.subMenu.assetSettings
? root.subMenu.assetSettings
: d.isStatusAction && root.action.assetSettings
? root.action.assetSettings
: d.defaultAssetSettings
readonly property StatusAssetSettings assetSettings: StatusAssetSettings {
// overriden properties
readonly property int letterSize: 11
//icon
readonly property string name: d.originalAssetSettings.name
readonly property url source: d.originalAssetSettings.source
readonly property real width: d.originalAssetSettings.width
readonly property real height: d.originalAssetSettings.height
readonly property color color: d.originalAssetSettings.color
readonly property color hoverColor: d.originalAssetSettings.hoverColor
readonly property color disabledColor: d.originalAssetSettings.disabledColor
readonly property int rotation: d.originalAssetSettings.rotation
readonly property bool isLetterIdenticon: d.originalAssetSettings.isLetterIdenticon
readonly property int charactersLen: d.originalAssetSettings.charactersLen
readonly property string emoji: d.originalAssetSettings.emoji
readonly property string emojiSize: d.originalAssetSettings.emojiSize
//icon b
readonly property real bgWidth: d.originalAssetSettings.bgWidth
readonly property real bgHeight: d.originalAssetSettings.bgHeight
readonly property int bgRadius: d.originalAssetSettings.bgRadius
readonly property color bgColor: d.originalAssetSettings.bgColor
//image
readonly property bool isImage: d.originalAssetSettings.isImage
readonly property int imgStatus: d.originalAssetSettings.imgStatus
readonly property bool imgIsIdenticon: d.originalAssetSettings.imgIsIdenticon
// crop
readonly property rect cropRect: d.originalAssetSettings.cropRect
}
readonly property StatusFontSettings fontSettings: d.isStatusSubMenu
? root.subMenu.fontSettings
: d.isStatusAction
? root.action.fontSettings
: d.defaultFontSettings
readonly property StatusIdenticonRingSettings ringSettings: d.isStatusSubMenu
? root.subMenu.ringSettings
: d.isStatusAction
? root.action.ringSettings
: d.defaultRingSettings
readonly property StatusAssetSettings defaultAssetSettings: StatusAssetSettings {
width: 18
height: 18
rotation: 0
// Link to standard Qt properties. Not because it's a good idea,
// but because it we use it in some places and it will make refactor easier.
name: d.isSubMenu ? "" : root.action.icon.name
source: d.isSubMenu ? "" : root.action.icon.source
color: d.isSubMenu ? "" : root.action.icon.color
}
readonly property StatusFontSettings defaultFontSettings: StatusFontSettings {
pixelSize: 13
bold: false
italic: false
}
readonly property StatusIdenticonRingSettings defaultRingSettings: StatusIdenticonRingSettings {
ringPxSize: d.assetSettings.ringPxSize
distinctiveColors: Theme.palette.identiconRingColors
}
}
icon.color: "transparent"
property int type: StatusMenuItem.Type.Normal
property real iconRotation: 0
property StatusAssetSettings assetSettings: StatusAssetSettings {
width: 16
indicator: Item {
x: root.mirrored ? root.width - width - root.rightPadding : root.leftPadding
y: root.topPadding + (root.availableHeight - height) / 2
implicitWidth: 24
implicitHeight: 24
visible: d.assetSettings.isLetterIdenticon
|| d.assetSettings.isImage
|| !!d.assetSettings.name
StatusSmartIdenticon {
anchors.centerIn: parent
active: parent.visible
name: root.text
asset: d.assetSettings
ringSettings: d.ringSettings
}
}
contentItem: StatusBaseText {
readonly property real arrowPadding: root.spacing + (root.subMenu && root.arrow ? root.arrow.width : 0)
readonly property real indicatorPadding: root.spacing + (root.indicator.visible ? root.indicator.width : 0)
leftPadding: !root.mirrored ? indicatorPadding : arrowPadding
rightPadding: root.mirrored ? indicatorPadding : arrowPadding
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
text: root.text
color: !root.enabled ? Theme.palette.baseColor1
: d.isStatusDangerAction ? Theme.palette.dangerColor1 : Theme.palette.directColor1
font.pixelSize: d.fontSettings.pixelSize
font.bold: d.fontSettings.bold
font.italic: d.fontSettings.italic
elide: Text.ElideRight
}
arrow: StatusIcon {
id: arrowIcon
x: root.mirrored ? root.leftPadding : root.width - width - root.rightPadding
y: root.topPadding + (root.availableHeight - height) / 2
height: 16
color: "transparent"
isLetterIdenticon: false
imgIsIdenticon: false
name: statusMenuItem.icon.name
visible: d.isSubMenu
icon: "next"
color: Theme.palette.directColor1
}
property StatusFontSettings fontSettings: StatusFontSettings {}
background: Rectangle {
color: {
if (!root.hovered && !d.subMenuOpened)
return "transparent"
if (d.isStatusDangerAction)
return Theme.palette.dangerColor3;
return Theme.palette.statusMenu.hoverBackgroundColor;
}
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
acceptedButtons: Qt.NoButton
hoverEnabled: root.enabled
}
}

View File

@ -1,193 +0,0 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Components 0.1
import StatusQ.Popups 0.1
MenuItem {
id: statusPopupMenuItem
implicitWidth: parent ? parent.width : 0
implicitHeight: action.enabled ? 34 : 0
objectName: action.objectName
property int subMenuIndex
property var statusPopupMenu: null
Component.onCompleted: {
if (!!subMenu) {
subMenuIndex = statusPopupMenu.menuItemCount
statusPopupMenu.menuItemCount += 1
}
}
action: StatusMenuItem {
onTriggered: { statusPopupMenu.menuItemClicked(statusPopupMenuItem.subMenuIndex); }
}
Component {
id: indicatorComponent
Item {
implicitWidth: 24
implicitHeight: 24
StatusIcon {
anchors.centerIn: parent
width: {
let width = statusPopupMenuItem.action && statusPopupMenuItem.action.assetSettings.width
return !!width ? width : 18
}
rotation: !!statusPopupMenuItem.action.iconRotation ? statusPopupMenuItem.action.iconRotation : 0
icon: {
if (statusPopupMenuItem.subMenu && !!statusPopupMenu.subMenuItemIcons[statusPopupMenuItem.subMenuIndex] &&
statusPopupMenu.subMenuItemIcons[statusPopupMenuItem.subMenuIndex].icon.toString() !== "") {
return statusPopupMenu.subMenuItemIcons[statusPopupMenuItem.subMenuIndex].icon;
} else if (!!statusPopupMenuItem.action && statusPopupMenuItem.action.assetSettings.name !== "") {
return statusPopupMenuItem.action.assetSettings.name;
} else if (!!statusPopupMenuItem.action.assetSettings && statusPopupMenuItem.action.assetSettings.name !== "") {
return statusPopupMenuItem.action.assetSettings.name;
} else {
return "";
}
}
color: {
let c = !!statusPopupMenuItem.action.assetSettings && statusPopupMenuItem.action.assetSettings.color
if (!Qt.colorEqual(c, "transparent")) {
return c
}
switch (statusPopupMenuItem.action.type) {
case StatusMenuItem.Type.Danger:
return Theme.palette.dangerColor1
default:
return Theme.palette.primaryColor1
}
}
}
}
}
Component {
id: statusLetterIdenticonCmp
Item {
implicitWidth: 24
implicitHeight: 24
StatusLetterIdenticon {
anchors.centerIn: parent
width: 16
height: 16
color: {
let subMenuItemIcon = statusPopupMenu.subMenuItemIcons[statusPopupMenuItem.subMenuIndex]
return subMenuItemIcon && subMenuItemIcon.color ? subMenuItemIcon.color : statusPopupMenuItem.action.assetSettings.bgColor
}
name: statusPopupMenuItem.text
letterSize: 11
}
}
}
Component {
id: statusRoundImageCmp
Item {
implicitWidth: 24
implicitHeight: 24
StatusRoundedImage {
anchors.centerIn: parent
width: statusPopupMenuItem.action.assetSettings.width
height: statusPopupMenuItem.action.assetSettings.height
image.source: statusPopupMenuItem.subMenu ?
statusPopupMenu.subMenuItemIcons[statusPopupMenuItem.subMenuIndex].source :
statusPopupMenuItem.action.assetSettings.name
border.width: (statusPopupMenuItem.subMenu && statusPopupMenu.subMenuItemIcons[statusPopupMenuItem.subMenuIndex].isIdenticon) ||
statusPopupMenuItem.action.assetSettings.imgIsIdenticon ? 1 : 0
border.color: Theme.palette.directColor7
}
}
}
indicator: Loader {
sourceComponent: {
let subMenuItemIcon = statusPopupMenu.subMenuItemIcons && statusPopupMenu.subMenuItemIcons[parent.subMenuIndex]
if ((parent.subMenu && subMenuItemIcon && statusPopupMenu.subMenuItemIcons[parent.subMenuIndex].source) ||
statusPopupMenuItem.action.assetSettings && !!statusPopupMenuItem.action.assetSettings.name.toString()
&& statusPopupMenuItem.action.assetSettings.isImage) {
return statusRoundImageCmp
}
return (parent.subMenu && subMenuItemIcon && subMenuItemIcon.isLetterIdenticon) ||
(statusPopupMenuItem.action.assetSettings && statusPopupMenuItem.action.assetSettings.isLetterIdenticon) ?
statusLetterIdenticonCmp : indicatorComponent
}
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 8
active: {
if (enabled) {
let hasIconSettings = !!statusPopupMenuItem.action.assetSettings.name ||
(statusPopupMenuItem.action.assetSettings &&
(!!statusPopupMenuItem.action.assetSettings.name || !!statusPopupMenuItem.action.assetSettings.isLetterIdenticon))
let hasImageSettings = statusPopupMenuItem.action.assetSettings && !!statusPopupMenuItem.action.assetSettings.name.toString()
return enabled && (parent.subMenu && !!statusPopupMenu.subMenuItemIcons[parent.subMenuIndex]) || hasIconSettings || hasImageSettings
}
return false
}
}
contentItem: StatusBaseText {
anchors.left: statusPopupMenuItem.indicator.right
anchors.right: arrowIcon.visible ? arrowIcon.left : arrowIcon.right
anchors.rightMargin: 8
anchors.leftMargin: 4
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
text: statusPopupMenuItem.text
color: {
switch (statusPopupMenuItem.action.type) {
case StatusMenuItem.Type.Danger:
return Theme.palette.dangerColor1
default:
return Theme.palette.directColor1
}
}
font.pixelSize: !!statusPopupMenuItem.action.fontSettings ? statusPopupMenuItem.action.fontSettings.pixelSize : 13
font.bold: !!statusPopupMenuItem.action.fontSettings ? statusPopupMenuItem.action.fontSettings.bold : false
font.italic: !!statusPopupMenuItem.action.fontSettings ? statusPopupMenuItem.action.fontSettings.italic : false
elide: Text.ElideRight
visible: statusPopupMenuItem.action.enabled
}
arrow: StatusIcon {
id: arrowIcon
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: 8
height: 16
visible: statusPopupMenuItem.subMenu
icon: "next"
color: Theme.palette.directColor1
}
background: Rectangle {
color: {
if (statusPopupMenuItem.hovered) {
return statusPopupMenuItem.action.type === StatusMenuItem.Type.Danger ? Theme.palette.dangerColor3 : Theme.palette.statusPopupMenu.hoverBackgroundColor
}
return "transparent"
}
}
MouseArea {
id: sensor
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
hoverEnabled: statusPopupMenuItem.action.enabled
onPressed: mouse.accepted = false
}
}

View File

@ -8,6 +8,6 @@ MenuSeparator {
contentItem: Rectangle {
implicitWidth: 176
implicitHeight: 1
color: Theme.palette.statusPopupMenu.separatorColor
color: Theme.palette.statusMenu.separatorColor
}
}

View File

@ -1,77 +0,0 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtGraphicalEffects 1.13
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Components 0.1
import StatusQ.Popups 0.1
Menu {
id: root
closePolicy: Popup.CloseOnPressOutside | Popup.CloseOnEscape
topPadding: 8
bottomPadding: 8
bottomMargin: 16
property int menuItemCount: 0
property var subMenuItemIcons: []
property var openHandler
property var closeHandler
dim: false
signal menuItemClicked(int menuIndex)
onOpened: {
if (typeof openHandler === "function") {
openHandler()
}
}
onClosed: {
if (typeof closeHandler === "function") {
closeHandler()
}
}
delegate: StatusMenuItemDelegate {
statusPopupMenu: root
}
contentItem: StatusListView {
currentIndex: root.currentIndex
implicitHeight: contentHeight
interactive: contentHeight > availableHeight
model: root.contentModel
}
background: Item {
id: statusPopupMenuBackground
implicitWidth: 176
Rectangle {
id: statusPopupMenuBackgroundContent
implicitWidth: statusPopupMenuBackground.width
implicitHeight: statusPopupMenuBackground.height
color: Theme.palette.statusPopupMenu.backgroundColor
radius: 8
layer.enabled: true
layer.effect: DropShadow {
width: statusPopupMenuBackgroundContent.width
height: statusPopupMenuBackgroundContent.height
x: statusPopupMenuBackgroundContent.x
visible: statusPopupMenuBackgroundContent.visible
source: statusPopupMenuBackgroundContent
horizontalOffset: 0
verticalOffset: 4
radius: 12
samples: 25
spread: 0.2
color: Theme.palette.dropShadow
}
}
}
}

View File

@ -2,153 +2,163 @@ import QtQuick 2.14
import QtQml 2.14
import QtQuick.Controls 2.14
import Qt.labs.qmlmodels 1.0
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Popups 0.1
import StatusQ.Controls 0.1
import StatusQ.Core.Utils 0.1 as StatusQUtils
StatusPopupMenu {
StatusMenu {
id: root
dim: false
property var searchPopup
property var locationModel
readonly property int numDefaultItems: 2
signal itemClicked(string firstLevelItemValue, string secondLevelItemValue)
StatusMenuItem {
signal resetSearchSelection()
signal setSearchSelection(string text,
string secondaryText,
string imageSource,
string isIdenticon,
string iconName,
string iconColor,
var isUserIcon,
int colorId,
string colorHash)
function processTriggeredMenuItem(title,
parentImageSource,
parentIsIdenticon,
parentIconName,
parentIdenticonColoe) {
root.resetSearchSelection()
let menuItem = root.menuAt(root.currentIndex)
root.setSearchSelection(menuItem.title,
"",
menuItem.parentImageSource,
menuItem.parentIsIdenticon,
menuItem.parentIconName,
menuItem.parentIdenticonColor)
//TODO fix error "QML StatusMenu: cannot find any window to open popup in."
root.dismiss()
}
StatusAction {
text: qsTr("Anywhere")
onTriggered: {
searchPopup.resetSearchSelection();
root.resetSearchSelection();
root.itemClicked("", "");
}
}
StatusMenuSeparator { }
//Dummy item to keep seperator in right position
MenuItem { implicitHeight: 0.00001 }
Instantiator {
StatusMenuInstantiator {
model: root.locationModel
delegate: Loader {
sourceComponent: (!!model.subItems && model.subItems.count > 0) ? subMenus : subMenuItemComponent
onLoaded: {
if (!!model.subItems && model.subItems.count > 0) {
item.parentValue = model.value
item.title = model.title;
item.subItemsModel = model.subItems;
item.parentIconName = model.iconName;
item.parentImageSource = model.imageSource;
item.parentIdenticonColor = !!model.iconColor ? model.iconColor : Theme.palette.primaryColor1;
root.subMenuItemIcons.push({
source: model.imageSource,
icon: model.iconName,
isIdenticon: model.isIdenticon,
color: model.iconColor,
isLetterIdenticon: !model.imageSource && !model.iconName
});
root.insertMenu(index + numDefaultItems, item);
} else {
item.value = model.value
item.text = model.title;
item.assetSettings.name = !!model.imageSource ? !!model.imageSource : model.iconName;
item.assetSettings.color = model.iconColor;
item.assetSettings.isImage = !!model.imageSource;
item.assetSettings.isLetterIdenticon = !model.imageSource && !model.iconName
item.assetSettings.imgIsIdenticon = model.isIdenticon;
root.insertItem(index + numDefaultItems, item);
menu: root
delegate: DelegateChooser {
role: "hasSubItems"
DelegateChoice {
roleValue: false
delegate: StatusSearchPopupMenuItem {
text: model.title
assetSettings.name: !!model.imageSource ? !!model.imageSource : model.iconName
assetSettings.isImage: !!model.imageSource
assetSettings.isLetterIdenticon: !model.imageSource && !model.iconName
assetSettings.imgIsIdenticon: model.isIdenticon
onTriggered: {
root.resetSearchSelection()
root.setSearchSelection(text,
"",
"",
assetSettings.isIdenticon,
assetSettings.name,
assetSettings.color)
root.itemClicked(model.value, "")
}
}
}
}
onObjectRemoved: { root.removeItem(root.takeItem(index + numDefaultItems)); }
}
Component {
id: subMenuItemComponent
StatusSearchPopupMenuItem {
onTriggered: {
searchPopup.resetSearchSelection()
searchPopup.setSearchSelection(text,
"",
"",
assetSettings.isIdenticon,
assetSettings.name,
assetSettings.color)
root.itemClicked(value, "")
}
}
}
DelegateChoice {
roleValue: true
delegate: StatusMenu {
id: subMenuDelegate
Component {
id: subMenus
StatusPopupMenu {
id: menu
dim: false
property var subItemsModel
property string parentValue
property string parentIconName
property string parentImageSource
property string parentIdenticonColor
property string parentIsIdenticon
Repeater {
id: menuLoader
model: menu.subItemsModel
property string parentValue: menu.parentValue
property string parentTitleText: menu.title
property string parentIconName: menu.parentIconName
property string parentImageSource: menu.parentImageSource
property string parentIdenticonColor: menu.parentIdenticonColor
property string parentIsIdenticon: menu.parentIsIdenticon
Loader {
id: subMenuLoader
sourceComponent: StatusSearchPopupMenuItem {
value: model.value
text: model.text
assetSettings.isImage: !!model.imageSource
assetSettings.name: !!StatusQUtils.Emoji.iconSource(model.imageSource) ?
StatusQUtils.Emoji.iconSource(model.imageSource) : model.imageSource
assetSettings.color: model.isUserIcon ? Theme.palette.userCustomizationColors[model.colorId] : model.iconColor
assetSettings.bgColor: model.iconColor
assetSettings.charactersLen: model.isUserIcon ? 2 : 1
ringSettings.ringSpecModel: model.colorHash
onTriggered: {
searchPopup.resetSearchSelection()
if (menuLoader.parentTitleText === "Chat") {
searchPopup.setSearchSelection(model.text,
"",
model.imageSource,
model.isIdenticon,
model.iconName,
model.iconColor,
model.isUserIcon,
model.colorId,
model.colorHash.toJson())
} else {
searchPopup.setSearchSelection(menuLoader.parentTitleText,
model.text,
menuLoader.parentImageSource,
menuLoader.parentIsIdenticon,
menuLoader.parentIconName,
menuLoader.parentIdenticonColor)
readonly property var subItemsModel: model.subItems
readonly property string parentValue: model.value
readonly property string parentIconName: model.iconName
readonly property string parentImageSource: model.imageSource
readonly property string parentIdenticonColor: !!model.iconColor ? model.iconColor : defaultIconColor
readonly property bool parentIsIdenticon: model.isIdenticon
title: model.title
assetSettings.name: !!model.iconName ? model.iconName : model.imageSource
assetSettings.color: !!model.iconColor ? model.iconColor : defaultIconColor
assetSettings.isImage: !!model.imageSource
assetSettings.imgIsIdenticon: model.isIdenticon
assetSettings.isLetterIdenticon: !model.imageSource && !model.iconName
StatusMenuInstantiator {
id: menuLoader
readonly property string parentValue: subMenuDelegate.parentValue
readonly property string parentTitleText: subMenuDelegate.title
readonly property string parentIconName: subMenuDelegate.parentIconName
readonly property string parentImageSource: subMenuDelegate.parentImageSource
readonly property string parentIdenticonColor: subMenuDelegate.parentIdenticonColor
readonly property string parentIsIdenticon: subMenuDelegate.parentIsIdenticon
menu: subMenuDelegate
model: subMenuDelegate.subItemsModel
delegate: StatusSearchPopupMenuItem {
value: model.value
text: model.text
assetSettings.isImage: !!model.imageSource
assetSettings.name: !!StatusQUtils.Emoji.iconSource(model.imageSource) ?
StatusQUtils.Emoji.iconSource(model.imageSource) : model.imageSource
assetSettings.color: model.isUserIcon ? Theme.palette.userCustomizationColors[model.colorId] : model.iconColor
assetSettings.bgColor: model.iconColor
assetSettings.charactersLen: model.isUserIcon ? 2 : 1
ringSettings.ringSpecModel: model.colorHash
onTriggered: {
root.resetSearchSelection()
if (menuLoader.parentTitleText === "Chat") {
root.setSearchSelection(model.text,
"",
model.imageSource,
model.isIdenticon,
model.iconName,
model.iconColor,
model.isUserIcon,
model.colorId,
model.colorHash.toJson())
} else {
root.setSearchSelection(menuLoader.parentTitleText,
model.text,
menuLoader.parentImageSource,
menuLoader.parentIsIdenticon,
menuLoader.parentIconName,
menuLoader.parentIdenticonColor,
"",
-1,
"")
}
root.itemClicked(subMenuDelegate.parentValue, value)
root.dismiss()
}
root.itemClicked(menuLoader.parentValue, value)
root.dismiss()
}
}
}
}
}
}
onMenuItemClicked: {
searchPopup.resetSearchSelection()
let menuItem = root.menuAt(root.currentIndex)
searchPopup.setSearchSelection(menuItem.title,
"",
menuItem.parentImageSource,
menuItem.parentIsIdenticon,
menuItem.parentIconName,
menuItem.parentIdenticonColor)
root.itemClicked(menuItem.parentValue, "")
//TODO fix error "QML StatusPopupMenu: cannot find any window to open popup in."
root.dismiss()
}
}

View File

@ -4,61 +4,16 @@ import QtQuick.Layouts 1.12
import StatusQ.Components 0.1
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
MenuItem {
StatusAction {
id: root
implicitHeight: 38
property string value: ""
property StatusAssetSettings assetSettings: StatusAssetSettings {
height: 16
width: 16
isImage: (name.toString() !== "")
isLetterIdenticon: (name.toString() === "")
color: (name === "channel") ? Theme.palette.directColor1 : "transparent"
letterSize: charactersLen > 1 ? 8 : 11
imgIsIdenticon: false
}
property alias ringSettings: identicon.ringSettings
background: Rectangle {
color: root.hovered ? Theme.palette.statusPopupMenu.hoverBackgroundColor : "transparent"
}
contentItem: RowLayout {
anchors.left: parent.left
anchors.leftMargin: 12
Item {
Layout.preferredWidth: root.assetSettings.width
Layout.preferredHeight: root.assetSettings.height
Layout.alignment: Qt.AlignVCenter
StatusSmartIdenticon {
id: identicon
anchors.centerIn: parent
asset: root.assetSettings
name: root.text
ringSettings: root.ringSettings
}
}
StatusBaseText {
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
text: root.text
color: Theme.palette.directColor1
font.pixelSize: 13
elide: Text.ElideRight
}
Item {
Layout.fillWidth: true
}
}
MouseArea {
id: sensor
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onPressed: mouse.accepted = false
}
assetSettings.isImage: assetSettings.name.toString() !== ""
assetSettings.isLetterIdenticon: assetSettings.name.toString() === ""
assetSettings.color: assetSettings.name === "channel" ? Theme.palette.directColor1 : icon.color
assetSettings.letterSize: assetSettings.charactersLen > 1 ? 8 : 11
assetSettings.imgIsIdenticon: false
}

View File

@ -1,107 +0,0 @@
import QtQuick 2.14
import QtQuick.Controls 2.14
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
StatusPopupMenu {
id: root
property alias suggestions: suggestionsMenu.model
signal addToUserDict()
signal disableSpellchecking()
Column {
Repeater {
id: suggestionsMenu
delegate: MenuItem {
id: variants
implicitWidth: parent ? parent.width : 0
implicitHeight: 38
contentItem: StatusBaseText {
rightPadding: 8
leftPadding: 4
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
text: modelData
color: Theme.palette.directColor1
font.pixelSize: 13
elide: Text.ElideRight
}
background: Rectangle {
color: variants.hovered ? Theme.palette.statusPopupMenu.hoverBackgroundColor
: "transparent"
}
onTriggered: {
root.menuItemClicked(index)
}
}
}
StatusMenuSeparator { visible: !!suggestionsMenu.model && suggestionsMenu.model.length !== 0}
MenuItem {
id: ignoreWord
implicitWidth: parent ? parent.width : 0
implicitHeight: 38
contentItem: StatusBaseText {
rightPadding: 8
leftPadding: 4
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
text: qsTr("Add to dictionary")
color: Theme.palette.directColor1
font.pixelSize: 13
elide: Text.ElideRight
}
background: Rectangle {
color: ignoreWord.hovered ? Theme.palette.statusPopupMenu.hoverBackgroundColor
: "transparent"
}
onTriggered: {
root.addToUserDict()
}
}
MenuItem {
id: disableSpellchecking
implicitWidth: parent ? parent.width : 0
implicitHeight: 38
contentItem: StatusBaseText {
rightPadding: 8
leftPadding: 4
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
text: qsTr("Disable Spellchecking")
color: Theme.palette.directColor1
font.pixelSize: 13
elide: Text.ElideRight
}
background: Rectangle {
color: disableSpellchecking.hovered ? Theme.palette.statusPopupMenu.hoverBackgroundColor
: "transparent"
}
onTriggered: {
root.disableSpellchecking()
}
}
}
}

View File

@ -1,9 +1,10 @@
module StatusQ.Popups
StatusMenuSeparator 0.1 StatusMenuSeparator.qml
StatusPopupMenu 0.1 StatusPopupMenu.qml
StatusAction 0.1 StatusAction.qml
StatusMenu 0.1 StatusMenu.qml
StatusMenuItem 0.1 StatusMenuItem.qml
StatusMenuItemDelegate 0.1 StatusMenuItemDelegate.qml
StatusMenuInstantiator 0.1 StatusMenuInstantiator.qml
StatusMenuHeadline 0.1 StatusMenuHeadline.qml
StatusModal 0.1 StatusModal.qml
StatusStackModal 0.1 StatusStackModal.qml
@ -12,5 +13,4 @@ StatusSearchPopup 0.1 StatusSearchPopup.qml
StatusModalDivider 0.1 StatusModalDivider.qml
StatusSearchPopupMenuItem 0.1 StatusSearchPopupMenuItem.qml
StatusSearchLocationMenu 0.1 StatusSearchLocationMenu.qml
StatusSpellcheckingMenuItems 0.1 StatusSpellcheckingMenuItems.qml
StatusColorDialog 0.1 StatusColorDialog.qml

View File

@ -51,6 +51,9 @@
<file>assets/fonts/RobotoMono/RobotoMono-SemiBoldItalic.ttf</file>
<file>assets/fonts/RobotoMono/RobotoMono-Thin.ttf</file>
<file>assets/fonts/RobotoMono/RobotoMono-ThinItalic.ttf</file>
<file>assets/img/icons/statuses/automatic.svg</file>
<file>assets/img/icons/statuses/inactive.svg</file>
<file>assets/img/icons/statuses/online.svg</file>
<file>assets/img/icons/bigger/browser.svg</file>
<file>assets/img/icons/bigger/network.svg</file>
<file>assets/img/icons/bigger/pause.svg</file>

View File

Before

Width:  |  Height:  |  Size: 270 B

After

Width:  |  Height:  |  Size: 270 B

View File

Before

Width:  |  Height:  |  Size: 186 B

After

Width:  |  Height:  |  Size: 186 B

View File

Before

Width:  |  Height:  |  Size: 186 B

After

Width:  |  Height:  |  Size: 186 B

View File

@ -158,16 +158,15 @@
<file>StatusQ/Popups/qmldir</file>
<file>StatusQ/Popups/StatusColorDialog.qml</file>
<file>StatusQ/Popups/StatusMenuHeadline.qml</file>
<file>StatusQ/Popups/StatusAction.qml</file>
<file>StatusQ/Popups/StatusMenuItem.qml</file>
<file>StatusQ/Popups/StatusMenuItemDelegate.qml</file>
<file>StatusQ/Popups/StatusMenuSeparator.qml</file>
<file>StatusQ/Popups/StatusModal.qml</file>
<file>StatusQ/Popups/StatusModalDivider.qml</file>
<file>StatusQ/Popups/StatusPopupMenu.qml</file>
<file>StatusQ/Popups/StatusMenu.qml</file>
<file>StatusQ/Popups/StatusSearchLocationMenu.qml</file>
<file>StatusQ/Popups/StatusSearchPopup.qml</file>
<file>StatusQ/Popups/StatusSearchPopupMenuItem.qml</file>
<file>StatusQ/Popups/StatusSpellcheckingMenuItems.qml</file>
<file>StatusQ/Popups/StatusStackModal.qml</file>
<file>StatusQ/qmldir</file>
<file>StatusQ/Components/StatusListPickerProxies.qml</file>
@ -193,5 +192,6 @@
<file>StatusQ/Core/StatusProfileImageSettings.qml</file>
<file>StatusQ/Core/StatusRollArea.qml</file>
<file>StatusQ/Popups/Dialog/StatusDialogBackground.qml</file>
<file>StatusQ/Popups/StatusMenuInstantiator.qml</file>
</qresource>
</RCC>

View File

@ -9,7 +9,7 @@ import shared.popups 1.0
import utils 1.0
// TODO: replace with StatusPopupMenu
// TODO: replace with StatusMenu
PopupMenu {
id: browserSettingsMenu

View File

@ -12,7 +12,7 @@ import utils 1.0
import "../stores"
// TODO: replace with StatusPopupMenu
// TODO: replace with StatusMenu
Popup {
id: popup

View File

@ -8,7 +8,7 @@ import utils 1.0
import "../stores"
// TODO: replace with StatusPopupMenu
// TODO: replace with StatusMenu
PopupMenu {
id: downloadMenu

View File

@ -8,7 +8,7 @@ import utils 1.0
import "../stores"
// TODO: replace with StatusPopupMenu
// TODO: replace with StatusMenu
PopupMenu {
id: favoritePopupMenu

View File

@ -26,7 +26,7 @@ StatusListView {
header: Rectangle {
visible: root.isHeaderVisible
z: 3 // Above delegate (z=1) and above section.delegate (z = 2)
color: Theme.palette.statusPopupMenu.backgroundColor
color: Theme.palette.statusMenu.backgroundColor
width: root.width
height: root.isHeaderVisible ? columnHeader.implicitHeight + 2 * columnHeader.anchors.topMargin : 0
ColumnLayout {

View File

@ -109,7 +109,7 @@ StackLayout {
implicitHeight: 1
visible: root.editable
color: Theme.palette.statusPopupMenu.separatorColor
color: Theme.palette.statusMenu.separatorColor
}
RowLayout {

View File

@ -35,10 +35,10 @@ StatusModal {
onClicked: contextMenu.popup(-contextMenu.width+width, height + 4)
StatusPopupMenu {
StatusMenu {
id: contextMenu
width: 230
StatusMenuItem {
StatusAction {
icon.name: "download"
text: qsTr("Access existing community")
onTriggered: {

View File

@ -11,7 +11,7 @@ import shared.controls.chat.menuItems 1.0
import "../popups"
import "../popups/community"
StatusPopupMenu {
StatusMenu {
id: root
property string currentFleet: ""
@ -53,7 +53,7 @@ StatusPopupMenu {
onTriggered: root.displayProfilePopup(root.chatId)
}
StatusMenuItem {
StatusAction {
text: root.amIChatAdmin ? qsTr("Add / remove from group") : qsTr("Add to group")
icon.name: "add-to-dm"
enabled: (root.chatType === Constants.chatType.privateGroupChat)
@ -64,7 +64,7 @@ StatusPopupMenu {
visible: root.chatType === Constants.chatType.oneToOne || root.chatType === Constants.chatType.privateGroupChat
}
StatusMenuItem {
StatusAction {
objectName: "editNameAndImageMenuItem"
text: qsTr("Edit name and image")
icon.name: "edit_pencil"
@ -98,7 +98,7 @@ StatusPopupMenu {
}
}
StatusMenuItem {
StatusAction {
objectName: "chatMarkAsReadMenuItem"
text: qsTr("Mark as Read")
icon.name: "checkmark-circle"
@ -108,32 +108,32 @@ StatusPopupMenu {
}
//TODO uncomment when implemented
// StatusPopupMenu {
// StatusMenu {
// title: qsTr("Fetch messages")
// enabled: (root.chatType === Constants.chatType.oneToOne ||
// root.chatType === Constants.chatType.privateGroupChat)
// StatusMenuItem {
// StatusAction {
// text: "Last 24 hours"
// onTriggered: {
// root.fetchMoreMessages();
// }
// }
// StatusMenuItem {
// StatusAction {
// text: "Last 2 days"
// onTriggered: {
// }
// }
// StatusMenuItem {
// StatusAction {
// text: "Last 3 days"
// onTriggered: {
// }
// }
// StatusMenuItem {
// StatusAction {
// text: "Last 7 days"
// onTriggered: {
@ -141,7 +141,7 @@ StatusPopupMenu {
// }
// }
StatusMenuItem {
StatusAction {
objectName: "clearHistoryMenuItem"
text: qsTr("Clear History")
icon.name: "close-circle"
@ -150,7 +150,7 @@ StatusPopupMenu {
}
}
StatusMenuItem {
StatusAction {
objectName: "editChannelMenuItem"
text: qsTr("Edit Channel")
icon.name: "edit"
@ -188,7 +188,7 @@ StatusPopupMenu {
}
}
StatusMenuItem {
StatusAction {
text: qsTr("Download")
enabled: localAccountSensitiveSettings.downloadChannelMessagesEnabled
icon.name: "download"
@ -199,7 +199,7 @@ StatusPopupMenu {
visible: deleteOrLeaveMenuItem.enabled
}
StatusMenuItem {
StatusAction {
objectName: "deleteOrLeaveMenuItem"
id: deleteOrLeaveMenuItem
text: {
@ -216,7 +216,7 @@ StatusPopupMenu {
icon.name: root.chatType === Constants.chatType.oneToOne || root.isCommunityChat ? "delete" : "arrow-left"
icon.width: root.chatType === Constants.chatType.oneToOne || root.isCommunityChat ? 18 : 14
type: StatusMenuItem.Type.Danger
type: StatusAction.Type.Danger
onTriggered: {
if (root.chatType === Constants.chatType.privateGroupChat) {
root.leaveChat(root.chatId);

View File

@ -167,7 +167,7 @@ Item {
}
}
StatusPopupMenu {
StatusMenu {
id: adminPopupMenu
enabled: communityData.amISectionAdmin
@ -175,14 +175,14 @@ Item {
onClosed: adminPopupMenu.showInviteButton = false
StatusMenuItem {
StatusAction {
objectName: "createCommunityChannelBtn"
text: qsTr("Create channel")
icon.name: "channel"
onTriggered: Global.openPopup(createChannelPopup)
}
StatusMenuItem {
StatusAction {
objectName: "createCommunityCategoryBtn"
text: qsTr("Create category")
icon.name: "channel-category"
@ -193,7 +193,7 @@ Item {
visible: invitePeopleBtn.enabled
}
StatusMenuItem {
StatusAction {
id: invitePeopleBtn
text: qsTr("Invite people")
icon.name: "share-ios"
@ -253,15 +253,15 @@ Item {
categoryId: id
})
popupMenu: StatusPopupMenu {
StatusMenuItem {
popupMenu: StatusMenu {
StatusAction {
text: qsTr("Create channel")
icon.name: "channel"
enabled: communityData.amISectionAdmin
onTriggered: Global.openPopup(createChannelPopup)
}
StatusMenuItem {
StatusAction {
text: qsTr("Create category")
icon.name: "channel-category"
enabled: communityData.amISectionAdmin
@ -270,7 +270,7 @@ Item {
StatusMenuSeparator {}
StatusMenuItem {
StatusAction {
text: qsTr("Invite people")
icon.name: "share-ios"
enabled: communityData.canManageUsers
@ -282,7 +282,7 @@ Item {
}
}
categoryPopupMenu: StatusPopupMenu {
categoryPopupMenu: StatusMenu {
property var categoryItem
@ -297,7 +297,7 @@ Item {
categoryItem = obj
}
StatusMenuItem {
StatusAction {
text: categoryItem.muted ? qsTr("Unmute category") : qsTr("Mute category")
icon.name: "notification"
onTriggered: {
@ -309,7 +309,7 @@ Item {
}
}
StatusMenuItem {
StatusAction {
objectName: "editCategoryMenuItem"
enabled: communityData.amISectionAdmin
text: qsTr("Edit Category")
@ -328,12 +328,12 @@ Item {
visible: communityData.amISectionAdmin
}
StatusMenuItem {
StatusAction {
objectName: "deleteCategoryMenuItem"
enabled: communityData.amISectionAdmin
text: qsTr("Delete Category")
icon.name: "delete"
type: StatusMenuItem.Type.Danger
type: StatusAction.Type.Danger
onTriggered: {
Global.openPopup(deleteCategoryConfirmationDialogComponent, {
title: qsTr("Delete %1 category").arg(categoryItem.name),

View File

@ -27,9 +27,11 @@ Item {
width: parent.width
height: 64
Rectangle {
anchors.fill: root
color: sensor.containsMouse ? Theme.palette.statusSelect.menuItemHoverBackgroundColor : Theme.palette.statusSelect.menuItemBackgroundColor
color: sensor.containsMouse ? Theme.palette.statusSelect.menuItemHoverBackgroundColor
: Theme.palette.statusSelect.menuItemBackgroundColor
}
MouseArea {

View File

@ -269,11 +269,9 @@ Item {
}
}
StatusPopupMenu {
StatusMenu {
id: accountsPopup
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
width: parent.width + Style.current.bigPadding
dim: false
SortFilterProxyModel {
id: proxyModel
@ -285,46 +283,40 @@ Item {
}
}
Column {
width: parent.width
Repeater {
objectName: "LoginView_AccountsRepeater"
model: proxyModel
Repeater {
objectName: "LoginView_AccountsRepeater"
width: parent.width
height: parent.height
model: proxyModel
delegate: AccountMenuItemPanel {
label: model.username
image: model.thumbnailImage
colorId: model.colorId
colorHash: model.colorHash
keycardCreatedAccount: model.keycardCreatedAccount
onClicked: {
d.resetLogin()
accountsPopup.close()
const realIndex = proxyModel.mapToSource(index)
root.startupStore.setSelectedLoginAccountByIndex(realIndex)
}
delegate: AccountMenuItemPanel {
label: model.username
image: model.thumbnailImage
colorId: model.colorId
colorHash: model.colorHash
keycardCreatedAccount: model.keycardCreatedAccount
onClicked: {
d.resetLogin()
accountsPopup.close()
const realIndex = proxyModel.mapToSource(index)
root.startupStore.setSelectedLoginAccountByIndex(realIndex)
}
}
}
AccountMenuItemPanel {
label: qsTr("Add new user")
asset.name: "add"
onClicked: {
accountsPopup.close()
root.startupStore.doTertiaryAction()
}
AccountMenuItemPanel {
label: qsTr("Add new user")
asset.name: "add"
onClicked: {
accountsPopup.close()
root.startupStore.doTertiaryAction()
}
}
AccountMenuItemPanel {
label: qsTr("Add existing Status user")
asset.name: "wallet"
onClicked: {
accountsPopup.close()
root.startupStore.doQuaternaryAction()
}
AccountMenuItemPanel {
label: qsTr("Add existing Status user")
asset.name: "wallet"
onClicked: {
accountsPopup.close()
root.startupStore.doQuaternaryAction()
}
}
}

View File

@ -41,27 +41,27 @@ Item {
}
}
StatusPopupMenu {
StatusMenu {
id: selectMenu
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
width: parent.width
clip: true
StatusMenuItem {
StatusAction {
text: d.sendAlertsText
onTriggered: {
root.sendAlertsClicked()
}
}
StatusMenuItem {
StatusAction {
text: d.deliverQuietlyText
onTriggered: {
root.deliverQuietlyClicked()
}
}
StatusMenuItem {
StatusAction {
text: d.turnOffText
onTriggered: {
root.turnOffClicked()

View File

@ -49,7 +49,7 @@ Item {
toggleVisibleClicked(chainId, address)
}
StatusPopupMenu {
StatusMenu {
id: contextMenu
Action {
icon.name: "admin"

View File

@ -151,7 +151,7 @@ Item {
}
}
StatusPopupMenu {
StatusMenu {
id: derivedAddressPopup
width: _internal.popupWidth
contentItem: Column {
@ -234,7 +234,7 @@ Item {
background: Rectangle {
implicitWidth: stackLayout.width
implicitHeight: stackLayout.height
color: Theme.palette.statusPopupMenu.backgroundColor
color: Theme.palette.statusMenu.backgroundColor
radius: 8
}
}

View File

@ -95,7 +95,7 @@ StatusSelect {
titleText.color: Theme.palette.indirectColor1
}
}
selectMenu.delegate: StatusListItem {
menuDelegate: StatusListItem {
id: defaultListItem
title: model.name
asset.name: model.iconName

View File

@ -366,7 +366,7 @@ Item {
changeAppSectionBySectionId(model.id)
}
popupMenu: StatusPopupMenu {
popupMenu: StatusMenu {
id: communityContextMenu
property var chatCommunitySectionModule
@ -379,7 +379,7 @@ Item {
}
StatusMenuItem {
StatusAction {
text: qsTr("Invite People")
icon.name: "share-ios"
enabled: model.canManageUsers
@ -390,7 +390,7 @@ Item {
}
}
StatusMenuItem {
StatusAction {
text: qsTr("View Community")
icon.name: "group-chat"
onTriggered: Global.openPopup(communityProfilePopup, {
@ -402,10 +402,10 @@ Item {
StatusMenuSeparator {}
StatusMenuItem {
StatusAction {
text: qsTr("Leave Community")
icon.name: "arrow-left"
type: StatusMenuItem.Type.Danger
type: StatusAction.Type.Danger
onTriggered: communityContextMenu.chatCommunitySectionModule.leaveCommunity()
}
}

View File

@ -41,7 +41,7 @@ Item {
StatusSearchLocationMenu {
id: searchPopupMenu
searchPopup: searchPopup
locationModel: appSearch.store.locationMenuModel
onItemClicked: {
@ -50,6 +50,22 @@ Item {
if(searchPopup.searchText !== "")
searchMessages(searchPopup.searchText)
}
onResetSearchSelection: {
searchPopup.resetSearchSelection()
}
onSetSearchSelection: {
searchPopup.setSearchSelection(text,
secondaryText,
imageSource,
isIdenticon,
iconName,
iconColor,
isUserIcon,
colorId,
colorHash)
}
}
StatusSearchPopup {

View File

@ -88,7 +88,7 @@ StatusListItem {
}
]
StatusPopupMenu {
StatusMenu {
id: editDeleteMenu
property string contactName
property string contactAddress
@ -104,7 +104,7 @@ StatusListItem {
contactAddress = "";
storeFavourite = false;
}
StatusMenuItem {
StatusAction {
text: qsTr("Edit")
objectName: "editroot"
assetSettings.name: "pencil-outline"
@ -119,9 +119,9 @@ StatusListItem {
}
}
StatusMenuSeparator { }
StatusMenuItem {
StatusAction {
text: qsTr("Delete")
type: StatusMenuItem.Type.Danger
type: StatusAction.Type.Danger
assetSettings.name: "delete"
objectName: "deleteSavedAddress"
onTriggered: {

View File

@ -247,20 +247,20 @@ Item {
}
}
StatusPopupMenu {
StatusMenu {
id: imageEditMenu
StatusMenuItem {
StatusAction {
text: qsTr("Upload a file")
icon.name: "download"
iconRotation: 180
assetSettings.name: "download"
assetSettings.rotation: 180
onTriggered: Global.openChangeProfilePicPopup(editButton.tempIcon)
}
StatusMenuItem {
StatusAction {
text: qsTr("Remove image")
type: StatusMenuItem.Danger
icon.name: "delete"
type: StatusAction.Danger
assetSettings.name: "delete"
onTriggered: root.icon = ""
}
}

View File

@ -2,7 +2,7 @@ import QtQuick 2.14
import StatusQ.Popups 0.1
StatusMenuItem {
StatusAction {
property bool muted: false
text: muted ? qsTr("Unmute Chat") : qsTr("Mute Chat")

View File

@ -2,7 +2,7 @@ import QtQuick 2.14
import StatusQ.Popups 0.1
StatusMenuItem {
StatusAction {
text: qsTr("Send Contact Request")
icon.name: "add-contact"
}

View File

@ -2,7 +2,7 @@ import QtQuick 2.14
import StatusQ.Popups 0.1
StatusMenuItem {
StatusAction {
text: qsTr("Send Message")
icon.name: "chat"
}

View File

@ -2,7 +2,7 @@ import QtQuick 2.14
import StatusQ.Popups 0.1
StatusMenuItem {
StatusAction {
text: qsTr("View Profile")
icon.name: "profile"
}

View File

@ -54,7 +54,7 @@ Row {
contactContextMenu.popup(-contactContextMenu.width+menuButton.width, menuButton.height + 4)
}
StatusPopupMenu {
StatusMenu {
id: contactContextMenu
onClosed: {
@ -67,10 +67,10 @@ Row {
StatusMenuSeparator {}
StatusMenuItem {
StatusAction {
text: qsTr("Decline and block")
icon.name: "cancel"
type: StatusMenuItem.Type.Danger
type: StatusAction.Type.Danger
onTriggered: root.blockClicked()
}
}

View File

@ -97,7 +97,7 @@ StatusFloatingButtonsSelector {
asset.bgColor: Theme.palette.indirectColor1
onClicked: {
changeSelectedAccount(model, index)
root.itemSelected(index)
root.selectItem(index)
}
visible: !root.visibleIndices.includes(index) && d.isWalletTypeAccepted(walletType, index)
}

View File

@ -10,7 +10,7 @@ import shared.panels 1.0
import StatusQ.Components 0.1
import StatusQ.Popups 0.1
StatusPopupMenu {
StatusMenu {
id: root
property var store
@ -29,7 +29,7 @@ StatusPopupMenu {
StatusMenuSeparator {
}
StatusMenuItem {
StatusAction {
objectName: "userStatusViewMyProfileAction"
text: qsTr("View My Profile")
icon.name: "profile"
@ -42,14 +42,14 @@ StatusPopupMenu {
StatusMenuSeparator {
}
StatusMenuItem {
StatusAction {
id: alwaysOnlineAction
objectName: "userStatusMenuAlwaysOnlineAction"
text: qsTr("Always online")
icon.name: Style.svg("statuses/online")
assetSettings.isImage: true
icon.width: 12
icon.height: 12
assetSettings.name: "statuses/online"
assetSettings.width: 12
assetSettings.height: 12
assetSettings.color: "transparent"
fontSettings.bold: root.store.userProfileInst.currentUserStatus === Constants.currentUserStatus.alwaysOnline
onTriggered: {
store.setCurrentUserStatus(Constants.currentUserStatus.alwaysOnline)
@ -57,14 +57,14 @@ StatusPopupMenu {
}
}
StatusMenuItem {
StatusAction {
id: inactiveAction
objectName: "userStatusMenuInactiveAction"
text: qsTr("Inactive")
icon.name: Style.svg("statuses/inactive")
assetSettings.isImage: true
icon.width: 12
icon.height: 12
assetSettings.name: "statuses/inactive"
assetSettings.width: 12
assetSettings.height: 12
assetSettings.color: "transparent"
fontSettings.bold: root.store.userProfileInst.currentUserStatus === Constants.currentUserStatus.inactive
onTriggered: {
store.setCurrentUserStatus(Constants.currentUserStatus.inactive)
@ -72,12 +72,12 @@ StatusPopupMenu {
}
}
StatusMenuItem {
StatusAction {
id: automaticAction
objectName: "userStatusMenuAutomaticAction"
text: qsTr("Set status automatically")
icon.name: Style.svg("statuses/automatic")
assetSettings.isImage: true
assetSettings.name: "statuses/automatic"
assetSettings.color: "transparent"
fontSettings.bold: root.store.userProfileInst.currentUserStatus === Constants.currentUserStatus.automatic
onTriggered: {
store.setCurrentUserStatus(Constants.currentUserStatus.automatic)

View File

@ -385,7 +385,7 @@ Pane {
highlighted: moreMenu.opened
onClicked: moreMenu.popup(-moreMenu.width + width, height + 4)
StatusPopupMenu {
StatusMenu {
id: moreMenu
width: 230
@ -398,7 +398,7 @@ Pane {
popup => popup.closed.connect(d.reload))
}
}
StatusMenuItem {
StatusAction {
text: qsTr("Verify Identity")
icon.name: "checkmark-circle"
enabled: d.isContact && !d.isBlocked &&
@ -410,7 +410,7 @@ Pane {
popup => popup.accepted.connect(d.reload))
}
}
StatusMenuItem {
StatusAction {
text: qsTr("ID Request Pending...")
icon.name: "checkmark-circle"
enabled: d.isContact && !d.isBlocked && !d.isTrusted && d.isVerificationRequestSent
@ -420,7 +420,7 @@ Pane {
popup => popup.closed.connect(d.reload))
}
}
StatusMenuItem {
StatusAction {
text: qsTr("Rename")
icon.name: "edit_pencil"
onTriggered: {
@ -429,7 +429,7 @@ Pane {
"%1 (%2)".arg(d.userDisplayName).arg(Utils.getElidedCompressedPk(root.publicKey)))
}
}
StatusMenuItem {
StatusAction {
text: qsTr("Reverse Contact Rejection")
icon.name: "refresh"
enabled: d.contactDetails.removed
@ -439,7 +439,7 @@ Pane {
d.reload()
}
}
StatusMenuItem {
StatusAction {
text: qsTr("Copy Link to Profile")
icon.name: "copy"
onTriggered: {
@ -447,7 +447,7 @@ Pane {
root.profileStore.copyToClipboard(d.linkToProfile)
}
}
StatusMenuItem {
StatusAction {
text: qsTr("Unblock User")
icon.name: "remove-circle"
enabled: d.isBlocked
@ -457,10 +457,10 @@ Pane {
}
}
StatusMenuSeparator {}
StatusMenuItem {
StatusAction {
text: qsTr("Mark as Untrustworthy")
icon.name: "warning"
type: StatusMenuItem.Type.Danger
type: StatusAction.Type.Danger
enabled: d.contactDetails.trustStatus === Constants.trustStatus.unknown
onTriggered: {
moreMenu.close()
@ -471,7 +471,7 @@ Pane {
d.reload()
}
}
StatusMenuItem {
StatusAction {
text: qsTr("Remove Untrustworthy Mark")
icon.name: "warning"
enabled: d.contactDetails.trustStatus === Constants.trustStatus.untrustworthy
@ -481,30 +481,30 @@ Pane {
d.reload()
}
}
StatusMenuItem {
StatusAction {
text: qsTr("Remove Identity Verification")
icon.name: "warning"
type: StatusMenuItem.Type.Danger
type: StatusAction.Type.Danger
enabled: d.isContact && d.isTrusted
onTriggered: {
moreMenu.close()
removeVerificationConfirmationDialog.open()
}
}
StatusMenuItem {
StatusAction {
text: qsTr("Remove Contact")
icon.name: "remove-contact"
type: StatusMenuItem.Type.Danger
type: StatusAction.Type.Danger
enabled: d.isContact && !d.isBlocked
onTriggered: {
moreMenu.close()
removeContactConfirmationDialog.open()
}
}
StatusMenuItem {
StatusAction {
text: qsTr("Cancel Contact Request")
icon.name: "cancel"
type: StatusMenuItem.Type.Danger
type: StatusAction.Type.Danger
enabled: !d.isContact && d.isContactRequestSent && !d.contactDetails.removed
onTriggered: {
moreMenu.close()
@ -512,10 +512,10 @@ Pane {
d.reload()
}
}
StatusMenuItem {
StatusAction {
text: qsTr("Block User")
icon.name: "cancel"
type: StatusMenuItem.Type.Danger
type: StatusAction.Type.Danger
enabled: !d.isBlocked
onTriggered: {
moreMenu.close()

View File

@ -15,7 +15,7 @@ import shared.status 1.0
import shared.controls.chat 1.0
import shared.controls.chat.menuItems 1.0
StatusPopupMenu {
StatusMenu {
id: root
property var store
@ -196,7 +196,7 @@ StatusPopupMenu {
visible: !root.isEmoji && !root.hideEmojiPicker && !pinnedPopup
}
StatusMenuItem {
StatusAction {
id: copyImageAction
text: qsTr("Copy image")
onTriggered: {
@ -209,7 +209,7 @@ StatusPopupMenu {
enabled: root.isRightClickOnImage && !root.pinnedPopup
}
StatusMenuItem {
StatusAction {
id: downloadImageAction
text: qsTr("Download image")
onTriggered: {
@ -247,7 +247,7 @@ StatusPopupMenu {
}
}
StatusMenuItem {
StatusAction {
text: qsTr("Verify Identity")
icon.name: "checkmark-circle"
enabled: root.isProfile && !root.isMe && root.isContact
@ -260,7 +260,7 @@ StatusPopupMenu {
}
}
StatusMenuItem {
StatusAction {
text: isVerificationRequestSent ||
root.incomingVerificationStatus === Constants.verificationStatus.verified ?
qsTr("ID Request Pending....") :
@ -281,7 +281,7 @@ StatusPopupMenu {
}
}
StatusMenuItem {
StatusAction {
text: qsTr("Rename")
icon.name: "edit_pencil"
enabled: root.isProfile && !root.isMe
@ -292,7 +292,7 @@ StatusPopupMenu {
}
}
StatusMenuItem {
StatusAction {
text: qsTr("Unblock User")
icon.name: "remove-circle"
enabled: root.isProfile && !root.isMe && root.isBlockedContact
@ -303,16 +303,16 @@ StatusPopupMenu {
visible: blockMenuItem.enabled || markUntrustworthyMenuItem.enabled || removeUntrustworthyMarkMenuItem.enabled
}
StatusMenuItem {
StatusAction {
id: markUntrustworthyMenuItem
text: qsTr("Mark as Untrustworthy")
icon.name: "warning"
type: StatusMenuItem.Type.Danger
type: StatusAction.Type.Danger
enabled: root.isProfile && !root.isMe && root.userTrustIsUnknown
onTriggered: root.store.contactsStore.markUntrustworthy(root.selectedUserPublicKey)
}
StatusMenuItem {
StatusAction {
id: removeUntrustworthyMarkMenuItem
text: qsTr("Remove Untrustworthy Mark")
icon.name: "warning"
@ -320,16 +320,16 @@ StatusPopupMenu {
onTriggered: root.store.contactsStore.removeTrustStatus(root.selectedUserPublicKey)
}
StatusMenuItem {
StatusAction {
id: blockMenuItem
text: qsTr("Block User")
icon.name: "cancel"
type: StatusMenuItem.Type.Danger
type: StatusAction.Type.Danger
enabled: root.isProfile && !root.isMe && !root.isBlockedContact
onTriggered: Global.blockContactRequested(root.selectedUserPublicKey, root.selectedUserDisplayName)
}
StatusMenuItem {
StatusAction {
id: replyToMenuItem
text: qsTr("Reply to")
icon.name: "chat"
@ -344,7 +344,7 @@ StatusPopupMenu {
!root.isRightClickOnImage)
}
StatusMenuItem {
StatusAction {
id: editMessageAction
text: qsTr("Edit message")
onTriggered: {
@ -360,7 +360,7 @@ StatusPopupMenu {
!root.isRightClickOnImage
}
StatusMenuItem {
StatusAction {
id: copyMessageIdAction
text: qsTr("Copy Message Id")
icon.name: "chat"
@ -371,7 +371,7 @@ StatusPopupMenu {
}
}
StatusMenuItem {
StatusAction {
id: pinAction
text: {
if (root.pinnedMessage) {
@ -428,7 +428,7 @@ StatusPopupMenu {
pinAction.enabled)
}
StatusMenuItem {
StatusAction {
id: deleteMessageAction
enabled: root.isMyMessage &&
!root.isProfile &&
@ -450,10 +450,10 @@ StatusPopupMenu {
}
}
icon.name: "delete"
type: StatusMenuItem.Type.Danger
type: StatusAction.Type.Danger
}
StatusMenuItem {
StatusAction {
id: jumpToAction
enabled: root.pinnedPopup && !root.isProfile
text: qsTr("Jump to")