-/***************************************************************************
- * Copyright (C) 2011 by Peter Penz <peter.penz19@gmail.com> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program 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 General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
- ***************************************************************************/
+/*
+ * SPDX-FileCopyrightText: 2011 Peter Penz <peter.penz19@gmail.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
#include "kfileitemlistview.h"
-#include "kfileitemmodelrolesupdater.h"
#include "kfileitemlistwidget.h"
#include "kfileitemmodel.h"
+#include "kfileitemmodelrolesupdater.h"
#include "private/kpixmapmodifier.h"
-#include <QIcon>
#include <KIconLoader>
-#include <QPainter>
-#include <QTimer>
#include <QGraphicsScene>
#include <QGraphicsView>
+#include <QPainter>
+#include <QTimer>
// #define KFILEITEMLISTVIEW_DEBUG
namespace {
// If the visible index range changes, KFileItemModelRolesUpdater is not
- // informed immediatetly, but with a short delay. This ensures that scrolling
+ // informed immediately, but with a short delay. This ensures that scrolling
// always feels smooth and is not interrupted by icon loading (which can be
// quite expensive if a disk access is required to determine the final icon).
const int ShortInterval = 50;
KFileItemListView::KFileItemListView(QGraphicsWidget* parent) :
KStandardItemListView(parent),
- m_modelRolesUpdater(0),
- m_updateVisibleIndexRangeTimer(0),
- m_updateIconSizeTimer(0)
+ m_modelRolesUpdater(nullptr),
+ m_updateVisibleIndexRangeTimer(nullptr),
+ m_updateIconSizeTimer(nullptr)
{
setAcceptDrops(true);
return m_modelRolesUpdater ? m_modelRolesUpdater->enabledPlugins() : QStringList();
}
+void KFileItemListView::setLocalFileSizePreviewLimit(const qlonglong size)
+{
+ if (m_modelRolesUpdater) {
+ m_modelRolesUpdater->setLocalFileSizePreviewLimit(size);
+ }
+}
+
+qlonglong KFileItemListView::localFileSizePreviewLimit() const
+{
+ return m_modelRolesUpdater ? m_modelRolesUpdater->localFileSizePreviewLimit() : 0;
+}
+
QPixmap KFileItemListView::createDragPixmap(const KItemSet& indexes) const
{
if (!model()) {
void KFileItemListView::onPreviewsShownChanged(bool shown)
{
- Q_UNUSED(shown);
+ Q_UNUSED(shown)
}
void KFileItemListView::onItemLayoutChanged(ItemLayout current, ItemLayout previous)
KStandardItemListView::onModelChanged(current, previous);
delete m_modelRolesUpdater;
- m_modelRolesUpdater = 0;
+ m_modelRolesUpdater = nullptr;
if (current) {
m_modelRolesUpdater = new KFileItemModelRolesUpdater(static_cast<KFileItemModel*>(current), this);
void KFileItemListView::onItemSizeChanged(const QSizeF& current, const QSizeF& previous)
{
- Q_UNUSED(current);
- Q_UNUSED(previous);
+ Q_UNUSED(current)
+ Q_UNUSED(previous)
triggerVisibleIndexRangeUpdate();
}