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 };
48
49public:
50 // constuctor
51 ScriptRepositoryView(QWidget *parent = nullptr);
52 // destructor - not virtual, because this is not intended to be base
53 ~ScriptRepositoryView() override;
54
55signals:
56 // allow Mantid to open a python file to be seen
57 void loadScript(const QString /*_t1*/);
58
59protected slots:
60 // allow to interact with the cells, in order to update the description of the
61 // files
62 void cell_activated(const QModelIndex & /*in*/);
63 void updateModel();
64 void currentChanged(const QModelIndex &current);
65 void helpClicked();
66 void openFolderLink(const QString & /*link*/);
67
68private:
69 bool chooseLocationAndInstall(Mantid::API::ScriptRepository_sptr repo_ptr);
70 void updateLocationString(const std::string &installDir);
71
72 Ui::ScriptRepositoryView *ui;
74};
75
76} // namespace API
77} // 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:68
Delegate to show the checkbox for configuring the auto update.
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 ScriptRepository base class