예제 #1
0
DataItem JInfoRequest::createDataItem() const
{
	Q_D(const JInfoRequest);
	DataItem item;
	const bool isAccount = qobject_cast<Account*>(object());
	{
		DataItem general(QT_TRANSLATE_NOOP("ContactInfo", "General"));
		// General page
		{
			//// Avatar
			{
				QString photoPath;
				JVCardManager::ensurePhoto(d->vcard->photo(), &photoPath);
				DataItem avatarItem(QLatin1String("avatar"),
									QT_TRANSLATE_NOOP("ContactInfo", "Avatar"),
									QPixmap(photoPath));
				avatarItem.setProperty("imagePath", photoPath);
				avatarItem.setProperty("hideTitle", true);
				avatarItem.setProperty("imageSize", QSize(64, 64));
				avatarItem.setProperty("defaultImage", Icon(QLatin1String("qutim")).pixmap(64));
				general.addSubitem(avatarItem);
			}
			// name
//			QString name = d->vcard->nickname().isEmpty() ? d->vcard->formattedName() : d->vcard->nickname();
			addItemList(Nick, general, d->vcard->nickname());
			addItemList(FirstName, general, d->vcard->name().given());
			addItemList(MiddleName, general, d->vcard->name().middle());
			addItemList(LastName, general, d->vcard->name().family());
			// birthday
			addItem(Birthday, general, d->vcard->birthday().date());
			//// homepage
			addItem(Homepage, general, QVariant::fromValue(d->vcard->url()));
		}
		if (!isAccount) {
		//// telephone
			if (!d->vcard->telephones().empty()) {
				foreach (Jreen::VCard::Telephone phone, d->vcard->telephones())
					addItem(getPhoneType(phone), general, phone.number());
			} else {
				addItem(Phone, general, QString());
			}
		//// email
			if (!d->vcard->emails().empty()) {
				foreach (const Jreen::VCard::EMail &email, d->vcard->emails())
					addItem(getEmailType(email), general,email.userId());
			} else {
				addItem(Email, general, QString());
			}
		}
//============MidiOutputDeviceSelector===========================================
MidiOutputDeviceSelector::MidiOutputDeviceSelector(String name) : ComboBox(name)
{
    // populate self with available devices
    StringArray options = MidiOutput::getDevices();
    addItemList(options, 1);
    addListener(this);
    setSelectedItemIndex(MidiOutput::getDefaultDeviceIndex());
}
//=============MidiInputDeviceSelector============================================
MidiInputDeviceSelector::MidiInputDeviceSelector(String name) : ComboBox(name)
{
    // get list of devices
    StringArray devices = MidiInput::getDevices();
    addItemList(devices, 1);
    addListener(this);
    setSelectedItemIndex(MidiInput::getDefaultDeviceIndex());
}
예제 #4
0
int main()
{
    //Create two lists
    LinkedListP list1 = newList();
    LinkedListP list2 = newList();
    char name[10] = "Diana";

    // Insert three items and print the list
    insertItemList( list1, "Alice" );
    printf("\n\nCurrent item contains  (Alice) %s\n", getItemList(list1));
    insertItemList( list1, "Bob" );
    printf("Current item contains  (Bob)   %s\n", getItemList(list1));
    insertItemList( list1, "Carl" );
    printf("Current item containsj (Carl) %s\n", getItemList(list1));
    displayListForward(list1);
    displayListBackward(list1);
    
    printf("\n\nCurrent item contains  (Carl)  %s\n", getItemList(list1));
    printf("Moving to NEXT item\n");
    nextItemList( list1 );
    printf("Current item contains  (Bob)   %s\n", getItemList( list1 ));

    //Try moving to previous - no change
    printf("moving to PREVIOUS item \n");
    previousItemList( list1 );
    printf("Current item contains  (Carl)  %s\n", getItemList( list1 ));

    //Add three more names into list1
    printf("\n\nAdding three items Don, Eric, Diana\n");
    addItemList( list1, "Don" );
    addItemList( list1, "Eric" );
    addItemList( list1, name );

    //Use the utility function below to display list1 forward
    displayListForward(list1);

    //Change Diana's name
    //Notice that the node is NOT modified
    printf("\nSetting DIANA to DONNY\n");
    strcpy(name, "Donny");
    displayListForward(list1);

    //Insert two more people into list1
    printf("\n\nInserting EARL and FRAN at front of list 10 :\n");
    firstItemList(list1);
    insertItemList( list1, "Earl" );
    insertItemList( list1, "Fran" );
    displayListForward(list1);

    if(isEmptyList(list1)) printf("\n\nList 1 is empty\n");
    else printf("\n\nList 1 is not empty\n");
    if(isEmptyList(list2)) printf("List 2 is empty\n");
    else printf("List 2 is not empty\n");

    //Take three people from list1 and insert into list2
    printf("\n\nRemove 3 from front of list 1 add to list 2\n");
    firstItemList(list1);
    addItemList(list2, removeItemList(list1));
    addItemList(list2, removeItemList(list1));
    addItemList(list2, removeItemList(list1));

    //Use the utility function below to display both lists forward
    printf("\nList 1 Forward\n");
    displayListForward(list1);
    printf("List 1 Forward\n");
    displayListBackward(list1);
    printf("\nList 2 Forward\n");
    displayListForward(list2);
    printf("List 2 Backward\n");
    displayListBackward(list2);

    //Free both lists
    list1 = freeList(list1);
    list2 = freeList(list2);
    if(list1 == NULL) printf("\n\nList 1 is NULL\n");
    else printf("\n\nList 1 is not NULL\n");
    if(list2 == NULL) printf("List 2 is NULL\n");
    else printf("List 2 is not NULL\n");

   return 0;
}