File indexing completed on 2024-05-05 04:19:14

0001 // vim: set tabstop=4 shiftwidth=4 expandtab:
0002 /*
0003 Gwenview: an image viewer
0004 Copyright 2008 Aurélien Gâteau <agateau@kde.org>
0005 
0006 This program is free software; you can redistribute it and/or
0007 modify it under the terms of the GNU General Public License
0008 as published by the Free Software Foundation; either version 2
0009 of the License, or (at your option) any later version.
0010 
0011 This program is distributed in the hope that it will be useful,
0012 but WITHOUT ANY WARRANTY; without even the implied warranty of
0013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014 GNU General Public License for more details.
0015 
0016 You should have received a copy of the GNU General Public License
0017 along with this program; if not, write to the Free Software
0018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA.
0019 
0020 */
0021 #ifndef BROWSEMAINPAGE_H
0022 #define BROWSEMAINPAGE_H
0023 
0024 // Qt
0025 #include <QUrl>
0026 #include <QWidget>
0027 
0028 // KF
0029 
0030 // Local
0031 
0032 class QDropEvent;
0033 class QModelIndex;
0034 class QItemSelection;
0035 class QToolButton;
0036 
0037 class KActionCollection;
0038 class KUrlNavigator;
0039 
0040 namespace Gwenview
0041 {
0042 class GvCore;
0043 class ThumbnailView;
0044 
0045 struct BrowseMainPagePrivate;
0046 /**
0047  * This class contains all the necessary widgets displayed in browse mode:
0048  * the thumbnail view, the url navigator, the bottom bar.
0049  */
0050 class BrowseMainPage : public QWidget
0051 {
0052     Q_OBJECT
0053 public:
0054     BrowseMainPage(QWidget *parent, KActionCollection *, GvCore *);
0055     ~BrowseMainPage() override;
0056 
0057     void reload();
0058 
0059     ThumbnailView *thumbnailView() const;
0060     KUrlNavigator *urlNavigator() const;
0061 
0062     void loadConfig();
0063     void saveConfig() const;
0064 
0065     void setFullScreenMode(bool);
0066     void setStatusBarVisible(bool);
0067 
0068     QToolButton *toggleSideBarButton() const;
0069 
0070 private Q_SLOTS:
0071     void editLocation();
0072     void addFolderToPlaces();
0073 
0074     void slotDirModelRowsInserted(const QModelIndex &parent, int start, int end);
0075     void slotDirModelRowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
0076     void slotDirModelReset();
0077     void slotSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
0078     void updateSortOrder();
0079     void updateThumbnailDetails();
0080     void slotUrlsDropped(const QUrl &destUrl, QDropEvent *);
0081     void showMenuForDroppedUrls(const QList<QUrl> &, const QUrl &destUrl);
0082 
0083 protected:
0084     bool eventFilter(QObject *watched, QEvent *event) override;
0085     void mousePressEvent(QMouseEvent *) override;
0086 
0087 private:
0088     BrowseMainPagePrivate *const d;
0089 };
0090 
0091 } // namespace
0092 
0093 #endif /* BROWSEMAINPAGE_H */