mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 05:25:50 +03:00
Add new qml tray icon.
This is a work in progress. Signed-off-by: Camila San <hello@camila.codes>
This commit is contained in:
parent
5c3f71c097
commit
1e43c29484
4 changed files with 42 additions and 2 deletions
|
@ -31,4 +31,8 @@
|
||||||
<file>resources/state-info.svg</file>
|
<file>resources/state-info.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="/"/>
|
<qresource prefix="/"/>
|
||||||
|
<qresource prefix="/qml">
|
||||||
|
<file>src/gui/systemtray.qml</file>
|
||||||
|
<file>src/gui/traywindow.qml</file>
|
||||||
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -55,6 +55,12 @@
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
|
|
||||||
|
#include <QQmlEngine>
|
||||||
|
#include <QQmlComponent>
|
||||||
|
#include <QQmlApplicationEngine>
|
||||||
|
#include <QQuickItem>
|
||||||
|
#include <QQmlContext>
|
||||||
|
|
||||||
namespace OCC {
|
namespace OCC {
|
||||||
|
|
||||||
const char propertyAccountC[] = "oc_account";
|
const char propertyAccountC[] = "oc_account";
|
||||||
|
@ -88,6 +94,15 @@ ownCloudGui::ownCloudGui(Application *parent)
|
||||||
|
|
||||||
_tray->show();
|
_tray->show();
|
||||||
|
|
||||||
|
// QML System tray
|
||||||
|
QQmlEngine *engine = new QQmlEngine;
|
||||||
|
//engine.load(QUrl(QStringLiteral(":/qml/src/gui/systemtray.qml")));
|
||||||
|
QQmlComponent systrayrtest(engine, QUrl(QStringLiteral("qrc:/qml/src/gui/systemtray.qml")));
|
||||||
|
QQmlContext *ctxt = engine->contextForObject(systrayrtest.create());
|
||||||
|
// TODO hack to pass the icon to QML
|
||||||
|
//ctxt->setContextProperty("theme", QLatin1String("colored"));
|
||||||
|
//ctxt->setContextProperty("filename", "state-offline");
|
||||||
|
|
||||||
ProgressDispatcher *pd = ProgressDispatcher::instance();
|
ProgressDispatcher *pd = ProgressDispatcher::instance();
|
||||||
connect(pd, &ProgressDispatcher::progressInfo, this,
|
connect(pd, &ProgressDispatcher::progressInfo, this,
|
||||||
&ownCloudGui::slotUpdateProgress);
|
&ownCloudGui::slotUpdateProgress);
|
||||||
|
|
20
src/gui/systemtray.qml
Normal file
20
src/gui/systemtray.qml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import QtQuick 2.0
|
||||||
|
import Qt.labs.platform 1.1
|
||||||
|
|
||||||
|
SystemTrayIcon {
|
||||||
|
visible: true
|
||||||
|
//icon.source: "qrc:/client/theme/colored/state-offiline-32.png"
|
||||||
|
icon.source: "qrc:/client/theme/colored/state-sync-32.png";
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
showMessage("Desktop Client 2.7", "New QML menu!", 1000)
|
||||||
|
}
|
||||||
|
|
||||||
|
onActivated: {
|
||||||
|
var component = Qt.createComponent("qrc:/qml/src/gui/traywindow.qml")
|
||||||
|
win = component.createObject()
|
||||||
|
win.show()
|
||||||
|
win.raise()
|
||||||
|
win.requestActivate()
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,8 +12,9 @@ Window {
|
||||||
flags: Qt.FramelessWindowHint
|
flags: Qt.FramelessWindowHint
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
setX((Screen.width - width) - 18);
|
// desktopAvailableWidth and Height doesn't include the system tray bar
|
||||||
setY(Screen.height - (height + 60));
|
setX(Screen.desktopAvailableWidth - width);
|
||||||
|
setY(Screen.desktopAvailableHeight + height);
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
Loading…
Reference in a new issue