File indexing completed on 2024-05-05 04:40:55

0001 /*
0002     SPDX-FileCopyrightText: 2018 Amish K. Naidu <amhndu@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef SCRATCHPADVIEW_H
0008 #define SCRATCHPADVIEW_H
0009 
0010 #include <QWidget>
0011 
0012 #include <vector>
0013 
0014 #include "ui_scratchpadview.h"
0015 
0016 class Scratchpad;
0017 
0018 class QModelIndex;
0019 class QLineEdit;
0020 class QAbstractProxyModel;
0021 
0022 class ScratchpadView
0023     : public QWidget
0024     , public Ui::ScratchpadBaseView
0025 {
0026     Q_OBJECT
0027 
0028 public:
0029     ScratchpadView(QWidget* parent, Scratchpad* scratchpad);
0030 
0031 private Q_SLOTS:
0032     void runSelectedScratch();
0033     void scratchActivated(const QModelIndex& index);
0034     void createScratch();
0035 
0036 private:
0037     QAbstractProxyModel* proxyModel() const;
0038     QModelIndex currentIndex() const;
0039 
0040     void setupActions();
0041     void validateItemActions();
0042 
0043     Scratchpad* m_scratchpad;
0044     QLineEdit* m_filter = nullptr;
0045     QVector<QAction*> m_itemActions;
0046 };
0047 
0048 #endif // SCRATCHPADVIEW_H