示例#1
0
WidgetBox::WidgetBox(QWidget * parent):QDialog(parent)
{
	setFixedSize(200,250);
	setModal(true);
	setWindowTitle(tr("Select Widgets"));

	 _model = new QStandardItemModel();

	QStandardItem *parentItem = _model->invisibleRootItem();
	appendItem(*StringConstants::WIDGET1,parentItem);
	appendItem(*StringConstants::WIDGET2,parentItem);
	appendItem(*StringConstants::WIDGET3,parentItem);
	appendItem(*StringConstants::WIDGET4,parentItem);
	_listView= new QListView();
	_listView->setModel(_model);

	_listView->setSelectionBehavior(QAbstractItemView::SelectRows);

	QVBoxLayout * vlayout = new QVBoxLayout();
	QPushButton *btn = new QPushButton();
	btn->setText(tr("ok"));

	connect(btn,&QPushButton::clicked,this,&WidgetBox::getSelectedWidget);

	vlayout->addWidget(_listView);
	vlayout->addWidget(btn);
	this->setLayout(vlayout);
}
示例#2
0
BuddyListGroup::GroupContextMenu::GroupContextMenu(
    BuddyListGroup& parent_group_)
: ContextMenu(parent_group_), parent_group(&parent_group_)
{
  appendExtendedMenu();

  appendItem(_("Rename..."), sigc::mem_fun(this,
        &GroupContextMenu::onRename));
  appendItem(_("Delete..."), sigc::mem_fun(this,
        &GroupContextMenu::onRemove));

  if (BUDDYLIST->getGroupSortMode() == BuddyList::GROUP_SORT_BY_USER) {
    /* If the manual sorting is enabled then show a menu item and a submenu
     * for group moving. */
    CppConsUI::MenuWindow *groups = new CppConsUI::MenuWindow(*this, AUTOSIZE,
        AUTOSIZE);

    groups->appendItem(_("-Top-"), sigc::bind(
          sigc::mem_fun(this, &GroupContextMenu::onMoveAfter),
          static_cast<PurpleGroup*>(NULL)));
    for (PurpleBlistNode *node = purple_blist_get_root(); node;
        node = purple_blist_node_get_sibling_next(node)) {
      if (!PURPLE_BLIST_NODE_IS_GROUP(node))
        continue;

      PurpleGroup *group = PURPLE_GROUP(node);
      groups->appendItem(purple_group_get_name(group), sigc::bind(
            sigc::mem_fun(this, &GroupContextMenu::onMoveAfter), group));
    }

    appendSubMenu(_("Move after..."), *groups);
  }
}
示例#3
0
bool KOfficePlugin::readInfo( KFileMetaInfo& info, uint what)
{
    if ( info.path().isEmpty() ) // remote file
        return false;

    KFileMetaInfoGroup group = appendGroup(info, "DocumentInfo");

    KoStore* store = KoStore::createStore(info.path(), KoStore::Read);
    if ( store && store->open( QString("documentinfo.xml") ) )
    {
        KoStoreDevice dev( store );
        QDomDocument doc;
        doc.setContent( &dev );

        QDomNode authorNode = doc.namedItem("document-info").namedItem("author");
        QDomNode aboutNode = doc.namedItem("document-info").namedItem("about");

        QString author = stringFromNode(authorNode, "full-name");
        QString title = stringFromNode(aboutNode, "title");
        QString abstract = stringFromNode(aboutNode, "abstract");

        appendItem(group, "Author", author);
        appendItem(group, "Title", title);
        appendItem(group, "Abstract", abstract);

        store->close();
        delete store;
        return true;
    }
    delete store;
    return false;
}
示例#4
0
文件: action.cpp 项目: ArildF/masters
void
appendPseudoTargetList(
    STRINGLIST **pseudo,
    STRINGLIST *list
    )
{
    STRINGLIST  *p, *q, *r;
    char *t, *u;

    while ((p = list)) {
        if (!_tcschr(p->text, '$')) {
            list = list->next;
            p->next = NULL;
            appendItem(pseudo, p);
        } else {
            r = macros;
            t = expandMacros(p->text, &macros);
            while (r != macros) {
                q = r->next;
                FREE_STRINGLIST(r);
                r = q;
            }
            for (u = _tcstok(t, " \t"); u; u = _tcstok(NULL, " \t")) {
                q = makeNewStrListElement();
                q->text = makeString(u);
                appendItem(pseudo, q);
            }
            FREE(t);
            FREE(p->text);
            list = list->next;
            FREE_STRINGLIST(p);
        }
    }
}
示例#5
0
BuddyListChat::ChatContextMenu::ChatContextMenu(BuddyListChat& parent_chat_)
: ContextMenu(parent_chat_), parent_chat(&parent_chat_)
{
  appendProtocolMenu(purple_account_get_connection(
          purple_chat_get_account(parent_chat->getPurpleChat())));
  appendExtendedMenu();

  appendItem(_("Alias..."), sigc::mem_fun(this,
        &ChatContextMenu::onChangeAlias));
  appendItem(_("Delete..."), sigc::mem_fun(this,
        &ChatContextMenu::onRemove));
}
示例#6
0
BuddyListBuddy::BuddyContextMenu::BuddyContextMenu(
    BuddyListBuddy& parent_buddy_)
