@@ -28,7 +28,6 gui_moc_headers = [ | |||||
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 | |||
@@ -50,8 +49,7 gui_ui_files = [ | |||||
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'] | |
@@ -126,7 +124,6 gui_sources = [ | |||||
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 |
@@ -11,7 +11,6 | |||||
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> | |
@@ -25,6 +24,12 | |||||
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; | |
@@ -113,33 +118,36 void CatalogueActionManager::installSelectionZoneActions() | |||||
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)); |
|
|||
131 | if (dialog.exec() == QDialog::Accepted) { |
|
|||
132 | auto selectedCatalogue = dialog.selectedCatalogue(); |
|
|||
133 | if (!selectedCatalogue) { |
|
|||
134 | selectedCatalogue = std::make_shared<DBCatalogue>(); |
|
|||
135 | selectedCatalogue->setName(dialog.catalogueName()); |
|
|||
136 | sqpApp->catalogueController().addCatalogue(selectedCatalogue); |
|
|||
137 | impl->m_CatalogueExplorer->sideBarWidget().addCatalogue(selectedCatalogue, |
|
|||
138 | REPOSITORY_DEFAULT); |
|
|||
139 | } |
|
|||
140 |
|
130 | |||
141 | impl->createEventFromZones(dialog.eventName(), zones, selectedCatalogue); |
|
131 | auto newCatalogue = std::make_shared<DBCatalogue>(); | |
142 | } |
|
132 | newCatalogue->setName(DEFAULT_CATALOGUE_NAME); | |
|
133 | sqpApp->catalogueController().addCatalogue(newCatalogue); | |||
|
134 | impl->m_CatalogueExplorer->sideBarWidget().addCatalogue(newCatalogue, | |||
|
135 | REPOSITORY_DEFAULT); | |||
|
136 | ||||
|
137 | impl->createEventFromZones(DEFAULT_EVENT_NAME, zones, newCatalogue); | |||
143 | }); |
|
138 | }); | |
144 | createEventInCatalogueAction->setEnableFunction(createEventEnableFuntion); |
|
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); | |||
|
150 | }); | |||
|
151 | createEventInCatalogueAction->setEnableFunction(createEventEnableFuntion); | |||
|
152 | } | |||
145 | } |
|
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