##// END OF EJS Templates
Rework event creation menus without popup dialog
trabillard -
r1326:04c34c9f216f
parent child
Show More
@@ -1,148 +1,145
1 qxorm_dep = dependency('QxOrm', required : true, fallback:['QxOrm','qxorm_dep'])
1 qxorm_dep = dependency('QxOrm', required : true, fallback:['QxOrm','qxorm_dep'])
2 catalogueapi_dep = dependency('CatalogueAPI', required : true, fallback:['CatalogueAPI','CatalogueAPI_dep'])
2 catalogueapi_dep = dependency('CatalogueAPI', required : true, fallback:['CatalogueAPI','CatalogueAPI_dep'])
3
3
4 gui_moc_headers = [
4 gui_moc_headers = [
5 'include/DataSource/DataSourceWidget.h',
5 'include/DataSource/DataSourceWidget.h',
6 'include/Settings/SqpSettingsDialog.h',
6 'include/Settings/SqpSettingsDialog.h',
7 'include/Settings/SqpSettingsGeneralWidget.h',
7 'include/Settings/SqpSettingsGeneralWidget.h',
8 'include/SidePane/SqpSidePane.h',
8 'include/SidePane/SqpSidePane.h',
9 'include/SqpApplication.h',
9 'include/SqpApplication.h',
10 'include/DragAndDrop/DragDropScroller.h',
10 'include/DragAndDrop/DragDropScroller.h',
11 'include/DragAndDrop/DragDropTabSwitcher.h',
11 'include/DragAndDrop/DragDropTabSwitcher.h',
12 'include/TimeWidget/TimeWidget.h',
12 'include/TimeWidget/TimeWidget.h',
13 'include/Variable/VariableInspectorWidget.h',
13 'include/Variable/VariableInspectorWidget.h',
14 'include/Variable/RenameVariableDialog.h',
14 'include/Variable/RenameVariableDialog.h',
15 'include/Visualization/qcustomplot.h',
15 'include/Visualization/qcustomplot.h',
16 'include/Visualization/VisualizationGraphWidget.h',
16 'include/Visualization/VisualizationGraphWidget.h',
17 'include/Visualization/VisualizationTabWidget.h',
17 'include/Visualization/VisualizationTabWidget.h',
18 'include/Visualization/VisualizationWidget.h',
18 'include/Visualization/VisualizationWidget.h',
19 'include/Visualization/VisualizationZoneWidget.h',
19 'include/Visualization/VisualizationZoneWidget.h',
20 'include/Visualization/VisualizationDragDropContainer.h',
20 'include/Visualization/VisualizationDragDropContainer.h',
21 'include/Visualization/VisualizationDragWidget.h',
21 'include/Visualization/VisualizationDragWidget.h',
22 'include/Visualization/ColorScaleEditor.h',
22 'include/Visualization/ColorScaleEditor.h',
23 'include/Visualization/VisualizationSelectionZoneItem.h',
23 'include/Visualization/VisualizationSelectionZoneItem.h',
24 'include/Actions/SelectionZoneAction.h',
24 'include/Actions/SelectionZoneAction.h',
25 'include/Visualization/VisualizationMultiZoneSelectionDialog.h',
25 'include/Visualization/VisualizationMultiZoneSelectionDialog.h',
26 'include/Catalogue/CatalogueExplorer.h',
26 'include/Catalogue/CatalogueExplorer.h',
27 'include/Catalogue/CatalogueEventsWidget.h',
27 'include/Catalogue/CatalogueEventsWidget.h',
28 'include/Catalogue/CatalogueSideBarWidget.h',
28 'include/Catalogue/CatalogueSideBarWidget.h',
29 'include/Catalogue/CatalogueInspectorWidget.h',
29 'include/Catalogue/CatalogueInspectorWidget.h',
30 'include/Catalogue/CatalogueEventsModel.h',
30 'include/Catalogue/CatalogueEventsModel.h',
31 'include/Catalogue/CreateEventDialog.h',
32 'include/Catalogue/CatalogueTreeModel.h'
31 'include/Catalogue/CatalogueTreeModel.h'
33 ]
32 ]
34
33
35 gui_ui_files = [
34 gui_ui_files = [
36 'ui/DataSource/DataSourceWidget.ui',
35 'ui/DataSource/DataSourceWidget.ui',
37 'ui/Settings/SqpSettingsDialog.ui',
36 'ui/Settings/SqpSettingsDialog.ui',
38 'ui/Settings/SqpSettingsGeneralWidget.ui',
37 'ui/Settings/SqpSettingsGeneralWidget.ui',
39 'ui/SidePane/SqpSidePane.ui',
38 'ui/SidePane/SqpSidePane.ui',
40 'ui/TimeWidget/TimeWidget.ui',
39 'ui/TimeWidget/TimeWidget.ui',
41 'ui/Variable/VariableInspectorWidget.ui',
40 'ui/Variable/VariableInspectorWidget.ui',
42 'ui/Variable/RenameVariableDialog.ui',
41 'ui/Variable/RenameVariableDialog.ui',
43 'ui/Variable/VariableMenuHeaderWidget.ui',
42 'ui/Variable/VariableMenuHeaderWidget.ui',
44 'ui/Visualization/VisualizationGraphWidget.ui',
43 'ui/Visualization/VisualizationGraphWidget.ui',
45 'ui/Visualization/VisualizationTabWidget.ui',
44 'ui/Visualization/VisualizationTabWidget.ui',
46 'ui/Visualization/VisualizationWidget.ui',
45 'ui/Visualization/VisualizationWidget.ui',
47 'ui/Visualization/VisualizationZoneWidget.ui',
46 'ui/Visualization/VisualizationZoneWidget.ui',
48 'ui/Visualization/ColorScaleEditor.ui',
47 'ui/Visualization/ColorScaleEditor.ui',
49 'ui/Visualization/VisualizationMultiZoneSelectionDialog.ui',
48 'ui/Visualization/VisualizationMultiZoneSelectionDialog.ui',
50 'ui/Catalogue/CatalogueExplorer.ui',
49 'ui/Catalogue/CatalogueExplorer.ui',
51 'ui/Catalogue/CatalogueEventsWidget.ui',
50 'ui/Catalogue/CatalogueEventsWidget.ui',
52 'ui/Catalogue/CatalogueSideBarWidget.ui',
51 'ui/Catalogue/CatalogueSideBarWidget.ui',
53 'ui/Catalogue/CatalogueInspectorWidget.ui',
52 'ui/Catalogue/CatalogueInspectorWidget.ui'
54 'ui/Catalogue/CreateEventDialog.ui'
55 ]
53 ]
56
54
57 gui_qresources = ['resources/sqpguiresources.qrc']
55 gui_qresources = ['resources/sqpguiresources.qrc']
58
56
59 rcc_gen = generator(rcc,
57 rcc_gen = generator(rcc,
60 output : 'qrc_@BASENAME@.cpp',
58 output : 'qrc_@BASENAME@.cpp',
61 arguments : [
59 arguments : [
62 '--output',
60 '--output',
63 '@OUTPUT@',
61 '@OUTPUT@',
64 '@INPUT@',
62 '@INPUT@',
65 '@EXTRA_ARGS@'])
63 '@EXTRA_ARGS@'])
66
64
67 rcc_files = rcc_gen.process(gui_qresources, extra_args : ['-name', 'sqpguiresources'])
65 rcc_files = rcc_gen.process(gui_qresources, extra_args : ['-name', 'sqpguiresources'])
68
66
69 gui_moc_files = qt5.preprocess(moc_headers : gui_moc_headers,
67 gui_moc_files = qt5.preprocess(moc_headers : gui_moc_headers,
70 ui_files : gui_ui_files)
68 ui_files : gui_ui_files)
71
69
72 gui_sources = [
70 gui_sources = [
73 'src/SqpApplication.cpp',
71 'src/SqpApplication.cpp',
74 'src/DragAndDrop/DragDropGuiController.cpp',
72 'src/DragAndDrop/DragDropGuiController.cpp',
75 'src/DragAndDrop/DragDropScroller.cpp',
73 'src/DragAndDrop/DragDropScroller.cpp',
76 'src/DragAndDrop/DragDropTabSwitcher.cpp',
74 'src/DragAndDrop/DragDropTabSwitcher.cpp',
77 'src/Common/ColorUtils.cpp',
75 'src/Common/ColorUtils.cpp',
78 'src/Common/VisualizationDef.cpp',
76 'src/Common/VisualizationDef.cpp',
79 'src/DataSource/DataSourceTreeWidgetItem.cpp',
77 'src/DataSource/DataSourceTreeWidgetItem.cpp',
80 'src/DataSource/DataSourceTreeWidgetHelper.cpp',
78 'src/DataSource/DataSourceTreeWidgetHelper.cpp',
81 'src/DataSource/DataSourceWidget.cpp',
79 'src/DataSource/DataSourceWidget.cpp',
82 'src/DataSource/DataSourceTreeWidget.cpp',
80 'src/DataSource/DataSourceTreeWidget.cpp',
83 'src/Settings/SqpSettingsDialog.cpp',
81 'src/Settings/SqpSettingsDialog.cpp',
84 'src/Settings/SqpSettingsGeneralWidget.cpp',
82 'src/Settings/SqpSettingsGeneralWidget.cpp',
85 'src/SidePane/SqpSidePane.cpp',
83 'src/SidePane/SqpSidePane.cpp',
86 'src/TimeWidget/TimeWidget.cpp',
84 'src/TimeWidget/TimeWidget.cpp',
87 'src/Variable/VariableInspectorWidget.cpp',
85 'src/Variable/VariableInspectorWidget.cpp',
88 'src/Variable/VariableInspectorTableView.cpp',
86 'src/Variable/VariableInspectorTableView.cpp',
89 'src/Variable/VariableMenuHeaderWidget.cpp',
87 'src/Variable/VariableMenuHeaderWidget.cpp',
90 'src/Variable/RenameVariableDialog.cpp',
88 'src/Variable/RenameVariableDialog.cpp',
91 'src/Visualization/VisualizationGraphHelper.cpp',
89 'src/Visualization/VisualizationGraphHelper.cpp',
92 'src/Visualization/VisualizationGraphRenderingDelegate.cpp',
90 'src/Visualization/VisualizationGraphRenderingDelegate.cpp',
93 'src/Visualization/VisualizationGraphWidget.cpp',
91 'src/Visualization/VisualizationGraphWidget.cpp',
94 'src/Visualization/VisualizationTabWidget.cpp',
92 'src/Visualization/VisualizationTabWidget.cpp',
95 'src/Visualization/VisualizationWidget.cpp',
93 'src/Visualization/VisualizationWidget.cpp',
96 'src/Visualization/VisualizationZoneWidget.cpp',
94 'src/Visualization/VisualizationZoneWidget.cpp',
97 'src/Visualization/qcustomplot.cpp',
95 'src/Visualization/qcustomplot.cpp',
98 'src/Visualization/QCustomPlotSynchronizer.cpp',
96 'src/Visualization/QCustomPlotSynchronizer.cpp',
99 'src/Visualization/operations/FindVariableOperation.cpp',
97 'src/Visualization/operations/FindVariableOperation.cpp',
100 'src/Visualization/operations/GenerateVariableMenuOperation.cpp',
98 'src/Visualization/operations/GenerateVariableMenuOperation.cpp',
101 'src/Visualization/operations/MenuBuilder.cpp',
99 'src/Visualization/operations/MenuBuilder.cpp',
102 'src/Visualization/operations/RemoveVariableOperation.cpp',
100 'src/Visualization/operations/RemoveVariableOperation.cpp',
103 'src/Visualization/operations/RescaleAxeOperation.cpp',
101 'src/Visualization/operations/RescaleAxeOperation.cpp',
104 'src/Visualization/VisualizationDragDropContainer.cpp',
102 'src/Visualization/VisualizationDragDropContainer.cpp',
105 'src/Visualization/VisualizationDragWidget.cpp',
103 'src/Visualization/VisualizationDragWidget.cpp',
106 'src/Visualization/AxisRenderingUtils.cpp',
104 'src/Visualization/AxisRenderingUtils.cpp',
107 'src/Visualization/PlottablesRenderingUtils.cpp',
105 'src/Visualization/PlottablesRenderingUtils.cpp',
108 'src/Visualization/MacScrollBarStyle.cpp',
106 'src/Visualization/MacScrollBarStyle.cpp',
109 'src/Visualization/VisualizationCursorItem.cpp',
107 'src/Visualization/VisualizationCursorItem.cpp',
110 'src/Visualization/ColorScaleEditor.cpp',
108 'src/Visualization/ColorScaleEditor.cpp',
111 'src/Visualization/SqpColorScale.cpp',
109 'src/Visualization/SqpColorScale.cpp',
112 'src/Visualization/QCPColorMapIterator.cpp',
110 'src/Visualization/QCPColorMapIterator.cpp',
113 'src/Visualization/VisualizationSelectionZoneItem.cpp',
111 'src/Visualization/VisualizationSelectionZoneItem.cpp',
114 'src/Visualization/VisualizationSelectionZoneManager.cpp',
112 'src/Visualization/VisualizationSelectionZoneManager.cpp',
115 'src/Actions/SelectionZoneAction.cpp',
113 'src/Actions/SelectionZoneAction.cpp',
116 'src/Actions/ActionsGuiController.cpp',
114 'src/Actions/ActionsGuiController.cpp',
117 'src/Visualization/VisualizationActionManager.cpp',
115 'src/Visualization/VisualizationActionManager.cpp',
118 'src/Visualization/VisualizationMultiZoneSelectionDialog.cpp',
116 'src/Visualization/VisualizationMultiZoneSelectionDialog.cpp',
119 'src/Catalogue/CatalogueExplorer.cpp',
117 'src/Catalogue/CatalogueExplorer.cpp',
120 'src/Catalogue/CatalogueEventsWidget.cpp',
118 'src/Catalogue/CatalogueEventsWidget.cpp',
121 'src/Catalogue/CatalogueSideBarWidget.cpp',
119 'src/Catalogue/CatalogueSideBarWidget.cpp',
122 'src/Catalogue/CatalogueInspectorWidget.cpp',
120 'src/Catalogue/CatalogueInspectorWidget.cpp',
123 'src/Catalogue/CatalogueTreeItems/CatalogueAbstractTreeItem.cpp',
121 'src/Catalogue/CatalogueTreeItems/CatalogueAbstractTreeItem.cpp',
124 'src/Catalogue/CatalogueTreeItems/CatalogueTreeItem.cpp',
122 'src/Catalogue/CatalogueTreeItems/CatalogueTreeItem.cpp',
125 'src/Catalogue/CatalogueTreeItems/CatalogueTextTreeItem.cpp',
123 'src/Catalogue/CatalogueTreeItems/CatalogueTextTreeItem.cpp',
126 'src/Catalogue/CatalogueEventsModel.cpp',
124 'src/Catalogue/CatalogueEventsModel.cpp',
127 'src/Catalogue/CatalogueExplorerHelper.cpp',
125 'src/Catalogue/CatalogueExplorerHelper.cpp',
128 'src/Catalogue/CatalogueActionManager.cpp',
126 'src/Catalogue/CatalogueActionManager.cpp',
129 'src/Catalogue/CreateEventDialog.cpp',
130 'src/Catalogue/CatalogueTreeModel.cpp'
127 'src/Catalogue/CatalogueTreeModel.cpp'
131 ]
128 ]
132
129
133 gui_inc = include_directories(['include'])
130 gui_inc = include_directories(['include'])
134
131
135 sciqlop_gui_lib = library('sciqlopgui',
132 sciqlop_gui_lib = library('sciqlopgui',
136 gui_sources,
133 gui_sources,
137 gui_moc_files,
134 gui_moc_files,
138 rcc_files,
135 rcc_files,
139 include_directories : [gui_inc],
136 include_directories : [gui_inc],
140 dependencies : [ qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core, catalogueapi_dep],
137 dependencies : [ qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core, catalogueapi_dep],
141 install : true
138 install : true
142 )
139 )
143
140
144 sciqlop_gui = declare_dependency(link_with : sciqlop_gui_lib,
141 sciqlop_gui = declare_dependency(link_with : sciqlop_gui_lib,
145 include_directories : gui_inc,
142 include_directories : gui_inc,
146 dependencies : [qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core, catalogueapi_dep])
143 dependencies : [qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core, catalogueapi_dep])
147
144
148
145
@@ -1,145 +1,153
1 #include "Catalogue/CatalogueActionManager.h"
1 #include "Catalogue/CatalogueActionManager.h"
2
2
3 #include <Actions/ActionsGuiController.h>
3 #include <Actions/ActionsGuiController.h>
4 #include <Catalogue/CatalogueController.h>
4 #include <Catalogue/CatalogueController.h>
5 #include <DataSource/DataSourceItem.h>
5 #include <DataSource/DataSourceItem.h>
6 #include <SqpApplication.h>
6 #include <SqpApplication.h>
7 #include <Variable/Variable.h>
7 #include <Variable/Variable.h>
8 #include <Visualization/VisualizationGraphWidget.h>
8 #include <Visualization/VisualizationGraphWidget.h>
9 #include <Visualization/VisualizationSelectionZoneItem.h>
9 #include <Visualization/VisualizationSelectionZoneItem.h>
10
10
11 #include <Catalogue/CatalogueEventsWidget.h>
11 #include <Catalogue/CatalogueEventsWidget.h>
12 #include <Catalogue/CatalogueExplorer.h>
12 #include <Catalogue/CatalogueExplorer.h>
13 #include <Catalogue/CatalogueSideBarWidget.h>
13 #include <Catalogue/CatalogueSideBarWidget.h>
14 #include <Catalogue/CreateEventDialog.h>
15
14
16 #include <CatalogueDao.h>
15 #include <CatalogueDao.h>
17 #include <DBCatalogue.h>
16 #include <DBCatalogue.h>
18 #include <DBEvent.h>
17 #include <DBEvent.h>
19 #include <DBEventProduct.h>
18 #include <DBEventProduct.h>
20
19
21 #include <QBoxLayout>
20 #include <QBoxLayout>
22 #include <QComboBox>
21 #include <QComboBox>
23 #include <QDialog>
22 #include <QDialog>
24 #include <QDialogButtonBox>
23 #include <QDialogButtonBox>
25 #include <QLineEdit>
24 #include <QLineEdit>
26 #include <memory>
25 #include <memory>
27
26
27 const auto CATALOGUE_MENU_NAME = QObject::tr("Catalogues");
28 const auto CATALOGUE_CREATE_EVENT_MENU_NAME = QObject::tr("New Event");
29
30 const auto DEFAULT_EVENT_NAME = QObject::tr("New Event");
31 const auto DEFAULT_CATALOGUE_NAME = QObject::tr("New Catalogue");
32
28 struct CatalogueActionManager::CatalogueActionManagerPrivate {
33 struct CatalogueActionManager::CatalogueActionManagerPrivate {
29
34
30 CatalogueExplorer *m_CatalogueExplorer = nullptr;
35 CatalogueExplorer *m_CatalogueExplorer = nullptr;
31
36
32 CatalogueActionManagerPrivate(CatalogueExplorer *catalogueExplorer)
37 CatalogueActionManagerPrivate(CatalogueExplorer *catalogueExplorer)
33 : m_CatalogueExplorer(catalogueExplorer)
38 : m_CatalogueExplorer(catalogueExplorer)
34 {
39 {
35 }
40 }
36
41
37 void createEventFromZones(const QString &eventName,
42 void createEventFromZones(const QString &eventName,
38 const QVector<VisualizationSelectionZoneItem *> &zones,
43 const QVector<VisualizationSelectionZoneItem *> &zones,
39 const std::shared_ptr<DBCatalogue> &catalogue = nullptr)
44 const std::shared_ptr<DBCatalogue> &catalogue = nullptr)
40 {
45 {
41 auto event = std::make_shared<DBEvent>();
46 auto event = std::make_shared<DBEvent>();
42 event->setName(eventName);
47 event->setName(eventName);
43
48
44 std::list<DBEventProduct> productList;
49 std::list<DBEventProduct> productList;
45 for (auto zone : zones) {
50 for (auto zone : zones) {
46 auto graph = zone->parentGraphWidget();
51 auto graph = zone->parentGraphWidget();
47 for (auto var : graph->variables()) {
52 for (auto var : graph->variables()) {
48 auto eventProduct = std::make_shared<DBEventProduct>();
53 auto eventProduct = std::make_shared<DBEventProduct>();
49 eventProduct->setEvent(*event);
54 eventProduct->setEvent(*event);
50
55
51 auto productId
56 auto productId
52 = var->metadata().value(DataSourceItem::ID_DATA_KEY, "UnknownID").toString();
57 = var->metadata().value(DataSourceItem::ID_DATA_KEY, "UnknownID").toString();
53
58
54 auto zoneRange = zone->range();
59 auto zoneRange = zone->range();
55 eventProduct->setTStart(zoneRange.m_TStart);
60 eventProduct->setTStart(zoneRange.m_TStart);
56 eventProduct->setTEnd(zoneRange.m_TEnd);
61 eventProduct->setTEnd(zoneRange.m_TEnd);
57
62
58 eventProduct->setProductId(productId);
63 eventProduct->setProductId(productId);
59
64
60 productList.push_back(*eventProduct);
65 productList.push_back(*eventProduct);
61 }
66 }
62 }
67 }
63
68
64 event->setEventProducts(productList);
69 event->setEventProducts(productList);
65
70
66 sqpApp->catalogueController().addEvent(event);
71 sqpApp->catalogueController().addEvent(event);
67
72
68
73
69 if (catalogue) {
74 if (catalogue) {
70 catalogue->addEvent(event->getUniqId());
75 catalogue->addEvent(event->getUniqId());
71 sqpApp->catalogueController().updateCatalogue(catalogue);
76 sqpApp->catalogueController().updateCatalogue(catalogue);
72 m_CatalogueExplorer->sideBarWidget().setCatalogueChanges(catalogue, true);
77 m_CatalogueExplorer->sideBarWidget().setCatalogueChanges(catalogue, true);
73 if (m_CatalogueExplorer->eventsWidget().displayedCatalogues().contains(catalogue)) {
78 if (m_CatalogueExplorer->eventsWidget().displayedCatalogues().contains(catalogue)) {
74 m_CatalogueExplorer->eventsWidget().addEvent(event);
79 m_CatalogueExplorer->eventsWidget().addEvent(event);
75 m_CatalogueExplorer->eventsWidget().setEventChanges(event, true);
80 m_CatalogueExplorer->eventsWidget().setEventChanges(event, true);
76 }
81 }
77 }
82 }
78 else if (m_CatalogueExplorer->eventsWidget().isAllEventsDisplayed()) {
83 else if (m_CatalogueExplorer->eventsWidget().isAllEventsDisplayed()) {
79 m_CatalogueExplorer->eventsWidget().addEvent(event);
84 m_CatalogueExplorer->eventsWidget().addEvent(event);
80 m_CatalogueExplorer->eventsWidget().setEventChanges(event, true);
85 m_CatalogueExplorer->eventsWidget().setEventChanges(event, true);
81 }
86 }
82 }
87 }
83 };
88 };
84
89
85 CatalogueActionManager::CatalogueActionManager(CatalogueExplorer *catalogueExplorer)
90 CatalogueActionManager::CatalogueActionManager(CatalogueExplorer *catalogueExplorer)
86 : impl{spimpl::make_unique_impl<CatalogueActionManagerPrivate>(catalogueExplorer)}
91 : impl{spimpl::make_unique_impl<CatalogueActionManagerPrivate>(catalogueExplorer)}
87 {
92 {
88 }
93 }
89
94
90 void CatalogueActionManager::installSelectionZoneActions()
95 void CatalogueActionManager::installSelectionZoneActions()
91 {
96 {
92 auto &actionController = sqpApp->actionsGuiController();
97 auto &actionController = sqpApp->actionsGuiController();
93
98
94 auto createEventEnableFuntion = [](auto zones) {
99 auto createEventEnableFuntion = [](auto zones) {
95
100
96 // Checks that all variables in the zones doesn't refer to the same product
101 // Checks that all variables in the zones doesn't refer to the same product
97 QSet<QString> usedDatasource;
102 QSet<QString> usedDatasource;
98 for (auto zone : zones) {
103 for (auto zone : zones) {
99 auto graph = zone->parentGraphWidget();
104 auto graph = zone->parentGraphWidget();
100 auto variables = graph->variables();
105 auto variables = graph->variables();
101
106
102 for (auto var : variables) {
107 for (auto var : variables) {
103 auto datasourceId = var->metadata().value(DataSourceItem::ID_DATA_KEY).toString();
108 auto datasourceId = var->metadata().value(DataSourceItem::ID_DATA_KEY).toString();
104 if (!usedDatasource.contains(datasourceId)) {
109 if (!usedDatasource.contains(datasourceId)) {
105 usedDatasource.insert(datasourceId);
110 usedDatasource.insert(datasourceId);
106 }
111 }
107 else {
112 else {
108 return false;
113 return false;
109 }
114 }
110 }
115 }
111 }
116 }
112
117
113 return true;
118 return true;
114 };
119 };
115
120
121
116 auto createEventAction = actionController.addSectionZoneAction(
122 auto createEventAction = actionController.addSectionZoneAction(
117 {QObject::tr("Catalogues")}, QObject::tr("New Event..."), [this](auto zones) {
123 {CATALOGUE_MENU_NAME, CATALOGUE_CREATE_EVENT_MENU_NAME}, QObject::tr("Without Catalogue"),
118 CreateEventDialog dialog(
124 [this](auto zones) { impl->createEventFromZones(DEFAULT_EVENT_NAME, zones); });
119 impl->m_CatalogueExplorer->sideBarWidget().getCatalogues(REPOSITORY_DEFAULT));
120 dialog.hideCatalogueChoice();
121 if (dialog.exec() == QDialog::Accepted) {
122 impl->createEventFromZones(dialog.eventName(), zones);
123 }
124 });
125 createEventAction->setEnableFunction(createEventEnableFuntion);
125 createEventAction->setEnableFunction(createEventEnableFuntion);
126
126
127 auto createEventInCatalogueAction = actionController.addSectionZoneAction(
127 auto createEventInNewCatalogueAction = actionController.addSectionZoneAction(
128 {QObject::tr("Catalogues")}, QObject::tr("New Event in Catalogue..."), [this](auto zones) {
128 {CATALOGUE_MENU_NAME, CATALOGUE_CREATE_EVENT_MENU_NAME}, QObject::tr("In New Catalogue"),
129 CreateEventDialog dialog(
129 [this](auto zones) {
130 impl->m_CatalogueExplorer->sideBarWidget().getCatalogues(REPOSITORY_DEFAULT));
130
131 if (dialog.exec() == QDialog::Accepted) {
131 auto newCatalogue = std::make_shared<DBCatalogue>();
132 auto selectedCatalogue = dialog.selectedCatalogue();
132 newCatalogue->setName(DEFAULT_CATALOGUE_NAME);
133 if (!selectedCatalogue) {
133 sqpApp->catalogueController().addCatalogue(newCatalogue);
134 selectedCatalogue = std::make_shared<DBCatalogue>();
134 impl->m_CatalogueExplorer->sideBarWidget().addCatalogue(newCatalogue,
135 selectedCatalogue->setName(dialog.catalogueName());
136 sqpApp->catalogueController().addCatalogue(selectedCatalogue);
137 impl->m_CatalogueExplorer->sideBarWidget().addCatalogue(selectedCatalogue,
138 REPOSITORY_DEFAULT);
135 REPOSITORY_DEFAULT);
139 }
140
136
141 impl->createEventFromZones(dialog.eventName(), zones, selectedCatalogue);
137 impl->createEventFromZones(DEFAULT_EVENT_NAME, zones, newCatalogue);
142 }
138 });
139 createEventInNewCatalogueAction->setEnableFunction(createEventEnableFuntion);
140
141
142 auto allCatalogues
143 = impl->m_CatalogueExplorer->sideBarWidget().getCatalogues(REPOSITORY_DEFAULT);
144 for (auto catalogue : allCatalogues) {
145 auto catalogueName = catalogue->getName();
146 auto createEventInCatalogueAction = actionController.addSectionZoneAction(
147 {CATALOGUE_MENU_NAME, CATALOGUE_CREATE_EVENT_MENU_NAME},
148 QObject::tr("In ").append(catalogueName), [this, catalogue](auto zones) {
149 impl->createEventFromZones(DEFAULT_EVENT_NAME, zones, catalogue);
143 });
150 });
144 createEventInCatalogueAction->setEnableFunction(createEventEnableFuntion);
151 createEventInCatalogueAction->setEnableFunction(createEventEnableFuntion);
145 }
152 }
153 }
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now