mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
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>
This commit is contained in:
parent
dbf629331a
commit
5c6f1554ba
@ -568,8 +568,7 @@ void ConfigList::setParentMenu(void)
|
|||||||
* parent: either the menu list widget or a menu entry widget
|
* parent: either the menu list widget or a menu entry widget
|
||||||
* menu: entry to be updated
|
* menu: entry to be updated
|
||||||
*/
|
*/
|
||||||
template <class P>
|
void ConfigList::updateMenuList(ConfigItem *parent, struct menu* menu)
|
||||||
void ConfigList::updateMenuList(P* parent, struct menu* menu)
|
|
||||||
{
|
{
|
||||||
struct menu* child;
|
struct menu* child;
|
||||||
ConfigItem* item;
|
ConfigItem* item;
|
||||||
@ -578,6 +577,11 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
|
|||||||
enum prop_type type;
|
enum prop_type type;
|
||||||
|
|
||||||
if (!menu) {
|
if (!menu) {
|
||||||
|
while (parent->childCount() > 0)
|
||||||
|
{
|
||||||
|
delete parent->takeChild(0);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -629,6 +633,71 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConfigList::updateMenuList(ConfigList *parent, struct menu* menu)
|
||||||
|
{
|
||||||
|
struct menu* child;
|
||||||
|
ConfigItem* item;
|
||||||
|
ConfigItem* last;
|
||||||
|
bool visible;
|
||||||
|
enum prop_type type;
|
||||||
|
|
||||||
|
if (!menu) {
|
||||||
|
while (parent->topLevelItemCount() > 0)
|
||||||
|
{
|
||||||
|
delete parent->takeTopLevelItem(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
last = (ConfigItem*)parent->topLevelItem(0);
|
||||||
|
if (last && !last->goParent)
|
||||||
|
last = 0;
|
||||||
|
for (child = menu->list; child; child = child->next) {
|
||||||
|
item = last ? last->nextSibling() : (ConfigItem*)parent->topLevelItem(0);
|
||||||
|
type = child->prompt ? child->prompt->type : P_UNKNOWN;
|
||||||
|
|
||||||
|
switch (mode) {
|
||||||
|
case menuMode:
|
||||||
|
if (!(child->flags & MENU_ROOT))
|
||||||
|
goto hide;
|
||||||
|
break;
|
||||||
|
case symbolMode:
|
||||||
|
if (child->flags & MENU_ROOT)
|
||||||
|
goto hide;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
visible = menu_is_visible(child);
|
||||||
|
if (!menuSkip(child)) {
|
||||||
|
if (!child->sym && !child->list && !child->prompt)
|
||||||
|
continue;
|
||||||
|
if (!item || item->menu != child)
|
||||||
|
item = new ConfigItem(parent, last, child, visible);
|
||||||
|
else
|
||||||
|
item->testUpdateMenu(visible);
|
||||||
|
|
||||||
|
if (mode == fullMode || mode == menuMode || type != P_MENU)
|
||||||
|
updateMenuList(item, child);
|
||||||
|
else
|
||||||
|
updateMenuList(item, 0);
|
||||||
|
last = item;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
hide:
|
||||||
|
if (item && item->menu == child) {
|
||||||
|
last = (ConfigItem*)parent->topLevelItem(0);
|
||||||
|
if (last == item)
|
||||||
|
last = 0;
|
||||||
|
else while (last->nextSibling() != item)
|
||||||
|
last = last->nextSibling();
|
||||||
|
delete item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ConfigList::keyPressEvent(QKeyEvent* ev)
|
void ConfigList::keyPressEvent(QKeyEvent* ev)
|
||||||
{
|
{
|
||||||
QTreeWidgetItem* i = currentItem();
|
QTreeWidgetItem* i = currentItem();
|
||||||
|
@ -102,8 +102,8 @@ public:
|
|||||||
|
|
||||||
bool menuSkip(struct menu *);
|
bool menuSkip(struct menu *);
|
||||||
|
|
||||||
template <class P>
|
void updateMenuList(ConfigItem *parent, struct menu*);
|
||||||
void updateMenuList(P*, struct menu*);
|
void updateMenuList(ConfigList *parent, struct menu*);
|
||||||
|
|
||||||
bool updateAll;
|
bool updateAll;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user