mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-18 03:21:27 +02:00
Add spell scroll inspector
This commit is contained in:
parent
3f4fa8ec10
commit
50dbf9a254
@ -123,7 +123,7 @@ void Inspector::updateProperties(CArmedInstance * o)
|
|||||||
{
|
{
|
||||||
if(!o) return;
|
if(!o) return;
|
||||||
|
|
||||||
auto * delegate = new InspectorDelegate;
|
auto * delegate = new InspectorDelegate();
|
||||||
delegate->options << "NEUTRAL";
|
delegate->options << "NEUTRAL";
|
||||||
for(int p = 0; p < map->players.size(); ++p)
|
for(int p = 0; p < map->players.size(); ++p)
|
||||||
if(map->players[p].canAnyonePlay())
|
if(map->players[p].canAnyonePlay())
|
||||||
@ -170,6 +170,24 @@ void Inspector::updateProperties(CGTownInstance * o)
|
|||||||
void Inspector::updateProperties(CGArtifact * o)
|
void Inspector::updateProperties(CGArtifact * o)
|
||||||
{
|
{
|
||||||
if(!o) return;
|
if(!o) return;
|
||||||
|
|
||||||
|
addProperty("Message", o->message, false);
|
||||||
|
|
||||||
|
CArtifactInstance * instance = o->storedArtifact;
|
||||||
|
if(instance)
|
||||||
|
{
|
||||||
|
SpellID spellId = instance->getGivenSpellID();
|
||||||
|
if(spellId != -1)
|
||||||
|
{
|
||||||
|
auto * delegate = new InspectorDelegate;
|
||||||
|
for(auto spell : VLC->spellh->objects)
|
||||||
|
{
|
||||||
|
//if(map->isAllowedSpell(spell->id))
|
||||||
|
delegate->options << QString::fromStdString(spell->name);
|
||||||
|
}
|
||||||
|
addProperty("Spell", VLC->spellh->objects[spellId]->name, delegate, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inspector::updateProperties(CGMine * o)
|
void Inspector::updateProperties(CGMine * o)
|
||||||
@ -186,6 +204,7 @@ void Inspector::updateProperties(CGResource * o)
|
|||||||
if(!o) return;
|
if(!o) return;
|
||||||
|
|
||||||
addProperty("Amount", o->amount, false);
|
addProperty("Amount", o->amount, false);
|
||||||
|
addProperty("Message", o->message, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inspector::updateProperties(CGCreature * o)
|
void Inspector::updateProperties(CGCreature * o)
|
||||||
@ -286,6 +305,21 @@ void Inspector::setProperty(CGMine * object, const QString & key, const QVariant
|
|||||||
void Inspector::setProperty(CGArtifact * object, const QString & key, const QVariant & value)
|
void Inspector::setProperty(CGArtifact * object, const QString & key, const QVariant & value)
|
||||||
{
|
{
|
||||||
if(!object) return;
|
if(!object) return;
|
||||||
|
|
||||||
|
if(key == "Message")
|
||||||
|
object->message = value.toString().toStdString();
|
||||||
|
|
||||||
|
if(object->storedArtifact && key == "Spell")
|
||||||
|
{
|
||||||
|
for(auto spell : VLC->spellh->objects)
|
||||||
|
{
|
||||||
|
if(spell->name == value.toString().toStdString())
|
||||||
|
{
|
||||||
|
object->storedArtifact = CArtifactInstance::createScroll(spell->getId());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inspector::setProperty(CGDwelling * object, const QString & key, const QVariant & value)
|
void Inspector::setProperty(CGDwelling * object, const QString & key, const QVariant & value)
|
||||||
|
@ -131,8 +131,6 @@ class InspectorDelegate : public QStyledItemDelegate
|
|||||||
public:
|
public:
|
||||||
static InspectorDelegate * boolDelegate();
|
static InspectorDelegate * boolDelegate();
|
||||||
|
|
||||||
InspectorDelegate(const QStringList &);
|
|
||||||
|
|
||||||
using QStyledItemDelegate::QStyledItemDelegate;
|
using QStyledItemDelegate::QStyledItemDelegate;
|
||||||
|
|
||||||
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||||
|
@ -197,13 +197,13 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>192</width>
|
<width>268</width>
|
||||||
<height>196</height>
|
<height>196</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>192</width>
|
<width>524287</width>
|
||||||
<height>524287</height>
|
<height>524287</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -344,7 +344,7 @@
|
|||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="editTriggers">
|
<property name="editTriggers">
|
||||||
<set>QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked</set>
|
<set>QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="selectionMode">
|
<property name="selectionMode">
|
||||||
<enum>QAbstractItemView::SingleSelection</enum>
|
<enum>QAbstractItemView::SingleSelection</enum>
|
||||||
@ -668,7 +668,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>128</width>
|
<width>128</width>
|
||||||
<height>344</height>
|
<height>271</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -711,7 +711,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>128</width>
|
<width>128</width>
|
||||||
<height>344</height>
|
<height>271</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -730,7 +730,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>128</width>
|
<width>128</width>
|
||||||
<height>344</height>
|
<height>271</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user