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_resources(${CMAKE_PROJECT_NAME} "configuration"
|
||||
PREFIX "/"
|
||||
FILES
|
||||
|
||||
@@ -18,6 +18,9 @@ qt6_add_qml_module(KomplexHubContent
|
||||
"pages/UserProfilePage.qml"
|
||||
"pages/WallpaperSettingsPage.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
|
||||
@@ -168,6 +173,11 @@ Item
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onViewMoreTriggered: () =>
|
||||
{
|
||||
showFeaturedImagesPage()
|
||||
}
|
||||
}
|
||||
|
||||
Text
|
||||
@@ -215,6 +225,11 @@ Item
|
||||
onViewMoreTriggered:() => showVideoPopup(parent.index)
|
||||
}
|
||||
}
|
||||
|
||||
onViewMoreTriggered: () =>
|
||||
{
|
||||
showFeaturedVideosPage()
|
||||
}
|
||||
}
|
||||
|
||||
/* 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: [
|
||||
State {
|
||||
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)
|
||||
{
|
||||
viewMoreImagePopup.author = imagesModel.data(imagesModel.index(index,0), FeaturedImagesModel.AuthorRole)
|
||||
@@ -415,6 +496,25 @@ Item
|
||||
|
||||
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
|
||||
viewMoreVideoPopup.opacity = 0
|
||||
viewMoreWallpaperPopup.opacity = 0
|
||||
|
||||
@@ -25,6 +25,8 @@ Item
|
||||
|
||||
property Component delegate
|
||||
|
||||
signal viewMoreTriggered()
|
||||
|
||||
id: rootItem
|
||||
|
||||
Item
|
||||
@@ -162,6 +164,8 @@ Item
|
||||
icon.source: "qrc:/images/icons/icons8-forward.svg"
|
||||
icon.height: 24
|
||||
icon.width: 24
|
||||
|
||||
onTriggered: () => viewMoreTriggered()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,6 +120,7 @@ public:
|
||||
* @brief resultsPerPage
|
||||
* @return
|
||||
*/
|
||||
[[nodiscard]]
|
||||
auto resultsPerPage() const -> qsizetype
|
||||
{
|
||||
return m_resultsPerPage;
|
||||
@@ -204,6 +205,7 @@ public:
|
||||
* @brief data
|
||||
* @return
|
||||
*/
|
||||
[[nodiscard]]
|
||||
auto data() const -> const QList<T>
|
||||
{
|
||||
if(boundaryCheck(m_resultsPerPage))
|
||||
@@ -219,6 +221,7 @@ public:
|
||||
* @brief count
|
||||
* @return
|
||||
*/
|
||||
[[nodiscard]]
|
||||
auto count() const -> qsizetype
|
||||
{
|
||||
if(m_offset == nullsize)
|
||||
@@ -240,6 +243,7 @@ public:
|
||||
* @param index
|
||||
* @return
|
||||
*/
|
||||
[[nodiscard]]
|
||||
auto at(qsizetype index) const -> const T&
|
||||
{
|
||||
return m_cacheController.at(m_offset + index);
|
||||
@@ -251,6 +255,7 @@ public:
|
||||
* The total number of results as reported by the controller
|
||||
* @return
|
||||
*/
|
||||
[[nodiscard]]
|
||||
auto totalResults() const -> qsizetype
|
||||
{
|
||||
return m_cacheController.totalCount();
|
||||
@@ -261,6 +266,7 @@ public:
|
||||
* Calculates the current page
|
||||
* @return
|
||||
*/
|
||||
[[nodiscard]]
|
||||
auto page() const -> qsizetype
|
||||
{
|
||||
return std::floor(
|
||||
@@ -273,6 +279,7 @@ public:
|
||||
* Calculates the total number of pages available
|
||||
* @return
|
||||
*/
|
||||
[[nodiscard]]
|
||||
auto totalPages() const -> qsizetype
|
||||
{
|
||||
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:
|
||||
|
||||
auto queryable() const -> bool
|
||||
|
||||
@@ -337,6 +337,13 @@ private:
|
||||
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))
|
||||
{
|
||||
if(!slideForward())
|
||||
|
||||
@@ -245,7 +245,6 @@ auto FeaturedImagesModel::resultsPerPage() const -> qsizetype
|
||||
|
||||
auto FeaturedImagesModel::setResultsPerPage(qsizetype resultsPerPage) -> void
|
||||
{
|
||||
|
||||
if(m_paginator != nullptr)
|
||||
{
|
||||
QFuture<void> future = QtConcurrent::run
|
||||
|
||||
@@ -248,7 +248,6 @@ signals:
|
||||
auto stateChanged() -> void;
|
||||
auto errorStringChanged() -> void;
|
||||
auto resultsPerPageChanged() -> void;
|
||||
|
||||
auto pageChanged() -> void;
|
||||
auto totalResultsChanged() -> void;
|
||||
auto totalPagesChanged() -> void;
|
||||
|
||||
@@ -205,6 +205,24 @@ auto FeaturedVideosModel::itemModel() const -> VideoItemModel*
|
||||
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>
|
||||
{
|
||||
return m_dataRoles;
|
||||
|
||||
@@ -217,6 +217,20 @@ public:
|
||||
|
||||
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:
|
||||
/**
|
||||
* @brief setErrorString
|
||||
@@ -243,7 +257,7 @@ signals:
|
||||
auto stateChanged() -> void;
|
||||
auto errorStringChanged() -> void;
|
||||
auto resultsPerPageChanged() -> void;
|
||||
|
||||
auto windowSizeChanged() -> void;
|
||||
auto pageChanged() -> void;
|
||||
auto totalResultsChanged() -> void;
|
||||
auto totalPagesChanged() -> void;
|
||||
@@ -314,6 +328,7 @@ private:
|
||||
Q_PROPERTY(qsizetype totalPages READ totalPages NOTIFY totalPagesChanged FINAL)
|
||||
Q_PROPERTY(qsizetype page READ page NOTIFY pageChanged FINAL)
|
||||
Q_PROPERTY(VideoItemModel *itemModel READ itemModel CONSTANT FINAL)
|
||||
Q_PROPERTY(qsizetype windowSize READ windowSize WRITE setWindowSize NOTIFY windowSizeChanged FINAL)
|
||||
};
|
||||
Q_DECLARE_METATYPE(FeaturedVideosModel)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user