File indexing completed on 2024-04-28 04:20:38

0001 /************************************************************************
0002  *                                  *
0003  *  This file is part of Kooka, a scanning/OCR application using    *
0004  *  Qt <http://www.qt.io> and KDE Frameworks <http://www.kde.org>.  *
0005  *                                  *
0006  *  Copyright (C) 2002-2016 Klaas Freitag <freitag@suse.de>     *
0007  *                          Jonathan Marten <jjm@keelhaul.me.uk>    *
0008  *                                  *
0009  *  Kooka is free software; you can redistribute it and/or modify it    *
0010  *  under the terms of the GNU Library General Public License as    *
0011  *  published by the Free Software Foundation and appearing in the  *
0012  *  file COPYING included in the packaging of this file;  either    *
0013  *  version 2 of the License, or (at your option) any later version.    *
0014  *                                  *
0015  *  As a special exception, permission is given to link this program    *
0016  *  with any version of the KADMOS OCR/ICR engine (a product of     *
0017  *  reRecognition GmbH, Kreuzlingen), and distribute the resulting  *
0018  *  executable without including the source code for KADMOS in the  *
0019  *  source distribution.                        *
0020  *                                  *
0021  *  This program is distributed in the hope that it will be useful, *
0022  *  but WITHOUT ANY WARRANTY; without even the implied warranty of  *
0023  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   *
0024  *  GNU General Public License for more details.            *
0025  *                                  *
0026  *  You should have received a copy of the GNU General Public       *
0027  *  License along with this program;  see the file COPYING.  If     *
0028  *  not, see <http://www.gnu.org/licenses/>.                *
0029  *                                  *
0030  ************************************************************************/
0031 
0032 #ifndef THUMBVIEW_H
0033 #define THUMBVIEW_H
0034 
0035 #include <qmap.h>
0036 #include <qurl.h>
0037 
0038 #include <kdiroperator.h>
0039 #include <kiconloader.h>
0040 
0041 
0042 class QMenu;
0043 class KFileItem;
0044 class KActionMenu;
0045 class KToggleAction;
0046 
0047 
0048 class ThumbView : public KDirOperator
0049 {
0050     Q_OBJECT
0051 
0052 public:
0053     explicit ThumbView(QWidget *parent);
0054     ~ThumbView();
0055 
0056     QMenu *contextMenu() const
0057     {
0058         return (mContextMenu);
0059     }
0060     void readSettings();
0061 
0062     static QString standardBackground();
0063     static QString sizeName(KIconLoader::StdSizes size);
0064 
0065 public slots:
0066     void slotImageDeleted(const KFileItem *kfi);
0067     void slotImageChanged(const KFileItem *kfi);
0068     void slotImageRenamed(const KFileItem *kfi, const QString &newName);
0069     void slotHighlightItem(const QUrl &url, bool isDir);
0070 
0071 protected:
0072     void saveConfig();
0073 
0074 protected slots:
0075     void slotContextMenu(const QPoint &pos);
0076     void slotFileSelected(const KFileItem &kfi);
0077     void slotFileHighlighted(const KFileItem &kfi);
0078     void slotFinishedLoading();
0079     void slotEnsureVisible();
0080     void slotSetSize(KIconLoader::StdSizes size);
0081 
0082 signals:
0083     void itemHighlighted(const QUrl &url);
0084     void itemActivated(const QUrl &url);
0085 
0086 private:
0087     void setBackground();
0088     void createActionForSize(KIconLoader::StdSizes size);
0089 
0090     QMenu *mContextMenu;
0091     bool m_firstMenu;
0092     KActionMenu *m_sizeMenu;
0093     QMap<KIconLoader::StdSizes, KToggleAction *> m_sizeMap;
0094 
0095     KIconLoader::StdSizes m_thumbSize;
0096 
0097     QUrl m_lastSelected;
0098     QUrl m_toSelect;
0099 };
0100 
0101 #endif                          // THUMBVIEW_H