added tablet notification

This commit is contained in:
Dante Ruiz 2017-03-15 19:26:50 +01:00
parent 08ee2fd43f
commit 4bc050e583
3 changed files with 20 additions and 3 deletions

View file

@ -56,7 +56,14 @@ public:
QQuickWindow* getTabletWindow();
QObject* getFlags();
signals:
/** jsdoc
* Signaled when a tablet message or dialog is created
* @function TabletProxy#tabletNotification
* @returns {Signal}
*/
void tabletNotification();
private:
void processMenuEvents(QObject* object, const QKeyEvent* event);
void processTabletEvents(QObject* object, const QKeyEvent* event);

View file

@ -223,6 +223,7 @@ QQuickItem* OffscreenUi::createMessageBox(Icon icon, const QString& title, const
invokeResult = QMetaObject::invokeMethod(tabletRoot, "messageBox",
Q_RETURN_ARG(QVariant, result),
Q_ARG(QVariant, QVariant::fromValue(map)));
emit tabletScriptingInterface->tabletNotification();
}
if (!invokeResult) {
@ -430,6 +431,7 @@ QQuickItem* OffscreenUi::createInputDialog(const Icon icon, const QString& title
invokeResult = QMetaObject::invokeMethod(tabletRoot, "inputDialog",
Q_RETURN_ARG(QVariant, result),
Q_ARG(QVariant, QVariant::fromValue(map)));
emit tabletScriptingInterface->tabletNotification();
}
if (!invokeResult) {
qWarning() << "Failed to create message box";
@ -457,6 +459,7 @@ QQuickItem* OffscreenUi::createCustomInputDialog(const Icon icon, const QString&
invokeResult = QMetaObject::invokeMethod(tabletRoot, "inputDialog",
Q_RETURN_ARG(QVariant, result),
Q_ARG(QVariant, QVariant::fromValue(map)));
emit tabletScriptingInterface->tabletNotification();
}
if (!invokeResult) {
@ -614,6 +617,7 @@ QString OffscreenUi::fileDialog(const QVariantMap& properties) {
invokeResult = QMetaObject::invokeMethod(tabletRoot, "fileDialog",
Q_RETURN_ARG(QVariant, buildDialogResult),
Q_ARG(QVariant, QVariant::fromValue(properties)));
emit tabletScriptingInterface->tabletNotification();
}
if (!invokeResult) {

View file

@ -94,11 +94,13 @@ var NotificationType = {
LOD_WARNING: 2,
CONNECTION_REFUSED: 3,
EDIT_ERROR: 4,
TABLET: 5,
properties: [
{ text: "Snapshot" },
{ text: "Level of Detail" },
{ text: "Connection Refused" },
{ text: "Edit error" }
{ text: "Edit error" },
{ text: "Tablet" }
],
getTypeFromMenuItem: function(menuItemName) {
if (menuItemName.substr(menuItemName.length - NOTIFICATION_MENU_ITEM_POST.length) !== NOTIFICATION_MENU_ITEM_POST) {
@ -535,6 +537,10 @@ function onSnapshotTaken(pathStillSnapshot, pathAnimatedSnapshot, notify) {
}
}
function tabletNotification() {
createNotification("Tablet need your attention", NotificationType.TABLET);
}
function processingGif() {
createNotification("Processing GIF snapshot...", NotificationType.SNAPSHOT);
}
@ -641,7 +647,7 @@ Window.snapshotTaken.connect(onSnapshotTaken);
Window.processingGif.connect(processingGif);
Window.notifyEditError = onEditError;
Window.notify = onNotify;
Tablet.tabletNotification.connect(tabletNotification);
setup();
}()); // END LOCAL_SCOPE