[app] Made BooksHints a singleton
This commit is contained in:
parent
4bc47ef775
commit
d2bc2d10cd
5 changed files with 37 additions and 29 deletions
|
@ -52,7 +52,6 @@ ApplicationWindow {
|
||||||
|
|
||||||
property variant currentShelf: mainPage.currentShelf
|
property variant currentShelf: mainPage.currentShelf
|
||||||
|
|
||||||
BooksHints { id: globalHints }
|
|
||||||
DisplayBlanking {
|
DisplayBlanking {
|
||||||
pauseRequested: Qt.application.active &&
|
pauseRequested: Qt.application.active &&
|
||||||
Settings.currentBook &&
|
Settings.currentBook &&
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2015-2019 Jolla Ltd.
|
Copyright (C) 2015-2020 Jolla Ltd.
|
||||||
Copyright (C) 2015-2019 Slava Monich <slava.monich@jolla.com>
|
Copyright (C) 2015-2020 Slava Monich <slava.monich@jolla.com>
|
||||||
|
|
||||||
You may use this file under the terms of BSD license as follows:
|
You may use this file under the terms of BSD license as follows:
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ Item {
|
||||||
Loader {
|
Loader {
|
||||||
id: leftSwipeHintLoader
|
id: leftSwipeHintLoader
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
active: globalHints.storageLeftSwipe < MaximumHintCount || running
|
active: BooksHints.storageLeftSwipe < MaximumHintCount || running
|
||||||
property bool running
|
property bool running
|
||||||
sourceComponent: Component {
|
sourceComponent: Component {
|
||||||
HarbourHorizontalSwipeHint {
|
HarbourHorizontalSwipeHint {
|
||||||
|
@ -321,12 +321,12 @@ Item {
|
||||||
storageView.visible &&
|
storageView.visible &&
|
||||||
shelfIndex == storageListWatcher.currentIndex &&
|
shelfIndex == storageListWatcher.currentIndex &&
|
||||||
(shelfIndex+1) < storageModel.count &&
|
(shelfIndex+1) < storageModel.count &&
|
||||||
globalHints.storageLeftSwipe < MaximumHintCount
|
BooksHints.storageLeftSwipe < MaximumHintCount
|
||||||
|
|
||||||
//% "Swipe left to see what's on the SD-card"
|
//% "Swipe left to see what's on the SD-card"
|
||||||
text: qsTrId("harbour-books-storage-view-swipe_left_hint")
|
text: qsTrId("harbour-books-storage-view-swipe_left_hint")
|
||||||
swipeRight: false
|
swipeRight: false
|
||||||
onHintShown: globalHints.storageLeftSwipe++
|
onHintShown: BooksHints.storageLeftSwipe++
|
||||||
onHintRunningChanged: leftSwipeHintLoader.running = hintRunning
|
onHintRunningChanged: leftSwipeHintLoader.running = hintRunning
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 Jolla Ltd.
|
* Copyright (C) 2015-2020 Jolla Ltd.
|
||||||
* Contact: Slava Monich <slava.monich@jolla.com>
|
* Copyright (C) 2015-2020 Slava Monich <slava.monich@jolla.com>
|
||||||
*
|
*
|
||||||
* You may use this file under the terms of the BSD license as follows:
|
* You may use this file under the terms of the BSD license as follows:
|
||||||
*
|
*
|
||||||
|
@ -8,15 +8,15 @@
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
*
|
*
|
||||||
* * Redistributions of source code must retain the above copyright
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer
|
||||||
* the documentation and/or other materials provided with the
|
* in the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* * Neither the name of Nemo Mobile nor the names of its contributors
|
* 3. Neither the names of the copyright holders nor the names of its
|
||||||
* may be used to endorse or promote products derived from this
|
* contributors may be used to endorse or promote products derived
|
||||||
* software without specific prior written permission.
|
* from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
@ -61,3 +61,9 @@ BooksHints::setStorageLeftSwipe(
|
||||||
HDEBUG(aValue);
|
HDEBUG(aValue);
|
||||||
iStorageLeftSwipe->set(aValue);
|
iStorageLeftSwipe->set(aValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Callback for qmlRegisterSingletonType<BooksHints>
|
||||||
|
QObject* BooksHints::createSingleton(QQmlEngine*, QJSEngine*)
|
||||||
|
{
|
||||||
|
return new BooksHints;
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 Jolla Ltd.
|
* Copyright (C) 2015-2020 Jolla Ltd.
|
||||||
* Contact: Slava Monich <slava.monich@jolla.com>
|
* Copyright (C) 2015-2020 Slava Monich <slava.monich@jolla.com>
|
||||||
*
|
*
|
||||||
* You may use this file under the terms of the BSD license as follows:
|
* You may use this file under the terms of the BSD license as follows:
|
||||||
*
|
*
|
||||||
|
@ -8,15 +8,15 @@
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
*
|
*
|
||||||
* * Redistributions of source code must retain the above copyright
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer
|
||||||
* the documentation and/or other materials provided with the
|
* in the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* * Neither the name of Nemo Mobile nor the names of its contributors
|
* 3. Neither the names of the copyright holders nor the names of its
|
||||||
* may be used to endorse or promote products derived from this
|
* contributors may be used to endorse or promote products derived
|
||||||
* software without specific prior written permission.
|
* from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
@ -50,6 +50,9 @@ public:
|
||||||
int storageLeftSwipe() const;
|
int storageLeftSwipe() const;
|
||||||
void setStorageLeftSwipe(int aValue);
|
void setStorageLeftSwipe(int aValue);
|
||||||
|
|
||||||
|
// Callback for qmlRegisterSingletonType<BooksHints>
|
||||||
|
static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void storageLeftSwipeChanged();
|
void storageLeftSwipeChanged();
|
||||||
|
|
||||||
|
|
|
@ -83,9 +83,9 @@ Q_DECL_EXPORT int main(int argc, char **argv)
|
||||||
BOOKS_QML_REGISTER(BooksPageWidget, "PageWidget");
|
BOOKS_QML_REGISTER(BooksPageWidget, "PageWidget");
|
||||||
BOOKS_QML_REGISTER(BooksListWatcher, "ListWatcher");
|
BOOKS_QML_REGISTER(BooksListWatcher, "ListWatcher");
|
||||||
BOOKS_QML_REGISTER(BooksCoverWidget, "BookCover");
|
BOOKS_QML_REGISTER(BooksCoverWidget, "BookCover");
|
||||||
BOOKS_QML_REGISTER(BooksHints, "BooksHints");
|
|
||||||
BOOKS_QML_REGISTER(BooksSettings, "BooksSettings");
|
BOOKS_QML_REGISTER(BooksSettings, "BooksSettings");
|
||||||
BOOKS_QML_REGISTER(HarbourDisplayBlanking, "DisplayBlanking");
|
BOOKS_QML_REGISTER(HarbourDisplayBlanking, "DisplayBlanking");
|
||||||
|
BOOKS_QML_REGISTER_SINGLETON(BooksHints, "BooksHints");
|
||||||
BOOKS_QML_REGISTER_SINGLETON(BooksFeedback, "BooksFeedback");
|
BOOKS_QML_REGISTER_SINGLETON(BooksFeedback, "BooksFeedback");
|
||||||
|
|
||||||
QLocale locale;
|
QLocale locale;
|
||||||
|
|
Loading…
Reference in a new issue