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