diff --git a/resources.qrc b/resources.qrc index 7222e8c9ff0e7..c3c3a76cf515d 100644 --- a/resources.qrc +++ b/resources.qrc @@ -55,7 +55,6 @@ src/gui/tray/EnforcedPlainTextLabel.qml theme/Style/Style.qml theme/Style/qmldir - src/gui/filedetails/NCRadioButton.qml src/gui/tray/ListItemLineAndSubline.qml src/gui/tray/TrayFoldersMenuButton.qml src/gui/tray/TrayFolderListItem.qml diff --git a/src/gui/BasicComboBox.qml b/src/gui/BasicComboBox.qml index 851e7ceef6d91..a890adeaf665e 100644 --- a/src/gui/BasicComboBox.qml +++ b/src/gui/BasicComboBox.qml @@ -12,12 +12,12 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Layouts 1.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls import Qt5Compat.GraphicalEffects -import Style 1.0 +import Style import "./tray" ComboBox { diff --git a/src/gui/ConflictDelegate.qml b/src/gui/ConflictDelegate.qml index 915173507233a..07ebea17836c5 100644 --- a/src/gui/ConflictDelegate.qml +++ b/src/gui/ConflictDelegate.qml @@ -12,12 +12,12 @@ * for more details. */ -import QtQml 2.15 -import QtQuick 2.15 -import QtQuick.Layouts 1.15 -import QtQuick.Controls 2.15 -import Style 1.0 -import com.nextcloud.desktopclient 1.0 +import QtQml +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls +import Style +import com.nextcloud.desktopclient import "./tray" Item { diff --git a/src/gui/ConflictItemFileInfo.qml b/src/gui/ConflictItemFileInfo.qml index 7a706f7b7fc02..ba1f87510949b 100644 --- a/src/gui/ConflictItemFileInfo.qml +++ b/src/gui/ConflictItemFileInfo.qml @@ -12,11 +12,11 @@ * for more details. */ -import QtQml 2.15 -import QtQuick 2.15 -import QtQuick.Layouts 1.15 -import QtQuick.Controls 2.15 -import Style 1.0 +import QtQml +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls +import Style import "./tray" Item { @@ -31,24 +31,6 @@ Item { CheckBox { id: selectItem - palette { - text: Style.ncTextColor - windowText: Style.ncTextColor - buttonText: Style.ncTextColor - brightText: Style.ncTextBrightColor - highlight: Style.lightHover - highlightedText: Style.ncTextColor - light: Style.lightHover - midlight: Style.ncSecondaryTextColor - mid: Style.darkerHover - dark: Style.menuBorder - button: Style.buttonBackgroundColor - window: palette.dark // NOTE: Fusion theme uses darker window colour for the border of the checkbox - base: Style.backgroundColor - toolTipBase: Style.backgroundColor - toolTipText: Style.ncTextColor - } - anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter diff --git a/src/gui/EmojiPicker.qml b/src/gui/EmojiPicker.qml index 9c1882ed433ff..486965ebd79f7 100644 --- a/src/gui/EmojiPicker.qml +++ b/src/gui/EmojiPicker.qml @@ -12,11 +12,11 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.15 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts -import Style 1.0 +import Style import com.nextcloud.desktopclient 1.0 as NC import "./tray" @@ -134,7 +134,6 @@ ColumnLayout { width: parent.width * 0.8 anchors.centerIn: parent text: qsTr("No recent emojis") - color: palette.midlight wrapMode: Text.Wrap font.bold: true visible: emojiView.count === 0 diff --git a/src/gui/ErrorBox.qml b/src/gui/ErrorBox.qml index 1ac6c5e2ac365..10699b90b665b 100644 --- a/src/gui/ErrorBox.qml +++ b/src/gui/ErrorBox.qml @@ -12,11 +12,11 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Layouts 1.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls -import Style 1.0 +import Style import "./tray" Item { @@ -70,7 +70,7 @@ Item { background: null icon.color: palette.buttonText - icon.source: "qrc:///client/theme/close.svg" + icon.source: "image://svgimage-custom-color/close.svg" visible: errorBox.showCloseButton enabled: visible diff --git a/src/gui/PredefinedStatusButton.qml b/src/gui/PredefinedStatusButton.qml index f51716a725d3e..b44147103a8ee 100644 --- a/src/gui/PredefinedStatusButton.qml +++ b/src/gui/PredefinedStatusButton.qml @@ -12,11 +12,11 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Layouts 1.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls -import Style 1.0 +import Style import "./tray" AbstractButton { diff --git a/src/gui/ResolveConflictsDialog.qml b/src/gui/ResolveConflictsDialog.qml index 285bd8c038a27..af404fba41fd6 100644 --- a/src/gui/ResolveConflictsDialog.qml +++ b/src/gui/ResolveConflictsDialog.qml @@ -12,14 +12,14 @@ * for more details. */ -import QtQml 2.15 -import QtQuick 2.15 -import QtQuick.Window 2.15 as QtWindow -import QtQuick.Layouts 1.15 -import QtQuick.Controls 2.15 -import QtQml.Models 2.15 -import Style 1.0 -import com.nextcloud.desktopclient 1.0 +import QtQml +import QtQuick +import QtQuick.Window as QtWindow +import QtQuick.Layouts +import QtQuick.Controls +import QtQml.Models +import Style +import com.nextcloud.desktopclient import "./tray" ApplicationWindow { @@ -36,26 +36,6 @@ ApplicationWindow { minimumHeight: Style.minimumHeightResolveConflictsDialog title: qsTr('Solve sync conflicts') - // TODO: Rather than setting all these palette colours manually, - // create a custom style and do it for all components globally - palette { - text: Style.ncTextColor - windowText: Style.ncTextColor - buttonText: Style.ncTextColor - brightText: Style.ncTextBrightColor - highlight: Style.lightHover - highlightedText: Style.ncTextColor - light: Style.lightHover - midlight: Style.ncSecondaryTextColor - mid: Style.darkerHover - dark: Style.menuBorder - button: Style.buttonBackgroundColor - window: Style.backgroundColor - base: Style.backgroundColor - toolTipBase: Style.backgroundColor - toolTipText: Style.ncTextColor - } - onClosing: function(close) { Systray.destroyDialog(self); close.accepted = true @@ -94,24 +74,6 @@ ApplicationWindow { Layout.fillWidth: true - palette { - text: Style.ncTextColor - windowText: Style.ncTextColor - buttonText: Style.ncTextColor - brightText: Style.ncTextBrightColor - highlight: Style.lightHover - highlightedText: Style.ncTextColor - light: Style.lightHover - midlight: Style.ncSecondaryTextColor - mid: Style.darkerHover - dark: Style.menuBorder - button: Style.buttonBackgroundColor - window: palette.dark // NOTE: Fusion theme uses darker window colour for the border of the checkbox - base: Style.backgroundColor - toolTipBase: Style.backgroundColor - toolTipText: Style.ncTextColor - } - text: qsTr('All local versions') leftPadding: 0 @@ -130,24 +92,6 @@ ApplicationWindow { Layout.fillWidth: true - palette { - text: Style.ncTextColor - windowText: Style.ncTextColor - buttonText: Style.ncTextColor - brightText: Style.ncTextBrightColor - highlight: Style.lightHover - highlightedText: Style.ncTextColor - light: Style.lightHover - midlight: Style.ncSecondaryTextColor - mid: Style.darkerHover - dark: Style.menuBorder - button: Style.buttonBackgroundColor - window: palette.dark // NOTE: Fusion theme uses darker window colour for the border of the checkbox - base: Style.backgroundColor - toolTipBase: Style.backgroundColor - toolTipText: Style.ncTextColor - } - text: qsTr('All server versions') leftPadding: 0 diff --git a/src/gui/UserStatusSelector.qml b/src/gui/UserStatusSelector.qml index 91ef770f67dec..3d2452c6c82ff 100644 --- a/src/gui/UserStatusSelector.qml +++ b/src/gui/UserStatusSelector.qml @@ -12,14 +12,14 @@ * for more details. */ -import QtQuick 2.6 +import QtQuick import QtQuick.Dialogs -import QtQuick.Layouts 1.15 -import QtQuick.Controls 2.15 -import QtQuick.Window 2.15 +import QtQuick.Layouts +import QtQuick.Controls +import QtQuick.Window -import com.nextcloud.desktopclient 1.0 as NC -import Style 1.0 +import com.nextcloud.desktopclient as NC +import Style import "./tray" ColumnLayout { diff --git a/src/gui/UserStatusSelectorButton.qml b/src/gui/UserStatusSelectorButton.qml index c549d25267e2a..db622f917b5a5 100644 --- a/src/gui/UserStatusSelectorButton.qml +++ b/src/gui/UserStatusSelectorButton.qml @@ -12,11 +12,11 @@ * for more details. */ -import QtQuick 2.6 -import QtQuick.Layouts 1.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls -import Style 1.0 +import Style import "./tray" @@ -71,7 +71,6 @@ AbstractButton { text: root.text wrapMode: Text.Wrap - color: root.colored ? palette.brightText : palette.buttonText font.bold: root.primary } @@ -85,7 +84,6 @@ AbstractButton { text: root.secondaryText wrapMode: Text.Wrap - color: palette.midlight visible: root.secondaryText !== "" } } diff --git a/src/gui/UserStatusSelectorPage.qml b/src/gui/UserStatusSelectorPage.qml index 42b92249f35ae..c40654b6f0505 100644 --- a/src/gui/UserStatusSelectorPage.qml +++ b/src/gui/UserStatusSelectorPage.qml @@ -12,11 +12,11 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import Style 1.0 +import QtQuick +import QtQuick.Controls +import Style -import com.nextcloud.desktopclient 1.0 as NC +import com.nextcloud.desktopclient as NC Page { id: page diff --git a/src/gui/filedetails/FileActivityView.qml b/src/gui/filedetails/FileActivityView.qml index 002654b7955bc..904bee76240be 100644 --- a/src/gui/filedetails/FileActivityView.qml +++ b/src/gui/filedetails/FileActivityView.qml @@ -12,12 +12,12 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Layouts 1.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls -import com.nextcloud.desktopclient 1.0 -import Style 1.0 +import com.nextcloud.desktopclient +import Style import "../tray" ActivityList { diff --git a/src/gui/filedetails/FileDetailsPage.qml b/src/gui/filedetails/FileDetailsPage.qml index 5008017a8efe4..231d4fc9e1eff 100644 --- a/src/gui/filedetails/FileDetailsPage.qml +++ b/src/gui/filedetails/FileDetailsPage.qml @@ -12,12 +12,12 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Layouts 1.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls -import com.nextcloud.desktopclient 1.0 -import Style 1.0 +import com.nextcloud.desktopclient +import Style import "../tray" Page { @@ -139,8 +139,6 @@ Page { Layout.rightMargin: headerGridLayout.textRightMargin icon.source: "image://svgimage-custom-color/clear.svg" + "/" + palette.buttonText - bgColor: palette.highlight - bgNormalOpacity: 0 toolTipText: qsTr("Dismiss") visible: root.showCloseButton @@ -155,7 +153,6 @@ Page { Layout.rightMargin: headerGridLayout.textRightMargin text: `${root.fileDetails.sizeString} · ${root.fileDetails.lastChangedString}` - color: palette.midlight wrapMode: Text.Wrap } @@ -166,7 +163,6 @@ Page { Layout.rightMargin: headerGridLayout.textRightMargin text: root.fileDetails.lockExpireString - color: palette.midlight wrapMode: Text.Wrap visible: headerGridLayout.showFileLockedString } @@ -208,7 +204,7 @@ Page { id: hoverHandler } - NCToolTip { + ToolTip { visible: hoverHandler.hovered text: tagRepeater.fileTagModel.overflowTagsString } diff --git a/src/gui/filedetails/FileDetailsView.qml b/src/gui/filedetails/FileDetailsView.qml index 5fae863d4f6d0..c7b7104dfa372 100644 --- a/src/gui/filedetails/FileDetailsView.qml +++ b/src/gui/filedetails/FileDetailsView.qml @@ -12,12 +12,12 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Layouts 1.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls -import com.nextcloud.desktopclient 1.0 -import Style 1.0 +import com.nextcloud.desktopclient +import Style StackView { id: root diff --git a/src/gui/filedetails/FileDetailsWindow.qml b/src/gui/filedetails/FileDetailsWindow.qml index abcf3e850f90e..2353498ad8db0 100644 --- a/src/gui/filedetails/FileDetailsWindow.qml +++ b/src/gui/filedetails/FileDetailsWindow.qml @@ -12,13 +12,13 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Window 2.15 -import QtQuick.Layouts 1.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Window +import QtQuick.Layouts +import QtQuick.Controls -import com.nextcloud.desktopclient 1.0 -import Style 1.0 +import com.nextcloud.desktopclient +import Style ApplicationWindow { id: root @@ -33,26 +33,6 @@ ApplicationWindow { title: qsTr("File details of %1 · %2").arg(fileDetailsPage.fileDetails.name).arg(Systray.windowTitle) - // TODO: Rather than setting all these palette colours manually, - // create a custom style and do it for all components globally - palette { - text: Style.ncTextColor - windowText: Style.ncTextColor - buttonText: Style.ncTextColor - brightText: Style.ncTextBrightColor - highlight: Style.lightHover - highlightedText: Style.ncTextColor - light: Style.lightHover - midlight: Style.ncSecondaryTextColor - mid: Style.darkerHover - dark: Style.menuBorder - button: Style.buttonBackgroundColor - window: Style.backgroundColor - base: Style.backgroundColor - toolTipBase: Style.backgroundColor - toolTipText: Style.ncTextColor - } - FileDetailsView { id: fileDetailsPage anchors.fill: parent diff --git a/src/gui/filedetails/FileTag.qml b/src/gui/filedetails/FileTag.qml index f9a340f2c3c03..425c1024bb1d1 100644 --- a/src/gui/filedetails/FileTag.qml +++ b/src/gui/filedetails/FileTag.qml @@ -12,9 +12,9 @@ * for more details. */ -import QtQuick 2.15 +import QtQuick -import Style 1.0 +import Style import "../tray" EnforcedPlainTextLabel { @@ -27,7 +27,6 @@ EnforcedPlainTextLabel { color: palette.base } - color: palette.midlight elide: Text.ElideRight padding: Style.smallSpacing } diff --git a/src/gui/filedetails/NCInputDateField.qml b/src/gui/filedetails/NCInputDateField.qml index 4c0ea491c7fe4..b39eed3273065 100644 --- a/src/gui/filedetails/NCInputDateField.qml +++ b/src/gui/filedetails/NCInputDateField.qml @@ -12,9 +12,9 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import com.nextcloud.desktopclient 1.0 +import QtQuick +import QtQuick.Controls +import com.nextcloud.desktopclient NCInputTextField { id: root @@ -46,4 +46,5 @@ NCInputTextField { backend.dateString = text; root.userAcceptedDate(); } -} \ No newline at end of file +} + diff --git a/src/gui/filedetails/NCInputTextEdit.qml b/src/gui/filedetails/NCInputTextEdit.qml index 3685b1f9deaa7..8a16a4a6d7811 100644 --- a/src/gui/filedetails/NCInputTextEdit.qml +++ b/src/gui/filedetails/NCInputTextEdit.qml @@ -12,12 +12,12 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.15 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts -import com.nextcloud.desktopclient 1.0 -import Style 1.0 +import com.nextcloud.desktopclient +import Style TextEdit { id: root @@ -33,16 +33,6 @@ TextEdit { selectByMouse: true height: Math.max(Style.talkReplyTextFieldPreferredHeight, contentHeight) - Rectangle { - id: textFieldBorder - anchors.fill: parent - radius: Style.slightlyRoundedButtonRadius - border.width: Style.normalBorderWidth - border.color: root.activeFocus ? root.accentColor : root.secondaryColor - color: palette.base - z: -1 - } - Button { id: submitButton @@ -53,11 +43,6 @@ TextEdit { width: height height: parent.height - background: Rectangle { - radius: width / 2 - color: textFieldBorder.color - } - flat: true icon.source: "image://svgimage-custom-color/confirm.svg" + "/" + root.secondaryColor icon.color: hovered && enabled ? UserModel.currentUser.accentColor : root.secondaryColor diff --git a/src/gui/filedetails/NCInputTextField.qml b/src/gui/filedetails/NCInputTextField.qml index fa4bef0bfc8a2..a67d697349986 100644 --- a/src/gui/filedetails/NCInputTextField.qml +++ b/src/gui/filedetails/NCInputTextField.qml @@ -12,12 +12,12 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.15 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts -import com.nextcloud.desktopclient 1.0 -import Style 1.0 +import com.nextcloud.desktopclient +import Style TextField { id: root @@ -33,14 +33,6 @@ TextField { selectByMouse: true - background: Rectangle { - id: textFieldBorder - radius: Style.slightlyRoundedButtonRadius - border.width: Style.normalBorderWidth - border.color: root.activeFocus ? root.validInput ? root.accentColor : Style.errorBoxBackgroundColor : root.secondaryColor - color: palette.base - } - Button { id: submitButton diff --git a/src/gui/filedetails/NCRadioButton.qml b/src/gui/filedetails/NCRadioButton.qml deleted file mode 100644 index 52e12d7964b32..0000000000000 --- a/src/gui/filedetails/NCRadioButton.qml +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) by Oleksandr Zolotov - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - */ - -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import Style 1.0 - -RadioButton { - id: root - - property int indicatorItemWidth: Style.radioButtonIndicatorSize - property int indicatorItemHeight: Style.radioButtonIndicatorSize - property int radius: Style.radioButtonCustomRadius - - indicator: Rectangle { - implicitWidth: root.indicatorItemWidth - implicitHeight: root.indicatorItemHeight - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: Style.radioButtonCustomMarginLeftOuter - radius: root.radius - color: palette.base - border.color: palette.dark - border.width: Style.normalBorderWidth - - Rectangle { - anchors.fill: parent - visible: root.checked - color: palette.buttonText - radius: root.radius - anchors.margins: Style.radioButtonCustomMarginLeftInner - } - } -} diff --git a/src/gui/filedetails/NCTabButton.qml b/src/gui/filedetails/NCTabButton.qml index f1ac3c3037e10..c06f73ff233a2 100644 --- a/src/gui/filedetails/NCTabButton.qml +++ b/src/gui/filedetails/NCTabButton.qml @@ -12,13 +12,13 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Window 2.15 -import QtQuick.Layouts 1.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Window +import QtQuick.Layouts +import QtQuick.Controls -import com.nextcloud.desktopclient 1.0 -import Style 1.0 +import com.nextcloud.desktopclient +import Style import "../tray" TabButton { @@ -64,7 +64,6 @@ TabButton { Layout.fillWidth: true horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter - color: tabButtonLayout.elementColors text: tabButton.text font.bold: tabButton.checked } diff --git a/src/gui/filedetails/ShareDelegate.qml b/src/gui/filedetails/ShareDelegate.qml index 65e88ecf75644..45838ae44db07 100644 --- a/src/gui/filedetails/ShareDelegate.qml +++ b/src/gui/filedetails/ShareDelegate.qml @@ -12,14 +12,14 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Window 2.15 -import QtQuick.Layouts 1.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Window +import QtQuick.Layouts +import QtQuick.Controls import Qt5Compat.GraphicalEffects -import com.nextcloud.desktopclient 1.0 -import Style 1.0 +import com.nextcloud.desktopclient +import Style import "../tray" import "../" @@ -140,7 +140,6 @@ GridLayout { Layout.column: 1 text: root.detailText - color: palette.midlight elide: Text.ElideRight visible: text !== "" } @@ -162,9 +161,6 @@ GridLayout { toolTipText: qsTr("Create a new share link") - bgColor: palette.highlight - bgNormalOpacity: 0 - icon.source: "image://svgimage-custom-color/add.svg/" + palette.buttonText icon.width: Style.smallIconSize icon.height: Style.smallIconSize @@ -197,10 +193,6 @@ GridLayout { toolTipText: qsTr("Copy share link location") text: shareLinkCopied ? qsTr("Copied!") : "" - textColor: palette.brightText - contentsFont.bold: true - bgColor: shareLinkCopied ? Style.positiveColor : palette.highlight - bgNormalOpacity: shareLinkCopied ? 1 : 0 icon.source: shareLinkCopied ? "image://svgimage-custom-color/copy.svg/" + palette.brightText : "image://svgimage-custom-color/copy.svg/" + palette.buttonText @@ -212,13 +204,14 @@ GridLayout { onClicked: copyShareLink() - Behavior on bgColor { - ColorAnimation { duration: Style.shortAnimationDuration } - } + // TODO + // Behavior on bgColor { + // ColorAnimation { duration: Style.shortAnimationDuration } + // } - Behavior on bgNormalOpacity { - NumberAnimation { duration: Style.shortAnimationDuration } - } + // Behavior on bgNormalOpacity { + // NumberAnimation { duration: Style.shortAnimationDuration } + // } Behavior on Layout.preferredWidth { SmoothedAnimation { duration: Style.shortAnimationDuration } @@ -245,9 +238,6 @@ GridLayout { toolTipText: qsTr("Share options") - bgColor: palette.highlight - bgNormalOpacity: 0 - icon.source: "image://svgimage-custom-color/more.svg/" + palette.buttonText icon.width: Style.smallIconSize icon.height: Style.smallIconSize diff --git a/src/gui/filedetails/ShareDetailsPage.qml b/src/gui/filedetails/ShareDetailsPage.qml index 8b6f7930515c5..223468ee9b168 100644 --- a/src/gui/filedetails/ShareDetailsPage.qml +++ b/src/gui/filedetails/ShareDetailsPage.qml @@ -12,14 +12,14 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Window 2.15 -import QtQuick.Layouts 1.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Window +import QtQuick.Layouts +import QtQuick.Controls import Qt5Compat.GraphicalEffects -import com.nextcloud.desktopclient 1.0 -import Style 1.0 +import com.nextcloud.desktopclient +import Style import "../tray" import "../" @@ -229,8 +229,6 @@ Page { Layout.rightMargin: root.padding icon.source: "image://svgimage-custom-color/clear.svg" + "/" + palette.buttonText - bgColor: palette.highlight - bgNormalOpacity: 0 toolTipText: qsTr("Dismiss") onClicked: root.closeShareDetails() @@ -243,7 +241,6 @@ Page { Layout.rightMargin: root.padding text: root.fileDetails.name - color: palette.midlight wrapMode: Text.Wrap } } @@ -314,30 +311,6 @@ Page { active: !root.isFolderItem && !root.isEncryptedItem visible: active sourceComponent: CheckBox { - // TODO: Rather than setting all these palette colours manually, - // create a custom style and do it for all components globally. - // - // Additionally, we need to override the entire palette when we - // set one palette property, as otherwise we default back to the - // theme palette -- not the parent palette - palette { - text: Style.ncTextColor - windowText: Style.ncTextColor - buttonText: Style.ncTextColor - brightText: Style.ncTextBrightColor - highlight: Style.lightHover - highlightedText: Style.ncTextColor - light: Style.lightHover - midlight: Style.ncSecondaryTextColor - mid: Style.darkerHover - dark: Style.menuBorder - button: Style.buttonBackgroundColor - window: Style.menuBorder - base: Style.backgroundColor - toolTipBase: Style.backgroundColor - toolTipText: Style.ncTextColor - } - spacing: scrollContentsColumn.indicatorSpacing padding: scrollContentsColumn.itemPadding indicator.width: scrollContentsColumn.indicatorItemWidth @@ -372,43 +345,37 @@ Page { id: permissionModeRadioButtonsGroup } - NCRadioButton { + RadioButton { readonly property int permissionMode: ShareModel.ModeViewOnly Layout.fillWidth: true ButtonGroup.group: permissionModeRadioButtonsGroup enabled: !root.isSharePermissionChangeInProgress checked: root.currentPermissionMode === permissionMode text: qsTr("View only") - indicatorItemWidth: scrollContentsColumn.indicatorItemWidth - indicatorItemHeight: scrollContentsColumn.indicatorItemWidth spacing: scrollContentsColumn.indicatorSpacing padding: scrollContentsColumn.itemPadding onClicked: root.permissionModeChanged(permissionMode) } - NCRadioButton { + RadioButton { readonly property int permissionMode: ShareModel.ModeUploadAndEditing Layout.fillWidth: true ButtonGroup.group: permissionModeRadioButtonsGroup enabled: !root.isSharePermissionChangeInProgress checked: root.currentPermissionMode === permissionMode text: qsTr("Allow upload and editing") - indicatorItemWidth: scrollContentsColumn.indicatorItemWidth - indicatorItemHeight: scrollContentsColumn.indicatorItemWidth spacing: scrollContentsColumn.indicatorSpacing padding: scrollContentsColumn.itemPadding onClicked: root.permissionModeChanged(permissionMode) } - NCRadioButton { + RadioButton { readonly property int permissionMode: ShareModel.ModeFileDropOnly Layout.fillWidth: true ButtonGroup.group: permissionModeRadioButtonsGroup enabled: !root.isSharePermissionChangeInProgress checked: root.currentPermissionMode === permissionMode text: qsTr("File drop (upload only)") - indicatorItemWidth: scrollContentsColumn.indicatorItemWidth - indicatorItemHeight: scrollContentsColumn.indicatorItemWidth spacing: scrollContentsColumn.indicatorSpacing padding: scrollContentsColumn.itemPadding onClicked: root.permissionModeChanged(permissionMode) @@ -419,30 +386,6 @@ Page { Layout.fillWidth: true - // TODO: Rather than setting all these palette colours manually, - // create a custom style and do it for all components globally. - // - // Additionally, we need to override the entire palette when we - // set one palette property, as otherwise we default back to the - // theme palette -- not the parent palette - palette { - text: Style.ncTextColor - windowText: Style.ncTextColor - buttonText: Style.ncTextColor - brightText: Style.ncTextBrightColor - highlight: Style.lightHover - highlightedText: Style.ncTextColor - light: Style.lightHover - midlight: Style.ncSecondaryTextColor - mid: Style.darkerHover - dark: Style.menuBorder - button: Style.buttonBackgroundColor - window: palette.dark // NOTE: Fusion theme uses darker window colour for the border of the checkbox - base: Style.backgroundColor - toolTipBase: Style.backgroundColor - toolTipText: Style.ncTextColor - } - spacing: scrollContentsColumn.indicatorSpacing padding: scrollContentsColumn.itemPadding indicator.width: scrollContentsColumn.indicatorItemWidth @@ -482,30 +425,6 @@ Page { anchors.left: parent.left anchors.right: parent.right - // TODO: Rather than setting all these palette colours manually, - // create a custom style and do it for all components globally. - // - // Additionally, we need to override the entire palette when we - // set one palette property, as otherwise we default back to the - // theme palette -- not the parent palette - palette { - text: Style.ncTextColor - windowText: Style.ncTextColor - buttonText: Style.ncTextColor - brightText: Style.ncTextBrightColor - highlight: Style.lightHover - highlightedText: Style.ncTextColor - light: Style.lightHover - midlight: Style.ncSecondaryTextColor - mid: Style.darkerHover - dark: Style.menuBorder - button: Style.buttonBackgroundColor - window: palette.dark // NOTE: Fusion theme uses darker window colour for the border of the checkbox - base: Style.backgroundColor - toolTipBase: Style.backgroundColor - toolTipText: Style.ncTextColor - } - spacing: scrollContentsColumn.indicatorSpacing padding: scrollContentsColumn.itemPadding indicator.width: scrollContentsColumn.indicatorItemWidth @@ -531,30 +450,6 @@ Page { Layout.fillWidth: true - // TODO: Rather than setting all these palette colours manually, - // create a custom style and do it for all components globally. - // - // Additionally, we need to override the entire palette when we - // set one palette property, as otherwise we default back to the - // theme palette -- not the parent palette - palette { - text: Style.ncTextColor - windowText: Style.ncTextColor - buttonText: Style.ncTextColor - brightText: Style.ncTextBrightColor - highlight: Style.lightHover - highlightedText: Style.ncTextColor - light: Style.lightHover - midlight: Style.ncSecondaryTextColor - mid: Style.darkerHover - dark: Style.menuBorder - button: Style.buttonBackgroundColor - window: Style.menuBorder - base: Style.backgroundColor - toolTipBase: Style.backgroundColor - toolTipText: Style.ncTextColor - } - spacing: scrollContentsColumn.indicatorSpacing padding: scrollContentsColumn.itemPadding indicator.width: scrollContentsColumn.indicatorItemWidth @@ -664,30 +559,6 @@ Page { Layout.fillWidth: true - // TODO: Rather than setting all these palette colours manually, - // create a custom style and do it for all components globally. - // - // Additionally, we need to override the entire palette when we - // set one palette property, as otherwise we default back to the - // theme palette -- not the parent palette - palette { - text: Style.ncTextColor - windowText: Style.ncTextColor - buttonText: Style.ncTextColor - brightText: Style.ncTextBrightColor - highlight: Style.lightHover - highlightedText: Style.ncTextColor - light: Style.lightHover - midlight: Style.ncSecondaryTextColor - mid: Style.darkerHover - dark: Style.menuBorder - button: Style.buttonBackgroundColor - window: Style.menuBorder - base: Style.backgroundColor - toolTipBase: Style.backgroundColor - toolTipText: Style.ncTextColor - } - spacing: scrollContentsColumn.indicatorSpacing padding: scrollContentsColumn.itemPadding indicator.width: scrollContentsColumn.indicatorItemWidth @@ -772,30 +643,6 @@ Page { Layout.fillWidth: true - // TODO: Rather than setting all these palette colours manually, - // create a custom style and do it for all components globally. - // - // Additionally, we need to override the entire palette when we - // set one palette property, as otherwise we default back to the - // theme palette -- not the parent palette - palette { - text: Style.ncTextColor - windowText: Style.ncTextColor - buttonText: Style.ncTextColor - brightText: Style.ncTextBrightColor - highlight: Style.lightHover - highlightedText: Style.ncTextColor - light: Style.lightHover - midlight: Style.ncSecondaryTextColor - mid: Style.darkerHover - dark: Style.menuBorder - button: Style.buttonBackgroundColor - window: Style.menuBorder - base: Style.backgroundColor - toolTipBase: Style.backgroundColor - toolTipText: Style.ncTextColor - } - spacing: scrollContentsColumn.indicatorSpacing padding: scrollContentsColumn.itemPadding indicator.width: scrollContentsColumn.indicatorItemWidth @@ -872,13 +719,6 @@ Page { icon.source: "image://svgimage-custom-color/close.svg/" + Style.errorBoxBackgroundColor imageSourceHover: "image://svgimage-custom-color/close.svg/" + palette.brightText text: qsTr("Unshare") - textColor: Style.errorBoxBackgroundColor - textColorHovered: "white" - contentsFont.bold: true - bgNormalColor: palette.button - bgHoverColor: Style.errorBoxBackgroundColor - bgNormalOpacity: 1.0 - bgHoverOpacity: 1.0 onClicked: root.deleteShare() } @@ -889,13 +729,6 @@ Page { icon.source: "image://svgimage-custom-color/add.svg/" + root.accentColor imageSourceHover: "image://svgimage-custom-color/add.svg/" + palette.brightText text: qsTr("Add another link") - textColor: root.accentColor - textColorHovered: palette.brightText - contentsFont.bold: true - bgNormalColor: palette.button - bgHoverColor: root.accentColor - bgNormalOpacity: 1.0 - bgHoverOpacity: 1.0 visible: root.isLinkShare && root.canCreateLinkShares enabled: visible @@ -933,24 +766,19 @@ Page { icon.source: "image://svgimage-custom-color/copy.svg/" + palette.brightText text: shareLinkCopied ? qsTr("Share link copied!") : qsTr("Copy share link") - textColor: palette.brightText - contentsFont.bold: true - bgColor: shareLinkCopied ? Style.positiveColor : root.accentColor - bgNormalOpacity: 1.0 - bgHoverOpacity: shareLinkCopied ? 1.0 : Style.hoverOpacity - visible: root.isLinkShare enabled: visible onClicked: copyShareLink() - Behavior on bgColor { - ColorAnimation { duration: Style.shortAnimationDuration } - } + // TODO + // Behavior on bgColor { + // ColorAnimation { duration: Style.shortAnimationDuration } + // } - Behavior on bgHoverOpacity { - NumberAnimation { duration: Style.shortAnimationDuration } - } + // Behavior on bgHoverOpacity { + // NumberAnimation { duration: Style.shortAnimationDuration } + // } Behavior on Layout.preferredWidth { SmoothedAnimation { duration: Style.shortAnimationDuration } diff --git a/src/gui/filedetails/ShareView.qml b/src/gui/filedetails/ShareView.qml index c4c58fde14910..425e442800ba8 100644 --- a/src/gui/filedetails/ShareView.qml +++ b/src/gui/filedetails/ShareView.qml @@ -12,13 +12,13 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Window 2.15 -import QtQuick.Layouts 1.2 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Window +import QtQuick.Layouts +import QtQuick.Controls -import com.nextcloud.desktopclient 1.0 -import Style 1.0 +import com.nextcloud.desktopclient +import Style import "../tray" import "../" @@ -282,7 +282,6 @@ ColumnLayout { id: sharingDisabledLabel width: parent.width text: qsTr("Sharing is disabled") - color: palette.midlight wrapMode: Text.Wrap horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter @@ -290,7 +289,6 @@ ColumnLayout { EnforcedPlainTextLabel { width: parent.width text: qsTr("This item cannot be shared.") - color: palette.midlight wrapMode: Text.Wrap horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter @@ -299,7 +297,6 @@ ColumnLayout { EnforcedPlainTextLabel { width: parent.width text: qsTr("Sharing is disabled.") - color: palette.midlight wrapMode: Text.Wrap horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter diff --git a/src/gui/filedetails/ShareeDelegate.qml b/src/gui/filedetails/ShareeDelegate.qml index 40b169d87be1e..b46b3bb81e78a 100644 --- a/src/gui/filedetails/ShareeDelegate.qml +++ b/src/gui/filedetails/ShareeDelegate.qml @@ -12,13 +12,13 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Window 2.15 -import QtQuick.Layouts 1.2 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Window +import QtQuick.Layouts +import QtQuick.Controls -import com.nextcloud.desktopclient 1.0 -import Style 1.0 +import com.nextcloud.desktopclient +import Style import "../tray" diff --git a/src/gui/filedetails/ShareeSearchField.qml b/src/gui/filedetails/ShareeSearchField.qml index 4246d54e9ed8d..233466770a48c 100644 --- a/src/gui/filedetails/ShareeSearchField.qml +++ b/src/gui/filedetails/ShareeSearchField.qml @@ -12,13 +12,13 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Window 2.15 -import QtQuick.Layouts 1.2 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Window +import QtQuick.Layouts +import QtQuick.Controls -import com.nextcloud.desktopclient 1.0 -import Style 1.0 +import com.nextcloud.desktopclient +import Style import "../tray" TextField { @@ -90,13 +90,6 @@ TextField { leftPadding: searchIcon.width + searchIcon.anchors.leftMargin + horizontalPaddingOffset rightPadding: clearTextButton.width + clearTextButton.anchors.rightMargin + horizontalPaddingOffset - background: Rectangle { - radius: 5 - border.color: parent.activeFocus ? UserModel.currentUser.accentColor : palette.dark - border.width: 1 - color: palette.base - } - Image { id: searchIcon anchors { diff --git a/src/gui/macOS/ui/FileProviderEvictionDialog.qml b/src/gui/macOS/ui/FileProviderEvictionDialog.qml index 01db805c8bb53..4d94affa725da 100644 --- a/src/gui/macOS/ui/FileProviderEvictionDialog.qml +++ b/src/gui/macOS/ui/FileProviderEvictionDialog.qml @@ -54,10 +54,6 @@ ApplicationWindow { CustomButton { padding: Style.smallSpacing - textColor: Style.ncTextColor - textColorHovered: Style.ncHeaderTextColor - contentsFont.bold: true - bgColor: Style.ncBlue text: qsTr("Reload") onClicked: reloadMaterialisedItems(accountUserIdAtHost) } diff --git a/src/gui/macOS/ui/FileProviderFileDelegate.qml b/src/gui/macOS/ui/FileProviderFileDelegate.qml index d364a364c3744..731c8f4a64f11 100644 --- a/src/gui/macOS/ui/FileProviderFileDelegate.qml +++ b/src/gui/macOS/ui/FileProviderFileDelegate.qml @@ -93,9 +93,6 @@ Item { Layout.alignment: Qt.AlignRight | Qt.AlignVCenter text: qsTr("Delete") - textColorHovered: Style.ncHeaderTextColor - bgColor: Style.errorBoxBackgroundColor - contentsFont.bold: true onClicked: root.evictItem(root.identifier, root.domainIdentifier) } } diff --git a/src/gui/macOS/ui/FileProviderSettings.qml b/src/gui/macOS/ui/FileProviderSettings.qml index a4efa0a32eae9..b68e71757f63d 100644 --- a/src/gui/macOS/ui/FileProviderSettings.qml +++ b/src/gui/macOS/ui/FileProviderSettings.qml @@ -31,26 +31,6 @@ Page { title: qsTr("Virtual files settings") - // TODO: Rather than setting all these palette colours manually, - // create a custom style and do it for all components globally. - palette { - text: Style.ncTextColor - windowText: Style.ncTextColor - buttonText: Style.ncTextColor - brightText: Style.ncTextBrightColor - highlight: Style.lightHover - highlightedText: Style.ncTextColor - light: Style.lightHover - midlight: Style.ncSecondaryTextColor - mid: Style.darkerHover - dark: Style.menuBorder - button: Style.buttonBackgroundColor - window: Style.backgroundColor - base: Style.backgroundColor - toolTipBase: Style.backgroundColor - toolTipText: Style.ncTextColor - } - background: Rectangle { color: palette.window border.width: root.showBorder ? Style.normalBorderWidth : 0 diff --git a/src/gui/main.cpp b/src/gui/main.cpp index 14b55dab7dc35..2e7649fe6d78e 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -70,7 +70,17 @@ int main(int argc, char **argv) QSurfaceFormat::setDefaultFormat(surfaceFormat); QQuickWindow::setTextRenderType(QQuickWindow::NativeTextRendering); - QQuickStyle::setStyle(QStringLiteral("Fusion")); + + auto style = QStringLiteral("Fusion"); + +#if defined Q_OS_MAC + style = QStringLiteral("macOS"); +#elif defined Q_OS_WIN + style = QStringLiteral("Windows"); +#endif + + QQuickStyle::setStyle(style); + QQuickStyle::setFallbackStyle(QStringLiteral("Fusion")); OCC::Application app(argc, argv); diff --git a/src/gui/tray/ActivityActionButton.qml b/src/gui/tray/ActivityActionButton.qml index 1682bb2936438..36b92035c00a1 100644 --- a/src/gui/tray/ActivityActionButton.qml +++ b/src/gui/tray/ActivityActionButton.qml @@ -1,7 +1,7 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.3 -import Style 1.0 -import com.nextcloud.desktopclient 1.0 +import QtQuick +import QtQuick.Controls +import Style +import com.nextcloud.desktopclient AbstractButton { id: root @@ -10,11 +10,7 @@ AbstractButton { property bool primaryButton: false - property string imageSourceHover: "" - readonly property color adjustedHeaderColor: Style.adjustedCurrentUserHeaderColor - readonly property color textColor: primaryButton ? adjustedHeaderColor : palette.buttonText - readonly property color textColorHovered: primaryButton ? Style.currentUserHeaderTextColor : palette.buttonText property string verb: "" property bool isTalkReplyButton: false @@ -22,12 +18,6 @@ AbstractButton { leftPadding: root.text === "" ? Style.smallSpacing : Style.standardSpacing rightPadding: root.text === "" ? Style.smallSpacing : Style.standardSpacing - background: NCButtonBackground { - color: Style.currentUserHeaderColor - hovered: root.hovered - visible: root.primaryButton - } - contentItem: Loader { id: contentItemLoader active: true @@ -48,9 +38,6 @@ AbstractButton { anchors.fill: parent hovered: root.hovered text: root.text - textColor: root.textColor - textColorHovered: root.textColorHovered - bold: root.primaryButton } } @@ -60,12 +47,8 @@ AbstractButton { NCButtonContents { anchors.fill: parent hovered: root.hovered - imageSourceHover: root.imageSourceHover imageSource: root.icon.source text: root.text - textColor: root.textColor - textColorHovered: root.textColorHovered - font.bold: root.primaryButton } } } diff --git a/src/gui/tray/ActivityItem.qml b/src/gui/tray/ActivityItem.qml index 2cac0580b9798..c84b44cceda81 100644 --- a/src/gui/tray/ActivityItem.qml +++ b/src/gui/tray/ActivityItem.qml @@ -1,9 +1,9 @@ -import QtQml 2.15 -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.15 -import Style 1.0 -import com.nextcloud.desktopclient 1.0 +import QtQml +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import Style +import com.nextcloud.desktopclient ItemDelegate { id: root @@ -24,11 +24,12 @@ ItemDelegate { Accessible.name: (model.path !== "" && model.displayPath !== "") ? qsTr("Open %1 locally").arg(model.displayPath) : model.message Accessible.onPressAction: root.clicked() - NCToolTip { + ToolTip { visible: root.hovered && !activityContent.childHovered && model.displayLocation !== "" text: qsTr("In %1").arg(model.displayLocation) } + // TODO: the current style does not support customization of this control contentItem: ColumnLayout { spacing: Style.smallSpacing diff --git a/src/gui/tray/ActivityItemActions.qml b/src/gui/tray/ActivityItemActions.qml index c233d218e8e2c..0795ef3b83b6c 100644 --- a/src/gui/tray/ActivityItemActions.qml +++ b/src/gui/tray/ActivityItemActions.qml @@ -1,9 +1,9 @@ -import QtQml 2.15 -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.15 -import Style 1.0 -import com.nextcloud.desktopclient 1.0 +import QtQml +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import Style +import com.nextcloud.desktopclient Repeater { id: root @@ -44,11 +44,6 @@ Repeater { onClicked: isTalkReplyButton ? root.showReplyField() : root.triggerAction(model.index) - textColor: Style.adjustedCurrentUserHeaderColor - textColorHovered: Style.currentUserHeaderTextColor - contentsFont.bold: true - bgColor: Style.currentUserHeaderColor - visible: verb !== "REPLY" || (verb === "REPLY" && root.talkReplyButtonVisible) } } diff --git a/src/gui/tray/ActivityItemContent.qml b/src/gui/tray/ActivityItemContent.qml index 62d552bd1a8e2..afd7a6dbff091 100644 --- a/src/gui/tray/ActivityItemContent.qml +++ b/src/gui/tray/ActivityItemContent.qml @@ -1,10 +1,10 @@ -import QtQml 2.15 -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.15 -import Style 1.0 +import QtQml +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import Style import Qt5Compat.GraphicalEffects -import com.nextcloud.desktopclient 1.0 +import com.nextcloud.desktopclient RowLayout { id: root @@ -153,7 +153,6 @@ RowLayout { text: root.activityData.dateTime font.pixelSize: Style.subLinePixelSize - color: palette.midlight visible: text !== "" } @@ -166,7 +165,7 @@ RowLayout { icon.source: "image://svgimage-custom-color/more.svg/" + palette.buttonText - NCToolTip { + ToolTip { text: qsTr("Open file details") visible: parent.hovered } @@ -174,8 +173,6 @@ RowLayout { display: Button.IconOnly leftPadding: 0 rightPadding: 0 - bgColor: palette.mid - bgNormalOpacity: 0 visible: model.showFileDetails @@ -196,10 +193,8 @@ RowLayout { display: Button.IconOnly leftPadding: 0 rightPadding: 0 - bgColor: palette.mid - bgNormalOpacity: 0 - NCToolTip { + ToolTip { text: qsTr("Dismiss") visible: parent.hovered } @@ -249,7 +244,6 @@ RowLayout { wrapMode: Text.Wrap maximumLineCount: 2 font.pixelSize: Style.topLinePixelSize - color: palette.midlight visible: text !== "" } diff --git a/src/gui/tray/ActivityItemContextMenu.qml b/src/gui/tray/ActivityItemContextMenu.qml index 7dd000090ce1f..d0c4545a0a92e 100644 --- a/src/gui/tray/ActivityItemContextMenu.qml +++ b/src/gui/tray/ActivityItemContextMenu.qml @@ -1,7 +1,7 @@ -import QtQml 2.15 -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import Style 1.0 +import QtQml +import QtQuick +import QtQuick.Controls +import Style AutoSizingMenu { id: moreActionsButtonContextMenu diff --git a/src/gui/tray/ActivityList.qml b/src/gui/tray/ActivityList.qml index 150e6483b3c46..0e57289f8644a 100644 --- a/src/gui/tray/ActivityList.qml +++ b/src/gui/tray/ActivityList.qml @@ -1,8 +1,8 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Controls -import Style 1.0 -import com.nextcloud.desktopclient 1.0 as NC +import Style +import com.nextcloud.desktopclient as NC ScrollView { id: controlRoot @@ -132,7 +132,6 @@ ScrollView { EnforcedPlainTextLabel { width: parent.width text: qsTr("No activities yet") - color: palette.midlight font.bold: true wrapMode: Text.Wrap horizontalAlignment: Text.AlignHCenter diff --git a/src/gui/tray/AutoSizingMenu.qml b/src/gui/tray/AutoSizingMenu.qml index 1d3134b373069..aaa90e79bdcc8 100644 --- a/src/gui/tray/AutoSizingMenu.qml +++ b/src/gui/tray/AutoSizingMenu.qml @@ -1,6 +1,6 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.3 -import Style 1.0 +import QtQuick +import QtQuick.Controls +import Style Menu { width: { diff --git a/src/gui/tray/CallNotificationDialog.qml b/src/gui/tray/CallNotificationDialog.qml index 0bd53c8ba1430..0ea9cb0f82736 100644 --- a/src/gui/tray/CallNotificationDialog.qml +++ b/src/gui/tray/CallNotificationDialog.qml @@ -13,13 +13,13 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Window 2.15 -import Style 1.0 -import com.nextcloud.desktopclient 1.0 -import QtQuick.Layouts 1.2 -import QtMultimedia 5.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Window +import Style +import com.nextcloud.desktopclient +import QtQuick.Layouts +import QtMultimedia +import QtQuick.Controls import Qt5Compat.GraphicalEffects ApplicationWindow { @@ -55,26 +55,6 @@ ApplicationWindow { width: root.windowWidth height: rootBackground.height - // TODO: Rather than setting all these palette colours manually, - // create a custom style and do it for all components globally - palette { - text: Style.ncTextColor - windowText: Style.ncTextColor - buttonText: Style.ncTextColor - brightText: Style.ncTextBrightColor - highlight: Style.lightHover - highlightedText: Style.ncTextColor - light: Style.lightHover - midlight: Style.ncSecondaryTextColor - mid: Style.darkerHover - dark: Style.menuBorder - button: Style.buttonBackgroundColor - window: Style.backgroundColor - base: Style.backgroundColor - toolTipBase: Style.backgroundColor - toolTipText: Style.ncTextColor - } - Component.onCompleted: { Systray.forceWindowInit(root); Systray.positionNotificationWindow(root); @@ -215,7 +195,6 @@ ApplicationWindow { EnforcedPlainTextLabel { id: message text: root.subject - color: root.usingUserAvatar ? palette.brightText : palette.windowText font.pixelSize: Style.topLinePixelSize wrapMode: Text.WordWrap horizontalAlignment: Text.AlignHCenter @@ -239,11 +218,6 @@ ApplicationWindow { visible: isAnswerCallButton text: modelData.label - contentsFont.bold: true - bgColor: Style.ncBlue - bgNormalOpacity: 0.8 - - textColor: palette.brightText icon.source: root.talkIcon + palette.brightText imageSourceHover: root.talkIcon + palette.brightText @@ -266,11 +240,6 @@ ApplicationWindow { CustomButton { id: declineCall text: qsTr("Decline") - contentsFont.bold: true - bgColor: Style.errorBoxBackgroundColor - bgNormalOpacity: 0.8 - - textColor: palette.brightText icon.source: root.deleteIcon + "white" imageSourceHover: root.deleteIcon + "white" diff --git a/src/gui/tray/CustomButton.qml b/src/gui/tray/CustomButton.qml index f57c065c935b1..2ed8dc40f36d7 100644 --- a/src/gui/tray/CustomButton.qml +++ b/src/gui/tray/CustomButton.qml @@ -12,10 +12,10 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.15 -import Style 1.0 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import Style Button { id: root @@ -25,43 +25,23 @@ Button { property string toolTipText: "" - property color textColor: palette.buttonText - property color textColorHovered: textColor - - property alias contentsFont: contents.font - - property alias bgColor: bgRectangle.color - property alias bgNormalColor: bgRectangle.normalColor - property alias bgHoverColor: bgRectangle.hoverColor - property alias bgNormalOpacity: bgRectangle.normalOpacity - property alias bgHoverOpacity: bgRectangle.hoverOpacity - - background: NCButtonBackground { - id: bgRectangle - hovered: root.hovered - } - leftPadding: root.text === "" ? Style.smallSpacing : Style.standardSpacing rightPadding: root.text === "" ? Style.smallSpacing : Style.standardSpacing implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding hoverEnabled: true - NCToolTip { + ToolTip { text: root.toolTipText visible: root.toolTipText !== "" && root.hovered } - contentItem: NCButtonContents { + NCButtonContents { id: contents display: root.display hovered: root.hovered - imageSourceHover: root.imageSourceHover imageSource: root.icon.source imageSourceWidth: root.icon.width imageSourceHeight: root.icon.height - text: root.text - textColor: root.textColor - textColorHovered: root.textColorHovered } } diff --git a/src/gui/tray/EditFileLocallyLoadingDialog.qml b/src/gui/tray/EditFileLocallyLoadingDialog.qml index 42c41322394f9..b23b0da746297 100644 --- a/src/gui/tray/EditFileLocallyLoadingDialog.qml +++ b/src/gui/tray/EditFileLocallyLoadingDialog.qml @@ -1,9 +1,9 @@ -import QtQuick 2.15 -import QtQuick.Window 2.15 -import Style 1.0 -import com.nextcloud.desktopclient 1.0 -import QtQuick.Layouts 1.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Window +import Style +import com.nextcloud.desktopclient +import QtQuick.Layouts +import QtQuick.Controls ApplicationWindow { id: root @@ -19,26 +19,6 @@ ApplicationWindow { readonly property real fontPixelSize: Style.topLinePixelSize * 1.5 readonly property real iconWidth: fontPixelSize * 2 - // TODO: Rather than setting all these palette colours manually, - // create a custom style and do it for all components globally - palette { - text: Style.ncTextColor - windowText: Style.ncTextColor - buttonText: Style.ncTextColor - brightText: Style.ncTextBrightColor - highlight: Style.lightHover - highlightedText: Style.ncTextColor - light: Style.lightHover - midlight: Style.ncSecondaryTextColor - mid: Style.darkerHover - dark: Style.menuBorder - button: Style.buttonBackgroundColor - window: Style.backgroundColor - base: Style.backgroundColor - toolTipBase: Style.backgroundColor - toolTipText: Style.ncTextColor - } - Component.onCompleted: { Systray.forceWindowInit(root); x = Screen.width / 2 - width / 2 diff --git a/src/gui/tray/EnforcedPlainTextLabel.qml b/src/gui/tray/EnforcedPlainTextLabel.qml index f47692c2c84e1..bfc3c09957433 100644 --- a/src/gui/tray/EnforcedPlainTextLabel.qml +++ b/src/gui/tray/EnforcedPlainTextLabel.qml @@ -12,8 +12,8 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Controls Label { function resetToPlainText() { diff --git a/src/gui/tray/HeaderButton.qml b/src/gui/tray/HeaderButton.qml index a1280176d10c7..6bdcb28768efa 100644 --- a/src/gui/tray/HeaderButton.qml +++ b/src/gui/tray/HeaderButton.qml @@ -12,16 +12,16 @@ * for more details. */ -import QtQml 2.15 -import QtQml.Models 2.15 -import QtQuick 2.15 -import QtQuick.Window 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.15 +import QtQml +import QtQml.Models +import QtQuick +import QtQuick.Window +import QtQuick.Controls +import QtQuick.Layouts // Custom qml modules are in /theme (and included by resources.qrc) -import Style 1.0 -import com.nextcloud.desktopclient 1.0 +import Style +import com.nextcloud.desktopclient Button { id: root @@ -36,25 +36,4 @@ Button { Layout.alignment: Qt.AlignRight Layout.preferredWidth: Style.trayWindowHeaderHeight Layout.preferredHeight: Style.trayWindowHeaderHeight - - background: Rectangle { - color: root.hovered || root.visualFocus ? Style.currentUserHeaderTextColor : Style.currentUserHeaderColor - opacity: 0.2 - } - - contentItem: Item { - anchors.fill: parent - - Image { - id: internalImage - anchors.centerIn: parent - width: root.icon.width - height: root.icon.height - source: root.icon.source - sourceSize { - width: root.icon.width - height: root.icon.height - } - } - } } diff --git a/src/gui/tray/ListItemLineAndSubline.qml b/src/gui/tray/ListItemLineAndSubline.qml index ce1a76f10d4be..84a0f1c6a56ee 100644 --- a/src/gui/tray/ListItemLineAndSubline.qml +++ b/src/gui/tray/ListItemLineAndSubline.qml @@ -11,12 +11,12 @@ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ -import QtQml 2.15 -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.15 +import QtQml +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts -import Style 1.0 +import Style ColumnLayout { id: root @@ -38,7 +38,6 @@ ColumnLayout { text: root.lineText elide: Text.ElideRight font.pixelSize: root.titleFontSize - color: root.titleColor } EnforcedPlainTextLabel { id: subline @@ -47,6 +46,5 @@ ColumnLayout { visible: text !== "" elide: Text.ElideRight font.pixelSize: root.sublineFontSize - color: root.sublineColor } } diff --git a/src/gui/tray/NCBusyIndicator.qml b/src/gui/tray/NCBusyIndicator.qml index 973d3dee1ed62..031c762f24704 100644 --- a/src/gui/tray/NCBusyIndicator.qml +++ b/src/gui/tray/NCBusyIndicator.qml @@ -12,9 +12,9 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import Style 1.0 +import QtQuick +import QtQuick.Controls +import Style BusyIndicator { id: root diff --git a/src/gui/tray/NCButtonBackground.qml b/src/gui/tray/NCButtonBackground.qml index d7a8e01e3773f..cc9d286e8aaa9 100644 --- a/src/gui/tray/NCButtonBackground.qml +++ b/src/gui/tray/NCButtonBackground.qml @@ -12,9 +12,9 @@ * for more details. */ -import QtQuick 2.15 +import QtQuick -import Style 1.0 +import Style Rectangle { property bool hovered: false diff --git a/src/gui/tray/NCButtonContents.qml b/src/gui/tray/NCButtonContents.qml index f469f168ec344..e0053d850436a 100644 --- a/src/gui/tray/NCButtonContents.qml +++ b/src/gui/tray/NCButtonContents.qml @@ -12,25 +12,22 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.15 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts -import Style 1.0 +import Style RowLayout { id: root property bool hovered: false - property string imageSourceHover: "" property string imageSource: "" property int imageSourceWidth: undefined property int imageSourceHeight: undefined property string text: "" property var display - property color textColor: palette.buttonText - property color textColorHovered: textColor property alias font: buttonLabel.font Image { @@ -40,7 +37,7 @@ RowLayout { Layout.maximumHeight: root.height Layout.alignment: Qt.AlignCenter - source: root.hovered ? root.imageSourceHover : root.imageSource + source: root.imageSource sourceSize { width: root.imageSourceWidth @@ -62,8 +59,6 @@ RowLayout { visible: root.text !== "" - color: root.hovered ? root.textColorHovered : root.textColor - horizontalAlignment: icon.visible ? Text.AlignLeft : Text.AlignHCenter verticalAlignment: Text.AlignVCenter diff --git a/src/gui/tray/NCIconWithBackgroundImage.qml b/src/gui/tray/NCIconWithBackgroundImage.qml index 0ef155ad97f20..a6f9587ebd3d4 100644 --- a/src/gui/tray/NCIconWithBackgroundImage.qml +++ b/src/gui/tray/NCIconWithBackgroundImage.qml @@ -12,8 +12,8 @@ * for more details. */ -import QtQuick 2.15 -import Style 1.0 +import QtQuick +import Style Image { id: root diff --git a/src/gui/tray/NCProgressBar.qml b/src/gui/tray/NCProgressBar.qml index da154d430a958..c620f149a2ff5 100644 --- a/src/gui/tray/NCProgressBar.qml +++ b/src/gui/tray/NCProgressBar.qml @@ -12,9 +12,9 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import Style 1.0 +import QtQuick +import QtQuick.Controls +import Style ProgressBar { id: control diff --git a/src/gui/tray/NCToolTip.qml b/src/gui/tray/NCToolTip.qml index 942dbcab16994..ab27a57b4eaf3 100644 --- a/src/gui/tray/NCToolTip.qml +++ b/src/gui/tray/NCToolTip.qml @@ -12,11 +12,11 @@ * for more details. */ -import QtQml 2.15 -import QtQuick 2.15 -import QtQuick.Controls 2.15 +import QtQml +import QtQuick +import QtQuick.Controls -import Style 1.0 +import Style ToolTip { id: toolTip @@ -25,6 +25,5 @@ ToolTip { contentItem: EnforcedPlainTextLabel { text: toolTip.text wrapMode: Text.Wrap - color: palette.toolTipText } } diff --git a/src/gui/tray/SyncStatus.qml b/src/gui/tray/SyncStatus.qml index 25d4f69115a3a..e8bb975189663 100644 --- a/src/gui/tray/SyncStatus.qml +++ b/src/gui/tray/SyncStatus.qml @@ -1,10 +1,10 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.15 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts -import Style 1.0 +import Style -import com.nextcloud.desktopclient 1.0 as NC +import com.nextcloud.desktopclient as NC RowLayout { id: root @@ -79,7 +79,6 @@ RowLayout { text: syncStatus.syncStatusDetailString visible: syncStatus.syncStatusDetailString !== "" - color: palette.midlight font.pixelSize: Style.subLinePixelSize wrapMode: Text.Wrap } @@ -90,7 +89,6 @@ RowLayout { FontMetrics { id: syncNowFm - font: syncNowButton.contentsFont } Layout.rightMargin: Style.trayHorizontalMargin @@ -98,10 +96,6 @@ RowLayout { text: qsTr("Sync now") padding: Style.smallSpacing - textColor: Style.adjustedCurrentUserHeaderColor - textColorHovered: Style.currentUserHeaderTextColor - contentsFont.bold: true - bgColor: Style.currentUserHeaderColor visible: !activityModel.hasSyncConflicts && !syncStatus.syncing && @@ -123,10 +117,6 @@ RowLayout { Layout.rightMargin: Style.trayHorizontalMargin text: qsTr("Resolve conflicts") - textColor: Style.adjustedCurrentUserHeaderColor - textColorHovered: Style.currentUserHeaderTextColor - contentsFont.bold: true - bgColor: Style.currentUserHeaderColor visible: activityModel.hasSyncConflicts && !syncStatus.syncing && diff --git a/src/gui/tray/TalkReplyTextField.qml b/src/gui/tray/TalkReplyTextField.qml index 3cc1f867af097..259e28154ed65 100644 --- a/src/gui/tray/TalkReplyTextField.qml +++ b/src/gui/tray/TalkReplyTextField.qml @@ -1,9 +1,9 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.15 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts -import com.nextcloud.desktopclient 1.0 -import Style 1.0 +import com.nextcloud.desktopclient +import Style TextField { id: replyMessageTextField @@ -17,14 +17,6 @@ TextField { onAccepted: sendReplyMessage() - background: Rectangle { - id: replyMessageTextFieldBorder - radius: width / 2 - border.width: Style.normalBorderWidth - border.color: replyMessageTextField.activeFocus ? UserModel.currentUser.accentColor : palette.dark - color: palette.window - } - Button { id: sendReplyMessageButton @@ -47,7 +39,7 @@ TextField { top: replyMessageTextField.top } - NCToolTip { + ToolTip { visible: sendReplyMessageButton.hovered text: qsTr("Send reply to chat message") } diff --git a/src/gui/tray/TextButtonContents.qml b/src/gui/tray/TextButtonContents.qml index 9bd3b8a987c60..0d49e63ba96e0 100644 --- a/src/gui/tray/TextButtonContents.qml +++ b/src/gui/tray/TextButtonContents.qml @@ -12,21 +12,18 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.15 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts -import Style 1.0 +import Style EnforcedPlainTextLabel { property bool hovered: false - property color textColor: palette.windowText - property color textColorHovered: palette.midlight property bool bold: false font.underline: true font.bold: bold - color: hovered ? textColorHovered : textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter diff --git a/src/gui/tray/TrayFolderListItem.qml b/src/gui/tray/TrayFolderListItem.qml index b329645bcb6d4..e44be380f2831 100644 --- a/src/gui/tray/TrayFolderListItem.qml +++ b/src/gui/tray/TrayFolderListItem.qml @@ -11,11 +11,11 @@ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ -import QtQml 2.15 -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.15 -import Style 1.0 +import QtQml +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import Style MenuItem { id: root @@ -25,7 +25,7 @@ MenuItem { property string backgroundIconSource: value property string toolTipText: root.text - NCToolTip { + ToolTip { visible: root.hovered && root.toolTipText !== "" text: root.toolTipText } diff --git a/src/gui/tray/TrayFoldersMenuButton.qml b/src/gui/tray/TrayFoldersMenuButton.qml index 82e51a6b000c5..85a930f34cdc1 100644 --- a/src/gui/tray/TrayFoldersMenuButton.qml +++ b/src/gui/tray/TrayFoldersMenuButton.qml @@ -11,11 +11,11 @@ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.15 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts import Qt5Compat.GraphicalEffects -import Style 1.0 +import Style HeaderButton { id: root @@ -51,13 +51,14 @@ HeaderButton { Accessible.name: tooltip.text Accessible.onPressAction: root.clicked() - NCToolTip { + ToolTip { id: tooltip visible: root.hovered && !foldersMenuLoader.isMenuVisible text: root.userHasGroupFolders ? qsTr("Open local or group folders") : qsTr("Open local folder") } - contentItem: Item { + + Item { id: rootContent anchors.fill: parent @@ -90,7 +91,6 @@ HeaderButton { width: Style.folderStateIndicatorSize + Style.trayFolderStatusIndicatorSizeOffset height: width anchors.centerIn: parent - color: Style.currentUserHeaderColor radius: width * Style.trayFolderStatusIndicatorRadiusFactor z: -2 } @@ -100,7 +100,6 @@ HeaderButton { width: Style.folderStateIndicatorSize + Style.trayFolderStatusIndicatorSizeOffset height: width anchors.centerIn: parent - color: root.hovered ? Style.currentUserHeaderTextColor : palette.window opacity: Style.trayFolderStatusIndicatorMouseHoverOpacityFactor radius: width * Style.trayFolderStatusIndicatorRadiusFactor z: -1 @@ -115,7 +114,7 @@ HeaderButton { cache: true - source: "image://svgimage-custom-color/folder.svg/" + Style.currentUserHeaderTextColor + source: "image://svgimage-custom-color/folder.svg/" sourceSize { width: imageWidth height: imageHeight @@ -145,7 +144,7 @@ HeaderButton { cache: true - source: "image://svgimage-custom-color/caret-down.svg/" + Style.currentUserHeaderTextColor + source: "image://svgimage-custom-color/caret-down.svg/" sourceSize { width: openLocalFolderButtonCaretIconLoader.imageWidth height: openLocalFolderButtonCaretIconLoader.imageHeight @@ -209,9 +208,9 @@ HeaderButton { subline: model.modelData.parentPath width: foldersMenuListView.width height: Style.standardPrimaryButtonHeight - backgroundIconSource: "image://svgimage-custom-color/folder.svg/" + palette.buttonText + backgroundIconSource: "image://svgimage-custom-color/folder.svg/" iconSource: isGroupFolder - ? "image://svgimage-custom-color/account-group.svg/" + palette.brightText + ? "image://svgimage-custom-color/account-group.svg/" : "" onTriggered: { diff --git a/src/gui/tray/UnifiedSearchInputContainer.qml b/src/gui/tray/UnifiedSearchInputContainer.qml index f57e2e2a931f9..ab30760d106f0 100644 --- a/src/gui/tray/UnifiedSearchInputContainer.qml +++ b/src/gui/tray/UnifiedSearchInputContainer.qml @@ -12,13 +12,13 @@ * for more details. */ -import QtQml 2.15 -import QtQuick 2.15 -import QtQuick.Controls 2.15 +import QtQml +import QtQuick +import QtQuick.Controls import Qt5Compat.GraphicalEffects -import Style 1.0 +import Style -import com.nextcloud.desktopclient 1.0 +import com.nextcloud.desktopclient TextField { id: trayWindowUnifiedSearchTextField @@ -41,17 +41,9 @@ TextField { rightPadding: trayWindowUnifiedSearchTextFieldClearTextButton.width + trayWindowUnifiedSearchTextFieldClearTextButton.anchors.rightMargin + textFieldHorizontalPaddingOffset placeholderText: qsTr("Search files, messages, events …") - placeholderTextColor: placeholderColor selectByMouse: true - background: Rectangle { - radius: Style.slightlyRoundedButtonRadius - border.color: parent.activeFocus ? UserModel.currentUser.accentColor : palette.dark - border.width: Style.normalBorderWidth - color: palette.window - } - Image { id: trayWindowUnifiedSearchTextFieldSearchIcon width: Style.trayListItemIconSize - anchors.leftMargin diff --git a/src/gui/tray/UnifiedSearchResultFetchMoreTrigger.qml b/src/gui/tray/UnifiedSearchResultFetchMoreTrigger.qml index cf894a12f8514..7a39991ccafec 100644 --- a/src/gui/tray/UnifiedSearchResultFetchMoreTrigger.qml +++ b/src/gui/tray/UnifiedSearchResultFetchMoreTrigger.qml @@ -12,11 +12,11 @@ * for more details. */ -import QtQml 2.15 -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.15 -import Style 1.0 +import QtQml +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import Style ColumnLayout { id: unifiedSearchResultItemFetchMore @@ -45,7 +45,6 @@ ColumnLayout { text: qsTr("Load more results") wrapMode: Text.Wrap font.pixelSize: unifiedSearchResultItemFetchMore.fontSize - color: unifiedSearchResultItemFetchMore.textColor visible: !unifiedSearchResultItemFetchMore.isFetchMoreInProgress } diff --git a/src/gui/tray/UnifiedSearchResultItem.qml b/src/gui/tray/UnifiedSearchResultItem.qml index 76e4db2bd096c..3f034143bcb14 100644 --- a/src/gui/tray/UnifiedSearchResultItem.qml +++ b/src/gui/tray/UnifiedSearchResultItem.qml @@ -12,13 +12,13 @@ * for more details. */ -import QtQml 2.15 -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.15 +import QtQml +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts import Qt5Compat.GraphicalEffects -import Style 1.0 +import Style RowLayout { id: unifiedSearchResultItemDetails diff --git a/src/gui/tray/UnifiedSearchResultItemSkeleton.qml b/src/gui/tray/UnifiedSearchResultItemSkeleton.qml index d8724eae52e1f..f34862d838af6 100644 --- a/src/gui/tray/UnifiedSearchResultItemSkeleton.qml +++ b/src/gui/tray/UnifiedSearchResultItemSkeleton.qml @@ -12,11 +12,11 @@ * for more details. */ -import QtQml 2.15 -import QtQuick 2.15 -import QtQuick.Layouts 1.15 +import QtQml +import QtQuick +import QtQuick.Layouts import Qt5Compat.GraphicalEffects -import Style 1.0 +import Style RowLayout { id: unifiedSearchResultSkeletonItemDetails diff --git a/src/gui/tray/UnifiedSearchResultItemSkeletonContainer.qml b/src/gui/tray/UnifiedSearchResultItemSkeletonContainer.qml index bcb43df37094c..d74cea80fcf3b 100644 --- a/src/gui/tray/UnifiedSearchResultItemSkeletonContainer.qml +++ b/src/gui/tray/UnifiedSearchResultItemSkeletonContainer.qml @@ -12,12 +12,12 @@ * for more details. */ -import QtQml 2.15 -import QtQuick 2.15 -import QtQuick.Layouts 1.15 +import QtQml +import QtQuick +import QtQuick.Layouts import Qt5Compat.GraphicalEffects -import Style 1.0 +import Style ColumnLayout { id: unifiedSearchResultsListViewSkeletonColumn diff --git a/src/gui/tray/UnifiedSearchResultItemSkeletonGradientRectangle.qml b/src/gui/tray/UnifiedSearchResultItemSkeletonGradientRectangle.qml index a1b053b00e362..d7326262b064e 100644 --- a/src/gui/tray/UnifiedSearchResultItemSkeletonGradientRectangle.qml +++ b/src/gui/tray/UnifiedSearchResultItemSkeletonGradientRectangle.qml @@ -12,12 +12,12 @@ * for more details. */ -import QtQml 2.15 -import QtQuick 2.15 -import QtQuick.Layouts 1.15 +import QtQml +import QtQuick +import QtQuick.Layouts import Qt5Compat.GraphicalEffects -import Style 1.0 +import Style Rectangle { id: root diff --git a/src/gui/tray/UnifiedSearchResultListItem.qml b/src/gui/tray/UnifiedSearchResultListItem.qml index 27e95962109b7..a69855c53ae23 100644 --- a/src/gui/tray/UnifiedSearchResultListItem.qml +++ b/src/gui/tray/UnifiedSearchResultListItem.qml @@ -12,11 +12,11 @@ * for more details. */ -import QtQml 2.15 -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import Style 1.0 -import com.nextcloud.desktopclient 1.0 +import QtQml +import QtQuick +import QtQuick.Controls +import Style +import com.nextcloud.desktopclient MouseArea { id: unifiedSearchResultMouseArea @@ -38,7 +38,7 @@ MouseArea { height: Style.unifiedSearchItemHeight - NCToolTip { + ToolTip { visible: unifiedSearchResultMouseArea.containsMouse text: isFetchMoreTrigger ? qsTr("Load more results") : model.resultTitle + "\n\n" + model.subline } diff --git a/src/gui/tray/UnifiedSearchResultNothingFound.qml b/src/gui/tray/UnifiedSearchResultNothingFound.qml index f66b1fdafe4de..175874e57aa39 100644 --- a/src/gui/tray/UnifiedSearchResultNothingFound.qml +++ b/src/gui/tray/UnifiedSearchResultNothingFound.qml @@ -12,11 +12,11 @@ * for more details. */ -import QtQml 2.15 -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.15 -import Style 1.0 +import QtQml +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import Style ColumnLayout { id: unifiedSearchResultNothingFoundContainer @@ -29,7 +29,7 @@ ColumnLayout { Image { id: unifiedSearchResultsNoResultsLabelIcon - source: "qrc:///client/theme/magnifying-glass.svg" + source: "image://svgimage-custom-color/magnifying-glass.svg" sourceSize.width: Style.trayWindowHeaderHeight / 2 sourceSize.height: Style.trayWindowHeaderHeight / 2 Layout.alignment: Qt.AlignHCenter @@ -38,7 +38,6 @@ ColumnLayout { EnforcedPlainTextLabel { id: unifiedSearchResultsNoResultsLabel text: qsTr("No results for") - color: palette.dark font.pixelSize: Style.subLinePixelSize * 1.25 wrapMode: Text.Wrap Layout.fillWidth: true diff --git a/src/gui/tray/UnifiedSearchResultSectionItem.qml b/src/gui/tray/UnifiedSearchResultSectionItem.qml index 1637424f7f09d..31acaf202d279 100644 --- a/src/gui/tray/UnifiedSearchResultSectionItem.qml +++ b/src/gui/tray/UnifiedSearchResultSectionItem.qml @@ -12,12 +12,12 @@ * for more details. */ -import QtQml 2.15 -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.15 -import Style 1.0 -import com.nextcloud.desktopclient 1.0 +import QtQml +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import Style +import com.nextcloud.desktopclient EnforcedPlainTextLabel { required property string section @@ -28,7 +28,6 @@ EnforcedPlainTextLabel { text: section font.pixelSize: Style.unifiedSearchResultTitleFontSize - color: UserModel.currentUser.accentColor Accessible.role: Accessible.Separator Accessible.name: qsTr("Search results section %1").arg(section) diff --git a/src/gui/tray/UserLine.qml b/src/gui/tray/UserLine.qml index 2f9b8069fd586..ea2d222b1574d 100644 --- a/src/gui/tray/UserLine.qml +++ b/src/gui/tray/UserLine.qml @@ -12,14 +12,14 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Window 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.15 +import QtQuick +import QtQuick.Window +import QtQuick.Controls +import QtQuick.Layouts // Custom qml modules are in /theme (and included by resources.qrc) -import Style 1.0 -import com.nextcloud.desktopclient 1.0 +import Style +import com.nextcloud.desktopclient AbstractButton { id: userLine @@ -62,7 +62,6 @@ AbstractButton { height: width anchors.bottom: accountAvatar.bottom anchors.right: accountAvatar.right - color: userLine.hovered || userLine.visualFocus ? "#f6f6f6" : "white" radius: width*0.5 } @@ -146,15 +145,10 @@ AbstractButton { Accessible.onPressAction: userMoreButtonMouseArea.clicked() onClicked: userMoreButtonMenu.visible ? userMoreButtonMenu.close() : userMoreButtonMenu.popup() - background: Rectangle { - anchors.fill: parent - anchors.margins: 1 - color: userMoreButton.hovered || userMoreButton.visualFocus ? palette.highlight : palette.window - } - contentItem: Image { + Image { anchors.fill: parent - source: "image://svgimage-custom-color/more.svg" + "/" + palette.buttonText + source: "image://svgimage-custom-color/more.svg/" fillMode: Image.PreserveAspectFit } @@ -167,7 +161,6 @@ AbstractButton { height: visible ? implicitHeight : 0 text: qsTr("Set status") font.pixelSize: Style.topLinePixelSize - palette.windowText: Style.ncTextColor hoverEnabled: true onClicked: showUserStatusSelector(index) } @@ -175,23 +168,12 @@ AbstractButton { MenuItem { text: model.isConnected ? qsTr("Log out") : qsTr("Log in") font.pixelSize: Style.topLinePixelSize - palette.windowText: Style.ncTextColor hoverEnabled: true onClicked: { model.isConnected ? UserModel.logout(index) : UserModel.login(index) accountMenu.close() } - background: Item { - height: parent.height - width: parent.menu.width - Rectangle { - anchors.fill: parent - anchors.margins: 1 - color: parent.parent.hovered ? palette.highlight : palette.window - } - } - Accessible.role: Accessible.Button Accessible.name: model.isConnected ? qsTr("Log out") : qsTr("Log in") @@ -209,23 +191,12 @@ AbstractButton { id: removeAccountButton text: qsTr("Remove account") font.pixelSize: Style.topLinePixelSize - palette.windowText: Style.ncTextColor hoverEnabled: true onClicked: { UserModel.removeAccount(index) accountMenu.close() } - background: Item { - height: parent.height - width: parent.menu.width - Rectangle { - anchors.fill: parent - anchors.margins: 1 - color: parent.parent.hovered ? palette.highlight : palette.window - } - } - Accessible.role: Accessible.Button Accessible.name: text Accessible.onPressAction: removeAccountButton.clicked() diff --git a/src/gui/tray/Window.qml b/src/gui/tray/Window.qml index 08d847176097a..ccb192781597a 100644 --- a/src/gui/tray/Window.qml +++ b/src/gui/tray/Window.qml @@ -12,20 +12,20 @@ * for more details. */ -import QtQuick 2.15 -import QtQuick.Window 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.15 +import QtQuick +import QtQuick.Window +import QtQuick.Controls +import QtQuick.Layouts import Qt5Compat.GraphicalEffects -import Qt.labs.platform 1.1 as NativeDialogs +import Qt.labs.platform as NativeDialogs import "../" import "../filedetails/" // Custom qml modules are in /theme (and included by resources.qrc) -import Style 1.0 +import Style -import com.nextcloud.desktopclient 1.0 +import com.nextcloud.desktopclient ApplicationWindow { id: trayWindow @@ -34,28 +34,8 @@ ApplicationWindow { // If the main dialog is displayed as a regular window we want it to be quadratic width: Systray.useNormalWindow ? Style.trayWindowHeight : Style.trayWindowWidth height: Style.trayWindowHeight - color: "transparent" flags: Systray.useNormalWindow ? Qt.Window : Qt.Dialog | Qt.FramelessWindowHint - - // TODO: Rather than setting all these palette colours manually, - // create a custom style and do it for all components globally - palette { - text: Style.ncTextColor - windowText: Style.ncTextColor - buttonText: Style.ncTextColor - brightText: Style.ncTextBrightColor - highlight: Style.lightHover - highlightedText: Style.ncTextColor - light: Style.lightHover - midlight: Style.ncSecondaryTextColor - mid: Style.darkerHover - dark: Style.menuBorder - button: Style.buttonBackgroundColor - window: Style.backgroundColor - base: Style.backgroundColor - toolTipBase: Style.backgroundColor - toolTipText: Style.ncTextColor - } + color: 'transparent' readonly property int maxMenuHeight: Style.trayWindowHeight - Style.trayWindowHeaderHeight - 2 * Style.trayWindowBorderWidth @@ -339,16 +319,6 @@ ApplicationWindow { hoverEnabled: true visible: Systray.enableAddAccount - background: Item { - height: parent.height - width: parent.menu.width - Rectangle { - anchors.fill: parent - anchors.margins: 1 - color: parent.parent.hovered || parent.parent.visualFocus ? palette.highlight : palette.window - } - } - RowLayout { anchors.fill: parent spacing: 0 @@ -356,7 +326,7 @@ ApplicationWindow { Image { Layout.leftMargin: 12 verticalAlignment: Qt.AlignCenter - source: Theme.darkMode ? "qrc:///client/theme/white/add.svg" : "qrc:///client/theme/black/add.svg" + source: "image://svgimage-custom-color/add.svg" sourceSize.width: Style.headerButtonIconSize sourceSize.height: Style.headerButtonIconSize } @@ -390,17 +360,6 @@ ApplicationWindow { font.pixelSize: Style.topLinePixelSize hoverEnabled: true onClicked: Systray.syncIsPaused = !Systray.syncIsPaused - - background: Item { - height: parent.height - width: parent.menu.width - Rectangle { - anchors.fill: parent - anchors.margins: 1 - color: parent.parent.hovered || parent.parent.visualFocus ? palette.highlight : palette.window - } - } - Accessible.role: Accessible.MenuItem Accessible.name: Systray.syncIsPaused ? qsTr("Resume sync for all") : qsTr("Pause sync for all") Accessible.onPressAction: syncPauseButton.clicked() @@ -412,17 +371,6 @@ ApplicationWindow { font.pixelSize: Style.topLinePixelSize hoverEnabled: true onClicked: Systray.openSettings() - - background: Item { - height: parent.height - width: parent.menu.width - Rectangle { - anchors.fill: parent - anchors.margins: 1 - color: parent.parent.hovered || parent.parent.visualFocus ? palette.highlight : palette.window - } - } - Accessible.role: Accessible.MenuItem Accessible.name: text Accessible.onPressAction: settingsButton.clicked() @@ -434,28 +382,12 @@ ApplicationWindow { font.pixelSize: Style.topLinePixelSize hoverEnabled: true onClicked: Systray.shutdown() - - background: Item { - height: parent.height - width: parent.menu.width - Rectangle { - anchors.fill: parent - anchors.margins: 1 - color: parent.parent.hovered || parent.parent.visualFocus ? palette.highlight : palette.window - } - } - Accessible.role: Accessible.MenuItem Accessible.name: text Accessible.onPressAction: exitButton.clicked() } } - background: Rectangle { - color: currentAccountButton.hovered || currentAccountButton.visualFocus ? Style.currentUserHeaderTextColor : Style.currentUserHeaderColor - opacity: 0.2 - } - RowLayout { id: accountControlRowLayout @@ -531,7 +463,6 @@ ApplicationWindow { width: Style.currentAccountLabelWidth text: UserModel.currentUser ? UserModel.currentUser.name : "" elide: Text.ElideRight - color: Style.currentUserHeaderTextColor font.pixelSize: Style.topLinePixelSize font.bold: true @@ -543,7 +474,6 @@ ApplicationWindow { width: Style.currentAccountLabelWidth text: UserModel.currentUser ? UserModel.currentUser.server : "" elide: Text.ElideRight - color: Style.currentUserHeaderTextColor visible: UserModel.numUsers() > 1 } @@ -570,7 +500,6 @@ ApplicationWindow { ? UserModel.currentUser.statusMessage : UserModel.currentUser ? UserModel.currentUser.server : "" elide: Text.ElideRight - color: Style.currentUserHeaderTextColor font.pixelSize: Style.subLinePixelSize } } @@ -578,14 +507,13 @@ ApplicationWindow { ColorOverlay { cached: true - color: Style.currentUserHeaderTextColor width: source.width height: source.height source: Image { Layout.alignment: Qt.AlignRight verticalAlignment: Qt.AlignCenter Layout.margins: Style.accountDropDownCaretMargin - source: "qrc:///client/theme/white/caret-down.svg" + source: "image://svgimage-custom-color/caret-down.svg/" sourceSize.width: Style.accountDropDownCaretSize sourceSize.height: Style.accountDropDownCaretSize Accessible.role: Accessible.PopupMenu @@ -606,7 +534,6 @@ ApplicationWindow { visible: currentUser.hasLocalFolder currentUser: UserModel.currentUser - onClicked: openLocalFolderButton.userHasGroupFolders ? openLocalFolderButton.toggleMenuOpen() : UserModel.openCurrentAccountLocalFolder() onFolderEntryTriggered: isGroupFolder ? UserModel.openCurrentAccountFolderFromTrayInfo(fullFolderPath) : UserModel.openCurrentAccountLocalFolder() @@ -623,7 +550,7 @@ ApplicationWindow { HeaderButton { id: trayWindowFeaturedAppButton visible: UserModel.currentUser.isFeaturedAppEnabled - icon.source: UserModel.currentUser.featuredAppIcon + "/" + Style.currentUserHeaderTextColor + icon.source: UserModel.currentUser.featuredAppIcon + "/" onClicked: UserModel.openCurrentAccountFeaturedApp() Accessible.role: Accessible.Button @@ -637,7 +564,7 @@ ApplicationWindow { HeaderButton { id: trayWindowAppsButton - icon.source: "image://svgimage-custom-color/more-apps.svg" + "/" + Style.currentUserHeaderTextColor + icon.source: "image://svgimage-custom-color/more-apps.svg/" onClicked: { if(appsMenuListView.count <= 0) { @@ -685,24 +612,11 @@ ApplicationWindow { id: appEntry anchors.left: parent.left anchors.right: parent.right - text: model.appName font.pixelSize: Style.topLinePixelSize icon.source: model.appIconUrl - icon.color: palette.buttonText onTriggered: UserAppsModel.openAppUrl(appUrl) hoverEnabled: true - - background: Item { - height: parent.height - width: parent.width - Rectangle { - anchors.fill: parent - anchors.margins: 1 - color: parent.parent.hovered || parent.parent.visualFocus ? palette.highlight : palette.window - } - } - Accessible.role: Accessible.MenuItem Accessible.name: qsTr("Open %1 in browser").arg(model.appName) Accessible.onPressAction: appEntry.triggered() @@ -883,14 +797,6 @@ ApplicationWindow { hoverEnabled: true padding: Style.smallSpacing - textColor: Style.currentUserHeaderTextColor - textColorHovered: Style.currentUserHeaderTextColor - contentsFont.bold: true - bgNormalColor: Qt.lighter(bgHoverColor, 1.25) - bgHoverColor: Style.currentUserHeaderColor - bgNormalOpacity: Style.newActivitiesBgNormalOpacity - bgHoverOpacity: Style.newActivitiesBgHoverOpacity - anchors.fill: parent text: qsTr("New activities") diff --git a/src/gui/tray/activitydata.cpp b/src/gui/tray/activitydata.cpp index bc2bdda585fee..762a9cc3e4e77 100644 --- a/src/gui/tray/activitydata.cpp +++ b/src/gui/tray/activitydata.cpp @@ -165,11 +165,11 @@ OCC::Activity Activity::fromActivityJson(const QJsonObject &json, const AccountP if(!previewsData.isEmpty()) { if(activity._icon.contains(QStringLiteral("add-color.svg"))) { - activity._icon = "qrc:///client/theme/colored/add-bordered.svg"; - } else if(activity._icon.contains(QStringLiteral("delete-color.svg"))) { - activity._icon = "qrc:///client/theme/colored/delete-bordered.svg"; + activity._icon = "image://svgimage-custom-color/add.svg"; + } else if(activity._icon.contains(QStringLiteral("delete.svg"))) { + activity._icon = "image://svgimage-custom-color/delete.svg"; } else if(activity._icon.contains(QStringLiteral("change.svg"))) { - activity._icon = "qrc:///client/theme/colored/change-bordered.svg"; + activity._icon = "image://svgimage-custom-color/change.svg"; } } diff --git a/src/gui/tray/activitylistmodel.cpp b/src/gui/tray/activitylistmodel.cpp index 61c05b8d8c796..d200ecf7cb8c8 100644 --- a/src/gui/tray/activitylistmodel.cpp +++ b/src/gui/tray/activitylistmodel.cpp @@ -226,9 +226,9 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const }; const auto generateIconPath = [&]() { - auto colorIconPath = role == DarkIconRole ? QStringLiteral("qrc:///client/theme/white/") : QStringLiteral("qrc:///client/theme/black/"); + auto colorIconPath = QStringLiteral("image://svgimage-custom-color/");//role == DarkIconRole ? QStringLiteral("qrc:///client/theme/white/") : QStringLiteral("qrc:///client/theme/black/"); if (a._type == Activity::NotificationType && !a._talkNotificationData.userAvatar.isEmpty()) { - return QStringLiteral("qrc:///client/theme/colored/talk-bordered.svg"); + return QStringLiteral("image://svgimage-custom-color/talk-app.svg"); } else if (a._type == Activity::SyncResultType) { colorIconPath.append("state-error.svg"); return colorIconPath; @@ -254,14 +254,14 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const } else { // File sync successful if (a._fileAction == "file_created") { - return a._previews.empty() ? QStringLiteral("qrc:///client/theme/colored/add.svg") - : QStringLiteral("qrc:///client/theme/colored/add-bordered.svg"); + return a._previews.empty() ? QStringLiteral("image://svgimage-custom-color/add.svg") + : QStringLiteral("image://svgimage-custom-color/add-bordered.svg"); } else if (a._fileAction == "file_deleted") { - return a._previews.empty() ? QStringLiteral("qrc:///client/theme/colored/delete.svg") - : QStringLiteral("qrc:///client/theme/colored/delete-bordered.svg"); + return a._previews.empty() ? QStringLiteral("image://svgimage-custom-color/delete.svg") + : QStringLiteral("image://svgimage-custom-color/delete-bordered.svg"); } else { return a._previews.empty() ? colorIconPath % QStringLiteral("change.svg") - : QStringLiteral("qrc:///client/theme/colored/change-bordered.svg"); + : QStringLiteral("image://svgimage-custom-color/change-bordered.svg"); } } } else { @@ -511,7 +511,7 @@ void ActivityListModel::insertOrRemoveDummyFetchingActivity() _dummyFetchingActivities._objectType = dummyFetchingActivityObjectType; _dummyFetchingActivities._subject = tr("Fetching activities …"); _dummyFetchingActivities._dateTime = QDateTime::currentDateTime(); - _dummyFetchingActivities._icon = QLatin1String("qrc:///client/theme/colored/change-bordered.svg"); + _dummyFetchingActivities._icon = QLatin1String("image://svgimage-custom-color/change-bordered.svg"); addEntriesToActivityList({_dummyFetchingActivities}); } else if (!_finalList.isEmpty() && _finalList.first()._objectType == dummyFetchingActivityObjectType) { diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp index eb67495aa54f5..11c8982bf1fd1 100644 --- a/src/libsync/theme.cpp +++ b/src/libsync/theme.cpp @@ -25,6 +25,8 @@ #include #include #endif +#include +#include #include #include #include @@ -926,64 +928,26 @@ void Theme::connectToPaletteSignal() { if (!_paletteSignalsConnected) { if (const auto ptr = qobject_cast(QGuiApplication::instance())) { - connect(ptr, &QGuiApplication::paletteChanged, this, &Theme::systemPaletteChanged); - connect(ptr, &QGuiApplication::paletteChanged, this, &Theme::darkModeChanged); + connect(ptr->styleHints(), &QStyleHints::colorSchemeChanged, this, &Theme::darkModeChanged); _paletteSignalsConnected = true; } } } -QVariantMap Theme::systemPalette() -{ - connectToPaletteSignal(); -#if defined(Q_OS_WIN) - auto systemPalette = QGuiApplication::palette(); - if(darkMode()) { - systemPalette = reserveDarkPalette; - } -#else - const auto systemPalette = QGuiApplication::palette(); -#endif - - return QVariantMap { - { QStringLiteral("base"), systemPalette.base().color() }, - { QStringLiteral("alternateBase"), systemPalette.alternateBase().color() }, - { QStringLiteral("text"), systemPalette.text().color() }, - { QStringLiteral("toolTipBase"), systemPalette.toolTipBase().color() }, - { QStringLiteral("toolTipText"), systemPalette.toolTipText().color() }, - { QStringLiteral("brightText"), systemPalette.brightText().color() }, - { QStringLiteral("buttonText"), systemPalette.buttonText().color() }, - { QStringLiteral("button"), systemPalette.button().color() }, - { QStringLiteral("highlightedText"), systemPalette.highlightedText().color() }, - { QStringLiteral("placeholderText"), systemPalette.placeholderText().color() }, - { QStringLiteral("windowText"), systemPalette.windowText().color() }, - { QStringLiteral("window"), systemPalette.window().color() }, - { QStringLiteral("dark"), systemPalette.dark().color() }, - { QStringLiteral("highlight"), systemPalette.highlight().color() }, - { QStringLiteral("light"), systemPalette.light().color() }, - { QStringLiteral("link"), systemPalette.link().color() }, - { QStringLiteral("midlight"), systemPalette.midlight().color() }, - { QStringLiteral("mid"), systemPalette.mid().color() }, - { QStringLiteral("linkVisited"), systemPalette.linkVisited().color() }, - { QStringLiteral("shadow"), systemPalette.shadow().color() }, - }; -} - bool Theme::darkMode() { connectToPaletteSignal(); -// Windows: Check registry for dark mode -#if defined(Q_OS_WIN) - const auto darkModeSubkey = QStringLiteral("Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"); - if (Utility::registryKeyExists(HKEY_CURRENT_USER, darkModeSubkey) && - !Utility::registryGetKeyValue(HKEY_CURRENT_USER, darkModeSubkey, QStringLiteral("AppsUseLightTheme")).toBool()) { + switch (qGuiApp->styleHints()->colorScheme()) + { + case Qt::ColorScheme::Dark: return true; + case Qt::ColorScheme::Light: + return false; + case Qt::ColorScheme::Unknown: + return Theme::isDarkColor(QGuiApplication::palette().window().color()); } return false; -#else - return Theme::isDarkColor(QGuiApplication::palette().window().color()); -#endif } void Theme::setOverrideServerUrl(const QString &overrideServerUrl) diff --git a/src/libsync/theme.h b/src/libsync/theme.h index e5d312ddee400..0cca5484e4c69 100644 --- a/src/libsync/theme.h +++ b/src/libsync/theme.h @@ -67,7 +67,6 @@ class OWNCLOUDSYNC_EXPORT Theme : public QObject Q_PROPERTY(QColor defaultColor READ defaultColor CONSTANT) - Q_PROPERTY(QVariantMap systemPalette READ systemPalette NOTIFY systemPaletteChanged) Q_PROPERTY(bool darkMode READ darkMode NOTIFY darkModeChanged) public: enum CustomMediaType { @@ -594,7 +593,6 @@ class OWNCLOUDSYNC_EXPORT Theme : public QObject static constexpr const char *themePrefix = ":/client/theme/"; - QVariantMap systemPalette(); bool darkMode(); public slots: @@ -619,7 +617,6 @@ public slots: signals: void systrayUseMonoIconsChanged(bool); - void systemPaletteChanged(const QPalette &palette); void darkModeChanged(); void overrideServerUrlChanged(); void forceOverrideServerUrlChanged(); diff --git a/theme/Style/Style.qml b/theme/Style/Style.qml index 181a60999b88f..7370e6a71b1c9 100644 --- a/theme/Style/Style.qml +++ b/theme/Style/Style.qml @@ -1,24 +1,27 @@ pragma Singleton -import QtQuick 2.15 +import QtQuick -import com.nextcloud.desktopclient 1.0 +import com.nextcloud.desktopclient QtObject { readonly property int pixelSize: fontMetrics.font.pixelSize readonly property bool darkMode: Theme.darkMode + property SystemPalette nativePalette: SystemPalette { + } + // Colors readonly property color ncBlue: Theme.wizardHeaderBackgroundColor readonly property color ncHeaderTextColor: Theme.wizardHeaderTitleColor - readonly property color ncTextColor: Theme.systemPalette.windowText + readonly property color ncTextColor: nativePalette.text readonly property color ncTextBrightColor: "white" readonly property color ncSecondaryTextColor: "#808080" readonly property color lightHover: Theme.darkMode ? Qt.lighter(backgroundColor, 2) : Qt.darker(backgroundColor, 1.05) readonly property color darkerHover: Theme.darkMode ? Qt.lighter(backgroundColor, 2.35) : Qt.darker(backgroundColor, 1.25) readonly property color menuBorder: Theme.darkMode ? Qt.lighter(backgroundColor, 2.5) : Qt.darker(backgroundColor, 1.5) - readonly property color backgroundColor: Theme.systemPalette.window - readonly property color buttonBackgroundColor: Theme.systemPalette.button + readonly property color backgroundColor: nativePalette.window + readonly property color buttonBackgroundColor: nativePalette.button readonly property color positiveColor: Qt.rgba(0.38, 0.74, 0.38, 1) readonly property color currentUserHeaderColor: UserModel.currentUser ? UserModel.currentUser.headerColor : ncBlue