diff options
author | Boris Barbulovski <bbarbulovski@gmail.com> | 2015-09-22 14:36:27 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.com> | 2015-10-14 08:59:03 -0400 |
commit | 5c6f1554ba7f79fedebd3500741027dbb9b6dc79 (patch) | |
tree | dea961375ea88b5489d4d2883e12848bb1b64d76 /scripts | |
parent | dbf629331ac8e9458bb5fb1ccd5b850f3f2f94b6 (diff) |
Port xconfig to Qt5 - Remove ConfigList::updateMenuList template.
ConfigItem executes parent->takeChild(0)
while
ConfigList executes parent->takeTopLevelItem(0)
Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
Signed-off-by: Michal Marek <mmarek@suse.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/kconfig/qconf.cc | 73 | ||||
-rw-r--r-- | scripts/kconfig/qconf.h | 4 |
2 files changed, 73 insertions, 4 deletions
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 168f0cccc076..f54f19f55bdb 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc | |||
@@ -568,8 +568,7 @@ void ConfigList::setParentMenu(void) | |||
568 | * parent: either the menu list widget or a menu entry widget | 568 | * parent: either the menu list widget or a menu entry widget |
569 | * menu: entry to be updated | 569 | * menu: entry to be updated |
570 | */ | 570 | */ |
571 | template <class P> | 571 | void ConfigList::updateMenuList(ConfigItem *parent, struct menu* menu) |
572 | void ConfigList::updateMenuList(P* parent, struct menu* menu) | ||
573 | { | 572 | { |
574 | struct menu* child; | 573 | struct menu* child; |
575 | ConfigItem* item; | 574 | ConfigItem* item; |
@@ -578,6 +577,11 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu) | |||
578 | enum prop_type type; | 577 | enum prop_type type; |
579 | 578 | ||
580 | if (!menu) { | 579 | if (!menu) { |
580 | while (parent->childCount() > 0) | ||
581 | { | ||
582 | delete parent->takeChild(0); | ||
583 | } | ||
584 | |||
581 | return; | 585 | return; |
582 | } | 586 | } |
583 | 587 | ||
@@ -629,6 +633,71 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu) | |||
629 | } | 633 | } |
630 | } | 634 | } |
631 | 635 | ||
636 | void ConfigList::updateMenuList(ConfigList *parent, struct menu* menu) | ||
637 | { | ||
638 | struct menu* child; | ||
639 | ConfigItem* item; | ||
640 | ConfigItem* last; | ||
641 | bool visible; | ||
642 | enum prop_type type; | ||
643 | |||
644 | if (!menu) { | ||
645 | while (parent->topLevelItemCount() > 0) | ||
646 | { | ||
647 | delete parent->takeTopLevelItem(0); | ||
648 | } | ||
649 | |||
650 | return; | ||
651 | } | ||
652 | |||
653 | last = (ConfigItem*)parent->topLevelItem(0); | ||
654 | if (last && !last->goParent) | ||
655 | last = 0; | ||
656 | for (child = menu->list; child; child = child->next) { | ||
657 | item = last ? last->nextSibling() : (ConfigItem*)parent->topLevelItem(0); | ||
658 | type = child->prompt ? child->prompt->type : P_UNKNOWN; | ||
659 | |||
660 | switch (mode) { | ||
661 | case menuMode: | ||
662 | if (!(child->flags & MENU_ROOT)) | ||
663 | goto hide; | ||
664 | break; | ||
665 | case symbolMode: | ||
666 | if (child->flags & MENU_ROOT) | ||
667 | goto hide; | ||
668 | break; | ||
669 | default: | ||
670 | break; | ||
671 | } | ||
672 | |||
673 | visible = menu_is_visible(child); | ||
674 | if (!menuSkip(child)) { | ||
675 | if (!child->sym && !child->list && !child->prompt) | ||
676 | continue; | ||
677 | if (!item || item->menu != child) | ||
678 | item = new ConfigItem(parent, last, child, visible); | ||
679 | else | ||
680 | item->testUpdateMenu(visible); | ||
681 | |||
682 | if (mode == fullMode || mode == menuMode || type != P_MENU) | ||
683 | updateMenuList(item, child); | ||
684 | else | ||
685 | updateMenuList(item, 0); | ||
686 | last = item; | ||
687 | continue; | ||
688 | } | ||
689 | hide: | ||
690 | if (item && item->menu == child) { | ||
691 | last = (ConfigItem*)parent->topLevelItem(0); | ||
692 | if (last == item) | ||
693 | last = 0; | ||
694 | else while (last->nextSibling() != item) | ||
695 | last = last->nextSibling(); | ||
696 | delete item; | ||
697 | } | ||
698 | } | ||
699 | } | ||
700 | |||
632 | void ConfigList::keyPressEvent(QKeyEvent* ev) | 701 | void ConfigList::keyPressEvent(QKeyEvent* ev) |
633 | { | 702 | { |
634 | QTreeWidgetItem* i = currentItem(); | 703 | QTreeWidgetItem* i = currentItem(); |
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index d1383c6692d9..d86ae3c26979 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h | |||
@@ -102,8 +102,8 @@ public: | |||
102 | 102 | ||
103 | bool menuSkip(struct menu *); | 103 | bool menuSkip(struct menu *); |
104 | 104 | ||
105 | template <class P> | 105 | void updateMenuList(ConfigItem *parent, struct menu*); |
106 | void updateMenuList(P*, struct menu*); | 106 | void updateMenuList(ConfigList *parent, struct menu*); |
107 | 107 | ||
108 | bool updateAll; | 108 | bool updateAll; |
109 | 109 | ||