mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 21:15:55 +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>
|
||||
</qresource>
|
||||
<qresource prefix="/"/>
|
||||
<qresource prefix="/qml">
|
||||
<file>src/gui/systemtray.qml</file>
|
||||
<file>src/gui/traywindow.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -55,6 +55,12 @@
|
|||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
|
||||
#include <QQmlEngine>
|
||||
#include <QQmlComponent>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQuickItem>
|
||||
#include <QQmlContext>
|
||||
|
||||
namespace OCC {
|
||||
|
||||
const char propertyAccountC[] = "oc_account";
|
||||
|
@ -88,6 +94,15 @@ ownCloudGui::ownCloudGui(Application *parent)
|
|||
|
||||
_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();
|
||||
connect(pd, &ProgressDispatcher::progressInfo, this,
|
||||
&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
|
||||
|
||||
Component.onCompleted: {
|
||||
setX((Screen.width - width) - 18);
|
||||
setY(Screen.height - (height + 60));
|
||||
// desktopAvailableWidth and Height doesn't include the system tray bar
|
||||
setX(Screen.desktopAvailableWidth - width);
|
||||
setY(Screen.desktopAvailableHeight + height);
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
|
Loading…
Reference in a new issue