Commit Graph

247 Commits

Author SHA1 Message Date
B.Melnik 4da3ecd92a
Improve implementation and remove unnecessary code 2021-09-02 15:20:34 +03:00
Pascal Precht 50c9a4ca87
feat(StatusQ.Controls): introduce StatusSwitchTabBar and StatusSwitchTab
This commit adds two new components to the StatusQ.Controls module:

- StatusSwitchTabBar
- StatusSwitchTab

Usage:

```qml
StatusSwitchTabBar {

    StatusSwitchTab {
        text: "Tab 1"
    }

    StatusSwitchTab {
        text: "Tab 2"
    }

    StatusSwitchTab {
        text: "Tab 3"
    }
}
```

Closes #365
2021-08-31 17:12:28 +02:00
Pascal Precht b45aba4be8 feat(StatusSearchPopup): add function hook to allow timestamp formatting
This introduces a new API to allow users to provide a function that formats
timestamps in the search results.

```qml
StatusSearchPopup {
  formatTimestampFn: function (ts) {
      return // formatted ts
  }
}
```

Closes #363
2021-08-31 14:06:35 +02:00
Pascal Precht 0a4d3860ea feat: introduce bigger versions of navbar icons
Turns out the icons used in the navigation bar of the application actually
are designed to be bigger than the usual icons.

We can't just use the original source and scale them up in QML because that
will impact the stroke width of the SVGs as well, hence we need to introduce
a special set of icons that are design bigger but presever the feature ratios.
2021-08-31 13:48:28 +02:00
B.Melnik 387bfe77c0
fix(StatusBaseInput): Make clear button bigger
Closes: #294
2021-08-31 13:47:31 +02:00
Pascal Precht 1749cc0e3b feat(StatusDescriptionListItem): expose subtitle component for fine control
This enables users to get more control over the subtitle to set things like
`elide` and font properties.

Closes: #356
2021-08-31 11:27:43 +02:00
Pascal Precht a963ef80c8 feat(StatusDescriptionListItem): introduce support for `value`
This adds a new `value` property to the component to set label for a
selected value and also rendering a chevron as an indicator that the list
item becomes clickable.
2021-08-31 11:27:43 +02:00
B.Melnik fbecac4ac3 fix(StatusChatToolBar): Fix mouse event catching after menu closing
Closes: #350
2021-08-31 11:26:52 +02:00
Sale Djenic 9b3275f327 refactor(StatusSearchPopup): change expected search model shape
This changes the share of the model expected to render search results.

BREAKING CHANGE:
The model has changed in the following way:
- `image` field added
- `color` field added
- `badgeIdenticonColor` field renamed to `badgeIconColor`
- `isLetterIdenticon` field renamed to `badgeIsLetterIdenticon`
2021-08-31 11:23:23 +02:00
Pascal Precht 28e514f927 feat(StatusModal): add ability to set elide config of header titles
There are now two new properties in `StatusModalHeaderSettings`:

- `titleElide`
- `subTitleElide`

These can be used to configure the `elide` property of both header titles.
The default values for both of them is `Text.ElideRight`.

Closes #353
2021-08-31 10:59:56 +02:00
B.Melnik 5c706fdc80 fix(StatusListItem): Add propogateCompostedEvents to title mouse area
Closes: #346
2021-08-30 13:45:14 +02:00
Pascal Precht 450e863d44
chore: cut v0.7.0 release 2021-08-30 09:47:01 +02:00
B.Melnik faca4765f4
feat(StatusWindowsTitleBar): Add windows title bar
Closes: #200
2021-08-30 09:42:01 +02:00
Pascal Precht 503a07bf5a fix(StatusModal): ensure header and subtitles elide if needed
Closes #256
2021-08-27 23:08:09 +02:00
B.Melnik f9775e4de3
feat(StatusChatListCategoryItem): Add tooltips settings
Usage:

```qml
StatusChatListCategoryItem {
   addButton.tootlip.text: "Some add lazy text"
   menuButton.tooltip.text: "My menu"
}
```
2021-08-27 13:42:22 +02:00
B.Melnik 7ef61ed3f8 fix(StatusChatInfoButton): Add self-calculated implicitWIdth and elide to texts
This commit add elide flags to text in title and subtitle and add flexibility to width. Now compoents use next rules:
1. If width is set - text should be elided when implicit text  width is more than root object width
2. Component grows if width is not set based on inner elements natural sizes

