Skip to content

Commit

Permalink
Merge #87 nmc/2055-Changes to Main window (Icons and header logo)
Browse files Browse the repository at this point in the history
  • Loading branch information
eugenMCloud committed Apr 27, 2024
2 parents 61d752a + 8e9ab75 commit e5c1b18
Show file tree
Hide file tree
Showing 15 changed files with 465 additions and 190 deletions.
2 changes: 2 additions & 0 deletions resources.qrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<RCC>
<qresource prefix="/qml">
<file>src/gui/nmcgui/NMCHeaderButton.qml</file>
<file>src/gui/nmcgui/NMCMenuItem.qml</file>
<file>src/gui/UserStatusSelector.qml</file>
<file>src/gui/UserStatusSelectorPage.qml</file>
<file>src/gui/EmojiPicker.qml</file>
Expand Down
3 changes: 3 additions & 0 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ set(CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_SOURCE_DIR}/src/gui")
#NMC change, its needed to find the ui file in a different location than the header file
set(CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_SOURCE_DIR}/src/gui")

#NMC change, its needed to find the ui file in a different location than the header file
set(CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_SOURCE_DIR}/src/gui")

if(QUICK_COMPILER)
find_package(Qt5QuickCompiler)
set_package_properties(Qt5QuickCompiler PROPERTIES
Expand Down
4 changes: 3 additions & 1 deletion src/gui/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/


#include <QtGlobal>

#include <cmath>
Expand All @@ -38,6 +40,7 @@
#include <QQuickWindow>
#include <QSurfaceFormat>


using namespace OCC;

void warnSystray()
Expand Down Expand Up @@ -79,7 +82,6 @@ int main(int argc, char **argv)
#ifdef Q_OS_MAC
Mac::CocoaInitializer cocoaInit; // RIIA
#endif

auto surfaceFormat = QSurfaceFormat::defaultFormat();
surfaceFormat.setOption(QSurfaceFormat::ResetNotification);
QSurfaceFormat::setDefaultFormat(surfaceFormat);
Expand Down
74 changes: 74 additions & 0 deletions src/gui/nmcgui/NMCHeaderButton.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Copyright (C) 2024 by Eugen Fischer
*
* 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 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 QtGraphicalEffects 1.15

// Custom qml modules are in /theme (and included by resources.qrc)
import Style 1.0
import com.nextcloud.desktopclient 1.0

Item{
id: rec

width: 92
height: Style.nmcTrayWindowHeaderHeight

signal clickedButton

property string iconText: ""
property string iconSource: ""
property bool iconHovered: false

ColumnLayout{

spacing: 0
anchors.centerIn: parent

Button {
id: button
flat: true
icon.source: rec.iconSource
icon.width: Style.nmcTrayWindowIconWidth
icon.height: Style.nmcTrayWindowIconWidth

onClicked: {
rec.clickedButton()
}

background: Rectangle {
color: iconHovered || button.visualFocus ? "black" : "transparent"
opacity: 0.05
}
Layout.alignment: Qt.AlignHCenter
}

Text {
width: rec.width
text: rec.iconText
elide: Text.ElideRight
color: Style.nmcTrayWindowHeaderTextColor
font.pixelSize: Style.nmcFontSizeIconText
font.bold: false
leftPadding: 8
rightPadding: 8
}
}
}

26 changes: 26 additions & 0 deletions src/gui/nmcgui/NMCMenuItem.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (C) 2023 by Eugen Fischer
*
* 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 QtQml 2.15
import QtQuick 2.15
import QtQuick.Controls 2.15

import Style 1.0

MenuItem {
icon.color: hovered ? Style.ncBlue : Style.ncTextColor
palette.windowText: hovered ? Style.nmcTrayWindowHeaderTextColor : Style.nmcTrayWindowHeaderTextColor
hoverEnabled: true
font.pixelSize: Style.topLinePixelSize
}
15 changes: 13 additions & 2 deletions src/gui/tray/ActivityItemActions.qml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,22 @@ Repeater {

onClicked: isTalkReplyButton ? root.showReplyField() : root.triggerAction(model.index)

textColor: Style.adjustedCurrentUserHeaderColor
textColorHovered: Style.currentUserHeaderTextColor
textColor: Style.nmcTextInButtonColor
textColorHovered: Style.nmcTextInButtonColor
contentsFont.bold: true
bgColor: Style.currentUserHeaderColor

visible: verb !== "REPLY" || (verb === "REPLY" && root.talkReplyButtonVisible)

HoverHandler {
id: mouse
acceptedDevices: PointerDevice.Mouse
}

background: Rectangle {
color: mouse.hovered? Style.nmcConflictHoverColor : Style.nmcConflictColor
radius: Style.nmcStandardRadius
height: Style.nmcTraySyncButtonHeight
}
}
}
6 changes: 3 additions & 3 deletions src/gui/tray/ActivityItemContent.qml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ RowLayout {
Item {
id: thumbnailItem

readonly property int imageWidth: width * (1 - Style.thumbnailImageSizeReduction)
readonly property int imageHeight: height * (1 - Style.thumbnailImageSizeReduction)
readonly property int imageWidth: width //* (1 - Style.thumbnailImageSizeReduction)
readonly property int imageHeight: height //* (1 - Style.thumbnailImageSizeReduction)
readonly property int thumbnailRadius: model.thumbnail && model.thumbnail.isUserAvatar ? width / 2 : 3

implicitWidth: root.iconSize
Expand Down Expand Up @@ -177,7 +177,7 @@ RowLayout {
bgColor: palette.mid
bgNormalOpacity: 0

visible: model.showFileDetails
visible: false //model.showFileDetails

onClicked: Systray.presentShareViewInTray(model.openablePath)
}
Expand Down
3 changes: 2 additions & 1 deletion src/gui/tray/ActivityList.qml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ ScrollView {
background: null
width: activityList.contentItem.width

leftPadding: Style.nmcListViewLeftPadding
isFileActivityList: controlRoot.isFileActivityList
iconSize: controlRoot.iconSize
iconSize: Style.nmcListViewIconSize //controlRoot.iconSize
flickable: activityList
onHoveredChanged: if (hovered) {
// When we set the currentIndex the list view will scroll...
Expand Down
10 changes: 5 additions & 5 deletions src/gui/tray/NCProgressBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ ProgressBar {
background: Rectangle {
implicitWidth: Style.progressBarWidth
implicitHeight: Style.progressBarBackgroundHeight
radius: Style.progressBarRadius
color: Style.progressBarBackgroundColor
radius: Style.nmcStandardRadius
color: Style.nmcTrayWindowHeaderHighlightColor
border.color: Style.progressBarBackgroundBorderColor
border.width: Style.progressBarBackgroundBorderWidth
border.width: 0 //Style.progressBarBackgroundBorderWidth
}

contentItem: Item {
Expand All @@ -36,9 +36,9 @@ ProgressBar {
width: control.visualPosition * parent.width
height: parent.height
radius: Style.progressBarRadius
color: Style.progressBarContentColor
color: Style.nmcTelekomMagentaColor
border.color: Style.progressBarContentBorderColor
border.width: Style.progressBarContentBorderWidth
border.width: 0 //Style.progressBarContentBorderWidth
}
}
}
46 changes: 36 additions & 10 deletions src/gui/tray/SyncStatus.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ RowLayout {
Layout.topMargin: 16
Layout.rightMargin: whiteSpace * (0.5 + Style.thumbnailImageSizeReduction)
Layout.bottomMargin: 16
Layout.leftMargin: Style.trayHorizontalMargin + (whiteSpace * (0.5 - Style.thumbnailImageSizeReduction))
Layout.leftMargin: Style.nmcListViewLeftPadding //Style.trayHorizontalMargin + (whiteSpace * (0.5 - Style.thumbnailImageSizeReduction))

padding: 0

Expand All @@ -47,14 +47,16 @@ RowLayout {
Layout.fillWidth: true
Layout.fillHeight: true

Layout.leftMargin: Style.nmcProgressFieldTextOffset

EnforcedPlainTextLabel {
id: syncProgressText

Layout.fillWidth: true

text: syncStatus.syncStatusString
verticalAlignment: Text.AlignVCenter
font.pixelSize: Style.topLinePixelSize
font.pixelSize: Style.nmcFontSizeSyncText
font.bold: true
wrapMode: Text.Wrap
}
Expand All @@ -78,7 +80,8 @@ RowLayout {
Layout.fillWidth: true

text: syncStatus.syncStatusDetailString
visible: syncStatus.syncStatusDetailString !== ""
//NMC Customization
visible: false // syncStatus.syncStatusDetailString !== ""
color: palette.midlight
font.pixelSize: Style.subLinePixelSize
wrapMode: Text.Wrap
Expand All @@ -88,17 +91,17 @@ RowLayout {
CustomButton {
id: syncNowButton

FontMetrics {
id: syncNowFm
font: syncNowButton.contentsFont
}
// FontMetrics {
// id: syncNowFm
// font: syncNowButton.contentsFont
// }

Layout.rightMargin: Style.trayHorizontalMargin

text: qsTr("Sync now")

padding: Style.smallSpacing
textColor: Style.adjustedCurrentUserHeaderColor
textColor: Style.nmcTextInButtonColor
textColorHovered: Style.currentUserHeaderTextColor
contentsFont.bold: true
bgColor: Style.currentUserHeaderColor
Expand All @@ -113,6 +116,17 @@ RowLayout {
NC.UserModel.currentUser.forceSyncNow();
}
}

HoverHandler {
id: mouseSync
acceptedDevices: PointerDevice.Mouse
}

background: Rectangle {
color: mouseSync.hovered? Style.nmcSyncHoverColor : Style.nmcTelekomMagentaColor
radius: Style.nmcStandardRadius
height: Style.nmcTraySyncButtonHeight
}
}

CustomButton {
Expand All @@ -123,8 +137,9 @@ RowLayout {
Layout.rightMargin: Style.trayHorizontalMargin

text: qsTr("Resolve conflicts")
textColor: Style.adjustedCurrentUserHeaderColor
textColorHovered: Style.currentUserHeaderTextColor
padding: Style.smallSpacing
textColor: Style.nmcTextInButtonColor
textColorHovered: Style.nmcTextInButtonColor
contentsFont.bold: true
bgColor: Style.currentUserHeaderColor

Expand All @@ -134,5 +149,16 @@ RowLayout {
NC.UserModel.currentUser.isConnected
enabled: visible
onClicked: NC.Systray.createResolveConflictsDialog(activityModel.allConflicts);

HoverHandler {
id: mouseConflict
acceptedDevices: PointerDevice.Mouse
}

background: Rectangle {
color: mouseConflict.hovered? Style.nmcConflictHoverColor : Style.nmcConflictColor
radius: Style.nmcStandardRadius
height: Style.nmcTraySyncButtonHeight
}
}
}
Loading

0 comments on commit e5c1b18

Please sign in to comment.