KIO
kfilepreviewgenerator.cpp
43 KFilePreviewGeneratorPrivate(KFilePreviewGenerator *qq, KAbstractViewAdapter *viewAdapter, QAbstractItemModel *model);
249 * Set of all items that already have the 'cut' effect applied, together with the pixmap it was applied to
252 * Referencing the pixmaps here imposes no overhead, as they were also given to KDirModel::setData(),
397 const QRect contentRect = r.adjusted(LeftMargin + 1, TopMargin + 1, -(RightMargin + 1), -(BottomMargin + 1));
405KFilePreviewGeneratorPrivate::KFilePreviewGeneratorPrivate(KFilePreviewGenerator *qq, KAbstractViewAdapter *viewAdapter, QAbstractItemModel *model)
414 m_dirModel = (m_proxyModel == nullptr) ? qobject_cast<KDirModel *>(model) : qobject_cast<KDirModel *>(m_proxyModel->sourceModel());
420 q->connect(dirModel->dirLister(), &KCoreDirLister::newItems, q, [this](const KFileItemList &items) {
424 q->connect(dirModel, &KDirModel::dataChanged, q, [this](const QModelIndex &topLeft, const QModelIndex &bottomRight) {
428 q->connect(dirModel, &KDirModel::needSequenceIcon, q, [this](const QModelIndex &index, int sequenceIndex) {
432 q->connect(dirModel, &KDirModel::rowsAboutToBeRemoved, q, [this](const QModelIndex &parent, int first, int last) {
460 m_viewAdapter->connect(KAbstractViewAdapter::ScrollBarValueChanged, q, SLOT(pauseIconUpdates()));
469 KConfigGroup globalConfig(KSharedConfig::openConfig(QStringLiteral("dolphinrc")), QStringLiteral("PreviewSettings"));
471 globalConfig.readEntry("Plugins", QStringList{QStringLiteral("directorythumbnail"), QStringLiteral("imagethumbnail"), QStringLiteral("jpegthumbnail")});
490void KFilePreviewGeneratorPrivate::requestSequenceIcon(const QModelIndex &index, int sequenceIndex)
533void KFilePreviewGeneratorPrivate::updateIcons(const QModelIndex &topLeft, const QModelIndex &bottomRight)
580void KFilePreviewGeneratorPrivate::addToPreviewQueue(const KFileItem &item, const QPixmap &pixmap, KIO::PreviewJob *job)
607 const QUrl itemParentDir = item.url().adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash);
613 const bool isOldPreview = std::none_of(dirs.cbegin(), dirs.cend(), [&itemParentDir](const QUrl &dir) {
790 auto it = std::remove_if(m_pendingItems.begin(), m_pendingItems.end(), [&item](const KFileItem &pending) {
917 const bool applyFrame = (maxSize.width() > KIconLoader::SizeSmallMedium) && (maxSize.height() > KIconLoader::SizeSmallMedium) && !icon.hasAlpha();
924 const QSize size(maxSize.width() - TileSet::LeftMargin - TileSet::RightMargin, maxSize.height() - TileSet::TopMargin - TileSet::BottomMargin);
931 QPixmap framedIcon(icon.size().width() + TileSet::LeftMargin + TileSet::RightMargin, icon.size().height() + TileSet::TopMargin + TileSet::BottomMargin);
999void KFilePreviewGeneratorPrivate::startPreviewJob(const KFileItemList &items, int width, int height)
1016 q->connect(job, &KIO::PreviewJob::gotPreview, q, [this, job](const KFileItem &item, const QPixmap &pixmap) {
1077void KFilePreviewGeneratorPrivate::addItemsToList(const QModelIndex &index, KFileItemList &list)
1123void KFilePreviewGeneratorPrivate::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
1150 , d(new KFilePreviewGeneratorPrivate(this, new KIO::DefaultViewAdapter(parent, this), parent->model()))
Interface used by KFilePreviewGenerator to generate previews for files.
Definition kabstractviewadapter.h:59
QList< QUrl > directories() const
Returns all URLs that are listed by this KCoreDirLister.
Definition kcoredirlister.cpp:2221
KFileItemList itemsForDir(const QUrl &dirUrl, WhichItems which=FilteredItems) const
Returns the items listed for the given dirUrl.
Definition kcoredirlister.cpp:2666
Subclass of KCoreDirLister which uses QWidgets to show error messages and to associate jobs with wind...
Definition kdirlister.h:25
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
Reimplemented from QAbstractItemModel.
Definition kdirmodel.cpp:999
Q_INVOKABLE void itemChanged(const QModelIndex &index)
Notify the model that the item at this index has changed.
Definition kdirmodel.cpp:838
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Reimplemented from QAbstractItemModel.
Definition kdirmodel.cpp:857
Q_INVOKABLE QModelIndex indexForItem(const KFileItem &) const
Return the index for a given kfileitem.
Definition kdirmodel.cpp:1201
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Reimplemented from QAbstractItemModel. O(1)
Definition kdirmodel.cpp:1217
Q_INVOKABLE void clearAllPreviews()
Forget all previews (optimization for turning previews off).
Definition kdirmodel.cpp:833
void needSequenceIcon(const QModelIndex &index, int sequenceIndex)
Emitted when another icon sequence index is requested.
KDirLister * dirLister() const
Return the directory lister used by this model.
Definition kdirmodel.cpp:516
KFileItem itemForIndex(const QModelIndex &index) const
Return the fileitem for a given index.
Definition kdirmodel.cpp:1189
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Reimplemented from QAbstractItemModel.
Definition kdirmodel.cpp:1043
bool hasChildren(const QModelIndex &parent=QModelIndex()) const override
Reimplemented from QAbstractItemModel. Returns true for directories.
Definition kdirmodel.cpp:1256
Q_INVOKABLE QModelIndex indexForUrl(const QUrl &url) const
Return the index for a given url.
Definition kdirmodel.cpp:1207
List of KFileItems, which adds a few helper methods to QList<KFileItem>.
Definition kfileitem.h:632
Generates previews for files of an item view.
Definition kfilepreviewgenerator.h:43
KFilePreviewGenerator(QAbstractItemView *parent)
Definition kfilepreviewgenerator.cpp:1148
QStringList enabledPlugins() const
Returns the list of enabled thumbnail plugins.
Definition kfilepreviewgenerator.cpp:1215
void setPreviewShown(bool show)
If show is set to true, a preview is generated for each item.
Definition kfilepreviewgenerator.cpp:1163
void setEnabledPlugins(const QStringList &list)
Sets the list of enabled thumbnail plugins.
Definition kfilepreviewgenerator.cpp:1210
KIO Job to get a thumbnail picture.
void gotPreview(const KFileItem &item, const QPixmap &preview)
Emitted when a thumbnail picture for item has been successfully retrieved.
void setSequenceIndex(int index)
Sets the sequence index given to the thumb creators.
Definition previewjob.cpp:481
static void toDisabled(QImage &image)
SizeSmallMedium
bool suspend()
void finished(KJob *job)
bool kill(KJob::KillVerbosity verbosity=KJob::Quietly)
Q_SCRIPTABLE Q_NOREPLY void start()
KCALUTILS_EXPORT QString mimeType()
KIOGUI_EXPORT PreviewJob * filePreview(const KFileItemList &items, const QSize &size, const QStringList *enabledPlugins=nullptr)
Creates a PreviewJob to generate a preview image for the given items.
Definition previewjob.cpp:1054
KIOWIDGETS_EXPORT bool isClipboardDataCut(const QMimeData *mimeData)
Returns true if the URLs in mimeData were cut by the user.
Definition paste.cpp:281
QIcon addOverlays(const QIcon &icon, const QHash< Qt::Corner, QIcon > &overlays)
KIOCORE_EXPORT QStringList list(const QString &fileClass)
Returns a list of directories associated with this file-class.
Definition krecentdirs.cpp:33
QAction * actualSize(const QObject *recvr, const char *slot, QObject *parent)
const QList< QKeySequence > & end()
KCOREADDONS_EXPORT QList< QUrl > urlsFromMimeData(const QMimeData *mimeData, DecodeOptions decodeOptions=PreferKdeUrls, MetaDataMap *metaData=nullptr)
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList< int > &roles)
void rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last)
virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const const=0
void dataChanged()
const QMimeData * mimeData(Mode mode) const const
QClipboard * clipboard()
const_iterator cbegin() const const
const_iterator cend() const const
void clear()
const_iterator constEnd() const const
const_iterator constFind(const Key &key) const const
bool contains(const Key &key) const const
iterator insert(const Key &key, const T &value)
bool isEmpty() const const
bool remove(const Key &key)
QPixmap pixmap(QWindow *window, const QSize &size, Mode mode, State state) const const
Format_ARGB32_Premultiplied
void append(QList< T > &&value)
const_reference at(qsizetype i) const const
iterator begin()
const_iterator cbegin() const const
const_iterator cend() const const
void clear()
bool contains(const AT &value) const const
qsizetype count() const const
iterator end()
iterator erase(const_iterator begin, const_iterator end)
qsizetype indexOf(const AT &value, qsizetype from) const const
iterator insert(const_iterator before, parameter_type value)
bool isEmpty() const const
void removeAt(qsizetype i)
bool removeOne(const AT &t)
void reserve(qsizetype size)
qsizetype size() const const
value_type takeFirst()
void setGridSize(const QSize &size)
uniformItemSizes
const_iterator cend() const const
void clear()
const_iterator constFind(const Key &key) const const
iterator end()
iterator erase(const_iterator first, const_iterator last)
iterator find(const Key &key)
iterator insert(const Key &key, const T &value)
bool isEmpty() const const
size_type remove(const Key &key)
bool invokeMethod(QObject *context, Functor &&function, FunctorReturnType *ret)
QIcon
int column() const const
bool isValid() const const
int row() const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QObject * parent() const const
CompositionMode_Source
bool begin(QPaintDevice *device)
void drawPixmap(const QPoint &point, const QPixmap &pixmap)
void drawTiledPixmap(const QRect &rectangle, const QPixmap &pixmap, const QPoint &position)
bool end()
void fillRect(const QRect &rectangle, QGradient::Preset preset)
void setCompositionMode(CompositionMode mode)
qint64 cacheKey() const const
QPixmap copy(const QRect &rectangle) const const
QPixmap fromImage(QImage &&image, Qt::ImageConversionFlags flags)
bool hasAlpha() const const
int height() const const
QPixmap scaled(const QSize &size, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformMode) const const
QSize size() const const
int width() const const
T * data() const const
QRect adjusted(int dx1, int dy1, int dx2, int dy2) const const
int bottom() const const
int height() const const
bool intersects(const QRect &rectangle) const const
int right() const const
QPoint topLeft() const const
int width() const const
int x() const const
int y() const const
int height() const const
int width() const const
qsizetype indexOf(QChar ch, qsizetype from, Qt::CaseSensitivity cs) const const
QStringView left(qsizetype length) const const
KeepAspectRatio
QueuedConnection
transparent
DecorationRole
SmoothTransformation
void start()
void stop()
void timeout()
RemoveFilename
QUrl adjusted(FormattingOptions options) const const
int typeId() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:58:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:58:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.