: ContextMenu(parent_buddy_), parent_buddy(&parent_buddy_)
{
  appendProtocolMenu(purple_account_get_connection(
          purple_buddy_get_account(parent_buddy->getPurpleBuddy())));
  appendExtendedMenu();

  appendItem(_("Information..."), sigc::mem_fun(this,
        &BuddyContextMenu::onInformation));
  appendItem(_("Alias..."), sigc::mem_fun(this,
        &BuddyContextMenu::onChangeAlias));
  appendItem(_("Delete..."), sigc::mem_fun(this,
        &BuddyContextMenu::onRemove));
}
示例#7
0
文件: action.cpp 项目: ArildF/masters
void
makeTarget(
    char *s,
    BOOL firstTarg,
    BUILDBLOCK **block
    )
{
    BUILDLIST  *build;
    MAKEOBJECT *object;

    if (!*block)
        *block = makeNewBuildBlock();

    if (firstTarg) {
        build = makeNewBldListElement();
        build->buildBlock = *block;
    } else
        build = makeBuildList(*block);

    if ((object = findTarget(s))) {
        if (ON(object->flags2, F2_DOUBLECOLON) != ON(currentFlags, F2_DOUBLECOLON))
            makeError(currentLine, MIXED_SEPARATORS);
        appendItem((STRINGLIST**)&(object->buildList), (STRINGLIST*)build);
        FREE(s);
    } else {
        build->next = NULL;
        object = makeNewObject();
        object->name = s;
        object->buildList = build;
        object->flags2 = currentFlags;
        prependItem((STRINGLIST**)targetTable+hash(s, MAXTARGET, (BOOL)TRUE),
                    (STRINGLIST*)object);
    }
}
示例#8
0
文件: dma_sdmmc.c 项目: stxent/halm
/*----------------------------------------------------------------------------*/
static void channelAppend(void *object, void *destination, const void *source,
    size_t size)
{
  struct DmaSdmmc * const channel = object;
  LPC_SDMMC_Type * const reg = channel->reg;

  assert(size);
  assert(size <= channel->capacity * DESC_SIZE_MAX);
  assert(!destination ^ !source);

  const uintptr_t address = destination != 0 ?
      (uintptr_t)destination : (uintptr_t)source;

  /* Address and size must be aligned along 4-byte boundary */
  assert(address % 4 == 0);
  assert(size % 4 == 0);

  /* Reset DMA */
  reg->CTRL |= CTRL_DMA_RESET | CTRL_FIFO_RESET;
  while (reg->CTRL & (CTRL_DMA_RESET | CTRL_FIFO_RESET));

  size_t offset = 0;

  channel->length = 0;
  while (offset < size)
  {
    const size_t chunkLength = MIN(size - offset, DESC_SIZE_MAX);

    appendItem(channel, address + offset, chunkLength);
    offset += chunkLength;
  }
}
bool AMActionHistoryModel3::logCompletedAction(const AMAction3 *completedAction, AMDatabase *database, int parentLogId){
	if(completedAction && completedAction->inFinalState()) {

		if(database == AMDatabase::database("scanActions") && AMActionRunner3::scanActionRunner()->cachedLogCount() > 200){
			database->commitTransaction();
			AMActionRunner3::scanActionRunner()->resetCachedLogCount();
		}
		if(database == AMDatabase::database("scanActions")){
			if(!database->transactionInProgress())
				database->startTransaction();
			AMActionRunner3::scanActionRunner()->incrementCachedLogCount();
		}

		AMActionLog3 actionLog(completedAction);
		actionLog.setParentId(parentLogId);
		if(actionLog.storeToDb(database)){
			AMActionLogItem3* item = new AMActionLogItem3(actionLog);
			emit modelAboutToBeRefreshed();
			/// \todo Ordering... This may end up at the wrong spot until a full refresh is done.  Most of the time, any actions added will be the most recent ones, however that is not guaranteed.
			appendItem(item);
			visibleActionsCount_++;
			emit modelRefreshed();

			return true;
		}
		return false;
	}
	else {
		return false;
	}
}
示例#10
0
void SeafileModel::onFile(QSharedPointer<SeafileFile> file)
{
    Item::Ptr item ( new Item);
    if(file->isRepo){
        QSharedPointer<SeafileLibrary> lib (qSharedPointerCast<SeafileLibrary>(file));
        item->name = lib->id;
        if (!m_libraries.contains(lib->id)) {
            m_libraries.insert(lib->id, lib);
            qDebug() << "Adding library" << lib->id << lib->name;
        }
    } else {
        item->name = file->name;
    }

    if(file->isDir) {
        item->type = Folder;
    } else {
        item->type = File;
    }
    item->friendlyName = file->name;
    if(file->path() == currentPath){
        appendItem(item);
    } else {
        qWarning () << "ignoring file outside current dir: "  <<  file->path();
    }
}
示例#11
0
void IntPropChioce::init( int numSet , int const valueSet[] , char const* strSet[] )
{
	for( int i = 0 ; i < numSet ; ++i )
	{
		unsigned pos = appendItem( strSet[i] );
		setItemData( pos , (void*)valueSet[i] );
	}
}
示例#12
0
void SVGStringList::reset(const String& str)
{
    ExceptionCode ec = 0;

    parse(str, ' ');
    if (numberOfItems() == 0)
        appendItem(String(""), ec); // Create empty string...
}
示例#13
0
void ConsoleItemModel::shiftEditableRow()
{
    int position = rootItem()->childCount();
    Q_ASSERT(position > 0);

    appendItem(new ConsoleItem(ConsoleItem::InputType), position);
    emit selectEditableRow(index(position, 0, QModelIndex()), QItemSelectionModel::ClearAndSelect);
}
示例#14
0
void WSimpleThingContainer::appendThing(const hacc::TDBID &thingID, const hacc::TDBID &thingIconID,
                                     const QString &thingName, const hacc::TDBID &manufacturerID,
                                     const hacc::TDBID &manufacturerIconID, const QString &manufacturerName)
{
    WSimpleThingItem *i = new WSimpleThingItem(thingID, manufacturerID);
    i->setThingData(thingIconID, thingName);
    i->setManufacturerData(manufacturerIconID, manufacturerName);
    appendItem(i);
}
示例#15
0
int SkOSMenu::appendSlider(const char label[], const char slotName[],
                           SkEventSinkID target, SkScalar min, SkScalar max,
                           SkScalar defaultValue) {
    SkEvent* evt = new SkEvent(gMenuEventType, target);
    evt->setScalar(gSlider_Min_Scalar, min);
    evt->setScalar(gSlider_Max_Scalar, max);
    evt->setScalar(slotName, defaultValue);
    return appendItem(label, SkOSMenu::kSlider_Type, slotName, evt);
}
示例#16
0
void KOfficePlugin::addAttributeInfo(const QDomElement & elem, KFileMetaInfoGroup & group, const QString &attributeName)
{
  if (!elem.hasAttribute(attributeName)){
  	return;
  }
  QString m_attribute = elem.attribute(attributeName, "0");
  if (m_attribute == "0")
	  return;
  appendItem(group, attributeName, m_attribute);
}
示例#17
0
PassRefPtr<SVGTransform> SVGTransformList::consolidate()
{
    AffineTransform matrix;
    if (!concatenate(matrix))
        return SVGTransform::create();

    RefPtr<SVGTransform> transform = SVGTransform::create(matrix);
    clear();
    return appendItem(transform);
}
void QmlConsoleItemModel::shiftEditableRow()
{
    int position = rootItem()->childCount();
    Q_ASSERT(position > 0);

    // Disable editing for old editable row
    rootItem()->lastChild()->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);

    appendItem(new ConsoleItem(ConsoleItem::InputType), position);
    emit selectEditableRow(index(position, 0, QModelIndex()), QItemSelectionModel::ClearAndSelect);
}
示例#19
0
void ContextMenu::addInspectElementItem()
{
    Node* node = m_hitTestResult.innerNonSharedNode();
    if (!node)
        return;

    Frame* frame = node->document()->frame();
    if (!frame)
        return;

    Page* page = frame->page();
    if (!page)
        return;

    if (!page->inspectorController())
        return;

    ContextMenuItem InspectElementItem(ActionType, ContextMenuItemTagInspectElement, contextMenuItemTagInspectElement());
    appendItem(*separatorItem());
    appendItem(InspectElementItem);
}
示例#20
0
void KOfficePlugin::getEditingTime(KFileMetaInfoGroup group1,
		                   const char * labelid, QString & txt){
	QString t;
	int days = 0;
	int hours = 0;
	int minutes = 0;
	int seconds = 0;
	if (txt.at(0) != 'P'){
		kdDebug(7034) << labelid << "=" << txt <<
			" does not seems to be a valid duration" << endl;
		return;
	}
	int pos = 1;
	if (txt.at(pos).isNumber()){
		days = getNumber(txt, &pos);
		if (txt.at(pos++)!='D'){
			days=0;
			kdDebug(7034) << labelid <<
				" First arg was not a day in " << txt << endl;
		}
	}
	if (txt.at(pos)!= 'T'){
		kdDebug(7034) << labelid << "=" << txt <<
			" does not seems to contain time information" << endl;
		return;
	}
	pos++;
	int len = txt.length();
	while (pos < len){
		int res = getNumber(txt, &pos);
		if (pos >= len)
			return;
		switch (txt.at(pos).latin1()){
			case 'H':
				hours = res;
				break;
			case 'M':
				minutes = res;
				break;
			case 'S':
				seconds = res;
				break;
			default:
				kdDebug(7034) << "Unknown unit at pos " << pos << " while parsing " <<
					labelid << "="<< txt << endl;
		}
		pos++;
	}
	hours += days * 24;
	appendItem(group1, labelid,
		   i18n("%1:%2.%3").arg(hours).arg(minutes, 2).arg(seconds,2 ));
}
示例#21
0
BuddyListContact::ContactContextMenu::ContactContextMenu(
    BuddyListContact& parent_contact_)