Closes: #335 and #338
2021-08-27 13:39:36 +02:00
Pascal Precht ee5ec7b3db fix(StatusListItem): don't set width on title item
There was an explicit `width` introduced on `statusListItemTitle`, most likely
to make room for it when `titleAsideText` is supplied.

This unfortunately causes the title get a very small width, resulting in broken
UI.

Since we can assume that there should be enough space for the titleAsideText
when it's used, we probably don't have to calculate a fixed width for the title
in the first place.

This commit therefore removes that explicit setting.
2021-08-27 09:37:06 +02:00
Pascal Precht a4178bd6dc
feat(StatusChatListAndCategories): add drag and drop support for cate… (#349)
* feat(StatusChatListAndCategories): add drag and drop support for categories

This adds support for dragging and dropping chat list categories.
To persist reorder of chat categories, the new `onChatListCategoryReordered`
signal can be leveraged.

Drag and drop of categories is turned off by default and needs to
be turned on using `draggableCategories: true`.

Closes #227

* feat(Status.Core): introduce Utils namespace

This adds a new package for utility related things.
2021-08-26 15:33:45 -04:00
Alexandra Betouni 7da4bdee74
fix(StatusAppThreePanelLayout): increase minimum width in right panel
This is to ensure it also inlcludes right margin.
2021-08-26 17:26:03 +02:00
khushboo-dev-cpp 2d8fd576e0 feat(StatusPopupMenu): changed close policy
Close on press outside added to closing policy as the I found old one to be buggy on mac. Causes no side effects.
2021-08-26 14:45:41 +02:00
B.Melnik 138458d10c fix(StatusBaseInput): fix click to focus
Closes: #325
2021-08-26 09:43:44 +02:00
Pascal Precht 8e8f70af7c
chore: add v0.6.0 changelog 2021-08-26 09:36:04 +02:00
Pascal Precht 5da9cb06d5 fix(StatusChatListCategory): emit original mouse event data in clicked signal
This fixes a bug that was introduced in 01da750899 with a breaking change
where `StatusChatListCategoryItem`'s `clicked` signal would no longer receive
a `mouse` event object.

The reason this is happening is because we've introduced a new `clicked` signal
on `StatusListItem`. The idea was to rely on that within `StatusChatListCategoryItem`,
however, we didn't take into account that the new `clicked` signal in `StatusListItem`
doesn't emit a `mouse` event object.

To fix this issue could either reintroduce the custom `clicked` handler on
`StatusChatListCategoryItem`, or listen to the original `sensor.onClicked` and
`onTitleClicked` signals exposed by `StatusListItem` instead, ensuring the required
`mouse` event data exists.

Fixes #333
2021-08-23 14:17:13 +02:00
B.Melnik c679854d7d feat(StatusChatList): Add drag and drop support of list items
This implements drag and drop capabilities of chat items within a `StatusChatList`.
The commit introduces a `DelegateModal` to visually reorder chat items
when they're being dragged and dropped onto a `DropArea`.

To persist the new order of chat items, various signals have been introduced to chat
list related components:

```qml
StatusChatList {

    onChatItemReordered: function (id, from, to) {
        // ...
    }
}

StatusChatListAndCategories {

    onChatItemReordered: function (categoryId, chatId, from, to) {
        // ...
    }
}
```

There's no such API on the `StatusChatListCategory` type because that one already
exposes its underlying `StatusChatList` via `chatList`, which makes the signal available.

Dragging and dropping chat items is disabled by default and needs to be turned on
using the `draggableItems` property:

```qml
StatusChatList {
    draggableItems: true
    ...
}
```
2021-08-23 14:16:53 +02:00
Pascal Precht c6952a89ae
Revert "fix(StatusChatInputButton) ensure button text is elided correctly"
This reverts commit 38b0207055.
2021-08-19 19:48:00 +02:00
Alexandra Betouni 38b0207055
fix(StatusChatInputButton) ensure button text is elided correctly
Closes #335
2021-08-19 15:28:26 +02:00
Khushboo Mehta d16719adda feat(StatusLetterIdenticon): Expose the text component
Aliased the text compoenent so that its color, text value can be set from outside
2021-08-18 10:44:05 +02:00
Pascal Precht ea3408012f feat(StatusBaseInput): introduce `dirty` and `pristine` properties
These properties can be used to determine whether a user has either
interacted with the form control, or changed its value.

It's also used in initial validation to ensure validation is done but
visually, form controls stay untouched.

Closes #327
2021-08-17 10:44:28 +02:00
Pascal Precht 4b107a0ef4 fix(StatusInput): ensure validation is performed on initialization
Closes #326
2021-08-17 10:42:21 +02:00
Pascal Precht 51d8b55b79 fix(StatusInput): remove recursive binding in label height 2021-08-17 10:42:09 +02:00
Pascal Precht 0243852c63 fix(StatusBaseInput): ensure wrapmode works as expectefd in multiline mode
Closes #324
2021-08-17 10:41:57 +02:00
Pascal Precht ea6743a776 fix(StatusBaseInput): expose cursorPosition
Fixes #323
2021-08-17 10:41:44 +02:00
Sale Djenic 2de261c49b fix(StatusSearchPopup): replace "#" character with "channel" icon 2021-08-17 10:38:23 +02:00
Sale Djenic 78edcb3795 feat(StatusSearchPopupMenuItem): New APIs resetSearchSelection and setSearchSelection
New methods added `resetSearchSelection` and `setSearchSelection` for resetting
and setting selected location.
2021-08-17 10:38:23 +02:00
Sale Djenic 3e134ada18 refactor(StatusSearchLocationMenu): expose a single itemClicked signal
A single `signal itemClicked(string firstLevelItemValue, string secondLevelItemValue)`
with parameters referring to the first level and second level item is exposed
and replaced multiple signals we had before for the same purpose.
2021-08-17 10:38:23 +02:00
Sale Djenic b133d10f96 feat(StatusSearchPopupMenuItem): new API
Status Menu item received new value property.
2021-08-17 10:38:23 +02:00
Sale Djenic c306b68296 fix(StatusSearchLocationMenu): typo fix
Fixed a typo in StatusSearchLocationMenu.locationModel
2021-08-17 10:38:23 +02:00
Sale Djenic 01da750899 feat(StatusListItem): introduce itemId and titleId properties and their handlers
A click on the item's title or whole item emits appropriate `titleClicked` or
`clicked` signal with `titleId` or `itemId` value respectively. `titleId` and
`itemId` may or may not defer from their display values, it's up to logic which
is applied.

This is introduced because of need of the issue-2934.
2021-08-17 10:38:23 +02:00
Pascal Precht 482296c310
chore: cut 0.5.0 release 2021-08-16 09:39:06 +02:00
Pascal Precht ba4f27f9ba feat(StatusInput): introduce new validator pipeline
There's a new `validators` property that can be used to add validators to `StatusInput` instances, which are executed in the same order:

```qml
StatusInput {
  text: "Some value"
  validators: [...]
}
```

For convenience StatusQ provides some common validation methods, such as `StatusMinLengthValidator`, StatusMaxLengthValidator` and could be extended to other (e.g. email validation etc):

```qml
StatusInput {
  text: "Some value"
  validators: [
    StatusMinLengthValidator { minLength: 3 }
  ]
}
```

Validators are executed every time the text of the input changes. They are executed in the same order they have been applied, which enables users to create cascading conditions like "First make sure the value is at least 3 characters long, then make sure it matches a certain pattern".

When a validation fails, it sets the validity of the input (`valid: false`) accordingly and optionally exposes additional error information on `StatusInput.errors`:

```qml
StatusInput {
  text: "Fo"
  onTextChanged: {
    if (errors) {
      /**
       * errors now has the following structure:
       * errors: {
       *   minLength: { minValue: 3, actual: ... }
       * }
       * Also, `StatusInput` is now `valid = false`
       **/
       errorMesssage = "Expected " + errors.minLenght.minValue + " but got: "+ errors.minLength.actual; // i18n'able
    }
  }
  validators: [
    StatusMinLengthValidator { minLength: 3 }
  ]
}
```
There can be any number of error objects on the `errors` property, depending on who many validators have been run that failed validation.

Custom validators can be implemented by introducing a new `StatusValidator` type that has to implement a `validate()` function and defines the validators name. The `validate()` function has to return either `true` or `false` depending on whether the value is valid.

Alternatively, the function can return an error object which gets exposed on the underlying input's `errors` property, at which point it's considered invalid as well.

Here's a simple custom validator:

```qml
// HelloValidator.qml
import StatusQ.Controls.Validators 0.1

StatusValidator {

  property string name: "hello"

  validate: function (value) { // `value` is the `text` value of the underlying control
    return value === "hello"
  }
}
```

Applying this validators would look like this:

```qml
StatusInput {
  text: "Some value"
  validators: [
    HelloValidator {}
  ]
  onTextChanged: {
    if (errors.hello) {
      errorMessage = "Doesn't say hello!"
    }
  }
}
```

Alternatively, validators can return error objects to provide more information about what went wrong. Here's the implementation of the `StatusMinLengthValidator` as an example:

```qml
StatusValidator {

    property int minLength: 0

    name: "minLength"

    validate: function (value) {
        return value.length >= minLength ? true : {
            min: minLength,
            actual: value.length
        }
    }
}
```

Because validators as components, they can hold any custom properties they need to be configured.

There has been concern that, with this API, error messages need to be potentially defined in multiple places, given that there could be multiple instances of any validator. This is easily solved by having a centralized function figure out what the error message is, given a certain error object:

```qml
StatusInput {
  validators: [
    StatusMinLengthValidator { minLength: 3 }
  ]
  onTextChanged: {
    if (errors) {
      errorMessage = getErrorMessage(errors) // this function is provided by global or elsewhere
    }
  }
}
```

Closes #298
2021-08-16 09:37:39 +02:00
Pascal Precht f635bad63c feat(StatusBaseInput): enforce `maximumLength` if it's set
Prior to this commit, setting `charLimit` on `StatusInput` would only have a visual effect
(rendering the char limit), however it wouldn't actually enforce this limit.

This was by intended behaviour, because we wanted to leave some room
for possible validators to kick in (for example a max length validator).

If however the char limit is enforce, such a validator would never kick in.
There seems to be consensus in the team that the limit should be enforced though.

This commit enables that.
2021-08-16 09:28:35 +02:00
Pascal Precht 58a3071626 feat(StatusIcon): add `play-filled` and `pause-filled` icons
Closes #310
2021-08-13 15:02:23 +02:00
Khushboo Mehta d24c2e6208 fix(StatusChatToolBar): Use updated StatusFlatRoundButton
Adapting the StatusChatToolBar with the new StatusFlatRoundButton and initializing it
2021-08-12 17:23:47 +02:00
Khushboo Mehta 5a0489ba17 feat(StatusFlatRoundButton): Adding tooltip to the button
Adding the StatusToolTip to the StatusFlatRoundButton. This will only function when the tooltip text is set from the outside
2021-08-12 17:23:47 +02:00
Khushboo Mehta ee4296837a feat(StatusToolTip): Adding an offset property
Added an offset property with which the arrow position for the tooltip can be adjusted from the outside
2021-08-12 17:23:47 +02:00
Pascal Precht 87ae7b90e7
chore: cut 0.4.0 release 2021-08-12 12:57:33 +02:00
Alexandra Betouni 30f5ae4b32 feat(StatusQ.Popups) Adding SearchPopup component
Closes #264
2021-08-12 11:35:09 +02:00
Pascal Precht 90aa9d76c0 fix(StatusPopupMenu): ensure icon or image settings exist
Fixes #295
2021-08-10 15:12:28 +02:00
RichΛrd 2e1359c9e2
fix(StatusAppNavBar): add profile button (#311) 2021-08-06 12:47:57 -04:00
RichΛrd aab59763e5
chore: replace profile icon (#312) 2021-08-06 12:47:52 -04:00