Mantid
Loading...
Searching...
No Matches
ScriptRepositoryView.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2013 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include "DllOption.h"
11#include "ui_ScriptRepositoryView.h"
12#include <QDialog>
13#include <QStyledItemDelegate>
14
15namespace MantidQt {
16namespace API {
17class RepoModel;
26 Q_OBJECT
27
29 class RepoDelegate : public QStyledItemDelegate {
30 public:
31 RepoDelegate(QObject *parent = nullptr);
32
33 void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
34 bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option,
35 const QModelIndex &index) override;
36 QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
37 QIcon getIcon(const QString &state) const;
38 };
40 class CheckBoxDelegate : public QStyledItemDelegate {
41 public:
42 CheckBoxDelegate(QObject *parent = nullptr);
43 void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
44 bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option,
45 const QModelIndex &index) override;
46 };
49 class RemoveEntryDelegate : public QStyledItemDelegate {
50 public:
51 RemoveEntryDelegate(QObject *parent = nullptr);
52 void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
53 bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option,
54 const QModelIndex &index) override;
55 };
56
57public:
58 // constuctor
59 ScriptRepositoryView(QWidget *parent = nullptr);
60 // destructor - not virtual, because this is not intended to be base
61 ~ScriptRepositoryView() override;
62
63signals:
64 // allow Mantid to open a python file to be seen
65 void loadScript(const QString /*_t1*/);
66
67protected slots:
68 // allow to interact with the cells, in order to update the description of the
69 // files
70 void cell_activated(const QModelIndex & /*in*/);
71 void updateModel();
72 void currentChanged(const QModelIndex &current);
73 void helpClicked();
74 void openFolderLink(const QString & /*link*/);
75
76private:
77 Ui::ScriptRepositoryView *ui;
79};
80
81} // namespace API
82} // namespace MantidQt
#define EXPORT_OPT_MANTIDQT_COMMON
Definition: DllOption.h:15
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
RepoModel : Wrapper for ScriptRepository to fit the Model View Qt Framework.
Definition: RepoModel.h:75
Delegate to show the checkbox for configuring the auto update.
Delegate to show the icon to remove the entry from the local and central repository.
Delegate to show the icons Download and Upload.
ScriptRepositoryView : Provide the User Interface to the ScriptRepository.
The AlgorithmProgressDialogPresenter keeps track of the running algorithms and displays a progress ba...