mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-03 17:54:06 +00:00
Grey out completed quests in journal quests list
This commit is contained in:
parent
49d912e5b6
commit
a139e4efb0
@ -199,7 +199,7 @@ struct JournalViewModelImpl : JournalViewModel
|
||||
|
||||
};
|
||||
|
||||
void visitQuestNames (bool active_only, boost::function <void (const std::string&)> visitor) const
|
||||
void visitQuestNames (bool active_only, boost::function <void (const std::string&, bool)> visitor) const
|
||||
{
|
||||
MWBase::Journal * journal = MWBase::Environment::get ().getJournal ();
|
||||
|
||||
@ -231,7 +231,7 @@ struct JournalViewModelImpl : JournalViewModel
|
||||
if (visitedQuests.find(quest.getName()) != visitedQuests.end())
|
||||
continue;
|
||||
|
||||
visitor (quest.getName());
|
||||
visitor (quest.getName(), isFinished);
|
||||
|
||||
visitedQuests.insert(quest.getName());
|
||||
}
|
||||
|
@ -67,8 +67,8 @@ namespace MWGui
|
||||
/// returns true if their are no journal entries to display
|
||||
virtual bool isEmpty () const = 0;
|
||||
|
||||
/// walks the active and optionally completed, quests providing the name
|
||||
virtual void visitQuestNames (bool active_only, boost::function <void (const std::string&)> visitor) const = 0;
|
||||
/// walks the active and optionally completed, quests providing the name and completed status
|
||||
virtual void visitQuestNames (bool active_only, boost::function <void (const std::string&, bool)> visitor) const = 0;
|
||||
|
||||
/// walks over the journal entries related to all quests with the given name
|
||||
/// If \a questName is empty, simply visits all journal entries
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include <MyGUI_TextBox.h>
|
||||
#include <MyGUI_Button.h>
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/function.hpp>
|
||||
@ -428,11 +429,24 @@ namespace
|
||||
AddNamesToList(Gui::MWList* list) : mList(list) {}
|
||||
|
||||
Gui::MWList* mList;
|
||||
void operator () (const std::string& name)
|
||||
void operator () (const std::string& name, bool finished=false)
|
||||
{
|
||||
mList->addItem(name);
|
||||
}
|
||||
};
|
||||
struct SetNamesInactive
|
||||
{
|
||||
SetNamesInactive(Gui::MWList* list) : mList(list) {}
|
||||
|
||||
Gui::MWList* mList;
|
||||
void operator () (const std::string& name, bool finished)
|
||||
{
|
||||
if (finished)
|
||||
{
|
||||
mList->getItemWidget(name)->setStateSelected(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void notifyQuests(MyGUI::Widget* _sender)
|
||||
{
|
||||
@ -453,6 +467,12 @@ namespace
|
||||
mModel->visitQuestNames(!mAllQuests, add);
|
||||
|
||||
list->adjustSize();
|
||||
|
||||
if (mAllQuests)
|
||||
{
|
||||
SetNamesInactive setInactive(list);
|
||||
mModel->visitQuestNames(!mAllQuests, setInactive);
|
||||
}
|
||||
}
|
||||
|
||||
void notifyShowAll(MyGUI::Widget* _sender)
|
||||
|
@ -152,9 +152,9 @@ namespace Gui
|
||||
eventWidgetSelected(_sender);
|
||||
}
|
||||
|
||||
MyGUI::Widget* MWList::getItemWidget(const std::string& name)
|
||||
MyGUI::Button *MWList::getItemWidget(const std::string& name)
|
||||
{
|
||||
return mScrollView->findWidget (getName() + "_item_" + name);
|
||||
return mScrollView->findWidget (getName() + "_item_" + name)->castType<MyGUI::Button>();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ namespace Gui
|
||||
std::string getItemNameAt(unsigned int at); ///< \attention if there are separators, this method will return "" at the place where the separator is
|
||||
void clear();
|
||||
|
||||
MyGUI::Widget* getItemWidget(const std::string& name);
|
||||
MyGUI::Button* getItemWidget(const std::string& name);
|
||||
///< get widget for an item name, useful to set up tooltip
|
||||
|
||||
virtual void setPropertyOverride(const std::string& _key, const std::string& _value);
|
||||
|
@ -28,9 +28,9 @@
|
||||
<State name="normal" colour="#{fontcolour=journal_topic}" shift="0"/>
|
||||
<State name="highlighted" colour="#{fontcolour=journal_topic_over}" shift="0"/>
|
||||
<State name="pushed" colour="#{fontcolour=journal_topic_pressed}" shift="0"/>
|
||||
<State name="normal_checked" colour="#{fontcolour=journal_topic_pressed}" shift="0"/>
|
||||
<State name="highlighted_checked" colour="#{fontcolour=journal_topic_pressed}" shift="0"/>
|
||||
<State name="pushed_checked" colour="#{fontcolour=journal_topic_pressed}" shift="0"/>
|
||||
<State name="normal_checked" colour="0.2 0.2 0.2" shift="0"/>
|
||||
<State name="highlighted_checked" colour="0.4 0.4 0.4" shift="0"/>
|
||||
<State name="pushed_checked" colour="0.5 0.5 0.5" shift="0"/>
|
||||
</BasisSkin>
|
||||
</Resource>
|
||||
</MyGUI>
|
||||
|
Loading…
x
Reference in New Issue
Block a user