Skip to content

Commit

Permalink
changes to main window
Browse files Browse the repository at this point in the history
  • Loading branch information
memurats committed Jul 12, 2024
1 parent 71f61a0 commit 51b48a9
Show file tree
Hide file tree
Showing 20 changed files with 494 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 @@ -21,6 +21,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 @@ -303,6 +306,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 @@ -3,6 +3,9 @@ find_package(Qt5 REQUIRED COMPONENTS Widgets Svg Qml Quick QuickControls2 QuickW
find_package(KF5Archive REQUIRED)
find_package(KF5GuiAddons)

#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 @@ -261,6 +264,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 @@ -623,6 +630,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
12 changes: 12 additions & 0 deletions src/gui/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ 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 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

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
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
}
}
}
45 changes: 35 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

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,7 @@ RowLayout {
Layout.fillWidth: true

text: syncStatus.syncStatusDetailString
visible: syncStatus.syncStatusDetailString !== ""
visible: false
color: palette.midlight
font.pixelSize: Style.subLinePixelSize
wrapMode: Text.Wrap
Expand All @@ -88,17 +90,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 +115,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 +136,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 +148,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 51b48a9

Please sign in to comment.