Ejemplo n.º 1
0
void ThingTypeManager::loadOtb(const std::string& file)
{
    FileStreamPtr fin = g_resources.openFile(file);

    uint signature = fin->getU32();
    if(signature != 0)
        stdext::throw_exception("invalid otb file");

    BinaryTreePtr root = fin->getBinaryTree();

    signature = root->getU32();
    if(signature != 0)
        stdext::throw_exception("invalid otb file");

    root->getU32(); // flags

    m_otbMajorVersion = root->getU32();
    m_otbMinorVersion = root->getU32();
    root->getU32(); // build number
    root->skip(128); // description

    m_itemTypes.resize(root->getChildren().size(), m_nullItemType);
    for(const BinaryTreePtr& node : root->getChildren()) {
        ItemTypePtr itemType(new ItemType);
        itemType->unserialize(node);
        addItemType(itemType);
    }

    m_otbLoaded = true;
}
Ejemplo n.º 2
0
void QtFallbackWebPopup::populate()
{
    m_combo->clear();

    QStandardItemModel* model = qobject_cast<QStandardItemModel*>(m_combo->model());
    Q_ASSERT(model);

#if !defined(Q_WS_S60)
    m_combo->setFont(font());
#endif
    for (int i = 0; i < itemCount(); ++i) {
        switch (itemType(i)) {
        case Separator:
            m_combo->insertSeparator(i);
            break;
        case Group:
            m_combo->insertItem(i, itemText(i));
            model->item(i)->setEnabled(false);
            break;
        case Option:
            m_combo->insertItem(i, itemText(i));
            model->item(i)->setEnabled(itemIsEnabled(i));
            break;
        }
    }
}
Ejemplo n.º 3
0
int QMDEGalleryCategoryResultSet::appendScopeCondition(
    CMdELogicCondition *condition,
    const QVariant &rootItem,
    CMdENamespaceDef &namespaceDef)
{
    switch (rootItem.type()) {
    case QVariant::String:
    {
        QString idString = rootItem.toString();
        const int colonIndex = idString.indexOf(QLatin1Char(':'));
        if (colonIndex != -1) {
            QStringRef itemType(&idString, 0, colonIndex);

            const int typeIndex = qt_indexOf(itemType, qt_mdeGalleryCategoryTypes);
            if (typeIndex != -1) {
                return qt_appendScopeCondition(
                           condition,
                           qt_mdeGalleryCategoryTypes[typeIndex],
                           idString.mid(colonIndex + 1),
                           namespaceDef);
            }
        }
        return QDocumentGallery::ItemTypeError;
    }
    case QVariant::UInt:
        return qt_appendScopeCondition(condition, rootItem.toUInt(), namespaceDef);
    case QVariant::Invalid:
        return QDocumentGallery::NoError;
    default:
        return QDocumentGallery::ItemTypeError;
    }
}
Ejemplo n.º 4
0
QVariant loModel::data(const QModelIndex &index, int role) const
 {
     if (!index.isValid())
         return QVariant();

     loItem *item = static_cast<loItem*>(index.internalPointer());

     QFlags<ItemType::ItemTypes> itemType(item->data(1).toInt()) ;

     if (role == Qt::DisplayRole) {
         return item->data(index.column());
     } else if (role == Qt::FontRole) {
         if(itemType.testFlag(ItemType::FileHtml)) {
             if(item->parent()->data(2).toString() == item->data(0).toString()) {
                 QFont boldFont ;
                 boldFont.setBold(TRUE);
                 return boldFont ;
             } else {
                 return QVariant() ;
             }
         } else {
             return QVariant() ;
         }
     } else if (role == Qt::UserRole + 1) {
         return item->data(1) ;
     } else if (role == Qt::UserRole) {
         return item->data(2) ;
     } else if (role == Qt::UserRole + 2) {
        return item->childCount() ;
     } else if (role == Qt::DecorationRole) {
         if(itemType.testFlag(ItemType::Resource)) {
             if(itemType.testFlag(ItemType::ResInput)) {
                 return QIcon(":/icons/input.png") ;
             } else if(itemType.testFlag(ItemType::ResOutput)) {
                 return QIcon(":/icons/output.png") ;
             } else if(itemType.testFlag(ItemType::ResWebcontent)) {
                 return QIcon(":/icons/webcontent.png") ;
             } else if(itemType.testFlag(ItemType::ResSolution)) {
                 return QIcon(":/icons/solution.png") ;
             }
         } else if(itemType.testFlag(ItemType::File)) {
             if(itemType.testFlag(ItemType::FileHtml)) {
                 return QIcon(":/icons/filehtml.png") ;
             } else if(itemType.testFlag(ItemType::FileImage)) {
                 return QIcon(":/icons/fileimage.png") ;
             } else if(itemType.testFlag(ItemType::FileText)) {
                 return QIcon(":/icons/filetext.png") ;
             }
         } else if(itemType.testFlag(ItemType::Folder)) {
             return QIcon(":/icons/folder.png") ;
         } else if(itemType.testFlag(ItemType::EvalModel)) {
             return QIcon(":/icons/evalmodel.png") ;
         } else {
             return QIcon(":/icons/unknown.png") ;
         }

     }
     return QVariant() ;

 }
 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const
 {
     if (role == Qt::FontRole && itemType(index) == InterfaceItem) {
         QFont f;
         f.setItalic(true);
         return f;
     }
     return QDBusModel::data(index, role);
 }
