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"
12#include "ui_ScriptRepositoryView.h"
13#include <QDialog>
14#include <QStyledItemDelegate>
15
16namespace MantidQt {
17namespace API {
18class RepoModel;
27 Q_OBJECT
28
30 class RepoDelegate : public QStyledItemDelegate {
31 public:
32 RepoDelegate(QObject *parent = nullptr);
33
34 void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
35 bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option,
36 const QModelIndex &index) override;
37 QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
38 QIcon getIcon(const QString &state) const;
39 };
41 class CheckBoxDelegate : public QStyledItemDelegate {
42 public:
43 CheckBoxDelegate(QObject *parent = nullptr);
44 void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
45 bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option,
46 const QModelIndex &index) override;
47 };
50 class RemoveEntryDelegate : public QStyledItemDelegate {
51 public:
52 RemoveEntryDelegate(QObject *parent = nullptr);
53 void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
54 bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option,
55 const QModelIndex &index) override;
56 };
57
58public:
59 // constuctor
60 ScriptRepositoryView(QWidget *parent = nullptr);
61 // destructor - not virtual, because this is not intended to be base
62 ~ScriptRepositoryView() override;
63
64signals:
65 // allow Mantid to open a python file to be seen
66 void loadScript(const QString /*_t1*/);
67
68protected slots:
69 // allow to interact with the cells, in order to update the description of the
70 // files
71 void cell_activated(const QModelIndex & /*in*/);
72 void updateModel();
73 void currentChanged(const QModelIndex &current);
74 void helpClicked();
75 void openFolderLink(const QString & /*link*/);
76
77private:
78 bool chooseLocationAndInstall(Mantid::API::ScriptRepository_sptr repo_ptr);
79 void updateLocationString(const std::string &installDir);
80
81 Ui::ScriptRepositoryView *ui;
83};
84
85} // namespace API
86} // namespace MantidQt
#define EXPORT_OPT_MANTIDQT_COMMON
Definition DllOption.h:15
std::map< DeltaEMode::Type, std::string > index
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...
std::shared_ptr< ScriptRepository > ScriptRepository_sptr
shared pointer to the function base class