summaryrefslogtreecommitdiff
path: root/src/pluginlistview.h
blob: 95450ffdd931100b778874380005c60f11d8c794 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef PLUGINLISTVIEW_H
#define PLUGINLISTVIEW_H

#include <QTreeView>
#include <QDragEnterEvent>
#include "viewmarkingscrollbar.h"

namespace Ui {
  class MainWindow;
}

class OrganizerCore;
class MainWindow;
class PluginListSortProxy;

class PluginListView : public QTreeView
{
  Q_OBJECT
public:
  explicit PluginListView(QWidget* parent = nullptr);
  void setModel(QAbstractItemModel* model) override;

  void setup(OrganizerCore& core, MainWindow* mw, Ui::MainWindow* mwui);

  // the column by which the plugin list is currently sorted
  //
  int sortColumn() const;

  // update the plugin counter
  //
  void updatePluginCount();

  // TODO: Move these to private when possible.
  // map from/to the view indexes to the model
  //
  QModelIndex indexModelToView(const QModelIndex& index) const;
  QModelIndexList indexModelToView(const QModelIndexList& index) const;
  QModelIndex indexViewToModel(const QModelIndex& index) const;
  QModelIndexList indexViewToModel(const QModelIndexList& index) const;


protected slots:

  void onFilterChanged(const QString& filter);

private:

  struct PluginListViewUi
  {
    // the plguin counter
    QLCDNumber* counter;

    // the filter
    QLineEdit* filter;
  };

  OrganizerCore* m_core;
  PluginListViewUi ui;

  PluginListSortProxy* m_sortProxy;

  ViewMarkingScrollBar* m_Scrollbar;
};

#endif // PLUGINLISTVIEW_H