]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/private/kitemlistviewlayouter.h
GIT_SILENT Update Appstream for new release
[dolphin.git] / src / kitemviews / private / kitemlistviewlayouter.h
index 5ca73e1adacceccc4b3d47dbd0704169d2584795..fed541a4c084991939b638a79ec7969ca4dd0319 100644 (file)
@@ -1,31 +1,19 @@
-/***************************************************************************
- *   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
+ */
 
 #ifndef KITEMLISTVIEWLAYOUTER_H
 #define KITEMLISTVIEWLAYOUTER_H
 
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
 
 #include <QObject>
 #include <QRectF>
 #include <QSet>
 #include <QSizeF>
+#include <QVector>
 
 class KItemModelBase;
 class KItemListSizeHintResolver;
@@ -44,27 +32,27 @@ class KItemListSizeHintResolver;
  * changing properties of the layouter is not expensive, only the
  * first read of a property can get expensive.
  */
-class LIBDOLPHINPRIVATE_EXPORT KItemListViewLayouter : public QObject
+class DOLPHIN_EXPORT KItemListViewLayouter : public QObject
 {
     Q_OBJECT
 
 public:
-    KItemListViewLayouter(QObject* parent = 0);
-    virtual ~KItemListViewLayouter();
+    explicit KItemListViewLayouter(KItemListSizeHintResolver *sizeHintResolver, QObject *parent = nullptr);
+    ~KItemListViewLayouter() override;
 
     void setScrollOrientation(Qt::Orientation orientation);
     Qt::Orientation scrollOrientation() const;
 
-    void setSize(const QSizeFsize);
+    void setSize(const QSizeF &size);
     QSizeF size() const;
 
-    void setItemSize(const QSizeFsize);
+    void setItemSize(const QSizeF &size);
     QSizeF itemSize() const;
 
     /**
      * Margin between the rows and columns of items.
      */
-    void setItemMargin(const QSizeFmargin);
+    void setItemMargin(const QSizeF &margin);
     QSizeF itemMargin() const;
 
     /**
@@ -99,11 +87,8 @@ public:
 
     qreal maximumItemOffset() const;
 
-    void setModel(const KItemModelBase* model);
-    const KItemModelBase* model() const;
-
-    void setSizeHintResolver(const KItemListSizeHintResolver* sizeHintResolver);
-    const KItemListSizeHintResolver* sizeHintResolver() const;
+    void setModel(const KItemModelBase *model);
+    const KItemModelBase *model() const;
 
     /**
      * @return The first (at least partly) visible index. -1 is returned
@@ -169,6 +154,12 @@ public:
         return m_columnCount;
     }
 
+    /**
+     * Set the bottom offset for moving the view so that the small overlayed statusbar
+     * won't cover any items by accident.
+     */
+    void setStatusBarOffset(int offset);
+
 #ifndef QT_NO_DEBUG
     /**
      * @return True if the layouter has been marked as dirty and hence has
@@ -203,8 +194,8 @@ private:
     QSizeF m_itemSize;
     QSizeF m_itemMargin;
     qreal m_headerHeight;
-    const KItemModelBasem_model;
-    const KItemListSizeHintResolver* m_sizeHintResolver;
+    const KItemModelBase *m_model;
+    KItemListSizeHintResolver *m_sizeHintResolver;
 
     qreal m_scrollOffset;
     qreal m_maximumScrollOffset;
@@ -219,6 +210,9 @@ private:
     qreal m_xPosInc;
     int m_columnCount;
 
+    QVector<qreal> m_rowOffsets;
+    QVector<qreal> m_columnOffsets;
+
     // Stores all item indexes that are the first item of a group.
     // Assures fast access for KItemListViewLayouter::isFirstGroupItem().
     QSet<int> m_groupItemIndexes;
@@ -226,15 +220,14 @@ private:
     qreal m_groupHeaderMargin;
 
     struct ItemInfo {
-        QRectF rect;
         int column;
         int row;
     };
-    QList<ItemInfo> m_itemInfos;
+    QVector<ItemInfo> m_itemInfos;
+
+    int m_statusBarOffset;
 
     friend class KItemListControllerTest;
 };
 
 #endif
-
-