Ejemplo n.º 6
0
Qt::ItemFlags TorrentContentModel::flags(const QModelIndex& index) const
{
    if (!index.isValid())
        return 0;

    if (itemType(index) == TorrentContentModelItem::FolderType)
        return Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsTristate;

    return Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable;
}
Ejemplo n.º 7
0
QVariantMap TransferItem::itemDataWithRoleNames() const {
    QVariantMap map;
    map[roles.value(CanCancelRole)] = canCancel();
    map[roles.value(CanPauseRole)] = canPause();
    map[roles.value(CanStartRole)] = canStart();
    map[roles.value(ExpandedRole)] = expanded();
    map[roles.value(ItemTypeRole)] = itemType();
    map[roles.value(ItemTypeStringRole)] = itemTypeString();
    map[roles.value(RowRole)] = row();
    map[roles.value(RowCountRole)] = rowCount();
    return map;
}
Ejemplo n.º 8
0
QString TransferItem::itemTypeString() const {
    switch (itemType()) {
    case ListType:
        return tr("List");
    case PackageType:
        return tr("Package");
    case TransferType:
        return tr("Transfer");
    default:
        return tr("Unknown");
    }
}
Ejemplo n.º 9
0
QString
DragMimeData::toString() const
{
    switch ((int)itemType())
    {
        case UnicornEnums::ItemTrack:  return track().toString();
        case UnicornEnums::ItemAlbum:  return QString::fromUtf8( data( "item/album" ) );
        case UnicornEnums::ItemArtist: return QString::fromUtf8( data( "item/artist" ) ); //leave last as album and track have this data too
    }
    
    return QString();
}
Ejemplo n.º 10
0
QMap<int, QVariant> TransferItem::itemData() const {
    QMap<int, QVariant> map;
    map[CanCancelRole] = canCancel();
    map[CanPauseRole] = canPause();
    map[CanStartRole] = canStart();
    map[ExpandedRole] = expanded();
    map[ItemTypeRole] = itemType();
    map[ItemTypeStringRole] = itemTypeString();
    map[RowRole] = row();
    map[RowCountRole] = rowCount();
    return map;
}
Ejemplo n.º 11
0
bool XSchemaSimpleTypeList::generateDom(QDomDocument &document, QDomNode &parent)
{
    QDomElement node = createElement(document, IO_XSD_LIST);
    addAttrNotEmpty(node, IO_GENERIC_ID, id());
    addAttrNotEmpty(node, IO_SIMPLETYPE_LIST_ATTR_ITEMTYPE, itemType());
    //TODO ohther attributes
    if(NULL != _annotation) {
        _annotation->generateDom(document, node);
    }
    foreach(XSchemaObject * child, _children) {
        child->generateDom(document, parent);
        break;
    }
Ejemplo n.º 12
0
void ThingTypeManager::loadOtb(const std::string& file)
{
    try {
        FileStreamPtr fin = g_resources.openFile(file);

        uint signature = fin->getU32();
        if(signature != 0)
            stdext::throw_exception("invalid otb file");

        BinaryTreePtr root = fin->getBinaryTree();
        root->skip(1); // otb first byte is always 0

        signature = root->getU32();
        if(signature != 0)
            stdext::throw_exception("invalid otb file");

        uint8 rootAttr = root->getU8();
        if(rootAttr == 0x01) { // OTB_ROOT_ATTR_VERSION
            uint16 size = root->getU16();
            if(size != 4 + 4 + 4 + 128)
                stdext::throw_exception("invalid otb root attr version size");

            m_otbMajorVersion = root->getU32();
            m_otbMinorVersion = root->getU32();
            root->skip(4); // buildNumber
            root->skip(128); // description
        }

        m_reverseItemTypes.clear();
        m_itemTypes.resize(root->getChildren().size() + 1, m_nullItemType);
        m_reverseItemTypes.resize(root->getChildren().size() + 1, m_nullItemType);

        for(const BinaryTreePtr& node : root->getChildren()) {
            ItemTypePtr itemType(new ItemType);
            itemType->unserialize(node);
            addItemType(itemType);

            uint16 clientId = itemType->getClientId();
            if(unlikely(clientId >= m_reverseItemTypes.size()))
                m_reverseItemTypes.resize(clientId + 1);
            m_reverseItemTypes[clientId] = itemType;
        }

        m_otbLoaded = true;
        g_lua.callGlobalField("g_things", "onLoadOtb", file);
    } catch(std::exception& e) {
        g_logger.error(stdext::format("Failed to load '%s' (OTB file): %s", file, e.what()));
    }
}
Ejemplo n.º 13
0
/*!
  \qmlproperty bool OrganizerItem::isFloatingTime
  \since Mobility 1.1

   This property indicates whether the organizer item created with floating date time.
   A floating time will always appear with the same value regardless of what time zone the user is in.
   A non-floating (absolute) time represents the same time regardless of the time zone,
   but will appear to change in value if the user's time zone changes.
   This property is read only.

  */
bool QDeclarativeOrganizerItem::isFloatingTime() const
{
    switch (itemType()) {
    case QDeclarativeOrganizerItem::Event:
    case QDeclarativeOrganizerItem::EventOccurrence:
        return d->m_item.detail<QOrganizerEventTime>().startDateTime().timeSpec() == Qt::LocalTime;
    case QDeclarativeOrganizerItem::Todo:
    case QDeclarativeOrganizerItem::TodoOccurrence:
        return d->m_item.detail<QOrganizerTodoTime>().startDateTime().timeSpec() == Qt::LocalTime;
    case QDeclarativeOrganizerItem::Journal:
        return d->m_item.detail<QOrganizerJournalTime>().entryDateTime().timeSpec() == Qt::LocalTime;
    case QDeclarativeOrganizerItem::Note:
    default:
        break;
    }
    return d->m_item.detail<QOrganizerItemTimestamp>().created().timeSpec() == Qt::LocalTime;
}
Ejemplo n.º 14
0
void QtFallbackWebPopup::showS60BrowserDialog()
{
    static MBrCtlDialogsProvider* dialogs = CBrowserDialogsProvider::NewL(0);
    if (!dialogs)
        return;

    int size = itemCount();
    CArrayFix<TBrCtlSelectOptionData>* options = new CArrayFixFlat<TBrCtlSelectOptionData>(qMax(1, size));
    RPointerArray<HBufC> items(qMax(1, size));
    CleanupStack::PushL(TCleanupItem(&ResetAndDestroy, &items));

    for (int i = 0; i < size; i++) {
        if (itemType(i) == Separator) {
            TBrCtlSelectOptionData data(_L("----------"), false, false, false);
            options->AppendL(data);
        } else {
            HBufC16* itemStr = HBufC16::NewL(itemText(i).length());
            itemStr->Des().Copy((const TUint16*)itemText(i).utf16(), itemText(i).length());
            CleanupStack::PushL(itemStr);
            TBrCtlSelectOptionData data(*itemStr, i == currentIndex(), false, itemIsEnabled(i));
            options->AppendL(data);
            items.AppendL(itemStr);
            CleanupStack::Pop();
        }
    }

    dialogs->DialogSelectOptionL(KNullDesC(), (TBrCtlSelectOptionType)(ESelectTypeSingle | ESelectTypeWithFindPane), *options);

    CleanupStack::PopAndDestroy(&items);

    int newIndex;
    for (newIndex = 0; newIndex < options->Count() && !options->At(newIndex).IsSelected(); newIndex++) {}
    if (newIndex == options->Count())
        newIndex = currentIndex();
    
    m_popupVisible = false;
    popupDidHide();

    if (currentIndex() != newIndex && newIndex >= 0)
        valueChanged(newIndex);

    delete options;
}
Ejemplo n.º 15
0
/*!
  \qmlproperty date OrganizerItem::itemStartTime
  \since Mobility 1.1

   This property holds the start date time of the OrganizerItem object.
   For differrent organizer item type, the return value is differrent, too.

   \sa QDeclarativeOrganizerItem::OrganizerItemType
  */
QDateTime QDeclarativeOrganizerItem::itemStartTime() const
{
    switch (itemType()) {
    case QDeclarativeOrganizerItem::Event:
        return static_cast<const QDeclarativeOrganizerEvent*>(this)->startDateTime();
    case QDeclarativeOrganizerItem::EventOccurrence:
        return static_cast<const QDeclarativeOrganizerEventOccurrence*>(this)->startDateTime();
    case QDeclarativeOrganizerItem::Todo:
        return static_cast<const QDeclarativeOrganizerTodo*>(this)->startDateTime();
    case QDeclarativeOrganizerItem::TodoOccurrence:
        return static_cast<const QDeclarativeOrganizerTodoOccurrence*>(this)->startDateTime();
    case QDeclarativeOrganizerItem::Journal:
        return static_cast<const QDeclarativeOrganizerJournal*>(this)->dateTime();
    case QDeclarativeOrganizerItem::Note:
    default:
        break;
    }
    return item().detail<QOrganizerItemTimestamp>().created().toLocalTime();
}
Ejemplo n.º 16
0
void ThingTypeManager::loadOtb(const std::string& file)
{
    try {
        FileStreamPtr fin = g_resources.openFile(file);

        uint signature = fin->getU32();
        if(signature != 0)
            stdext::throw_exception("invalid otb file");

        BinaryTreePtr root = fin->getBinaryTree();

        signature = root->getU32();
        if(signature != 0)
            stdext::throw_exception("invalid otb file");

        root->skip(4);

        m_otbMajorVersion = root->getU32();
        m_otbMinorVersion = root->getU32();
        root->skip(4);
        root->skip(128); // description

        m_reverseItemTypes.clear();
        m_itemTypes.resize(root->getChildren().size() + 1, m_nullItemType);
        m_reverseItemTypes.resize(root->getChildren().size() + 1, m_nullItemType);

        for(const BinaryTreePtr& node : root->getChildren()) {
            ItemTypePtr itemType(new ItemType);
            itemType->unserialize(node);
            addItemType(itemType);

            uint16 clientId = itemType->getClientId();
            if(unlikely(clientId >= m_reverseItemTypes.size()))
                m_reverseItemTypes.resize(clientId + 1);
            m_reverseItemTypes[clientId] = itemType;
        }

        m_otbLoaded = true;
    } catch(std::exception& e) {
        g_logger.error(stdext::format("Failed to load '%s' (OTB file): %s", file, e.what()));
    }
}
Ejemplo n.º 17
0
Board::Board( ModelPart * modelPart, ViewLayer::ViewID viewID, const ViewGeometry & viewGeometry, long id, QMenu * itemMenu, bool doLabel)
	: PaletteItem(modelPart, viewID, viewGeometry, id, itemMenu, doLabel)
{
    m_svgOnly = true;
	m_fileNameComboBox = NULL;
    if (isBoard(modelPart)) {
        if (modelPart->localProp("layers").isNull()) {
            modelPart->setLocalProp("layers", modelPart->properties().value("layers"));
        }
        if (itemType() == ModelPart::Board && !modelPart->properties().keys().contains("filename")) {
            // deal with old style custom boards
            modelPart->modelPartShared()->setProperty("filename", "", false);
        }
    }

    if (StandardCustomBoardExplanation.isEmpty()) {
        StandardCustomBoardExplanation = tr("\n\nA custom board svg typically has one silkscreen layer and one board layer.\n") +
                                            tr("Have a look at the circle_pcb.svg file in your Fritzing installation folder at parts/svg/core/pcb/.\n\n");
    }

}
Ejemplo n.º 18
0
QDateTime QDeclarativeOrganizerItem::itemEndTime() const
{
    switch (itemType()) {
    case QDeclarativeOrganizerItem::Event:
        return static_cast<const QDeclarativeOrganizerEvent*>(this)->endDateTime();
    case QDeclarativeOrganizerItem::EventOccurrence:
        return static_cast<const QDeclarativeOrganizerEventOccurrence*>(this)->endDateTime();
    case QDeclarativeOrganizerItem::Todo:
        return static_cast<const QDeclarativeOrganizerTodo*>(this)->dueDateTime();
    case QDeclarativeOrganizerItem::TodoOccurrence:
        return static_cast<const QDeclarativeOrganizerTodoOccurrence*>(this)->dueDateTime();
    case QDeclarativeOrganizerItem::Journal:
        //there is no end time for journal item,  make it 30mins later for display purpose
        return static_cast<const QDeclarativeOrganizerJournal*>(this)->dateTime().addSecs(60*30);
    case QDeclarativeOrganizerItem::Note:
    default:
        break;
    }
    //there is no end time for note or customized items,  make it 30mins later for display purpose
    return item().detail<QOrganizerItemTimestamp>().created().toLocalTime().addSecs(60*30);
}
QVariant QDeclarativeGalleryQueryModel::property(int index, const QString &property) const
{
    if (index < 0
            || index >= m_rowCount
            || (m_resultSet->currentIndex() != index && !m_resultSet->fetch(index))) {
        return QVariant();
    }

    if (property == QLatin1String("itemId")) {
        return m_resultSet->itemId();
    } else if (property == QLatin1String("itemType")) {
        return itemType(m_resultSet->itemType());
    } else {
        const int propertyKey = m_resultSet->propertyKey(property);

        const QVariant value = m_resultSet->metaData(propertyKey);

        return value.isNull()
                ? QVariant(m_resultSet->propertyType(propertyKey))
                : value;
    }
}
Ejemplo n.º 20
0
QVariant TransferItem::data(int role) const {
    switch (role) {
    case CanCancelRole:
        return canCancel();
    case CanPauseRole:
        return canPause();
    case CanStartRole:
        return canStart();
    case ExpandedRole:
        return expanded();
    case ItemTypeRole:
        return itemType();
    case ItemTypeStringRole:
        return itemTypeString();
    case RowRole:
        return row();
    case RowCountRole:
        return rowCount();
    default:
        return QVariant();
    }
}
Ejemplo n.º 21
0
QList<QGalleryResource> QMDEGalleryResultSet::resources() const
{
    QList<QGalleryResource> resources;

    if (m_itemArray[m_cursorPosition]) {
        const QUrl url = QUrl(
                             QDocumentGalleryMDSUtility::s60DescToQString(m_itemArray[m_cursorPosition]->Uri()));

        QStringList propertyList;
        QDocumentGalleryMDSUtility::GetDataFieldsForItemType( propertyList, itemType() );

        const int count = propertyList.count();
        QMap<int, QVariant> attributes;

        for (int i = 0; i < count; i++) {
            int propertyKey = QDocumentGalleryMDSUtility::GetPropertyKey( propertyList[i] );
            QVariant value = metaData( propertyKey );
            if (!value.isNull())
                attributes.insert(propertyKey, value);
        }
        resources.append(QGalleryResource(url, attributes));
    }
    return resources;
}
QVariant QDeclarativeGalleryQueryModel::data(const QModelIndex &index, int role) const
{
    if (index.isValid()) {
        if (m_resultSet->currentIndex() != index.row())
            m_resultSet->fetch(index.row());

        switch (role) {
        case ItemId:
            return m_resultSet->itemId();
        case ItemType:
            return itemType(m_resultSet->itemType());
        default:
            {
                QVariant value = m_resultSet->metaData(role - MetaDataOffset);

                return value.isNull()
                        ? QVariant(m_resultSet->propertyType(role - MetaDataOffset))
                        : value;
            }
        }
    } else {
        return QVariant();
    }
}
Ejemplo n.º 23
0
void toCodeModel::addChildContent(const QModelIndex & index)
{
    toCodeModelItem * item = static_cast<toCodeModelItem*>(index.internalPointer());
    if (!item)
        return;

    QString itemType(item->type());
    if (itemType == "PACKAGE")
    {
        // don't re-read it until refresh action...
        if (item->childCount() > 0)
            return;

        toConnectionSubLoan c(toConnection::currentConnection(this));
        toQuery query(c, SQLListPackage, toQueryParams() << item->display() << m_owner);
        QString ctype;
        QString cstatus;

        emit layoutAboutToBeChanged();
        while (!query.eof())
        {
            ctype = (QString)query.readValue();
            cstatus = (QString)query.readValue();

            new toCodeModelItem(item, ctype, ctype, cstatus);
            // "inherit" child status for parent if it's required
            if ((ctype == "SPEC" || ctype == "BODY")
                    && cstatus != "VALID")
            {
                item->setStatus(cstatus);
            }
        }
        emit layoutChanged();
        return;
    } // end of packages
}
Ejemplo n.º 24
0
/*!
    \qmlproperty bool OrganizerItem::isOccurrence
    \since Mobility 1.1

    If this OrganizerItem is an occurrence item, returns true, otherwise returns false.

    This is a read only property.
*/
bool QDeclarativeOrganizerItem::isOccurrence() const
{
      return itemType() == QDeclarativeOrganizerItem::EventOccurrence || itemType() == QDeclarativeOrganizerItem::TodoOccurrence;
}
Ejemplo n.º 25
0
void Item::generateItem()
{
    //if item does not have a type, assign it one.
    if (type == D)
    {
        type = itemType(rand() % P + 1);
    }

    int itemMaterial = rand() % 4;//What the item is made of
    int itemClass = rand() % 4;//What kind of weapon/armor is it?
    int accType = rand() % 8;
    int tempBonus = 0;//bonus to add to stats based on item type

    //Determine the material the item is made of (or color for potions)
    if (type != A)
    {
        switch(itemMaterial){
        case 0:
            if (type != P)
            {
                itemName = "Wooden";
            }
            else
            {
                itemName = "Green Potion";
                hpHealAmount = 20;
            }
            break;
        case 1:
            if (type != P)
            {
                itemName = "Rusted";
                tempBonus = -1;
            }
            else
            {
                itemName = "Blue Potion";
                hpHealAmount = 10;
                spHealAmount = 10;
            }
            break;
        case 2:
            if (type != P)
            {
                itemName = "Iron";
                tempBonus = 2;
            }
            else
            {
                itemName = "Red Potion";
                hpHealAmount = 25;
                spHealAmount = 15;
            }
            break;
        case 3:
            if (type != P)
            {
                itemName = "Mithril";
                tempBonus = 5;
            }
            else
            {
                itemName = "Purple Drank";
                hpHealAmount = 40;
                spHealAmount = 20;
            }
            break;
        case 4:
            if (type != P)
            {
                itemName = "Grass";
                tempBonus = 15;
            }
            else
            {
                itemName = "Gold Drank";
                hpHealAmount = 10;
                spHealAmount = 10;
            }
            break;
        default:
            break;
        }
    }
    else//determine what accessory it will be
    {
        switch (accType)
        {
        case 0:
            itemName = "Feather Boots";
            spdBonus = 5 + (rand() % 5);
            break;
        case 1:
            itemName = "Holy Ring";
            hpBonus = 50;
            defBonus = rand() % 5 + 1;
            break;
        case 2:
            itemName = "Attack Charm";
            strBonus = rand() % 5 + 1;
            break;
        case 3:
            itemName = "Attack Ring";
            strBonus = rand() % 10 + 5;
            break;
        case 4:
            itemName = "Plain Ring";
            break;
        case 5:
            itemName = "Cursed Ring";
            strBonus = -2;
            defBonus = -2;
            spdBonus = -2;
            break;
        case 6:
            itemName = "Magic Ring";
            spBonus = rand() % 20 + 20;
            break;
        case 7:
            itemName = "Life Charm";
            hpBonus = rand() % 40 + 40;
            break;
        case 8:
            itemName = "Attack Ring";
            strBonus = rand() % 10 + 5;
            break;
        default:
            break;
        }
    }

    //accessories and potions are finished at this point
    if (type == P || type == A)
    {
        return;
    }

    //determines what kind of weapon/armor/helm
    switch (itemClass)
    {
    case 0:
        if (type == W)
        {
            itemName.append(" Knife");
            strBonus = tempBonus;
        }
        else if (type == R)
        {
            itemName.append(" Plate");
            defBonus = tempBonus;
        }
        else
        {
            itemName.append(" Helm");
            defBonus = tempBonus;
        }
        break;
    case 1:
        if (type == W)
        {
            itemName.append(" Rod");
            defBonus = tempBonus + rand() % 3;
            hpBonus = 20 + tempBonus;
        }
        else if (type == R)
        {
            itemName.append(" Mail");
            defBonus = tempBonus + rand() % 3 + 5;
        }
        else
        {
            itemName.append(" Helm");
            defBonus = tempBonus + rand() % 2;
        }
        break;
    case 2:
        if (type == W)
        {
            itemName.append(" Axe");
            strBonus = tempBonus + rand() % 15 + 5;
        }
        else if (type == R)
        {
            itemName.append(" Armor");
            defBonus = tempBonus + rand() % 7 + 4;
        }
        else
        {
            itemName.append(" Helm");
            defBonus = tempBonus + rand() % 5 + 1;
        }
        break;
    case 3:
        if (type == W)
        {
            itemName.append(" Sword");
            strBonus = tempBonus + 10 + rand() % 2;
        }
        else if (type == R)
        {
            itemName.append(" Armor");
            defBonus = tempBonus + rand() % 7 + 4;
        }
        else
        {
            itemName.append(" Helm");
            defBonus = tempBonus + rand() % 5 + 1;
        }
        break;
    case 4:
        if (type == W)
        {
            itemName = "Beam Sword";
            strBonus = rand() % 25 + 23;
        }
        else if (type == R)
        {
            itemName = "Battlesuit";
            defBonus = rand() % 20 + 18;
        }
        else
        {
            itemName.append(" Helm");
            defBonus = tempBonus + rand() % 8 + 2;
        }
        break;
    default:
        itemName = "NOTHING";
        break;
    }
}