|
|
|
@ -30,6 +30,7 @@ namespace MWGui
|
|
|
|
|
|
|
|
|
|
Repair::Repair()
|
|
|
|
|
: WindowBase("openmw_repair.layout")
|
|
|
|
|
, mItemSelectionDialog(NULL)
|
|
|
|
|
{
|
|
|
|
|
getWidget(mRepairBox, "RepairBox");
|
|
|
|
|
getWidget(mToolBox, "ToolBox");
|
|
|
|
@ -39,9 +40,11 @@ Repair::Repair()
|
|
|
|
|
getWidget(mCancelButton, "CancelButton");
|
|
|
|
|
|
|
|
|
|
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &Repair::onCancel);
|
|
|
|
|
mRepairBox->eventItemClicked += MyGUI::newDelegate(this, &Repair::onRepairItem);
|
|
|
|
|
|
|
|
|
|
mRepairBox->eventItemClicked += MyGUI::newDelegate(this, &Repair::onRepairItem);
|
|
|
|
|
mRepairBox->setDisplayMode(ItemChargeView::DisplayMode_Health);
|
|
|
|
|
|
|
|
|
|
mToolIcon->eventMouseButtonClick += MyGUI::newDelegate(this, &Repair::onSelectItem);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Repair::open()
|
|
|
|
@ -83,6 +86,8 @@ void Repair::updateRepairView()
|
|
|
|
|
|
|
|
|
|
float quality = ref->mBase->mData.mQuality;
|
|
|
|
|
|
|
|
|
|
mToolIcon->setUserData(mRepair.getTool());
|
|
|
|
|
|
|
|
|
|
std::stringstream qualityStr;
|
|
|
|
|
qualityStr << std::setprecision(3) << quality;
|
|
|
|
|
|
|
|
|
@ -93,6 +98,12 @@ void Repair::updateRepairView()
|
|
|
|
|
mToolBox->setVisible(toolBoxVisible);
|
|
|
|
|
mToolBox->setUserString("Hidden", toolBoxVisible ? "false" : "true");
|
|
|
|
|
|
|
|
|
|
if (!toolBoxVisible)
|
|
|
|
|
{
|
|
|
|
|
mToolIcon->setItem(MWWorld::Ptr());
|
|
|
|
|
mToolIcon->clearUserStrings();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mRepairBox->update();
|
|
|
|
|
|
|
|
|
|
Gui::Box* box = dynamic_cast<Gui::Box*>(mMainWidget);
|
|
|
|
@ -103,6 +114,36 @@ void Repair::updateRepairView()
|
|
|
|
|
center();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Repair::onSelectItem(MyGUI::Widget *sender)
|
|
|
|
|
{
|
|
|
|
|
delete mItemSelectionDialog;
|
|
|
|
|
mItemSelectionDialog = new ItemSelectionDialog("#{sRepair}");
|
|
|
|
|
mItemSelectionDialog->eventItemSelected += MyGUI::newDelegate(this, &Repair::onItemSelected);
|
|
|
|
|
mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &Repair::onItemCancel);
|
|
|
|
|
mItemSelectionDialog->setVisible(true);
|
|
|
|
|
mItemSelectionDialog->openContainer(MWMechanics::getPlayer());
|
|
|
|
|
mItemSelectionDialog->setFilter(SortFilterItemModel::Filter_OnlyRepairTools);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Repair::onItemSelected(MWWorld::Ptr item)
|
|
|
|
|
{
|
|
|
|
|
mItemSelectionDialog->setVisible(false);
|
|
|
|
|
|
|
|
|
|
mToolIcon->setItem(item);
|
|
|
|
|
mToolIcon->setUserString ("ToolTipType", "ItemPtr");
|
|
|
|
|
mToolIcon->setUserData(item);
|
|
|
|
|
|
|
|
|
|
mRepair.setTool(item);
|
|
|
|
|
|
|
|
|
|
MWBase::Environment::get().getSoundManager()->playSound(item.getClass().getDownSoundId(item), 1, 1);
|
|
|
|
|
updateRepairView();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Repair::onItemCancel()
|
|
|
|
|
{
|
|
|
|
|
mItemSelectionDialog->setVisible(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Repair::onCancel(MyGUI::Widget* /*sender*/)
|
|
|
|
|
{
|
|
|
|
|
exit();
|
|
|
|
|