##// END OF EJS Templates
Retrieves zone names from the visualization
trabillard -
r1136:6897882500e5
parent child
Show More
@@ -86,6 +86,8 MainWindow::MainWindow(QWidget *parent)
86 m_Ui->splitter->setCollapsible(LEFTINSPECTORSIDEPANESPLITTERINDEX, false);
86 m_Ui->splitter->setCollapsible(LEFTINSPECTORSIDEPANESPLITTERINDEX, false);
87 m_Ui->splitter->setCollapsible(RIGHTINSPECTORSIDEPANESPLITTERINDEX, false);
87 m_Ui->splitter->setCollapsible(RIGHTINSPECTORSIDEPANESPLITTERINDEX, false);
88
88
89 impl->m_CatalogExplorer->setVisualizationWidget(m_Ui->view);
90
89
91
90 auto leftSidePane = m_Ui->leftInspectorSidePane->sidePane();
92 auto leftSidePane = m_Ui->leftInspectorSidePane->sidePane();
91 auto openLeftInspectorAction = new QAction{QIcon{
93 auto openLeftInspectorAction = new QAction{QIcon{
@@ -6,6 +6,7
6
6
7 class DBCatalogue;
7 class DBCatalogue;
8 class DBEvent;
8 class DBEvent;
9 class VisualizationWidget;
9
10
10 namespace Ui {
11 namespace Ui {
11 class CatalogueEventsWidget;
12 class CatalogueEventsWidget;
@@ -21,6 +22,8 public:
21 explicit CatalogueEventsWidget(QWidget *parent = 0);
22 explicit CatalogueEventsWidget(QWidget *parent = 0);
22 virtual ~CatalogueEventsWidget();
23 virtual ~CatalogueEventsWidget();
23
24
25 void setVisualizationWidget(VisualizationWidget *visualization);
26
24 public slots:
27 public slots:
25 void populateWithCatalogues(const QVector<DBCatalogue> &catalogues);
28 void populateWithCatalogues(const QVector<DBCatalogue> &catalogues);
26
29
@@ -1,12 +1,15
1 #ifndef SCIQLOP_CATALOGUEEXPLORER_H
1 #ifndef SCIQLOP_CATALOGUEEXPLORER_H
2 #define SCIQLOP_CATALOGUEEXPLORER_H
2 #define SCIQLOP_CATALOGUEEXPLORER_H
3
3
4 #include <Common/spimpl.h>
4 #include <QDialog>
5 #include <QDialog>
5
6
6 namespace Ui {
7 namespace Ui {
7 class CatalogueExplorer;
8 class CatalogueExplorer;
8 }
9 }
9
10
11 class VisualizationWidget;
12
10 class CatalogueExplorer : public QDialog {
13 class CatalogueExplorer : public QDialog {
11 Q_OBJECT
14 Q_OBJECT
12
15
@@ -14,8 +17,13 public:
14 explicit CatalogueExplorer(QWidget *parent = 0);
17 explicit CatalogueExplorer(QWidget *parent = 0);
15 virtual ~CatalogueExplorer();
18 virtual ~CatalogueExplorer();
16
19
20 void setVisualizationWidget(VisualizationWidget *visualization);
21
17 private:
22 private:
18 Ui::CatalogueExplorer *ui;
23 Ui::CatalogueExplorer *ui;
24
25 class CatalogueExplorerPrivate;
26 spimpl::unique_impl_ptr<CatalogueExplorerPrivate> impl;
19 };
27 };
20
28
21 #endif // SCIQLOP_CATALOGUEEXPLORER_H
29 #endif // SCIQLOP_CATALOGUEEXPLORER_H
@@ -25,11 +25,15 public:
25 explicit VisualizationTabWidget(const QString &name = {}, QWidget *parent = 0);
25 explicit VisualizationTabWidget(const QString &name = {}, QWidget *parent = 0);
26 virtual ~VisualizationTabWidget();
26 virtual ~VisualizationTabWidget();
27
27
28 /// Add a zone widget
28 /// Adds a zone widget
29 void addZone(VisualizationZoneWidget *zoneWidget);
29 void addZone(VisualizationZoneWidget *zoneWidget);
30
30
31 /// Inserts a zone widget at the specified position
31 void insertZone(int index, VisualizationZoneWidget *zoneWidget);
32 void insertZone(int index, VisualizationZoneWidget *zoneWidget);
32
33
34 /// Returns the list of zone widget names in the order they are displayed
35 QStringList availableZoneWidgets() const;
36
33 /**
37 /**
34 * Creates a zone using a variable. The variable will be displayed in a new graph of the new
38 * Creates a zone using a variable. The variable will be displayed in a new graph of the new
35 * zone. The zone is added at the end.
39 * zone. The zone is added at the end.
@@ -30,6 +30,8 public:
30 /// Returns the class which manage the selection of selection zone across the visualization
30 /// Returns the class which manage the selection of selection zone across the visualization
31 VisualizationSelectionZoneManager &selectionZoneManager() const;
31 VisualizationSelectionZoneManager &selectionZoneManager() const;
32
32
33 VisualizationTabWidget *currentTabWidget() const;
34
33 // IVisualizationWidget interface
35 // IVisualizationWidget interface
34 void accept(IVisualizationWidgetVisitor *visitor) override;
36 void accept(IVisualizationWidgetVisitor *visitor) override;
35 bool canDrop(const Variable &variable) const override;
37 bool canDrop(const Variable &variable) const override;
@@ -6,6 +6,8
6 #include <CatalogueDao.h>
6 #include <CatalogueDao.h>
7 #include <DBCatalogue.h>
7 #include <DBCatalogue.h>
8 #include <SqpApplication.h>
8 #include <SqpApplication.h>
9 #include <Visualization/VisualizationTabWidget.h>
10 #include <Visualization/VisualizationWidget.h>
9
11
10 #include <QDialog>
12 #include <QDialog>
11 #include <QDialogButtonBox>
13 #include <QDialogButtonBox>
@@ -21,6 +23,8 struct CatalogueEventsWidget::CatalogueEventsWidgetPrivate {
21 QString m_ZoneForTimeMode;
23 QString m_ZoneForTimeMode;
22 QString m_ZoneForGraphMode;
24 QString m_ZoneForGraphMode;
23
25
26 VisualizationWidget *m_VisualizationWidget = nullptr;
27
24 void setEvents(const QVector<DBEvent> &events, QTableView *tableView)
28 void setEvents(const QVector<DBEvent> &events, QTableView *tableView)
25 {
29 {
26 tableView->setSortingEnabled(false);
30 tableView->setSortingEnabled(false);
@@ -42,10 +46,25 struct CatalogueEventsWidget::CatalogueEventsWidgetPrivate {
42 tableView->setSortingEnabled(true);
46 tableView->setSortingEnabled(true);
43 }
47 }
44
48
45 QStringList selectZone(QWidget *parent, const QStringList &availableZones,
49 QStringList getAvailableVisualizationZoneList() const
46 const QStringList &selectedZones, bool allowMultiSelection,
50 {
47 const QPoint &location)
51 if (m_VisualizationWidget) {
52 if (auto tab = m_VisualizationWidget->currentTabWidget()) {
53 return tab->availableZoneWidgets();
54 }
55 }
56
57 return QStringList{};
58 }
59
60 QStringList selectZone(QWidget *parent, const QStringList &selectedZones,
61 bool allowMultiSelection, const QPoint &location)
48 {
62 {
63 auto availableZones = getAvailableVisualizationZoneList();
64 if (availableZones.isEmpty()) {
65 return QStringList{};
66 }
67
49 QDialog d(parent, Qt::Tool);
68 QDialog d(parent, Qt::Tool);
50 d.setWindowTitle("Choose a zone");
69 d.setWindowTitle("Choose a zone");
51 auto layout = new QVBoxLayout{&d};
70 auto layout = new QVBoxLayout{&d};
@@ -103,6 +122,9 struct CatalogueEventsWidget::CatalogueEventsWidgetPrivate {
103 result += item->text();
122 result += item->text();
104 }
123 }
105 }
124 }
125 else {
126 result = selectedZones;
127 }
106
128
107 return result;
129 return result;
108 }
130 }
@@ -126,8 +148,7 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent)
126 if (checked) {
148 if (checked) {
127 ui->btnChart->setChecked(false);
149 ui->btnChart->setChecked(false);
128 impl->m_ZoneForTimeMode
150 impl->m_ZoneForTimeMode
129 = impl->selectZone(this, {"Zone 1", "Zone 2", "Zone 3", "Zone 4"},
151 = impl->selectZone(this, {impl->m_ZoneForTimeMode}, false,
130 {impl->m_ZoneForTimeMode}, false,
131 this->mapToGlobal(ui->btnTime->frameGeometry().center()))
152 this->mapToGlobal(ui->btnTime->frameGeometry().center()))
132 .value(0);
153 .value(0);
133 }
154 }
@@ -137,8 +158,7 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent)
137 if (checked) {
158 if (checked) {
138 ui->btnTime->setChecked(false);
159 ui->btnTime->setChecked(false);
139 impl->m_ZoneForGraphMode
160 impl->m_ZoneForGraphMode
140 = impl->selectZone(this, {"Zone 1", "Zone 2", "Zone 3", "Zone 4"},
161 = impl->selectZone(this, {impl->m_ZoneForGraphMode}, false,
141 {impl->m_ZoneForGraphMode}, false,
142 this->mapToGlobal(ui->btnChart->frameGeometry().center()))
162 this->mapToGlobal(ui->btnChart->frameGeometry().center()))
143 .value(0);
163 .value(0);
144 }
164 }
@@ -172,6 +192,11 CatalogueEventsWidget::~CatalogueEventsWidget()
172 delete ui;
192 delete ui;
173 }
193 }
174
194
195 void CatalogueEventsWidget::setVisualizationWidget(VisualizationWidget *visualization)
196 {
197 impl->m_VisualizationWidget = visualization;
198 }
199
175 void CatalogueEventsWidget::populateWithCatalogues(const QVector<DBCatalogue> &catalogues)
200 void CatalogueEventsWidget::populateWithCatalogues(const QVector<DBCatalogue> &catalogues)
176 {
201 {
177 auto &dao = sqpApp->catalogueController().getDao();
202 auto &dao = sqpApp->catalogueController().getDao();
@@ -1,12 +1,18
1 #include "Catalogue/CatalogueExplorer.h"
1 #include "Catalogue/CatalogueExplorer.h"
2 #include "ui_CatalogueExplorer.h"
2 #include "ui_CatalogueExplorer.h"
3
3
4 #include <Visualization/VisualizationWidget.h>
5
4 #include <DBCatalogue.h>
6 #include <DBCatalogue.h>
5 #include <DBEvent.h>
7 #include <DBEvent.h>
6
8
9 struct CatalogueExplorer::CatalogueExplorerPrivate {
10 };
11
7 CatalogueExplorer::CatalogueExplorer(QWidget *parent)
12 CatalogueExplorer::CatalogueExplorer(QWidget *parent)
8 : QDialog(parent, Qt::Dialog | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
13 : QDialog(parent, Qt::Dialog | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
9 ui(new Ui::CatalogueExplorer)
14 ui(new Ui::CatalogueExplorer),
15 impl{spimpl::make_unique_impl<CatalogueExplorerPrivate>()}
10 {
16 {
11 ui->setupUi(this);
17 ui->setupUi(this);
12
18
@@ -48,3 +54,8 CatalogueExplorer::~CatalogueExplorer()
48 {
54 {
49 delete ui;
55 delete ui;
50 }
56 }
57
58 void CatalogueExplorer::setVisualizationWidget(VisualizationWidget *visualization)
59 {
60 ui->events->setVisualizationWidget(visualization);
61 }
@@ -118,6 +118,15 void VisualizationTabWidget::insertZone(int index, VisualizationZoneWidget *zone
118 ui->dragDropContainer->insertDragWidget(index, zoneWidget);
118 ui->dragDropContainer->insertDragWidget(index, zoneWidget);
119 }
119 }
120
120
121 QStringList VisualizationTabWidget::availableZoneWidgets() const
122 {
123 QStringList zones;
124 processZones(tabLayout(),
125 [&zones](VisualizationZoneWidget &zoneWidget) { zones << zoneWidget.name(); });
126
127 return zones;
128 }
129
121 VisualizationZoneWidget *VisualizationTabWidget::createZone(std::shared_ptr<Variable> variable)
130 VisualizationZoneWidget *VisualizationTabWidget::createZone(std::shared_ptr<Variable> variable)
122 {
131 {
123 return createZone({variable}, -1);
132 return createZone({variable}, -1);
@@ -119,6 +119,15 VisualizationSelectionZoneManager &VisualizationWidget::selectionZoneManager() c
119 return *impl->m_ZoneSelectionManager.get();
119 return *impl->m_ZoneSelectionManager.get();
120 }
120 }
121
121
122 VisualizationTabWidget *VisualizationWidget::currentTabWidget() const
123 {
124 if (auto tab = qobject_cast<VisualizationTabWidget *>(ui->tabWidget->currentWidget())) {
125 return tab;
126 }
127
128 return nullptr;
129 }
130
122 void VisualizationWidget::accept(IVisualizationWidgetVisitor *visitor)
131 void VisualizationWidget::accept(IVisualizationWidgetVisitor *visitor)
123 {
132 {
124 if (visitor) {
133 if (visitor) {
General Comments 0
You need to be logged in to leave comments. Login now