Speedup GUI: higher priority, us eonly one qml engine on notifications, make asynchronous effets on notification,
This commit is contained in:
parent
c1be71191a
commit
5f2cfde69b
7 changed files with 83 additions and 62 deletions
|
|
@ -261,7 +261,7 @@ App::App(int &argc, char *argv[])
|
||||||
: SingleApplication(argc, argv, true, Mode::User | Mode::ExcludeAppPath | Mode::ExcludeAppVersion) {
|
: SingleApplication(argc, argv, true, Mode::User | Mode::ExcludeAppPath | Mode::ExcludeAppVersion) {
|
||||||
// Do not use APPLICATION_NAME here.
|
// Do not use APPLICATION_NAME here.
|
||||||
// The EXECUTABLE_NAME will be used in qt standard paths. It's our goal.
|
// The EXECUTABLE_NAME will be used in qt standard paths. It's our goal.
|
||||||
|
QThread::currentThread()->setPriority(QThread::HighPriority);
|
||||||
QCoreApplication::setApplicationName(EXECUTABLE_NAME);
|
QCoreApplication::setApplicationName(EXECUTABLE_NAME);
|
||||||
QApplication::setOrganizationDomain(EXECUTABLE_NAME);
|
QApplication::setOrganizationDomain(EXECUTABLE_NAME);
|
||||||
QCoreApplication::setApplicationVersion(APPLICATION_SEMVER);
|
QCoreApplication::setApplicationVersion(APPLICATION_SEMVER);
|
||||||
|
|
|
||||||
|
|
@ -153,20 +153,11 @@ bool Notifier::createNotification(Notifier::NotificationType type, QVariantMap d
|
||||||
// Use QQuickView to create a visual root object that is
|
// Use QQuickView to create a visual root object that is
|
||||||
// independant from current application Window
|
// independant from current application Window
|
||||||
QScreen *screen = allScreens[i];
|
QScreen *screen = allScreens[i];
|
||||||
// auto engine = App::getInstance()->mEngine;
|
auto engine = App::getInstance()->mEngine;
|
||||||
auto engine = new QQmlApplicationEngine();
|
|
||||||
engine->addImageProvider(ImageProvider::ProviderId, new ImageProvider());
|
|
||||||
engine->addImageProvider(AvatarProvider::ProviderId, new AvatarProvider());
|
|
||||||
engine->addImportPath(":/");
|
|
||||||
// if(showAsTool) window->setProperty("showAsTool",true);
|
|
||||||
engine->setInitialProperties(data);
|
|
||||||
// engine->rootContext()->setContextProperty("applicationDirPath",QGuiApplication::applicationDirPath());
|
|
||||||
// engine->setInitialProperties({{"screenIndex", i}});
|
|
||||||
//, {"x", screen->geometry().x()}, {"y", screen->geometry().y()}});
|
|
||||||
const QUrl url(QString(NotificationsPath) + Notifier::Notifications[type].filename);
|
const QUrl url(QString(NotificationsPath) + Notifier::Notifications[type].filename);
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
engine, &QQmlApplicationEngine::objectCreated, this,
|
engine, &QQmlApplicationEngine::objectCreated, this,
|
||||||
[this, url, screen, engine, type](QObject *obj, const QUrl &objUrl) {
|
[this, url, screen, engine, type, data](QObject *obj, const QUrl &objUrl) {
|
||||||
if (!obj && url == objUrl) {
|
if (!obj && url == objUrl) {
|
||||||
lCritical() << "[App] Notifier.qml couldn't be load.";
|
lCritical() << "[App] Notifier.qml couldn't be load.";
|
||||||
engine->deleteLater();
|
engine->deleteLater();
|
||||||
|
|
@ -175,6 +166,9 @@ bool Notifier::createNotification(Notifier::NotificationType type, QVariantMap d
|
||||||
lDebug() << engine->rootObjects()[0];
|
lDebug() << engine->rootObjects()[0];
|
||||||
auto window = qobject_cast<QQuickWindow *>(obj);
|
auto window = qobject_cast<QQuickWindow *>(obj);
|
||||||
if (window) {
|
if (window) {
|
||||||
|
window->setProperty(NotificationPropertyData, data);
|
||||||
|
// for (auto it = data.begin(); it != data.end(); ++it)
|
||||||
|
// window->setProperty(it.key().toLatin1(), it.value());
|
||||||
int *screenHeightOffset = &mScreenHeightOffset[screen->name()]; // Access optimization
|
int *screenHeightOffset = &mScreenHeightOffset[screen->name()]; // Access optimization
|
||||||
QRect availableGeometry = screen->availableGeometry();
|
QRect availableGeometry = screen->availableGeometry();
|
||||||
int heightOffset =
|
int heightOffset =
|
||||||
|
|
@ -195,7 +189,8 @@ bool Notifier::createNotification(Notifier::NotificationType type, QVariantMap d
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Qt::QueuedConnection);
|
static_cast<Qt::ConnectionType>(Qt::QueuedConnection | Qt::SingleShotConnection));
|
||||||
|
lDebug() << log().arg("Engine loading notification");
|
||||||
engine->load(url);
|
engine->load(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ Control.Button {
|
||||||
property bool shadowEnabled: enabled && (activeFocus || containsMouse)
|
property bool shadowEnabled: enabled && (activeFocus || containsMouse)
|
||||||
property var contentImageColor
|
property var contentImageColor
|
||||||
property alias containsMouse: mouseArea.containsMouse
|
property alias containsMouse: mouseArea.containsMouse
|
||||||
|
property bool asynchronous: true
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
activeFocusOnTab: true
|
activeFocusOnTab: true
|
||||||
// leftPadding: 20 * DefaultStyle.dp
|
// leftPadding: 20 * DefaultStyle.dp
|
||||||
|
|
@ -38,7 +39,7 @@ Control.Button {
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Loader{
|
background: Loader{
|
||||||
asynchronous: true
|
asynchronous: mainItem.asynchronous
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
sourceComponent:
|
sourceComponent:
|
||||||
|
|
|
||||||
|
|
@ -40,21 +40,21 @@ import Qt.labs.platform
|
||||||
*/
|
*/
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
objectName: '__internalWindow'
|
objectName: '__internalWindow'
|
||||||
property bool isFrameLess : false;
|
property bool isFrameLess : false;
|
||||||
property bool showAsTool : false
|
property bool showAsTool : false
|
||||||
// Don't use Popup for flags : it could lead to error in geometry. On Mac, Using Tool ensure to have the Window on Top and fullscreen independant
|
// Don't use Popup for flags : it could lead to error in geometry. On Mac, Using Tool ensure to have the Window on Top and fullscreen independant
|
||||||
flags: Qt.BypassWindowManagerHint | (showAsTool?Qt.Tool:Qt.WindowStaysOnTopHint) | Qt.Window | Qt.FramelessWindowHint;
|
flags: Qt.BypassWindowManagerHint | (showAsTool?Qt.Tool:Qt.WindowStaysOnTopHint) | Qt.Window | Qt.FramelessWindowHint;
|
||||||
opacity: 1.0
|
opacity: 1.0
|
||||||
height: _content[0] != null ? _content[0].height : 0
|
height: _content[0] != null ? _content[0].height : 0
|
||||||
width: _content[0] != null ? _content[0].width : 0
|
width: _content[0] != null ? _content[0].width : 0
|
||||||
visible:true
|
visible:true
|
||||||
Item {
|
Item {
|
||||||
id: content
|
id: content
|
||||||
anchors.fill:parent
|
anchors.fill:parent
|
||||||
|
|
||||||
property var $parent: mainItem
|
property var $parent: mainItem
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@ DesktopPopup {
|
||||||
default property alias _content: content.data
|
default property alias _content: content.data
|
||||||
|
|
||||||
signal deleteNotification (var notification)
|
signal deleteNotification (var notification)
|
||||||
|
width: mainItem.overriddenWidth
|
||||||
|
height: mainItem.overriddenHeight
|
||||||
|
|
||||||
// Use as an intermediate between signal/slot without propagate the notification var : last signal parameter will be the last notification instance
|
// Use as an intermediate between signal/slot without propagate the notification var : last signal parameter will be the last notification instance
|
||||||
function deleteNotificationSlot(){
|
function deleteNotificationSlot(){
|
||||||
|
|
@ -29,42 +31,46 @@ DesktopPopup {
|
||||||
}
|
}
|
||||||
deleteNotificationSlot();
|
deleteNotificationSlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: background
|
anchors.fill: parent
|
||||||
|
visible: backgroundLoader.status != Loader.Ready
|
||||||
color: DefaultStyle.grey_0
|
color: DefaultStyle.grey_0
|
||||||
height: mainItem.overriddenHeight
|
|
||||||
width: mainItem.overriddenWidth
|
|
||||||
radius: mainItem.radius
|
radius: mainItem.radius
|
||||||
|
|
||||||
border {
|
border {
|
||||||
color: DefaultStyle.grey_400
|
color: DefaultStyle.grey_400
|
||||||
width: 1 * DefaultStyle.dp
|
width: 1 * DefaultStyle.dp
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Item {
|
|
||||||
id: content
|
Loader{
|
||||||
|
id: backgroundLoader
|
||||||
anchors.fill: parent
|
asynchronous: true
|
||||||
}
|
sourceComponent: Item{
|
||||||
|
width: mainItem.overriddenWidth
|
||||||
Image {
|
height: mainItem.overriddenHeight
|
||||||
id: iconSign
|
Rectangle {
|
||||||
|
id: background
|
||||||
anchors {
|
anchors.fill: parent
|
||||||
left: parent.left
|
visible: backgroundLoader.status != Loader.Ready
|
||||||
top: parent.top
|
color: DefaultStyle.grey_0
|
||||||
|
radius: mainItem.radius
|
||||||
|
border {
|
||||||
|
color: DefaultStyle.grey_400
|
||||||
|
width: 1 * DefaultStyle.dp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MultiEffect {
|
||||||
|
source: background
|
||||||
|
anchors.fill: background
|
||||||
|
shadowEnabled: true
|
||||||
|
shadowColor: DefaultStyle.grey_1000
|
||||||
|
shadowOpacity: 0.1
|
||||||
|
shadowBlur: 0.1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MultiEffect {
|
Item {
|
||||||
source: background
|
id: content
|
||||||
anchors.fill: background
|
anchors.fill: parent
|
||||||
shadowEnabled: true
|
|
||||||
shadowColor: DefaultStyle.grey_1000
|
|
||||||
shadowOpacity: 0.1
|
|
||||||
shadowBlur: 0.1
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ Notification {
|
||||||
radius: 20 * DefaultStyle.dp
|
radius: 20 * DefaultStyle.dp
|
||||||
overriddenWidth: content.implicitWidth//101 * DefaultStyle.dp
|
overriddenWidth: content.implicitWidth//101 * DefaultStyle.dp
|
||||||
overriddenHeight: content.implicitHeight//422 * DefaultStyle.dp
|
overriddenHeight: content.implicitHeight//422 * DefaultStyle.dp
|
||||||
|
|
||||||
readonly property var call: notificationData && notificationData.call
|
readonly property var call: notificationData && notificationData.call
|
||||||
property var state: call.core.state
|
property var state: call.core.state
|
||||||
property var status: call.core.status
|
property var status: call.core.status
|
||||||
|
|
@ -20,7 +21,7 @@ Notification {
|
||||||
onStatusChanged:{
|
onStatusChanged:{
|
||||||
console.log("status", status)
|
console.log("status", status)
|
||||||
}
|
}
|
||||||
|
|
||||||
Popup {
|
Popup {
|
||||||
id: content
|
id: content
|
||||||
visible: mainItem.visible
|
visible: mainItem.visible
|
||||||
|
|
@ -86,6 +87,7 @@ Notification {
|
||||||
color: DefaultStyle.success_500main
|
color: DefaultStyle.success_500main
|
||||||
Layout.preferredWidth: 75 * DefaultStyle.dp
|
Layout.preferredWidth: 75 * DefaultStyle.dp
|
||||||
Layout.preferredHeight: 55 * DefaultStyle.dp
|
Layout.preferredHeight: 55 * DefaultStyle.dp
|
||||||
|
asynchronous: false
|
||||||
contentItem: EffectImage {
|
contentItem: EffectImage {
|
||||||
colorizationColor: DefaultStyle.grey_0
|
colorizationColor: DefaultStyle.grey_0
|
||||||
imageSource: AppIcons.phone
|
imageSource: AppIcons.phone
|
||||||
|
|
@ -93,6 +95,7 @@ Notification {
|
||||||
imageHeight: 32 * DefaultStyle.dp
|
imageHeight: 32 * DefaultStyle.dp
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
console.debug("[NotificationReceivedCall] Accept click")
|
||||||
UtilsCpp.openCallsWindow(mainItem.call)
|
UtilsCpp.openCallsWindow(mainItem.call)
|
||||||
mainItem.call.core.lAccept(false)
|
mainItem.call.core.lAccept(false)
|
||||||
}
|
}
|
||||||
|
|
@ -101,6 +104,7 @@ Notification {
|
||||||
color: DefaultStyle.danger_500main
|
color: DefaultStyle.danger_500main
|
||||||
Layout.preferredWidth: 75 * DefaultStyle.dp
|
Layout.preferredWidth: 75 * DefaultStyle.dp
|
||||||
Layout.preferredHeight: 55 * DefaultStyle.dp
|
Layout.preferredHeight: 55 * DefaultStyle.dp
|
||||||
|
asynchronous: false
|
||||||
contentItem: EffectImage {
|
contentItem: EffectImage {
|
||||||
colorizationColor: DefaultStyle.grey_0
|
colorizationColor: DefaultStyle.grey_0
|
||||||
imageSource: AppIcons.endCall
|
imageSource: AppIcons.endCall
|
||||||
|
|
@ -108,10 +112,12 @@ Notification {
|
||||||
imageHeight: 32 * DefaultStyle.dp
|
imageHeight: 32 * DefaultStyle.dp
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
console.debug("[NotificationReceivedCall] Decline click")
|
||||||
mainItem.call.core.lDecline()
|
mainItem.call.core.lDecline()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -287,6 +287,7 @@ AbstractWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************* CONTENT ********************************/
|
/************************* CONTENT ********************************/
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: DefaultStyle.grey_900
|
color: DefaultStyle.grey_900
|
||||||
|
|
@ -533,7 +534,9 @@ AbstractWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|
@ -561,6 +564,8 @@ AbstractWindow {
|
||||||
headerValidateButtonText: qsTr("Ajouter")
|
headerValidateButtonText: qsTr("Ajouter")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: contactsListPanel
|
id: contactsListPanel
|
||||||
Item {
|
Item {
|
||||||
|
|
@ -1352,18 +1357,24 @@ AbstractWindow {
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
id: inCallItem
|
id: inCallItem
|
||||||
Item {
|
Loader{
|
||||||
property string objectName: "inCallItem"
|
asynchronous: true
|
||||||
CallLayout{
|
sourceComponent: Item {
|
||||||
anchors.fill: parent
|
property string objectName: "inCallItem"
|
||||||
anchors.leftMargin: 20 * DefaultStyle.dp
|
CallLayout{
|
||||||
anchors.rightMargin: (rightPanel.visible ? 0 : 10) * DefaultStyle.dp // Grid and AS have 10 in right margin (so apply -10 here)
|
anchors.fill: parent
|
||||||
anchors.topMargin: 10 * DefaultStyle.dp
|
anchors.leftMargin: 20 * DefaultStyle.dp
|
||||||
call: mainWindow.call
|
anchors.rightMargin: (rightPanel.visible ? 0 : 10) * DefaultStyle.dp // Grid and AS have 10 in right margin (so apply -10 here)
|
||||||
callTerminatedByUser: mainWindow.callTerminatedByUser
|
anchors.topMargin: 10 * DefaultStyle.dp
|
||||||
|
call: mainWindow.call
|
||||||
|
callTerminatedByUser: mainWindow.callTerminatedByUser
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: bottomButtonsLayout
|
id: bottomButtonsLayout
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
|
@ -1723,6 +1734,8 @@ AbstractWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue