Added Featured List Pages
This commit is contained in:
@@ -25,6 +25,7 @@ qt_standard_project_setup()
|
|||||||
|
|
||||||
qt_add_executable(${CMAKE_PROJECT_NAME}
|
qt_add_executable(${CMAKE_PROJECT_NAME}
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_add_resources(${CMAKE_PROJECT_NAME} "configuration"
|
qt_add_resources(${CMAKE_PROJECT_NAME} "configuration"
|
||||||
PREFIX "/"
|
PREFIX "/"
|
||||||
FILES
|
FILES
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ qt6_add_qml_module(KomplexHubContent
|
|||||||
"pages/UserProfilePage.qml"
|
"pages/UserProfilePage.qml"
|
||||||
"pages/WallpaperSettingsPage.qml"
|
"pages/WallpaperSettingsPage.qml"
|
||||||
"pages/VideoSearchPage.qml"
|
"pages/VideoSearchPage.qml"
|
||||||
|
QML_FILES pages/FeaturedVideosPage.qml
|
||||||
|
QML_FILES pages/FeaturedPacksPage.qml
|
||||||
|
QML_FILES pages/FeaturedImagesPage.qml
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -116,6 +116,11 @@ Item
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onViewMoreTriggered: () =>
|
||||||
|
{
|
||||||
|
showFeaturedPacksPage()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Text
|
Text
|
||||||
@@ -168,6 +173,11 @@ Item
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onViewMoreTriggered: () =>
|
||||||
|
{
|
||||||
|
showFeaturedImagesPage()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Text
|
Text
|
||||||
@@ -215,6 +225,11 @@ Item
|
|||||||
onViewMoreTriggered:() => showVideoPopup(parent.index)
|
onViewMoreTriggered:() => showVideoPopup(parent.index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onViewMoreTriggered: () =>
|
||||||
|
{
|
||||||
|
showFeaturedVideosPage()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* spacer */
|
/* spacer */
|
||||||
@@ -301,6 +316,51 @@ Item
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FeaturedVideosPage
|
||||||
|
{
|
||||||
|
id: featuredVideosPage
|
||||||
|
anchors.fill: parent
|
||||||
|
opacity: 0
|
||||||
|
visible: opacity > 0.01
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
duration: 250
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FeaturedPacksPage
|
||||||
|
{
|
||||||
|
id: featuredPacksPage
|
||||||
|
anchors.fill: parent
|
||||||
|
opacity: 0
|
||||||
|
visible: opacity > 0.01
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
duration: 250
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FeaturedImagesPage
|
||||||
|
{
|
||||||
|
id: featuredImagesPage
|
||||||
|
anchors.fill: parent
|
||||||
|
opacity: 0
|
||||||
|
visible: opacity > 0.01
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
duration: 250
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
states: [
|
states: [
|
||||||
State {
|
State {
|
||||||
name: "loading"
|
name: "loading"
|
||||||
@@ -364,6 +424,27 @@ Item
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
function showFeaturedVideosPage()
|
||||||
|
{
|
||||||
|
resultsLayout.opacity = 0
|
||||||
|
featuredVideosPage.opacity = 1
|
||||||
|
popup = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function showFeaturedPacksPage()
|
||||||
|
{
|
||||||
|
resultsLayout.opacity = 0
|
||||||
|
featuredPacksPage.opacity = 1
|
||||||
|
popup = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function showFeaturedImagesPage()
|
||||||
|
{
|
||||||
|
resultsLayout.opacity = 0
|
||||||
|
featuredImagesPage.opacity = 1
|
||||||
|
popup = true
|
||||||
|
}
|
||||||
|
|
||||||
function showImagePopup(index)
|
function showImagePopup(index)
|
||||||
{
|
{
|
||||||
viewMoreImagePopup.author = imagesModel.data(imagesModel.index(index,0), FeaturedImagesModel.AuthorRole)
|
viewMoreImagePopup.author = imagesModel.data(imagesModel.index(index,0), FeaturedImagesModel.AuthorRole)
|
||||||
@@ -415,6 +496,25 @@ Item
|
|||||||
|
|
||||||
function closePopup()
|
function closePopup()
|
||||||
{
|
{
|
||||||
|
if(featuredVideosPage.popup)
|
||||||
|
{
|
||||||
|
featuredVideosPage.closePopup()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(featuredImagesPage.popup)
|
||||||
|
{
|
||||||
|
featuredImagesPage.closePopup()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(featuredPacksPage.popup)
|
||||||
|
{
|
||||||
|
featuredPacksPage.closePopup()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
featuredVideosPage.opacity = 0
|
||||||
|
featuredImagesPage.opacity = 0
|
||||||
|
featuredPacksPage.opacity = 0
|
||||||
viewMoreImagePopup.opacity = 0
|
viewMoreImagePopup.opacity = 0
|
||||||
viewMoreVideoPopup.opacity = 0
|
viewMoreVideoPopup.opacity = 0
|
||||||
viewMoreWallpaperPopup.opacity = 0
|
viewMoreWallpaperPopup.opacity = 0
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ Item
|
|||||||
|
|
||||||
property Component delegate
|
property Component delegate
|
||||||
|
|
||||||
|
signal viewMoreTriggered()
|
||||||
|
|
||||||
id: rootItem
|
id: rootItem
|
||||||
|
|
||||||
Item
|
Item
|
||||||
@@ -162,6 +164,8 @@ Item
|
|||||||
icon.source: "qrc:/images/icons/icons8-forward.svg"
|
icon.source: "qrc:/images/icons/icons8-forward.svg"
|
||||||
icon.height: 24
|
icon.height: 24
|
||||||
icon.width: 24
|
icon.width: 24
|
||||||
|
|
||||||
|
onTriggered: () => viewMoreTriggered()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ public:
|
|||||||
* @brief resultsPerPage
|
* @brief resultsPerPage
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
auto resultsPerPage() const -> qsizetype
|
auto resultsPerPage() const -> qsizetype
|
||||||
{
|
{
|
||||||
return m_resultsPerPage;
|
return m_resultsPerPage;
|
||||||
@@ -204,6 +205,7 @@ public:
|
|||||||
* @brief data
|
* @brief data
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
auto data() const -> const QList<T>
|
auto data() const -> const QList<T>
|
||||||
{
|
{
|
||||||
if(boundaryCheck(m_resultsPerPage))
|
if(boundaryCheck(m_resultsPerPage))
|
||||||
@@ -219,6 +221,7 @@ public:
|
|||||||
* @brief count
|
* @brief count
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
auto count() const -> qsizetype
|
auto count() const -> qsizetype
|
||||||
{
|
{
|
||||||
if(m_offset == nullsize)
|
if(m_offset == nullsize)
|
||||||
@@ -240,6 +243,7 @@ public:
|
|||||||
* @param index
|
* @param index
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
auto at(qsizetype index) const -> const T&
|
auto at(qsizetype index) const -> const T&
|
||||||
{
|
{
|
||||||
return m_cacheController.at(m_offset + index);
|
return m_cacheController.at(m_offset + index);
|
||||||
@@ -251,6 +255,7 @@ public:
|
|||||||
* The total number of results as reported by the controller
|
* The total number of results as reported by the controller
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
auto totalResults() const -> qsizetype
|
auto totalResults() const -> qsizetype
|
||||||
{
|
{
|
||||||
return m_cacheController.totalCount();
|
return m_cacheController.totalCount();
|
||||||
@@ -261,6 +266,7 @@ public:
|
|||||||
* Calculates the current page
|
* Calculates the current page
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
auto page() const -> qsizetype
|
auto page() const -> qsizetype
|
||||||
{
|
{
|
||||||
return std::floor(
|
return std::floor(
|
||||||
@@ -273,6 +279,7 @@ public:
|
|||||||
* Calculates the total number of pages available
|
* Calculates the total number of pages available
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
auto totalPages() const -> qsizetype
|
auto totalPages() const -> qsizetype
|
||||||
{
|
{
|
||||||
return std::ceil(
|
return std::ceil(
|
||||||
@@ -280,6 +287,22 @@ public:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setWindowSize
|
||||||
|
* Sets the controller window size
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto setWindowSize(qsizetype size) -> void
|
||||||
|
{
|
||||||
|
m_cacheController.setWindowSize(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
|
auto windowSize() const -> qsizetype
|
||||||
|
{
|
||||||
|
return m_cacheController.windowSize();
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
auto queryable() const -> bool
|
auto queryable() const -> bool
|
||||||
|
|||||||
@@ -337,6 +337,13 @@ private:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qsizetype windowSize = this->windowSize();
|
||||||
|
|
||||||
|
if(windowSize == 0)
|
||||||
|
{
|
||||||
|
windowSize = SLIDING_CACHE_WINDOW_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
while (index >= m_windowOffset + (SLIDING_CACHE_WINDOW_SIZE - SLIDING_CACHE_PREFETCH_THRESHOLD))
|
while (index >= m_windowOffset + (SLIDING_CACHE_WINDOW_SIZE - SLIDING_CACHE_PREFETCH_THRESHOLD))
|
||||||
{
|
{
|
||||||
if(!slideForward())
|
if(!slideForward())
|
||||||
|
|||||||
@@ -245,7 +245,6 @@ auto FeaturedImagesModel::resultsPerPage() const -> qsizetype
|
|||||||
|
|
||||||
auto FeaturedImagesModel::setResultsPerPage(qsizetype resultsPerPage) -> void
|
auto FeaturedImagesModel::setResultsPerPage(qsizetype resultsPerPage) -> void
|
||||||
{
|
{
|
||||||
|
|
||||||
if(m_paginator != nullptr)
|
if(m_paginator != nullptr)
|
||||||
{
|
{
|
||||||
QFuture<void> future = QtConcurrent::run
|
QFuture<void> future = QtConcurrent::run
|
||||||
|
|||||||
@@ -248,7 +248,6 @@ signals:
|
|||||||
auto stateChanged() -> void;
|
auto stateChanged() -> void;
|
||||||
auto errorStringChanged() -> void;
|
auto errorStringChanged() -> void;
|
||||||
auto resultsPerPageChanged() -> void;
|
auto resultsPerPageChanged() -> void;
|
||||||
|
|
||||||
auto pageChanged() -> void;
|
auto pageChanged() -> void;
|
||||||
auto totalResultsChanged() -> void;
|
auto totalResultsChanged() -> void;
|
||||||
auto totalPagesChanged() -> void;
|
auto totalPagesChanged() -> void;
|
||||||
|
|||||||
@@ -205,6 +205,24 @@ auto FeaturedVideosModel::itemModel() const -> VideoItemModel*
|
|||||||
return m_itemModel;
|
return m_itemModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto FeaturedVideosModel::windowSize() const -> qsizetype
|
||||||
|
{
|
||||||
|
if(m_paginator == nullptr)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_paginator->windowSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedVideosModel::setWindowSize(qsizetype size) -> void
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
m_paginator->setWindowSize(size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto FeaturedVideosModel::roleNames() const -> QHash<int, QByteArray>
|
auto FeaturedVideosModel::roleNames() const -> QHash<int, QByteArray>
|
||||||
{
|
{
|
||||||
return m_dataRoles;
|
return m_dataRoles;
|
||||||
|
|||||||
@@ -217,6 +217,20 @@ public:
|
|||||||
|
|
||||||
VideoItemModel *itemModel() const;
|
VideoItemModel *itemModel() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief windowSize
|
||||||
|
* Paginator cache size
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto windowSize() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setWindowSize
|
||||||
|
* Set the paginator cache size
|
||||||
|
* @param size
|
||||||
|
*/
|
||||||
|
auto setWindowSize(qsizetype size) -> void;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief setErrorString
|
* @brief setErrorString
|
||||||
@@ -243,7 +257,7 @@ signals:
|
|||||||
auto stateChanged() -> void;
|
auto stateChanged() -> void;
|
||||||
auto errorStringChanged() -> void;
|
auto errorStringChanged() -> void;
|
||||||
auto resultsPerPageChanged() -> void;
|
auto resultsPerPageChanged() -> void;
|
||||||
|
auto windowSizeChanged() -> void;
|
||||||
auto pageChanged() -> void;
|
auto pageChanged() -> void;
|
||||||
auto totalResultsChanged() -> void;
|
auto totalResultsChanged() -> void;
|
||||||
auto totalPagesChanged() -> void;
|
auto totalPagesChanged() -> void;
|
||||||
@@ -314,6 +328,7 @@ private:
|
|||||||
Q_PROPERTY(qsizetype totalPages READ totalPages NOTIFY totalPagesChanged FINAL)
|
Q_PROPERTY(qsizetype totalPages READ totalPages NOTIFY totalPagesChanged FINAL)
|
||||||
Q_PROPERTY(qsizetype page READ page NOTIFY pageChanged FINAL)
|
Q_PROPERTY(qsizetype page READ page NOTIFY pageChanged FINAL)
|
||||||
Q_PROPERTY(VideoItemModel *itemModel READ itemModel CONSTANT FINAL)
|
Q_PROPERTY(VideoItemModel *itemModel READ itemModel CONSTANT FINAL)
|
||||||
|
Q_PROPERTY(qsizetype windowSize READ windowSize WRITE setWindowSize NOTIFY windowSizeChanged FINAL)
|
||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(FeaturedVideosModel)
|
Q_DECLARE_METATYPE(FeaturedVideosModel)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user