: ContextMenu(parent_contact_), parent_contact(&parent_contact_)
{
  appendExtendedMenu();

  if (parent_contact->isCollapsed())
    appendItem(_("Expand"), sigc::bind(sigc::mem_fun(this,
            &ContactContextMenu::onExpandRequest), true));
  else
    appendItem(_("Collapse"), sigc::bind(sigc::mem_fun(this,
            &ContactContextMenu::onExpandRequest), false));

  appendItem(_("Information..."), sigc::mem_fun(this,
        &ContactContextMenu::onInformation));
  appendItem(_("Alias..."), sigc::mem_fun(this,
        &ContactContextMenu::onChangeAlias));
  appendItem(_("Delete..."), sigc::mem_fun(this,
        &ContactContextMenu::onRemove));

  CppConsUI::MenuWindow *groups = new CppConsUI::MenuWindow(*this, AUTOSIZE,
      AUTOSIZE);

  for (PurpleBlistNode *node = purple_blist_get_root(); node;
      node = purple_blist_node_get_sibling_next(node)) {
    if (!PURPLE_BLIST_NODE_IS_GROUP(node))
      continue;

    PurpleGroup *group = PURPLE_GROUP(node);
    CppConsUI::Button *button = groups->appendItem(
        purple_group_get_name(group), sigc::bind(sigc::mem_fun(this,
            &ContactContextMenu::onMoveTo), group));
    if (purple_contact_get_group(parent_contact->getPurpleContact())
        == group)
      button->grabFocus();
  }

  appendSubMenu(_("Move to..."), *groups);
}
示例#22
0
int
registerAsyncIO( int fd, void (*program)() )
{
	AIOE		thisEntry;

	if (pRegisterAsync == NULL) {
		registerAsyncHandlers(
			SIGIO,
			sigio_irpt,
			processIOEntry
		);
	}

	thisEntry = (AIOE) malloc( sizeof( struct async_io_entry ) );
	if (thisEntry == NULL)
	  return( -1 );

	thisEntry->fd = fd;
	thisEntry->program = program;

/*  If there is no entry with this file descriptor, then add thisEntry to the list.
    If there is an entry, test if the associated programs are identical.  If not,
    delete the old entry and append the new entry.  (No action required if the old
    entry references the same program as the one referenced in the argument list.)

    You can just use the free program directly as the destructor.  See deleteEntry.	*/

	if (searchItem( pRegisterAsync, thisEntry, cmp_fd ) < 0) {
		pRegisterAsync = appendItem( pRegisterAsync, thisEntry );
	}
	else {
		if (searchItem( pRegisterAsync, thisEntry, cmp_async_io_entry ) >= 0)
		  return( 0 );

		pRegisterAsync = deleteItem( pRegisterAsync, thisEntry, cmp_fd, free );
		pRegisterAsync = appendItem( pRegisterAsync, thisEntry );
	}
}
示例#23
0
文件: main.c 项目: HanLee/Linked-List
int main()
{
	List *list = makeList();
	initialiseList(list);

	int i;
	for(i=0; i<10; i++)
	{
		appendItem(list, i);
	}

	printf("end!\n");
	printList(list);
	return 0;
}
示例#24
0
void SVGNumberList::parse(const String& value)
{
    ExceptionCode ec = 0;

    double number = 0;
   
    const UChar* ptr = value.characters();
    const UChar* end = ptr + value.length();
    // The spec strangely doesn't allow leading whitespace.  We might choose to violate that intentionally. (section 4.1)
    while (ptr < end) {
        if (!parseNumber(ptr, end, number))
            return;
        appendItem(number, ec);
    }
}
示例#25
0
GeneralMenu::GeneralMenu()
: MenuWindow(0, 0, AUTOSIZE, AUTOSIZE)
{
  setColorScheme("generalmenu");

  appendItem(_("Change status"), sigc::mem_fun(this,
        &GeneralMenu::openStatusWindow));
  appendItem(_("Accounts..."), sigc::mem_fun(this,
        &GeneralMenu::openAccountWindow));
  appendItem(_("Add buddy..."), sigc::mem_fun(this,
        &GeneralMenu::openAddBuddyRequest));
  appendItem(_("Add chat..."), sigc::mem_fun(this,
        &GeneralMenu::openAddChatRequest));
  appendItem(_("Add group..."), sigc::mem_fun(this,
        &GeneralMenu::openAddGroupRequest));
  appendItem(_("Pending requests..."), sigc::mem_fun(this,
        &GeneralMenu::openPendingRequests));
  appendItem(_("Config options..."), sigc::mem_fun(this,
        &GeneralMenu::openOptionWindow));
  appendItem(_("Plugins..."), sigc::mem_fun(this,
        &GeneralMenu::openPluginWindow));
  appendSeparator();
#ifdef DEBUG
  MenuWindow *submenu = new MenuWindow(0, 0, AUTOSIZE, AUTOSIZE);
  submenu->setColorScheme("generalmenu");
  submenu->appendItem("Request input", sigc::mem_fun(this,
        &GeneralMenu::openRequestInputTest));
  submenu->appendItem("Request choice", sigc::mem_fun(this,
        &GeneralMenu::openRequestChoiceTest));
  submenu->appendItem("Request action", sigc::mem_fun(this,
        &GeneralMenu::openRequestActionTest));
  submenu->appendItem("Request fields", sigc::mem_fun(this,
        &GeneralMenu::openRequestFieldsTest));
  appendSubMenu("Debug...", *submenu);
  appendSeparator();
#endif // DEBUG
  appendItem(_("Quit"), sigc::hide(sigc::mem_fun(CENTERIM,
          &CenterIM::quit)));
}
示例#26
0
void SVGLengthList::parse(const String& value, const SVGStyledElement* context, SVGLengthMode mode)
{
    ExceptionCode ec = 0;
    clear(ec);

    const UChar* ptr = value.characters();
    const UChar* end = ptr + value.length();
    while (ptr < end) {
        const UChar* start = ptr;
        while (ptr < end && *ptr != ',' && !isWhitespace(*ptr))
            ptr++;
        if (ptr == start)
            break;
        appendItem(SVGLength(context, mode, String(start, ptr - start)), ec);
        skipOptionalSpacesOrDelimiter(ptr, end);
    }
}
示例#27
0
void lruCacheSet(int key, int value) {
    struct LRUItem * foundItem = lruCacheFind(key);
    if (foundItem == NULL) {
        // It's a new key.
        if (mCacheSize < mCapacity) {
            // The cache list capacity is not full, append a new item to head only.
            appendItem(key, value);
        }
        else {
            // The cache list capacity is full, must be eliminate a item.
            eliminateItem(key, value);
        }
    }
    else {
        // Pickup the item to head.
        pickupItem(foundItem, value);
    }
}
示例#28
0
void TodoView::newTodo()
{
  QString tmpStr;
  KDPEvent *newEvent;

  newEvent = new KDPEvent;

  newEvent->setStatus(QString("NEEDS ACTION"));
  newEvent->setPriority(1);
  calendar->addTodo(newEvent);

  tmpStr.sprintf("%i\n",newEvent->getEventId());
  tmpStr += "EMPTY\n0\n \n ";
  appendItem(tmpStr.data());
  repaint();
  setCurrentItem(numRows()-1);
  updateItem(currentItem(), 3);
}
示例#29
0
void SVGStringList::parse(const String& data, UChar delimiter)
{
    // TODO : more error checking/reporting
    ExceptionCode ec = 0;
    clear(ec);

    const UChar* ptr = data.characters();
    const UChar* end = ptr + data.length();
    while (ptr < end) {
        const UChar* start = ptr;
        while (ptr < end && *ptr != delimiter && !isWhitespace(*ptr))
            ptr++;
        if (ptr == start)
            break;
        appendItem(String(start, ptr - start), ec);
        skipOptionalSpacesOrDelimiter(ptr, end, delimiter);
    }
}
示例#30
0
文件: action.cpp 项目: ArildF/masters
void
addItemToList()
{
    STRINGLIST *p;                  // from lexer
    STRINGLIST *NewList;

    if (name) {
        SET(actionFlags, A_TARGET);
        startNameList();
        name = NULL;
    }
    if (ON(actionFlags, A_TARGET)) {
        if (isRule(buf)) {
            if (ON(actionFlags, A_RULE))
                makeError(currentLine, TOO_MANY_RULE_NAMES);
            makeError(currentLine, MIXED_RULES);
        }
    }
    p = makeNewStrListElement();
    if (ON(actionFlags, A_STRING)) {    // we collect macros
        p->text = string;               // for dependents &
        string = NULL;                  // build lines for
    } else                              // non-implicit rules
        p->text = makeString(buf);

    NewList = p;                        // build lines for
    if (OFF(actionFlags, A_RULE)        // rules get expanded
        || ON(actionFlags, A_TARGET))   // after entire make-
    {
        findMacroValues(p->text, &macros, NULL, NULL, 0, 0, 0); //  file parsed
    }

    if (ON(actionFlags, A_TARGET)) {
        p = macros;
        expandFileNames("$", &NewList, &macros);
        expandFileNames("*?", &NewList, NULL);
        while ((macros = p)) {
            p = p->next;
            FREE_STRINGLIST(macros);
        }
    }

    appendItem(&list, NewList);
}