File indexing completed on 2024-04-28 05:08:19

0001 /***************************************************************************
0002     Copyright (C) 2002-2009 Robby Stephenson <robby@periapsis.org>
0003     Copyright (C) 2011 Pedro Miguel Carvalho <kde@pmc.com.pt>
0004  ***************************************************************************/
0005 
0006 /***************************************************************************
0007  *                                                                         *
0008  *   This program is free software; you can redistribute it and/or         *
0009  *   modify it under the terms of the GNU General Public License as        *
0010  *   published by the Free Software Foundation; either version 2 of        *
0011  *   the License or (at your option) version 3 or any later version        *
0012  *   accepted by the membership of KDE e.V. (or its successor approved     *
0013  *   by the membership of KDE e.V.), which shall act as a proxy            *
0014  *   defined in Section 14 of version 3 of the license.                    *
0015  *                                                                         *
0016  *   This program is distributed in the hope that it will be useful,       *
0017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0019  *   GNU General Public License for more details.                          *
0020  *                                                                         *
0021  *   You should have received a copy of the GNU General Public License     *
0022  *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
0023  *                                                                         *
0024  ***************************************************************************/
0025 
0026 #ifndef TELLICO_ENTRYICONVIEW_H
0027 #define TELLICO_ENTRYICONVIEW_H
0028 
0029 #include "observer.h"
0030 
0031 #include <QListView>
0032 
0033 namespace Tellico {
0034 
0035 /**
0036  * @author Robby Stephenson
0037  */
0038 class EntryIconView : public QListView, public Observer {
0039 Q_OBJECT
0040 
0041 public:
0042   EntryIconView(QWidget* parent);
0043   ~EntryIconView();
0044 
0045   void setModel(QAbstractItemModel* model) Q_DECL_OVERRIDE;
0046   int maxAllowedIconWidth() const { return m_maxAllowedIconWidth; }
0047 
0048 public Q_SLOTS:
0049   void setMaxAllowedIconWidth(int width);
0050 
0051 protected:
0052   void contextMenuEvent(QContextMenuEvent* event) Q_DECL_OVERRIDE;
0053 
0054 private Q_SLOTS:
0055   void slotDoubleClicked(const QModelIndex& index);
0056   void slotSortMenuActivated(QAction* action);
0057   void slotOpenUrlMenuActivated(QAction* action=nullptr);
0058   void updateModelColumn();
0059 
0060 private:
0061   int m_maxAllowedIconWidth;
0062 };
0063 
0064 } // end namespace
0065 #endif