comparison main/MainWindow.h @ 2093:6e3ef3aa341e spectrogramparam

Ensure that operations that need to iterate through action maps in order (most pointedly MainWindow::updateLayerShortcutsFor) get to do it in order of construction and not arbitrary pointer order. Fixes incorrect shortcut associations for add-layer/pane shortcuts in some cases
author Chris Cannam
date Tue, 13 Nov 2018 14:09:30 +0000
parents 2b83ca602ece
children 124de219669f c476db6cf3eb
comparison
equal deleted inserted replaced
2092:16d2c946171c 2093:6e3ef3aa341e
247 int channel; 247 int channel;
248 }; 248 };
249 249
250 QString shortcutFor(LayerFactory::LayerType, bool isPaneMenu); 250 QString shortcutFor(LayerFactory::LayerType, bool isPaneMenu);
251 void updateLayerShortcutsFor(Model *); 251 void updateLayerShortcutsFor(Model *);
252 252
253 typedef std::map<QAction *, LayerConfiguration> PaneActionMap; 253 // Map from menu action to the resulting layer configurations
254 PaneActionMap m_paneActions; 254 // etc. These all used to be std::maps, but we sometimes want to
255 255 // iterate through actions in order of creation, not in order of
256 typedef std::map<QAction *, LayerConfiguration> LayerActionMap; 256 // arbitrary QAction pointer. And speed of random lookup is not
257 LayerActionMap m_layerActions; 257 // important.
258 258 //
259 typedef std::map<QAction *, TransformId> TransformActionMap; 259 // Some of these would still be fine as maps, but we might as well
260 TransformActionMap m_transformActions; 260 // consistently use the same arrangement throughout.
261 261
262 typedef std::vector<std::pair<QAction *, LayerConfiguration>> PaneActions;
263 PaneActions m_paneActions;
264
265 typedef std::vector<std::pair<QAction *, LayerConfiguration>> LayerActions;
266 LayerActions m_layerActions;
267
268 typedef std::vector<std::pair<QAction *, Layer *>> ExistingLayerActions;
269 ExistingLayerActions m_existingLayerActions;
270 ExistingLayerActions m_sliceActions;
271
272 typedef std::vector<std::pair<ViewManager::ToolMode, QAction *>> ToolActions;
273 ToolActions m_toolActions;
274
275 typedef std::vector<std::pair<QAction *, int>> NumberingActions;
276 NumberingActions m_numberingActions;
277
278 typedef std::vector<std::pair<QAction *, TransformId>> TransformActions;
279 TransformActions m_transformActions;
280
281 // This one only makes sense as a map though
262 typedef std::map<TransformId, QAction *> TransformActionReverseMap; 282 typedef std::map<TransformId, QAction *> TransformActionReverseMap;
263 TransformActionReverseMap m_transformActionsReverse; 283 TransformActionReverseMap m_transformActionsReverse;
264
265 typedef std::map<QAction *, Layer *> ExistingLayerActionMap;
266 ExistingLayerActionMap m_existingLayerActions;
267 ExistingLayerActionMap m_sliceActions;
268
269 typedef std::map<ViewManager::ToolMode, QAction *> ToolActionMap;
270 ToolActionMap m_toolActions;
271
272 typedef std::map<QAction *, int> NumberingActionMap;
273 NumberingActionMap m_numberingActions;
274 284
275 QString getReleaseText() const; 285 QString getReleaseText() const;
276 286
277 virtual void setupMenus(); 287 virtual void setupMenus();
278 virtual void setupFileMenu(); 288 virtual void setupFileMenu();