Skip to content

Commit

Permalink
Merge #170 [stable-3.12] nmc/2055-Changes to Main window (Icons and h…
Browse files Browse the repository at this point in the history
…eader logo)
  • Loading branch information
tsdicloud committed Apr 25, 2024
2 parents bc3a00d + c0343aa commit b13fb19
Show file tree
Hide file tree
Showing 20 changed files with 502 additions and 192 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,6 @@ convert.exe
*-w10startmenu.png
*state-*.png
theme.qrc

# Ignore specific folders
shell_integration/MacOSX/NextcloudIntegration/NextcloudIntegration.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ set(CMAKE_XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME YES)

set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")

set(NMC_RCC_FILE "nmctheme_v1.rcc")
configure_file(${CMAKE_SOURCE_DIR}/${NMC_RCC_FILE} "${BIN_OUTPUT_DIRECTORY}/${NMC_RCC_FILE}" COPYONLY)

include(${CMAKE_SOURCE_DIR}/NEXTCLOUD.cmake)

# CfAPI Shell Extensions
Expand Down Expand Up @@ -301,6 +304,7 @@ configure_file(version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
if(BUILD_OWNCLOUD_OSX_BUNDLE)
install(FILES sync-exclude.lst DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/)
configure_file(sync-exclude.lst bin/${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/sync-exclude.lst COPYONLY)
install(FILES nmctheme_v1.rcc DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/)
elseif(BUILD_CLIENT)
install( FILES sync-exclude.lst DESTINATION ${SYSCONFDIR}/${APPLICATION_SHORTNAME} )
configure_file(sync-exclude.lst bin/sync-exclude.lst COPYONLY)
Expand Down
Binary file added nmctheme_v1.rcc
Binary file not shown.
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
8 changes: 8 additions & 0 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ project(gui)
find_package(Qt5 REQUIRED COMPONENTS Widgets Svg Qml Quick QuickControls2 Xml Network)
find_package(KF5Archive REQUIRED)

#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 Expand Up @@ -260,6 +263,10 @@ set(client_SRCS
wizard/linklabel.cpp
)

file(GLOB NMC_FILES "nmcgui/*")
set(NMC_SRCS ${NMC_FILES})
list(APPEND client_SRCS ${NMC_SRCS})

if (Qt5WebEngine_FOUND AND Qt5WebEngineWidgets_FOUND)
list(APPEND client_SRCS
wizard/webviewpage.h
Expand Down Expand Up @@ -590,6 +597,7 @@ if(NOT BUILD_OWNCLOUD_OSX_BUNDLE)
install(FILES ${VISUAL_ELEMENTS} DESTINATION bin/visualelements)
install(FILES "${theme_dir}/${APPLICATION_EXECUTABLE}.VisualElementsManifest.xml" DESTINATION bin)
install(FILES ${client_I18N} DESTINATION i18n)
install(FILES ${CMAKE_SOURCE_DIR}/nmctheme_v1.rcc DESTINATION bin)
endif()

# we may not add MACOSX_BUNDLE here, if not building one
Expand Down
15 changes: 14 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 All @@ -58,6 +61,17 @@ int main(int argc, char **argv)
#ifdef Q_OS_WIN
SetDllDirectory(L"");
#endif
bool resourceLoaded = false;
const QString currentPath = QDir::currentPath();
if(Utility::isMac())
{
resourceLoaded = QResource::registerResource(QDir::toNativeSeparators("/Applications/MagentaCLOUD.app/Contents/Resources/nmctheme_v1.rcc"));
}
else if(Utility::isWindows() || !resourceLoaded)
{
resourceLoaded = QResource::registerResource(QDir::toNativeSeparators(currentPath + "/nmctheme_v1.rcc"));
}

Q_INIT_RESOURCE(resources);
Q_INIT_RESOURCE(theme);

Expand All @@ -68,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 b13fb19

Please sign in to comment.