-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
212 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
### Sets QT_INSTALL_QML to the directory where QML Plugins should be installed | ||
function(FindQtInstallQml) | ||
find_program(QMAKE NAMES qmake6 qmake) | ||
if(NOT QMAKE) | ||
message(FATAL_ERROR "qmake not found") | ||
endif() | ||
execute_process( | ||
COMMAND ${QMAKE} -query QT_INSTALL_QML | ||
OUTPUT_VARIABLE PROC_RESULT | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
) | ||
set(QT_INSTALL_QML ${PROC_RESULT} PARENT_SCOPE) | ||
endfunction() | ||
|
||
set(SRC | ||
plugin.cpp | ||
gallerymodel.cpp) | ||
|
||
set(HEADERS | ||
plugin.h | ||
gallerymodel.h) | ||
|
||
set(QML | ||
qml/GalleryDelegate.qml | ||
qml/GalleryView.qml) | ||
|
||
add_library(glaciergalleryplugin SHARED ${SRC}) | ||
|
||
qt6_add_qml_module(glaciergalleryplugin | ||
URI Glacier.Gallery | ||
VERSION 1.0 | ||
PLUGIN_TARGET glaciergalleryplugin | ||
NO_GENERATE_PLUGIN_SOURCE | ||
SOURCES | ||
${SOURCES} | ||
${HEADERS} | ||
QML_FILES | ||
${QML} | ||
OUTPUT_DIRECTORY | ||
${CMAKE_BINARY_DIR}/Glacier/Gallery | ||
RESOURCES qml/qmldir | ||
SOURCES gallerymodel.h gallerymodel.cpp | ||
) | ||
|
||
target_link_libraries(glaciergalleryplugin PUBLIC | ||
Qt6::Core | ||
Qt6::Gui | ||
Qt6::Qml | ||
Qt6::Quick) | ||
|
||
FindQtInstallQml() | ||
|
||
install(TARGETS glaciergalleryplugin | ||
RUNTIME DESTINATION "${QT_INSTALL_QML}/Glacier/Gallery" | ||
BUNDLE DESTINATION "${QT_INSTALL_QML}/Glacier/Gallery" | ||
LIBRARY DESTINATION "${QT_INSTALL_QML}/Glacier/Gallery" | ||
) | ||
|
||
install(DIRECTORY qml/ | ||
DESTINATION ${QT_INSTALL_QML}/Glacier/Gallery) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include "gallerymodel.h" | ||
|
||
GalleryModel::GalleryModel(QObject *parent) | ||
: QAbstractListModel{parent} | ||
, m_loading(false) | ||
, m_error(true) | ||
{ | ||
} | ||
|
||
int GalleryModel::rowCount(const QModelIndex &parent) const | ||
{ | ||
return -1; | ||
} | ||
|
||
QVariant GalleryModel::data(const QModelIndex &index, int role) const | ||
{ | ||
return QVariant(); | ||
} | ||
|
||
QStringList GalleryModel::sortProperties() const | ||
{ | ||
return m_sortProperties; | ||
} | ||
|
||
void GalleryModel::setSortProperties(const QStringList &newSortProperties) | ||
{ | ||
if (m_sortProperties == newSortProperties) | ||
return; | ||
m_sortProperties = newSortProperties; | ||
emit sortPropertiesChanged(); | ||
} | ||
|
||
bool GalleryModel::loading() const | ||
{ | ||
return m_loading; | ||
} | ||
|
||
bool GalleryModel::error() const | ||
{ | ||
return m_error; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#ifndef GALLERYMODEL_H | ||
#define GALLERYMODEL_H | ||
|
||
#include <QAbstractListModel> | ||
|
||
class GalleryModel : public QAbstractListModel | ||
{ | ||
Q_OBJECT | ||
Q_PROPERTY(QStringList sortProperties READ sortProperties WRITE setSortProperties NOTIFY sortPropertiesChanged FINAL) | ||
Q_PROPERTY(bool loading READ loading NOTIFY loadingChanged FINAL) | ||
Q_PROPERTY(bool error READ error NOTIFY errorChanged FINAL) | ||
|
||
public: | ||
explicit GalleryModel(QObject *parent = nullptr); | ||
int rowCount(const QModelIndex& parent = QModelIndex()) const; | ||
QVariant data(const QModelIndex& index, int role) const; | ||
QHash<int, QByteArray> roleNames() const { return m_hash; } | ||
|
||
QStringList sortProperties() const; | ||
void setSortProperties(const QStringList &newSortProperties); | ||
|
||
bool loading() const; | ||
|
||
bool error() const; | ||
|
||
signals: | ||
void sortPropertiesChanged(); | ||
|
||
void loadingChanged(); | ||
|
||
void errorChanged(); | ||
|
||
private: | ||
QHash<int, QByteArray> m_hash; | ||
QStringList m_sortProperties; | ||
bool m_loading; | ||
bool m_error; | ||
}; | ||
|
||
#endif // GALLERYMODEL_H |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright (C) 2024 Chupligin Sergey <[email protected]> | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Library General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Library General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Library General Public License | ||
* along with this library; see the file COPYING.LIB. If not, write to | ||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
* Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
#include "plugin.h" | ||
#include "gallerymodel.h" | ||
#include <QtQml> | ||
|
||
void QQuickNemoControlsExtensionPlugin::registerTypes(const char* uri) | ||
{ | ||
Q_ASSERT(uri == QLatin1String("Glacier.Gallery")); | ||
qmlRegisterModule(uri, 1, 0); | ||
//@uri Glacier.Gallery | ||
qmlRegisterType<GalleryModel>(uri, 1, 0, "GalleryModel"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (C) 2024 Chupligin Sergey <[email protected]> | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Library General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Library General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Library General Public License | ||
* along with this library; see the file COPYING.LIB. If not, write to | ||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
* Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
|
||
#ifndef PLUGIN_H | ||
#define PLUGIN_H | ||
|
||
#include <QQmlExtensionPlugin> | ||
|
||
class QQuickNemoControlsExtensionPlugin : public QQmlExtensionPlugin { | ||
public: | ||
Q_OBJECT | ||
Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid FILE "glacier.gallery.json") | ||
public: | ||
void registerTypes(const char* uri); | ||
}; | ||
|
||
#endif // PLUGIN_H |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
module Glacier.Gallery | ||
plugin glaciergalleryplugin | ||
|
||
GalleryDelegate 1.0 GalleryDelegate.qml | ||
GalleryModel 1.0 GalleryModel.qml | ||
GalleryView 1.0 GalleryView.qml |
Oops, something went wrong.