project(gui)
-find_package(Qt5 REQUIRED COMPONENTS Widgets)
+find_package(Qt5 REQUIRED COMPONENTS Widgets Svg)
set(CMAKE_AUTOMOC TRUE)
set(CMAKE_AUTOUIC TRUE)
set(CMAKE_AUTORCC TRUE)
endif()
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})
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}" )
-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} updater )
target_link_libraries( ${APPLICATION_EXECUTABLE} ${OS_SPECIFIC_LINK_LIBRARIES} )
Rectangle {\r
color: userMoreButtonMouseArea.containsMouse ? "grey" : "transparent"\r
opacity: 0.2\r
+ height: userMoreButton.height - 2\r
+ y: userMoreButton.y + 1\r
}\r
\r
Menu {\r
id: userMoreButtonMenu\r
- width: 100\r
+ width: 120\r
\r
background: Rectangle {\r
border.color: "#0082c9"\r
#include <QDesktopServices>
#include <QIcon>
+#include <QSvgRenderer>
+#include <QPainter>
namespace OCC {
return serverUrl;
}
-QImage User::avatar() const
+QImage User::avatar(bool whiteBg) const
{
QImage img = AvatarJob::makeCircularAvatar(_account->account()->avatar());
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
{
- auto test = _account->hasTalk();
return _account->hasTalk();
}
QImage UserModel::avatarById(const int &id)
{
- return _users[id].avatar();
+ return _users[id].avatar(true);
}
Q_INVOKABLE QString UserModel::currentUserName()
QString server(bool shortened = true) const;
bool serverHasTalk() const;
bool hasActivities() const;
- QImage avatar() const;
+ QImage avatar(bool whiteBg = false) const;
QString id() const;
void login() const;
void logout() const;
};
}
-#endif // USERMODEL_H
\ No newline at end of file
+#endif // USERMODEL_H
<file>theme/white/talk-app.svg</file>
<file>theme/white/caret-down.svg</file>
<file>theme/black/caret-down.svg</file>
+ <file>theme/white/user.svg</file>
+ <file>theme/black/user.svg</file>
</qresource>
</RCC>
--- /dev/null
+<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>
\ No newline at end of file
--- /dev/null
+<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>
\ No newline at end of file