Revert "Accept a ConstPtr in ItemPtr tooltips"

This reverts commit 41c8ec56e0.

Does not work due to code relying on getting the non-const Ptr from the widget. Further refactoring is needed.
openmw-38
scrawl 9 years ago
parent 2176ac592c
commit db7b80b503

@ -139,7 +139,7 @@ namespace MWGui
if (!iter->isEmpty()) if (!iter->isEmpty())
{ {
mApparatus.at (index)->setUserString ("ToolTipType", "ItemPtr"); mApparatus.at (index)->setUserString ("ToolTipType", "ItemPtr");
mApparatus.at (index)->setUserData (MWWorld::ConstPtr(*iter)); mApparatus.at (index)->setUserData (*iter);
} }
} }
@ -207,9 +207,9 @@ namespace MWGui
continue; continue;
ingredient->setUserString("ToolTipType", "ItemPtr"); ingredient->setUserString("ToolTipType", "ItemPtr");
ingredient->setUserData(MWWorld::ConstPtr(item)); ingredient->setUserData(item);
ingredient->setCount(ingredient->getUserData<MWWorld::ConstPtr>()->getRefData().getCount()); ingredient->setCount(ingredient->getUserData<MWWorld::Ptr>()->getRefData().getCount());
} }
mItemView->update(); mItemView->update();

@ -79,7 +79,7 @@ namespace MWGui
{ {
mSoulBox->setItem(gem); mSoulBox->setItem(gem);
mSoulBox->setUserString ("ToolTipType", "ItemPtr"); mSoulBox->setUserString ("ToolTipType", "ItemPtr");
mSoulBox->setUserData(MWWorld::ConstPtr(gem)); mSoulBox->setUserData(gem);
mEnchanting.setSoulGem(gem); mEnchanting.setSoulGem(gem);
} }
} }
@ -97,7 +97,7 @@ namespace MWGui
mName->setCaption(item.getClass().getName(item)); mName->setCaption(item.getClass().getName(item));
mItemBox->setItem(item); mItemBox->setItem(item);
mItemBox->setUserString ("ToolTipType", "ItemPtr"); mItemBox->setUserString ("ToolTipType", "ItemPtr");
mItemBox->setUserData(MWWorld::ConstPtr(item)); mItemBox->setUserData(item);
mEnchanting.setOldItem(item); mEnchanting.setOldItem(item);
} }
} }

@ -417,7 +417,7 @@ namespace MWGui
mSpellStatus->setProgressPosition(chargePercent); mSpellStatus->setProgressPosition(chargePercent);
mSpellBox->setUserString("ToolTipType", "ItemPtr"); mSpellBox->setUserString("ToolTipType", "ItemPtr");
mSpellBox->setUserData(MWWorld::ConstPtr(item)); mSpellBox->setUserData(item);
mSpellImage->setItem(item); mSpellImage->setItem(item);
} }
@ -435,7 +435,7 @@ namespace MWGui
mWeapBox->clearUserStrings(); mWeapBox->clearUserStrings();
mWeapBox->setUserString("ToolTipType", "ItemPtr"); mWeapBox->setUserString("ToolTipType", "ItemPtr");
mWeapBox->setUserData(MWWorld::ConstPtr(item)); mWeapBox->setUserData(item);
mWeapStatus->setProgressRange(100); mWeapStatus->setProgressRange(100);
mWeapStatus->setProgressPosition(durabilityPercent); mWeapStatus->setProgressPosition(durabilityPercent);

@ -87,11 +87,11 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor)
currentY += 18; currentY += 18;
button->setUserString("Price", MyGUI::utility::toString(price)); button->setUserString("Price", MyGUI::utility::toString(price));
button->setUserData(*iter);
button->setCaptionWithReplacing(name); button->setCaptionWithReplacing(name);
button->setSize(button->getTextSize().width,18); button->setSize(button->getTextSize().width,18);
button->eventMouseWheel += MyGUI::newDelegate(this, &MerchantRepair::onMouseWheel); button->eventMouseWheel += MyGUI::newDelegate(this, &MerchantRepair::onMouseWheel);
button->setUserString("ToolTipType", "ItemPtr"); button->setUserString("ToolTipType", "ItemPtr");
button->setUserData(MWWorld::ConstPtr(*iter));
button->eventMouseButtonClick += MyGUI::newDelegate(this, &MerchantRepair::onRepairButtonClick); button->eventMouseButtonClick += MyGUI::newDelegate(this, &MerchantRepair::onRepairButtonClick);
} }
} }

