File indexing completed on 2025-01-05 03:57:54

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2021-08-27
0007  * Description : List-view for the Showfoto folder view.
0008  *
0009  * SPDX-FileCopyrightText: 2021-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef SHOWFOTO_FOLDER_VIEW_LIST_H
0016 #define SHOWFOTO_FOLDER_VIEW_LIST_H
0017 
0018 // QT includes
0019 
0020 #include <QTreeView>
0021 #include <QMouseEvent>
0022 #include <QContextMenuEvent>
0023 #include <QModelIndex>
0024 
0025 // Local includes
0026 
0027 #include "showfotofolderviewsidebar.h"
0028 
0029 namespace ShowFoto
0030 {
0031 
0032 class ShowfotoFolderViewBar;
0033 
0034 class ShowfotoFolderViewList : public QTreeView
0035 {
0036     Q_OBJECT
0037 
0038 public:
0039 
0040     enum FolderViewMode
0041     {
0042         ShortView = 0,
0043         DetailledView
0044     };
0045 
0046     enum FolderViewRole
0047     {
0048         FileName = 0,
0049         FileSize,
0050         FileType,
0051         FileDate            ///< Modifier date
0052     };
0053 
0054 public:
0055 
0056     explicit ShowfotoFolderViewList(ShowfotoFolderViewSideBar* const view,
0057                                     ShowfotoFolderViewBar* const bar);
0058     ~ShowfotoFolderViewList()                                           override;
0059 
0060 public Q_SLOTS:
0061 
0062     void slotIconSizeChanged(int);
0063 
0064 Q_SIGNALS:
0065 
0066     void signalAddBookmark();
0067 
0068 private:
0069 
0070     void mouseDoubleClickEvent(QMouseEvent*)                            override;
0071     void contextMenuEvent(QContextMenuEvent*)                           override;
0072     void mouseMoveEvent(QMouseEvent*)                                   override;
0073     void wheelEvent(QWheelEvent*)                                       override;
0074     void keyPressEvent(QKeyEvent*)                                      override;
0075     void focusOutEvent(QFocusEvent*)                                    override;
0076     void leaveEvent(QEvent*)                                            override;
0077 
0078     void hideToolTip();
0079     bool acceptToolTip(const QModelIndex& index)                 const;
0080 
0081 private Q_SLOTS:
0082 
0083     void slotToolTip();
0084     void slotOpenInFileManager();
0085 
0086 private:
0087 
0088     class Private;
0089     Private* const d;
0090 };
0091 
0092 } // namespace ShowFoto
0093 
0094 #endif // SHOWFOTO_FOLDER_VIEW_LIST_H