diff options
| author | Andrew Branson <andrew.branson@jolla.com> | 2026-03-22 20:18:39 +0100 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@jolla.com> | 2026-03-22 20:25:03 +0100 |
| commit | 218a05f6ac67f260288ff70344f0f004c7b48c7b (patch) | |
| tree | d213c375b94b467aa439aabf9810554087b29ec0 /eventsview-plugins/eventsview-plugin-mastodon/mastodonpostsmodel.cpp | |
| parent | 2b1a3046832074e47ad2ad703cd518526b9fb459 (diff) | |
Use shared buteo-common and split notifications service on mainmain
Keep main as the branch that builds against the newer shared social sync modules, while master stays self-contained.
- drop the bundled buteo-common sources and stop building or packaging libmastodonbuteocommon
- link the Mastodon sync plugins against buteosocialcommon and add the matching build/runtime package requirements
- install a dedicated mastodon-notifications account service and wire account creation/packaging around the separate notifications profile
- move the posts/events-view side over to the newer shared-helper style used with the updated socialcache stack
- clean up qmake project wiring for the shared-module layout and refresh the branch README to describe the split service model
- keep the notification schedule at the master value instead of carrying the temporary timing tweak
Diffstat (limited to 'eventsview-plugins/eventsview-plugin-mastodon/mastodonpostsmodel.cpp')
| -rw-r--r-- | eventsview-plugins/eventsview-plugin-mastodon/mastodonpostsmodel.cpp | 51 |
1 files changed, 9 insertions, 42 deletions
diff --git a/eventsview-plugins/eventsview-plugin-mastodon/mastodonpostsmodel.cpp b/eventsview-plugins/eventsview-plugin-mastodon/mastodonpostsmodel.cpp index aa98a95..fe61320 100644 --- a/eventsview-plugins/eventsview-plugin-mastodon/mastodonpostsmodel.cpp +++ b/eventsview-plugins/eventsview-plugin-mastodon/mastodonpostsmodel.cpp @@ -17,31 +17,7 @@ */ #include "mastodonpostsmodel.h" -#include <QtCore/QVariantMap> - -namespace { - -static const char *URL_KEY = "url"; -static const char *TYPE_KEY = "type"; -static const char *TYPE_PHOTO = "photo"; -static const char *TYPE_VIDEO = "video"; - -QVariantMap createImageData(const SocialPostImage::ConstPtr &image) -{ - QVariantMap imageData; - imageData.insert(QLatin1String(URL_KEY), image->url()); - switch (image->type()) { - case SocialPostImage::Video: - imageData.insert(QLatin1String(TYPE_KEY), QLatin1String(TYPE_VIDEO)); - break; - default: - imageData.insert(QLatin1String(TYPE_KEY), QLatin1String(TYPE_PHOTO)); - break; - } - return imageData; -} - -} +#include <socialcache/socialposthelpers.h> MastodonPostsModel::MastodonPostsModel(QObject *parent) : QAbstractListModel(parent) @@ -123,13 +99,16 @@ void MastodonPostsModel::postsChanged() const bool favourited = m_database.favourited(post); const bool reblogged = m_database.reblogged(post); - eventMap.insert(MastodonPostsModel::MastodonId, post->identifier()); - eventMap.insert(MastodonPostsModel::Name, post->name()); + SocialPostHelpers::appendCommonPostFields(&eventMap, post, + MastodonPostsModel::MastodonId, + MastodonPostsModel::Name, + MastodonPostsModel::Body, + MastodonPostsModel::Timestamp, + MastodonPostsModel::Icon, + MastodonPostsModel::Images, + MastodonPostsModel::Accounts); eventMap.insert(MastodonPostsModel::AccountName, accountName); eventMap.insert(MastodonPostsModel::Acct, accountName); - eventMap.insert(MastodonPostsModel::Body, post->body()); - eventMap.insert(MastodonPostsModel::Timestamp, post->timestamp()); - eventMap.insert(MastodonPostsModel::Icon, post->icon()); eventMap.insert(MastodonPostsModel::Url, postUrl); eventMap.insert(MastodonPostsModel::Link, postUrl); eventMap.insert(MastodonPostsModel::BoostedBy, boostedBy); @@ -140,18 +119,6 @@ void MastodonPostsModel::postsChanged() eventMap.insert(MastodonPostsModel::Favourited, favourited); eventMap.insert(MastodonPostsModel::Reblogged, reblogged); eventMap.insert(MastodonPostsModel::InstanceUrl, m_database.instanceUrl(post)); - - QVariantList images; - Q_FOREACH (const SocialPostImage::ConstPtr &image, post->images()) { - images.append(createImageData(image)); - } - eventMap.insert(MastodonPostsModel::Images, images); - - QVariantList accountsVariant; - Q_FOREACH (int account, post->accounts()) { - accountsVariant.append(account); - } - eventMap.insert(MastodonPostsModel::Accounts, accountsVariant); data.append(eventMap); } |
