mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-21 20:45:51 +03:00
More UserLine, avatar fixes
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
This commit is contained in:
parent
9c0221a0fa
commit
80e21560eb
7 changed files with 26 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
||||||
project(gui)
|
project(gui)
|
||||||
find_package(Qt5 REQUIRED COMPONENTS Widgets)
|
find_package(Qt5 REQUIRED COMPONENTS Widgets Svg)
|
||||||
set(CMAKE_AUTOMOC TRUE)
|
set(CMAKE_AUTOMOC TRUE)
|
||||||
set(CMAKE_AUTOUIC TRUE)
|
set(CMAKE_AUTOUIC TRUE)
|
||||||
set(CMAKE_AUTORCC TRUE)
|
set(CMAKE_AUTORCC TRUE)
|
||||||
|
@ -297,7 +297,7 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(updater STATIC ${updater_SRCS})
|
add_library(updater STATIC ${updater_SRCS})
|
||||||
target_link_libraries(updater ${synclib_NAME} Qt5::Widgets Qt5::Network Qt5::Xml Qt5::WebEngineWidgets)
|
target_link_libraries(updater ${synclib_NAME} Qt5::Widgets Qt5::Svg Qt5::Network Qt5::Xml Qt5::WebEngineWidgets)
|
||||||
target_include_directories(updater PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
target_include_directories(updater PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
set_target_properties( ${APPLICATION_EXECUTABLE} PROPERTIES
|
set_target_properties( ${APPLICATION_EXECUTABLE} PROPERTIES
|
||||||
|
@ -307,7 +307,7 @@ set_target_properties( ${APPLICATION_EXECUTABLE} PROPERTIES
|
||||||
set_target_properties( ${APPLICATION_EXECUTABLE} PROPERTIES
|
set_target_properties( ${APPLICATION_EXECUTABLE} PROPERTIES
|
||||||
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/${APPLICATION_EXECUTABLE};${CMAKE_INSTALL_RPATH}" )
|
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/${APPLICATION_EXECUTABLE};${CMAKE_INSTALL_RPATH}" )
|
||||||
|
|
||||||
target_link_libraries( ${APPLICATION_EXECUTABLE} Qt5::Widgets Qt5::Network Qt5::Xml)
|
target_link_libraries( ${APPLICATION_EXECUTABLE} Qt5::Widgets Qt5::Svg Qt5::Network Qt5::Xml)
|
||||||
target_link_libraries( ${APPLICATION_EXECUTABLE} ${synclib_NAME} )
|
target_link_libraries( ${APPLICATION_EXECUTABLE} ${synclib_NAME} )
|
||||||
target_link_libraries( ${APPLICATION_EXECUTABLE} updater )
|
target_link_libraries( ${APPLICATION_EXECUTABLE} updater )
|
||||||
target_link_libraries( ${APPLICATION_EXECUTABLE} ${OS_SPECIFIC_LINK_LIBRARIES} )
|
target_link_libraries( ${APPLICATION_EXECUTABLE} ${OS_SPECIFIC_LINK_LIBRARIES} )
|
||||||
|
|
|
@ -91,11 +91,13 @@ MenuItem {
|
||||||
Rectangle {
|
Rectangle {
|
||||||
color: userMoreButtonMouseArea.containsMouse ? "grey" : "transparent"
|
color: userMoreButtonMouseArea.containsMouse ? "grey" : "transparent"
|
||||||
opacity: 0.2
|
opacity: 0.2
|
||||||
|
height: userMoreButton.height - 2
|
||||||
|
y: userMoreButton.y + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu {
|
Menu {
|
||||||
id: userMoreButtonMenu
|
id: userMoreButtonMenu
|
||||||
width: 100
|
width: 120
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
border.color: "#0082c9"
|
border.color: "#0082c9"
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
|
#include <QSvgRenderer>
|
||||||
|
#include <QPainter>
|
||||||
|
|
||||||
namespace OCC {
|
namespace OCC {
|
||||||
|
|
||||||
|
@ -73,18 +75,25 @@ QString User::server(bool shortened) const
|
||||||
return serverUrl;
|
return serverUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage User::avatar() const
|
QImage User::avatar(bool whiteBg) const
|
||||||
{
|
{
|
||||||
QImage img = AvatarJob::makeCircularAvatar(_account->account()->avatar());
|
QImage img = AvatarJob::makeCircularAvatar(_account->account()->avatar());
|
||||||
if (img.isNull()) {
|
if (img.isNull()) {
|
||||||
img = AvatarJob::makeCircularAvatar(QImage(":/client/resources/account.png"));
|
QImage image(128, 128, QImage::Format_ARGB32);
|
||||||
|
image.fill(Qt::GlobalColor::transparent);
|
||||||
|
QPainter painter(&image);
|
||||||
|
|
||||||
|
QSvgRenderer renderer(QString(whiteBg ? ":/client/theme/black/user.svg" : ":/client/theme/white/user.svg"));
|
||||||
|
renderer.render(&painter);
|
||||||
|
|
||||||
|
return image;
|
||||||
|
} else {
|
||||||
|
return img;
|
||||||
}
|
}
|
||||||
return img;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool User::serverHasTalk() const
|
bool User::serverHasTalk() const
|
||||||
{
|
{
|
||||||
auto test = _account->hasTalk();
|
|
||||||
return _account->hasTalk();
|
return _account->hasTalk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +161,7 @@ Q_INVOKABLE QImage UserModel::currentUserAvatar()
|
||||||
|
|
||||||
QImage UserModel::avatarById(const int &id)
|
QImage UserModel::avatarById(const int &id)
|
||||||
{
|
{
|
||||||
return _users[id].avatar();
|
return _users[id].avatar(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_INVOKABLE QString UserModel::currentUserName()
|
Q_INVOKABLE QString UserModel::currentUserName()
|
||||||
|
|
|
@ -29,7 +29,7 @@ public:
|
||||||
QString server(bool shortened = true) const;
|
QString server(bool shortened = true) const;
|
||||||
bool serverHasTalk() const;
|
bool serverHasTalk() const;
|
||||||
bool hasActivities() const;
|
bool hasActivities() const;
|
||||||
QImage avatar() const;
|
QImage avatar(bool whiteBg = false) const;
|
||||||
QString id() const;
|
QString id() const;
|
||||||
void login() const;
|
void login() const;
|
||||||
void logout() const;
|
void logout() const;
|
||||||
|
@ -106,4 +106,4 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif // USERMODEL_H
|
#endif // USERMODEL_H
|
||||||
|
|
|
@ -136,5 +136,7 @@
|
||||||
<file>theme/white/talk-app.svg</file>
|
<file>theme/white/talk-app.svg</file>
|
||||||
<file>theme/white/caret-down.svg</file>
|
<file>theme/white/caret-down.svg</file>
|
||||||
<file>theme/black/caret-down.svg</file>
|
<file>theme/black/caret-down.svg</file>
|
||||||
|
<file>theme/white/user.svg</file>
|
||||||
|
<file>theme/black/user.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
1
theme/black/user.svg
Normal file
1
theme/black/user.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 16 16" height="16" width="16" version="1.1"><path d="m5 3.8c0 1.4 0.1 2.4 0.8 3.5 0.2 0.286 0.5 0.35 0.7 0.6 0.135 0.5 0.24 0.98 0.1 1.5-1.275 0.45-2.49 1-3.6 1.6-0.85 0.6-0.785 0.31-1 2.3-0.16 1.59 3.5 1.7 6 1.7s6.163-0.1 6-1.7c-0.215-2-0.23-1.71-1-2.3-1.1-0.654-2.45-1.167-3.6-1.6-0.15-0.56-0.04-0.973 0.1-1.5 0.235-0.25 0.5-0.363 0.7-0.6 0.69-0.885 0.8-2.425 0.8-3.5 0-1.59-1.43-2.8-3-2.8-1.75 0-3 1.43-3 2.8z" fill="#000"/></svg>
|
After Width: | Height: | Size: 486 B |
1
theme/white/user.svg
Normal file
1
theme/white/user.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 16 16" height="16" width="16" version="1.1"><path d="m5 3.8c0 1.4 0.1 2.4 0.8 3.5 0.2 0.286 0.5 0.35 0.7 0.6 0.135 0.5 0.24 0.98 0.1 1.5-1.275 0.45-2.49 1-3.6 1.6-0.85 0.6-0.785 0.31-1 2.3-0.16 1.59 3.5 1.7 6 1.7s6.163-0.1 6-1.7c-0.215-2-0.23-1.71-1-2.3-1.1-0.654-2.45-1.167-3.6-1.6-0.15-0.56-0.04-0.973 0.1-1.5 0.235-0.25 0.5-0.363 0.7-0.6 0.69-0.885 0.8-2.425 0.8-3.5 0-1.59-1.43-2.8-3-2.8-1.75 0-3 1.43-3 2.8z" fill="#fff"/></svg>
|
After Width: | Height: | Size: 486 B |
Loading…
Reference in a new issue