mirror of
https://github.com/transmission/transmission.git
synced 2025-12-19 18:08:31 +00:00
feat: add generic favicon_cache class for reuse between Qt, GTK app (#5294)
This commit is contained in:
@@ -147,6 +147,11 @@ public:
|
||||
return signal_torrents_changed_;
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr auto& favicon_cache()
|
||||
{
|
||||
return favicon_cache_;
|
||||
}
|
||||
|
||||
private:
|
||||
Glib::RefPtr<Session> get_core_ptr() const;
|
||||
|
||||
@@ -209,6 +214,8 @@ private:
|
||||
Glib::RefPtr<SortListModel<Torrent>> sorted_model_;
|
||||
Glib::RefPtr<TorrentSorter> sorter_ = TorrentSorter::create();
|
||||
tr_session* session_ = nullptr;
|
||||
|
||||
FaviconCache<Glib::RefPtr<Gdk::Pixbuf>> favicon_cache_;
|
||||
};
|
||||
|
||||
Glib::RefPtr<Session> Session::Impl::get_core_ptr() const
|
||||
@@ -531,8 +538,8 @@ Session::Session(tr_session* session)
|
||||
Session::~Session() = default;
|
||||
|
||||
Session::Impl::Impl(Session& core, tr_session* session)
|
||||
: core_(core)
|
||||
, session_(session)
|
||||
: core_{ core }
|
||||
, session_{ session }
|
||||
{
|
||||
raw_model_ = Gio::ListStore<Torrent>::create();
|
||||
signal_torrents_changed_.connect(sigc::hide<0>(sigc::mem_fun(*sorter_.get(), &TorrentSorter::update)));
|
||||
@@ -1359,6 +1366,11 @@ tr_torrent* Session::find_torrent(tr_torrent_id_t id) const
|
||||
return tor;
|
||||
}
|
||||
|
||||
FaviconCache<Glib::RefPtr<Gdk::Pixbuf>>& Session::favicon_cache() const
|
||||
{
|
||||
return impl_->favicon_cache();
|
||||
}
|
||||
|
||||
void Session::open_folder(tr_torrent_id_t torrent_id) const
|
||||
{
|
||||
auto const* tor = find_torrent(torrent_id);
|
||||
|
||||
Reference in New Issue
Block a user