Commit 69bb766e authored by Ronan Abhamon's avatar Ronan Abhamon

fix(app): naming conventions in `App.xpp` and correct access to root children in `Chat/Message`

parent 4ef9e4c7
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
#include <QQmlComponent> #include <QQmlComponent>
#include <QQmlContext> #include <QQmlContext>
#include <QQuickView> #include <QQuickView>
#include <QSystemTrayIcon>
#include <QtDebug> #include <QtDebug>
#include "../components/contacts/ContactsListProxyModel.hpp" #include "../components/contacts/ContactsListProxyModel.hpp"
...@@ -84,7 +83,7 @@ void App::addContextProperties () { ...@@ -84,7 +83,7 @@ void App::addContextProperties () {
if (component.isError()) { if (component.isError()) {
qWarning() << component.errors(); qWarning() << component.errors();
} else { } else {
// context->setContextProperty("CallsWindow", component.create()); context->setContextProperty("CallsWindow", component.create());
} }
// Models. // Models.
...@@ -99,7 +98,7 @@ void App::addContextProperties () { ...@@ -99,7 +98,7 @@ void App::addContextProperties () {
void App::setTrayIcon () { void App::setTrayIcon () {
QQuickWindow *root = qobject_cast<QQuickWindow *>(m_engine.rootObjects().at(0)); QQuickWindow *root = qobject_cast<QQuickWindow *>(m_engine.rootObjects().at(0));
QMenu *menu = new QMenu(); QMenu *menu = new QMenu();
QSystemTrayIcon *tray_icon = new QSystemTrayIcon(root); m_tray_icon = new QSystemTrayIcon(root);
// trayIcon: Right click actions. // trayIcon: Right click actions.
QAction *quit_action = new QAction("Quit", root); QAction *quit_action = new QAction("Quit", root);
...@@ -109,7 +108,7 @@ void App::setTrayIcon () { ...@@ -109,7 +108,7 @@ void App::setTrayIcon () {
root->connect(restore_action, &QAction::triggered, root, &QQuickWindow::showNormal); root->connect(restore_action, &QAction::triggered, root, &QQuickWindow::showNormal);
// trayIcon: Left click actions. // trayIcon: Left click actions.
root->connect(tray_icon, &QSystemTrayIcon::activated, [root](QSystemTrayIcon::ActivationReason reason) { root->connect(m_tray_icon, &QSystemTrayIcon::activated, [root](QSystemTrayIcon::ActivationReason reason) {
if (reason == QSystemTrayIcon::Trigger) { if (reason == QSystemTrayIcon::Trigger) {
if (root->visibility() == QWindow::Hidden) if (root->visibility() == QWindow::Hidden)
root->showNormal(); root->showNormal();
...@@ -123,8 +122,8 @@ void App::setTrayIcon () { ...@@ -123,8 +122,8 @@ void App::setTrayIcon () {
menu->addSeparator(); menu->addSeparator();
menu->addAction(quit_action); menu->addAction(quit_action);
tray_icon->setContextMenu(menu); m_tray_icon->setContextMenu(menu);
tray_icon->setIcon(QIcon(WINDOW_ICON_PATH)); m_tray_icon->setIcon(QIcon(WINDOW_ICON_PATH));
tray_icon->setToolTip("Linphone"); m_tray_icon->setToolTip("Linphone");
tray_icon->show(); m_tray_icon->show();
} }
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <QApplication> #include <QApplication>
#include <QQmlApplicationEngine> #include <QQmlApplicationEngine>
#include <QQmlFileSelector> #include <QQmlFileSelector>
#include <QSystemTrayIcon>
#include <QTranslator> #include <QTranslator>
// =================================================================== // ===================================================================
...@@ -20,6 +21,7 @@ private: ...@@ -20,6 +21,7 @@ private:
QQmlApplicationEngine m_engine; QQmlApplicationEngine m_engine;
QQmlFileSelector *m_file_selector; QQmlFileSelector *m_file_selector;
QSystemTrayIcon *m_tray_icon;
QTranslator m_translator; QTranslator m_translator;
}; };
......
...@@ -22,9 +22,11 @@ Item { ...@@ -22,9 +22,11 @@ Item {
var children = root.children var children = root.children
// Can be the `invertedMouseArea` of other message. // Can be the `invertedMouseArea` of other message.
var mouseArea = children[children.length - 1] var mouseArea = Utils.find(children, function (element) {
return Utils.qmlTypeof(element, 'QQuickMouseArea')
})
if (Utils.qmlTypeof(mouseArea, 'QQuickMouseArea')) { if (mouseArea != null) {
mouseArea.cursorShape = hoveredLink mouseArea.cursorShape = hoveredLink
? Qt.PointingHandCursor ? Qt.PointingHandCursor
: Qt.ArrowCursor : Qt.ArrowCursor
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment