Skip to content

Commit 4d41b8a

Browse files
committed
Merge #413 [stable-4.0] [master] 2055-Custom_Main_Window
2 parents 5576c5b + bae7610 commit 4d41b8a

32 files changed

+741
-398
lines changed

resources.qrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<RCC>
22
<qresource prefix="/qml">
3+
<file alias="NMCGui/qmldir">src/gui/nmcgui/qmldir</file>
4+
<file alias="NMCGui/NMCHeaderButton.qml">src/gui/nmcgui/NMCHeaderButton.qml</file>
5+
<file alias="NMCGui/NMCMenuItem.qml">src/gui/nmcgui/NMCMenuItem.qml</file>
36
<file>src/gui/UserStatusMessageView.qml</file>
47
<file>src/gui/UserStatusSelectorPage.qml</file>
58
<file>src/gui/EmojiPicker.qml</file>

src/gui/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ find_package(Qt${QT_MAJOR_VERSION} REQUIRED COMPONENTS Widgets Svg Qml Quick Qui
66
find_package(KF6Archive REQUIRED)
77
find_package(KF6GuiAddons)
88

9+
#NMC customization: needed to find the ui file in a different location than the header file
10+
set(CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_SOURCE_DIR}/src/gui")
11+
912
if(CMAKE_BUILD_TYPE MATCHES Debug)
1013
add_definitions(-DQT_QML_DEBUG)
1114
endif()
@@ -23,6 +26,9 @@ endif()
2326
configure_file(${CMAKE_SOURCE_DIR}/theme.qrc.in ${CMAKE_SOURCE_DIR}/theme.qrc)
2427
set(theme_dir ${CMAKE_SOURCE_DIR}/theme)
2528

29+
#NMC customization: needed to find the ui file in a different location than the header file
30+
set(CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_SOURCE_DIR}/src/gui")
31+
2632
set(client_UI_SRCS
2733
accountsettings.ui
2834
conflictdialog.ui
@@ -260,6 +266,10 @@ set(client_SRCS
260266
wizard/wizardproxysettingsdialog.cpp
261267
)
262268

269+
file(GLOB NMC_FILES "nmcgui/*")
270+
set(NMC_SRCS ${NMC_FILES})
271+
list(APPEND client_SRCS ${NMC_SRCS})
272+
263273
if (NOT DISABLE_ACCOUNT_MIGRATION)
264274
list(APPEND client_SRCS
265275
legacyaccountselectiondialog.h

src/gui/accountsettings.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent)
192192
#endif
193193
new ToolTipUpdater(_ui->_folderList);
194194

195+
const auto tabWidget = _ui->tabWidget;
196+
195197
#if defined(BUILD_FILE_PROVIDER_MODULE)
196198
if (Mac::FileProvider::fileProviderAvailable()) {
197199
const auto fileProviderTab = _ui->fileProviderTab;
@@ -204,7 +206,6 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent)
204206
fileProviderTab->setLayout(fpSettingsLayout);
205207
}
206208
#else
207-
const auto tabWidget = _ui->tabWidget;
208209
const auto fileProviderTab = _ui->fileProviderTab;
209210
if (const auto fileProviderWidgetTabIndex = tabWidget->indexOf(fileProviderTab); fileProviderWidgetTabIndex >= 0) {
210211
tabWidget->removeTab(fileProviderWidgetTabIndex);
@@ -219,6 +220,12 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent)
219220
connectionSettingsLayout->addWidget(networkSettings);
220221
connectionSettingsTab->setLayout(connectionSettingsLayout);
221222

223+
if (const auto connectionSettingsTabIndex = tabWidget->indexOf(connectionSettingsTab); connectionSettingsTabIndex >= 0) {
224+
tabWidget->removeTab(connectionSettingsTabIndex);
225+
}
226+
tabWidget->setCurrentIndex(0);
227+
tabWidget->tabBar()->hide();
228+
222229
const auto mouseCursorChanger = new MouseCursorChanger(this);
223230
mouseCursorChanger->folderList = _ui->_folderList;
224231
mouseCursorChanger->model = _model;

src/gui/nmcgui/NMCHeaderButton.qml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import QtQuick
2+
import QtQuick.Controls
3+
import QtQuick.Layouts
4+
5+
import Style
6+
import com.nextcloud.desktopclient
7+
8+
Item {
9+
id: rec
10+
11+
width: 92
12+
height: Style.nmcTrayWindowHeaderHeight
13+
14+
signal clickedButton
15+
16+
property string iconText: ""
17+
property string iconSource: ""
18+
property bool iconHovered: false
19+
20+
ColumnLayout {
21+
spacing: 0
22+
anchors.centerIn: parent
23+
24+
Button {
25+
id: button
26+
flat: true
27+
focusPolicy: Qt.NoFocus
28+
Layout.alignment: Qt.AlignHCenter
29+
30+
contentItem: Image {
31+
source: rec.iconSource
32+
width: Style.nmcTrayWindowIconWidth
33+
height: Style.nmcTrayWindowIconWidth
34+
fillMode: Image.PreserveAspectFit
35+
anchors.centerIn: parent
36+
}
37+
38+
background: Rectangle {
39+
color: rec.iconHovered || button.visualFocus ? "black" : "transparent"
40+
opacity: 0.05
41+
radius: 4
42+
}
43+
44+
MouseArea {
45+
id: buttonArea
46+
anchors.fill: parent
47+
onClicked: rec.clickedButton() // Trigger the button click signal
48+
}
49+
50+
// Optional: Handle hover on icon to change its state
51+
onClicked: rec.clickedButton()
52+
}
53+
54+
Text {
55+
width: rec.width
56+
text: rec.iconText
57+
elide: Text.ElideRight
58+
color: Style.nmcTrayWindowHeaderTextColor
59+
font.pixelSize: Style.nmcFontSizeIconText
60+
horizontalAlignment: Text.AlignHCenter
61+
leftPadding: 8
62+
rightPadding: 8
63+
}
64+
}
65+
}

src/gui/nmcgui/NMCMenuItem.qml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import QtQuick
2+
import QtQuick.Controls
3+
import QtQuick.Layouts
4+
5+
import Style
6+
7+
MenuItem {
8+
id: root
9+
10+
contentItem: RowLayout {
11+
spacing: 8
12+
anchors.fill: parent
13+
anchors.leftMargin: 12
14+
15+
Image {
16+
source: root.icon.source
17+
visible: root.icon.source !== ""
18+
width: Style.nmcTrayWindowIconWidth
19+
height: Style.nmcTrayWindowIconWidth
20+
fillMode: Image.PreserveAspectFit
21+
}
22+
23+
Text {
24+
text: root.text
25+
color: hovered ? Style.nmcTrayWindowHeaderTextColor : Style.nmcTrayWindowHeaderTextColor
26+
font.pixelSize: Style.topLinePixelSize
27+
verticalAlignment: Text.AlignVCenter
28+
horizontalAlignment: Text.AlignLeft
29+
elide: Text.ElideRight
30+
Layout.fillWidth: true
31+
}
32+
}
33+
34+
background: Rectangle {
35+
color: root.hovered ? Style.nmcTrayWindowHeaderHighlightColor : "transparent"
36+
}
37+
}

src/gui/nmcgui/qmldir

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module NMCGui
2+
NMCHeaderButton 1.0 NMCHeaderButton.qml
3+
NMCMenuItem 1.0 NMCMenuItem.qml

src/gui/nmcgui/qmldir.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module NMCGui
2+
NMCHeaderButton 1.0 NMCHeaderButton.qml
3+
NMCMenuItem 1.0 NMCMenuItem.qml

src/gui/tray/ActivityItemActions.qml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,25 @@ Repeater {
5050
onClicked: isTalkReplyButton ? root.showReplyField() : root.triggerAction(model.index)
5151

5252
visible: verb !== "REPLY" || (verb === "REPLY" && root.talkReplyButtonVisible)
53+
54+
HoverHandler {
55+
id: mouse
56+
acceptedDevices: PointerDevice.AllPointerTypes
57+
}
58+
59+
background: Rectangle {
60+
color: mouse.hovered ? Style.nmcConflictHoverColor : Style.nmcConflictColor
61+
radius: Style.nmcStandardRadius
62+
height: Style.nmcTraySyncButtonHeight
63+
}
64+
65+
contentItem: Text {
66+
text: activityActionButton.text
67+
color: mouse.hovered ? Style.nmcTextInButtonColor : Style.nmcTextInButtonColor
68+
font.pixelSize: Style.fontSizeSmall
69+
horizontalAlignment: Text.AlignHCenter
70+
verticalAlignment: Text.AlignVCenter
71+
elide: Text.ElideRight
72+
}
5373
}
5474
}

src/gui/tray/ActivityItemContent.qml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ RowLayout {
3333
Item {
3434
id: thumbnailItem
3535

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

4040
implicitWidth: root.iconSize
@@ -184,7 +184,7 @@ RowLayout {
184184
}
185185

186186
display: Button.IconOnly
187-
visible: model.showFileDetails
187+
visible: false
188188
onClicked: Systray.presentShareViewInTray(model.openablePath)
189189
}
190190

src/gui/tray/ActivityList.qml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ ScrollView {
9898
width: activityList.contentItem.width
9999

100100
isFileActivityList: controlRoot.isFileActivityList
101-
iconSize: controlRoot.iconSize
101+
iconSize: Style.nmcListViewIconSize
102+
leftPadding: Style.nmcListViewLeftPadding
102103
flickable: activityList
103104
onHoveredChanged: if (hovered) {
104105
// When we set the currentIndex the list view will scroll...
@@ -150,7 +151,7 @@ ScrollView {
150151

151152
Column {
152153
id: placeholderColumn
153-
width: parent.width * 0.8
154+
width: parent.width * 0.75
154155
anchors.centerIn: parent
155156
visible: activityList.count === 0
156157
spacing: Style.standardSpacing

0 commit comments

Comments
 (0)