@ -185,7 +185,7 @@ namespace MWGui
button->setItem(item, ItemWidget::Barter); button->setItem(item, ItemWidget::Barter);
button->setUserString ("ToolTipType", "ItemPtr"); button->setUserString ("ToolTipType", "ItemPtr");
button->setUserData(MWWorld::ConstPtr(item)); button->setUserData(item);
if (mItemSelectionDialog) if (mItemSelectionDialog)
mItemSelectionDialog->setVisible(false); mItemSelectionDialog->setVisible(false);
@ -209,7 +209,7 @@ namespace MWGui
button->setIcon(item); button->setIcon(item);
button->setUserString ("ToolTipType", "ItemPtr"); button->setUserString ("ToolTipType", "ItemPtr");
button->setUserData(MWWorld::ConstPtr(item)); button->setUserData(item);
if (mMagicSelectionDialog) if (mMagicSelectionDialog)
mMagicSelectionDialog->setVisible(false); mMagicSelectionDialog->setVisible(false);
@ -278,7 +278,7 @@ namespace MWGui
if (Misc::StringUtils::ciEqual(it->getCellRef().getRefId(), id)) if (Misc::StringUtils::ciEqual(it->getCellRef().getRefId(), id))
{ {
item = *it; item = *it;
button->setUserData(MWWorld::ConstPtr(item)); button->setUserData(item);
break; break;
} }
} }

@ -56,7 +56,7 @@ void Recharge::start (const MWWorld::Ptr &item)
{ {
mGemIcon->setItem(item); mGemIcon->setItem(item);
mGemIcon->setUserString("ToolTipType", "ItemPtr"); mGemIcon->setUserString("ToolTipType", "ItemPtr");
mGemIcon->setUserData(MWWorld::ConstPtr(item)); mGemIcon->setUserData(item);
updateView(); updateView();
} }
@ -116,7 +116,7 @@ void Recharge::updateView()
"MW_ItemIconSmall", MyGUI::IntCoord(16, currentY, 32, 32), MyGUI::Align::Default); "MW_ItemIconSmall", MyGUI::IntCoord(16, currentY, 32, 32), MyGUI::Align::Default);
icon->setItem(*iter); icon->setItem(*iter);
icon->setUserString("ToolTipType", "ItemPtr"); icon->setUserString("ToolTipType", "ItemPtr");
icon->setUserData(MWWorld::ConstPtr(*iter)); icon->setUserData(*iter);
icon->eventMouseButtonClick += MyGUI::newDelegate(this, &Recharge::onItemClicked); icon->eventMouseButtonClick += MyGUI::newDelegate(this, &Recharge::onItemClicked);
icon->eventMouseWheel += MyGUI::newDelegate(this, &Recharge::onMouseWheel); icon->eventMouseWheel += MyGUI::newDelegate(this, &Recharge::onMouseWheel);

@ -53,7 +53,7 @@ void Repair::startRepairItem(const MWWorld::Ptr &item)
mToolIcon->setItem(item); mToolIcon->setItem(item);
mToolIcon->setUserString("ToolTipType", "ItemPtr"); mToolIcon->setUserString("ToolTipType", "ItemPtr");
mToolIcon->setUserData(MWWorld::ConstPtr(item)); mToolIcon->setUserData(item);
updateRepairView(); updateRepairView();
} }
@ -119,7 +119,7 @@ void Repair::updateRepairView()
"MW_ItemIconSmall", MyGUI::IntCoord(16, currentY, 32, 32), MyGUI::Align::Default); "MW_ItemIconSmall", MyGUI::IntCoord(16, currentY, 32, 32), MyGUI::Align::Default);
icon->setItem(*iter); icon->setItem(*iter);
icon->setUserString("ToolTipType", "ItemPtr"); icon->setUserString("ToolTipType", "ItemPtr");
icon->setUserData(MWWorld::ConstPtr(*iter)); icon->setUserData(*iter);
icon->eventMouseButtonClick += MyGUI::newDelegate(this, &Repair::onRepairItem); icon->eventMouseButtonClick += MyGUI::newDelegate(this, &Repair::onRepairItem);
icon->eventMouseWheel += MyGUI::newDelegate(this, &Repair::onMouseWheel); icon->eventMouseWheel += MyGUI::newDelegate(this, &Repair::onMouseWheel);

@ -278,7 +278,7 @@ namespace MWGui
{ {
if (spell.mType == Spell::Type_EnchantedItem) if (spell.mType == Spell::Type_EnchantedItem)
{ {
widget->setUserData(MWWorld::ConstPtr(spell.mItem)); widget->setUserData(spell.mItem);
widget->setUserString("ToolTipType", "ItemPtr"); widget->setUserString("ToolTipType", "ItemPtr");
} }
else else

@ -182,7 +182,7 @@ namespace MWGui
} }
else if (type == "ItemPtr") else if (type == "ItemPtr")
{ {
mFocusObject = *focus->getUserData<MWWorld::ConstPtr>(); mFocusObject = *focus->getUserData<MWWorld::Ptr>();
tooltipSize = getToolTipViaPtr(mFocusObject.getRefData().getCount(), false); tooltipSize = getToolTipViaPtr(mFocusObject.getRefData().getCount(), false);
} }
else if (type == "ItemModelIndex") else if (type == "ItemModelIndex")

Loading…
Cancel
Save