Merge pull request #2575 from nextcloud/expose_branding_values_to_qtquick

Expose branding values to qtquick
This commit is contained in:
Kevin Ottens 2020-10-21 14:13:40 +02:00 committed by GitHub
commit bb43127633
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 11 deletions

View file

@ -74,6 +74,12 @@ Systray::Systray()
}
);
qmlRegisterSingletonType<Systray>("com.nextcloud.desktopclient", 1, 0, "Theme",
[](QQmlEngine *, QJSEngine *) -> QObject * {
return Theme::instance();
}
);
qmlRegisterSingletonType<Systray>("com.nextcloud.desktopclient", 1, 0, "Systray",
[](QQmlEngine *, QJSEngine *) -> QObject * {
return Systray::instance();

View file

@ -143,12 +143,6 @@ Window {
anchors.fill: parent
hoverEnabled: Style.hoverEffectsEnabled
// HACK: Imitate Qt hover effect brightness (which is not accessible as property)
// so that indicator background also flicks when hovered
onContainsMouseChanged: {
currentAccountStateIndicatorBackground.color = (containsMouse ? Style.ncBlueHover : Style.ncBlue)
}
// We call open() instead of popup() because we want to position it
// exactly below the dropdown button, not the mouse
onClicked: {
@ -349,6 +343,16 @@ Window {
radius: width*0.5
}
Rectangle {
width: Style.accountAvatarStateIndicatorSize + 2
height: width
anchors.bottom: currentAccountAvatar.bottom
anchors.right: currentAccountAvatar.right
color: accountBtnMouseArea.containsMouse ? "white" : "transparent"
opacity: 0.2
radius: width*0.5
}
Image {
id: currentAccountStateIndicator
source: UserModel.isUserConnected(UserModel.currentUserId) ? "qrc:///client/theme/colored/state-ok.svg" : "qrc:///client/theme/colored/state-offline.svg"
@ -374,7 +378,7 @@ Window {
width: Style.currentAccountLabelWidth
text: UserModel.currentUser.name
elide: Text.ElideRight
color: "white"
color: Style.ncTextColor
font.pixelSize: Style.topLinePixelSize
font.bold: true
}
@ -383,7 +387,7 @@ Window {
width: Style.currentAccountLabelWidth
text: UserModel.currentUser.server
elide: Text.ElideRight
color: "white"
color: Style.ncTextColor
font.pixelSize: Style.subLinePixelSize
}
}

View file

@ -15,10 +15,10 @@
#ifndef _THEME_H
#define _THEME_H
#include <QIcon>
#include <QObject>
#include "syncresult.h"
class QIcon;
class QString;
class QObject;
class QPixmap;
@ -37,6 +37,24 @@ class SyncResult;
class OWNCLOUDSYNC_EXPORT Theme : public QObject
{
Q_OBJECT
Q_PROPERTY(bool branded READ isBranded CONSTANT)
Q_PROPERTY(QString appNameGUI READ appNameGUI CONSTANT)
Q_PROPERTY(QString appName READ appName CONSTANT)
#ifndef TOKEN_AUTH_ONLY
Q_PROPERTY(QIcon folderDisabledIcon READ folderDisabledIcon CONSTANT)
Q_PROPERTY(QIcon folderOfflineIcon READ folderOfflineIcon CONSTANT)
Q_PROPERTY(QIcon applicationIcon READ applicationIcon CONSTANT)
#endif
Q_PROPERTY(QString version READ version CONSTANT)
Q_PROPERTY(QString helpUrl READ helpUrl CONSTANT)
Q_PROPERTY(QString conflictHelpUrl READ conflictHelpUrl CONSTANT)
Q_PROPERTY(QString overrideServerUrl READ overrideServerUrl)
Q_PROPERTY(bool forceOverrideServerUrl READ forceOverrideServerUrl)
#ifndef TOKEN_AUTH_ONLY
Q_PROPERTY(QColor wizardHeaderTitleColor READ wizardHeaderTitleColor CONSTANT)
Q_PROPERTY(QColor wizardHeaderBackgroundColor READ wizardHeaderBackgroundColor CONSTANT)
#endif
Q_PROPERTY(QString updateCheckUrl READ updateCheckUrl CONSTANT)
public:
enum CustomMediaType {
oCSetupTop, // ownCloud connect page

View file

@ -3,10 +3,12 @@ pragma Singleton
// Minimum for this is Qt 5.5
import QtQuick 2.5
import com.nextcloud.desktopclient 1.0
QtObject {
// Colors
property color ncBlue: "#0082c9"
property color ncBlueHover: "#009dd9"
property color ncBlue: Theme.wizardHeaderBackgroundColor
property color ncTextColor: Theme.wizardHeaderTitleColor
property color lightHover: "#f7f7f7"
property color menuBorder: "#bdbdbd"