WIP: refactoring ongoing.

This commit is contained in:
Matthias Koefferlein 2020-02-08 00:02:49 +01:00
parent a14e90f367
commit 64a09e07f9
2 changed files with 24 additions and 8 deletions

19
TODO
View File

@ -1,26 +1,26 @@
Plan: Plan:
1. Combine AbstractMenuProvider, PluginRoot and the AbstractMenuProvider's DONE 1. Combine AbstractMenuProvider, PluginRoot and the AbstractMenuProvider's
implementation in MainWindow/LayoutView into lay::Dispatcher implementation in MainWindow/LayoutView into lay::Dispatcher
2. Base MainWindow and LayoutView on lay::Dispatcher DONE 2. Base MainWindow and LayoutView on lay::Dispatcher
3. lay::Plugin::plugin_root -> lay::Dispatcher *lay::Plugin::dispatcher() DONE 3. lay::Plugin::plugin_root -> lay::Dispatcher *lay::Plugin::dispatcher()
This method will find the MainWindow or LayoutView depending This method will find the MainWindow or LayoutView depending
which is the root. which is the root.
4. Don't use AbstractMenuProvider::instance anymore, rather use lay::Dispatcher::instance DONE 4. Don't use AbstractMenuProvider::instance anymore, rather use lay::Dispatcher::instance
when necessary (should not be) when necessary (should not be)
5. Instead of slots, bind abstract menu items to symbols passed to DONE 5. Instead of slots, bind abstract menu items to symbols passed to
Dispatcher::menu_activated Dispatcher::menu_activated
6. MainWindow will automatically dispatch menu_activated to LayoutView DONE 6. MainWindow will automatically dispatch menu_activated to LayoutView
7. GSI-expose menu_activated in LayoutView and MainWindow DONE 7. GSI-expose menu_activated in LayoutView and MainWindow as "call_menu"
8. We can move menu initialization of LV-specifics to the LayoutView and DONE 8. We can move menu initialization of LV-specifics to the LayoutView and
remove the cm_... and the code which just passes signals to the current view! :) remove the cm_... and the code which just passes signals to the current view! :)
9. BTW: make QWidget::setParent and QObject::setParent transfer ownership for 9. BTW: make QWidget::setParent and QObject::setParent transfer ownership for
@ -28,6 +28,8 @@ Plan:
10. Provide the layer toolbox for GSI 10. Provide the layer toolbox for GSI
11. Tests for new features and GSI tests
Tests: Tests:
- compare menu layout - compare menu layout
- test every menu function - test every menu function
@ -36,4 +38,5 @@ Tests:
- ruby plugin (debugging, re-running) - ruby plugin (debugging, re-running)
- changing of macro title, move macro to different place - changing of macro title, move macro to different place
- funktionieren die check marks vor den menus? (Mode, selection modes, ruler template) - funktionieren die check marks vor den menus? (Mode, selection modes, ruler template)
- check whether there is a replacement for the "cm_..." methods and tests them (at least one)

View File

@ -402,6 +402,11 @@ public:
m_menu_entries.push_back (lay::menu_item (symbol, menu_name, insert_pos, title)); m_menu_entries.push_back (lay::menu_item (symbol, menu_name, insert_pos, title));
} }
void add_menu_entry_copy (const std::string &symbol, const std::string &menu_name, const std::string &insert_pos, const std::string &copy_from)
{
m_menu_entries.push_back (lay::menu_item_copy (symbol, menu_name, insert_pos, copy_from));
}
void add_submenu (const std::string &menu_name, const std::string &insert_pos, const std::string &title) void add_submenu (const std::string &menu_name, const std::string &insert_pos, const std::string &title)
{ {
m_menu_entries.push_back (lay::submenu (menu_name, insert_pos, title)); m_menu_entries.push_back (lay::submenu (menu_name, insert_pos, title));
@ -548,6 +553,14 @@ Class<gsi::PluginFactoryBase> decl_PluginFactory ("lay", "PluginFactory",
"\n" "\n"
"With version 0.27 it's more convenient to use \\add_submenu." "With version 0.27 it's more convenient to use \\add_submenu."
) + ) +
method ("add_menu_item_clone", &gsi::PluginFactoryBase::add_menu_entry_copy, gsi::arg ("symbol"), gsi::arg ("menu_name"), gsi::arg ("insert_pos"), gsi::arg ("copy_from"),
"@brief Specifies a menu item as a clone of another one\n"
"Using this method, a menu item can be made a clone of another entry (given as path by 'copy_from').\n"
"The new item will share the \\Action object with the original one, so manipulating the action will change both the original entry "
"and the new entry.\n"
"\n"
"This method has been introduced in version 0.27."
) +
method ("add_submenu", &gsi::PluginFactoryBase::add_submenu, gsi::arg ("menu_name"), gsi::arg ("insert_pos"), gsi::arg ("title"), method ("add_submenu", &gsi::PluginFactoryBase::add_submenu, gsi::arg ("menu_name"), gsi::arg ("insert_pos"), gsi::arg ("title"),
"@brief Specifies a menu item or sub-menu\n" "@brief Specifies a menu item or sub-menu\n"
"\n" "\n"