mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2025-09-04 01:42:44 +00:00
Add BlurHash placeholders at several places
* [ui] Added: Blurry previews of images before they are loaded Also fixes a bug where ApiModel would remove items that already started with a lowecase letter or didn't start with a letter at all.
This commit is contained in:
parent
bb2f6f3a3e
commit
79d378c9ed
13 changed files with 120 additions and 25 deletions
|
@ -362,6 +362,8 @@ public:
|
|||
// a QHash at the moment.
|
||||
Q_PROPERTY(QJsonObject imageTags MEMBER m_imageTags NOTIFY imageTagsChanged)
|
||||
Q_PROPERTY(QJsonObject imageBlurHashes MEMBER m_imageBlurHashes NOTIFY imageBlurHashesChanged)
|
||||
Q_PROPERTY(int width MEMBER m_width NOTIFY widthChanged)
|
||||
Q_PROPERTY(int height MEMBER m_height NOTIFY heightChanged)
|
||||
|
||||
QString jellyfinId() const { return m_id; }
|
||||
void setJellyfinId(QString newId);
|
||||
|
@ -450,6 +452,8 @@ signals:
|
|||
void artistsChanged(const QStringList &newArtists);
|
||||
void imageTagsChanged();
|
||||
void imageBlurHashesChanged();
|
||||
void widthChanged(int newWidth);
|
||||
void heightChanged(int newHeight);
|
||||
|
||||
public slots:
|
||||
void onUserDataChanged(const QString &itemId, QSharedPointer<UserData> userData);
|
||||
|
@ -505,6 +509,8 @@ protected:
|
|||
QStringList m_artists;
|
||||
QJsonObject m_imageTags;
|
||||
QJsonObject m_imageBlurHashes;
|
||||
int m_width;
|
||||
int m_height;
|
||||
|
||||
template<typename T>
|
||||
QQmlListProperty<T> toReadOnlyQmlListProperty(QList<T *> &list) {
|
||||
|
|
|
@ -183,6 +183,7 @@ QVariant ApiModel::data(const QModelIndex &index, int role) const {
|
|||
QJsonObject obj = m_array.at(index.row()).toObject();
|
||||
|
||||
const QString &key = m_roles[role];
|
||||
|
||||
if (obj.contains(key)) {
|
||||
return obj[key].toVariant();
|
||||
}
|
||||
|
|
|
@ -30,7 +30,12 @@ void convertToCamelCase(QJsonValueRef val) {
|
|||
QJsonValueRef ref = obj[key];
|
||||
convertToCamelCase(ref);
|
||||
obj[convertToCamelCaseHelper(key)] = ref;
|
||||
obj.remove(key);
|
||||
if (key[0].isLower() || !key[0].isLetter()) {
|
||||
obj[key] = ref;
|
||||
} else {
|
||||
obj[convertToCamelCaseHelper(key)] = ref;
|
||||
obj.remove(key);
|
||||
}
|
||||
}
|
||||
val = obj;
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue