本文整理汇总了C++中MessageView::notify方法的典型用法代码示例。如果您正苦于以下问题:C++ MessageView::notify方法的具体用法?C++ MessageView::notify怎么用?C++ MessageView::notify使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageView
的用法示例。
在下文中一共展示了MessageView::notify方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: forEachSimulator
void SimulationBar::forEachSimulator(boost::function<void(SimulatorItem* simulator)> callback, bool doSelect)
{
MessageView* mv = MessageView::instance();
/*
ItemList<SimulatorItem> simulators =
ItemTreeView::mainInstance()->selectedItems<SimulatorItem>();
*/
ItemList<SimulatorItem> simulators =
ItemTreeView::mainInstance()->selectedItems<SimulatorItem>();
if(simulators.empty()){
simulators.extractChildItems(RootItem::instance());
if(simulators.empty()){
mv->notify(_("There is no simulator item."));
} else if(simulators.size() > 1){
simulators.clear();
mv->notify(_("Please select a simulator item to simulate."));
} else {
if(doSelect){
ItemTreeView::instance()->selectItem(simulators.front());
}
}
}
typedef map<WorldItem*, SimulatorItem*> WorldToSimulatorMap;
WorldToSimulatorMap worldToSimulator;
for(int i=0; i < simulators.size(); ++i){
SimulatorItem* simulator = simulators.get(i);
WorldItem* world = simulator->findOwnerItem<WorldItem>();
if(world){
WorldToSimulatorMap::iterator p = worldToSimulator.find(world);
if(p == worldToSimulator.end()){
worldToSimulator[world] = simulator;
} else {
p->second = 0; // skip if multiple simulators are selected
}
}
}
for(int i=0; i < simulators.size(); ++i){
SimulatorItem* simulator = simulators.get(i);
WorldItem* world = simulator->findOwnerItem<WorldItem>();
if(!world){
mv->notify(format(_("%1% cannot be processed because it is not related with a world."))
% simulator->name());
} else {
WorldToSimulatorMap::iterator p = worldToSimulator.find(world);
if(p != worldToSimulator.end()){
if(!p->second){
mv->notify(format(_("%1% cannot be processed because another simulator"
"in the same world is also selected."))
% simulator->name());
} else {
callback(simulator);
}
}
}
}
}