コード例 #1
0
ファイル: directory_tree.cpp プロジェクト: jingqi/organic
void DirectoryTree::init_actions()
{
    PkmPlugin *plugin = dynamic_cast<PkmPlugin*>(get_plugin().pointer());
    assert(NULL != plugin);

    // rename directory
    _rename_action = new QAction(plugin->load_icon("pkm/rename"), tr("重命名(&R)"), this);
    _rename_action->setStatusTip(tr("重命名当前目录"));
    _rename_action->setToolTip(tr("重命名当前目录"));
    connect(_rename_action, SIGNAL(triggered()), this, SLOT(rename_directory()));

    // add brother
    _add_brother_action = new QAction(plugin->load_icon("pkm/add_brother"), tr("添加兄弟节点(&A)"), this);
    _add_brother_action->setStatusTip(tr("为当前目录添加一个兄弟节点"));
    _add_brother_action->setToolTip(tr("为当前目录添加一个兄弟节点"));
    connect(_add_brother_action, SIGNAL(triggered()), this, SLOT(add_brother()));

    // add child
    _add_child_action = new QAction(plugin->load_icon("pkm/add_child"), tr("添加子节点(&A)"), this);
    _add_child_action->setStatusTip(tr("为当前目录添加一个子节点"));
    _add_child_action->setToolTip(tr("为当前目录添加一个子节点"));
    connect(_add_child_action, SIGNAL(triggered()), this, SLOT(add_child()));

    // delete
    _delete_action = new QAction(plugin->load_icon("pkm/delete"), tr("删除(&D)"), this);
    _delete_action->setStatusTip(tr("删除当前目录"));
    _delete_action->setToolTip(tr("删除当前目录"));
    connect(_delete_action, SIGNAL(triggered()), this, SLOT(delete_directory()));

    // import
    _import_action = new QAction(plugin->load_icon("pkm/import_files"), tr("导入"), this);
    _import_action->setStatusTip(tr("导入本地文件"));
    _import_action->setToolTip(tr("导入本地文件"));
    connect(_import_action, SIGNAL(triggered()), this, SLOT(import_from_files()));
}
コード例 #2
0
ファイル: tree.c プロジェクト: pedrocb/Projeto-Compiladores
node add_to_tree(char *label, char *value, int n_children, ...){
  va_list args;
  va_start(args, n_children);

  //create_node
  node n;
  n = (node)malloc(sizeof(struct node_));
  n->label = strdup(label);
  n->child = NULL;
  n->brother = NULL;
  n->type_ = NULL;
  n->reg = NULL;
  if(value == NULL) n->value = value;
  else n->value = strdup(value);

  node t;
  for(int i = 0; i < n_children; i++){
    node b = va_arg(args, node);

    //Discard NULL children
    if(b == NULL)
      continue;

    //Add child
    if(n->child == NULL){
      n->child = b;
      t = b;
    }
    //Add brothers
    else{
      add_brother(t, b);
      t = b;
    }
  }

  va_end(args);
  return n;
}