kwave  18.07.70
MenuList.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  MenuList.cpp - placeholder for a list of menu entries
3  -------------------
4  begin : Wed Dec 03 2014
5  copyright : (C) 2014 by Thomas Eschenbacher
6  email : Thomas.Eschenbacher@gmx.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #include "config.h"
19 
20 #include "libkwave/String.h"
21 
22 #include "libgui/MenuList.h"
23 
24 //*****************************************************************************
26  const QString &command,
27  const QString &uid)
28  :MenuNode(parent, _("LISTENTRY[") + uid + _("]"), command, 0, uid)
29 {
30  /* NOTE: the "name" of this node is the uid of the list entries */
31 }
32 
33 //*****************************************************************************
35 {
36 }
37 
38 //*****************************************************************************
40 {
41  Kwave::MenuNode *parent = parentNode();
42  Q_ASSERT(parent);
43  if (!parent) return;
44 
45  QString list_uid = name();
46  Kwave::MenuNode *child;
47  while ((child = parent->findUID(list_uid)) != Q_NULLPTR)
48  parent->removeChild(child);
49 }
50 
51 //*****************************************************************************
53  const QString &command,
54  const QKeySequence &shortcut,
55  const QString &uid)
56 {
57  Q_UNUSED(uid);
58 
59  Kwave::MenuNode *parent = parentNode();
60  Q_ASSERT(parent);
61  QString list_uid = this->name();
62  return (parent) ?
63  parent->insertLeaf(name, command, shortcut, list_uid) : Q_NULLPTR;
64 }
65 
66 //*****************************************************************************
67 //*****************************************************************************
virtual Kwave::MenuNode * parentNode() const
Definition: MenuNode.cpp:103
virtual ~MenuList() Q_DECL_OVERRIDE
Definition: MenuList.cpp:34
Kwave::MenuNode * findUID(const QString &uid)
Definition: MenuNode.cpp:198
const QKeySequence & shortcut() const
Definition: MenuNode.h:95
virtual void removeChild(Kwave::MenuNode *child)
Definition: MenuNode.cpp:223
virtual void clear() Q_DECL_OVERRIDE
Definition: MenuList.cpp:39
const QString & name() const
Definition: MenuNode.h:74
const QString & command() const
Definition: MenuNode.h:77
MenuList(Kwave::MenuNode *parent, const QString &command, const QString &uid)
Definition: MenuList.cpp:25
#define _(m)
Definition: memcpy.c:66
const QString & uid() const
Definition: MenuNode.h:85
virtual Kwave::MenuNode * insertLeaf(const QString &name, const QString &command, const QKeySequence &shortcut, const QString &uid)
Definition: MenuNode.cpp:243
virtual Kwave::MenuNode * insertLeaf(const QString &name, const QString &command, const QKeySequence &shortcut, const QString &uid) Q_DECL_OVERRIDE
Definition: MenuList.cpp:52