add logger to FocusController
This commit is contained in:
parent
38813d9aa6
commit
a2267ccd92
1 changed files with 11 additions and 5 deletions
|
|
@ -4,6 +4,12 @@
|
||||||
#include <QQmlApplicationEngine>
|
#include <QQmlApplicationEngine>
|
||||||
#include <QQuickWindow>
|
#include <QQuickWindow>
|
||||||
|
|
||||||
|
#include "logger.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
Logger logger("FocusController");
|
||||||
|
}
|
||||||
|
|
||||||
FocusController::FocusController(QQmlApplicationEngine *engine, QObject *parent)
|
FocusController::FocusController(QQmlApplicationEngine *engine, QObject *parent)
|
||||||
: QObject { parent },
|
: QObject { parent },
|
||||||
m_engine { engine },
|
m_engine { engine },
|
||||||
|
|
@ -85,7 +91,7 @@ void FocusController::dropRootObject(QObject *object)
|
||||||
dropListView();
|
dropListView();
|
||||||
setFocusOnDefaultItem();
|
setFocusOnDefaultItem();
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "===>> TRY TO DROP WRONG ROOT OBJECT: " << m_rootObjects.top() << " SHOULD BE: " << object;
|
logger.warning() << "TRY TO DROP WRONG ROOT OBJECT: " << m_rootObjects.top() << " SHOULD BE: " << object;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -101,7 +107,7 @@ void FocusController::reload(Direction direction)
|
||||||
QObject *rootObject = (m_rootObjects.empty() ? m_engine->rootObjects().value(0) : m_rootObjects.top());
|
QObject *rootObject = (m_rootObjects.empty() ? m_engine->rootObjects().value(0) : m_rootObjects.top());
|
||||||
|
|
||||||
if (!rootObject) {
|
if (!rootObject) {
|
||||||
qCritical() << "No ROOT OBJECT found!";
|
logger.error() << "No ROOT OBJECT found!";
|
||||||
resetRootObject();
|
resetRootObject();
|
||||||
dropListView();
|
dropListView();
|
||||||
return;
|
return;
|
||||||
|
|
@ -113,7 +119,7 @@ void FocusController::reload(Direction direction)
|
||||||
direction == Direction::Forward ? FocusControl::isLess : FocusControl::isMore);
|
direction == Direction::Forward ? FocusControl::isLess : FocusControl::isMore);
|
||||||
|
|
||||||
if (m_focusChain.empty()) {
|
if (m_focusChain.empty()) {
|
||||||
qWarning() << "Focus chain is empty!";
|
logger.warning() << "Focus chain is empty!";
|
||||||
resetRootObject();
|
resetRootObject();
|
||||||
dropListView();
|
dropListView();
|
||||||
return;
|
return;
|
||||||
|
|
@ -131,7 +137,7 @@ void FocusController::nextItem(Direction direction)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_focusChain.empty()) {
|
if (m_focusChain.empty()) {
|
||||||
qWarning() << "There are no items to navigate";
|
logger.warning() << "There are no items to navigate";
|
||||||
setFocusOnDefaultItem();
|
setFocusOnDefaultItem();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -149,7 +155,7 @@ void FocusController::nextItem(Direction direction)
|
||||||
const auto focusedItem = qobject_cast<QQuickItem *>(m_focusChain.at(focusedItemIndex));
|
const auto focusedItem = qobject_cast<QQuickItem *>(m_focusChain.at(focusedItemIndex));
|
||||||
|
|
||||||
if (focusedItem == nullptr) {
|
if (focusedItem == nullptr) {
|
||||||
qWarning() << "Failed to get item to focus on. Setting focus on default";
|
logger.warning() << "Failed to get item to focus on. Setting focus on default";
|
||||||
setFocusOnDefaultItem();
|
setFocusOnDefaultItem();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue