Skip to content

Commit

Permalink
fix colours in dark mode
Browse files Browse the repository at this point in the history
- use placeholderText for TextField icons (introduced in Qt 5.12)
- use windowText for the large icons in activity view/search results
- also fix retrieval of icons from the server

Signed-off-by: Jyrki Gadinger <[email protected]>
  • Loading branch information
nilsding committed Jan 15, 2025
1 parent 0a52cc2 commit 42096b4
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
8 changes: 3 additions & 5 deletions src/gui/filedetails/ShareeSearchField.qml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,13 @@ TextField {
}

readonly property int horizontalPaddingOffset: Style.trayHorizontalMargin
readonly property color placeholderColor: palette.dark
readonly property double iconsScaleFactor: 0.6

function triggerSuggestionsVisibility() {
shareeListView.count > 0 ? suggestionsPopup.open() : suggestionsPopup.close();
}

placeholderText: enabled ? qsTr("Search for users or groups…") : qsTr("Sharing is not available for this folder")
placeholderTextColor: placeholderColor
verticalAlignment: Qt.AlignVCenter
implicitHeight: Math.max(Style.talkReplyTextFieldPreferredHeight, contentHeight)

Expand Down Expand Up @@ -109,7 +107,7 @@ TextField {
fillMode: Image.PreserveAspectFit
horizontalAlignment: Image.AlignLeft

source: "image://svgimage-custom-color/search.svg" + "/" + root.placeholderColor
source: "image://svgimage-custom-color/search.svg" + "/" + palette.placeholderText
sourceSize: Qt.size(parent.height * root.iconsScaleFactor, parent.height * root.iconsScaleFactor)

visible: !root.shareeModel.fetchOngoing
Expand All @@ -125,7 +123,7 @@ TextField {
}

width: height
color: root.placeholderColor
color: palette.placeholderText
visible: root.shareeModel.fetchOngoing
running: visible
}
Expand All @@ -147,7 +145,7 @@ TextField {
mipmap: true
fillMode: Image.PreserveAspectFit

source: "image://svgimage-custom-color/clear.svg" + "/" + root.placeholderColor
source: "image://svgimage-custom-color/clear.svg" + "/" + palette.placeholderText
sourceSize: Qt.size(parent.height * root.iconsScaleFactor, parent.height * root.iconsScaleFactor)

visible: root.text
Expand Down
2 changes: 1 addition & 1 deletion src/gui/tray/ActivityList.qml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ ScrollView {
verticalAlignment: Image.AlignVCenter
horizontalAlignment: Image.AlignHCenter
fillMode: Image.PreserveAspectFit
source: "image://svgimage-custom-color/activity.svg/" + palette.dark
source: "image://svgimage-custom-color/activity.svg/" + palette.windowText
}

EnforcedPlainTextLabel {
Expand Down
3 changes: 1 addition & 2 deletions src/gui/tray/UnifiedSearchInputContainer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ TextField {

property bool isSearchInProgress: false

readonly property color textFieldIconsColor: palette.dark
readonly property color placeholderColor: palette.dark
readonly property color textFieldIconsColor: palette.placeholderText

readonly property int iconInset: Style.smallSpacing

Expand Down
2 changes: 1 addition & 1 deletion src/gui/tray/UnifiedSearchPlaceholderView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ColumnLayout {
}

Image {
source: "image://svgimage-custom-color/magnifying-glass.svg"
source: `image://svgimage-custom-color/magnifying-glass.svg/${palette.windowText}`
sourceSize.width: Style.trayWindowHeaderHeight / 2
sourceSize.height: Style.trayWindowHeaderHeight / 2
Layout.alignment: Qt.AlignHCenter
Expand Down
2 changes: 1 addition & 1 deletion src/gui/tray/UnifiedSearchResultNothingFound.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ColumnLayout {

Image {
id: unifiedSearchResultsNoResultsLabelIcon
source: "image://svgimage-custom-color/magnifying-glass.svg"
source: `image://svgimage-custom-color/magnifying-glass.svg/${palette.windowText}`
sourceSize.width: Style.trayWindowHeaderHeight / 2
sourceSize.height: Style.trayWindowHeaderHeight / 2
Layout.alignment: Qt.AlignHCenter
Expand Down
7 changes: 6 additions & 1 deletion src/gui/tray/activitylistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,12 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
}
} else {
// We have an activity
return a._icon.isEmpty() ? colorIconPath.arg("activity.svg") : colorIconPath.arg(a._icon);
if (a._icon.isEmpty()) {
return colorIconPath.arg("activity.svg");
}

// using tray-image-provider here as it can read from URLs
return QStringLiteral("image://tray-image-provider/%1").arg(a._icon);
}
};

Expand Down

0 comments on commit 42096b4

Please sign in to comment.