本文整理汇总了C++中MessageView类的典型用法代码示例。如果您正苦于以下问题:C++ MessageView类的具体用法?C++ MessageView怎么用?C++ MessageView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MessageView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: restoreProperties
void PythonPlugin::restoreProperties(const Archive& archive)
{
Listing& pathListing = *archive.findListing("moduleSearchPath");
if(pathListing.isValid()){
MessageView* mv = MessageView::instance();
PyGILock lock;
python::list syspath = python::extract<python::list>(sysModule.attr("path"));
string newPath;
for(int i=0; i < pathListing.size(); ++i){
newPath = archive.resolveRelocatablePath(pathListing[i].toString());
if(!newPath.empty()){
bool isExisting = false;
list<string>::iterator p;
for(p = additionalSearchPathList.begin(); p != additionalSearchPathList.end(); ++p){
if(newPath == (*p)){
isExisting = true;
break;
}
}
if(!isExisting){
syspath.insert(0, getNativePathString(filesystem::path(newPath)));
additionalSearchPathList.push_back(newPath);
mv->putln(format(_("PythonPlugin: \"%1%\" has been added to the python module search path list."))
% newPath);
}
}
}
}
}
示例2: 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);
}
}
}
}
}
示例3: appendText
void ChatView::dispatchMessage(const MessageView &mv)
{
if ((mv.type() == MessageView::Message || mv.type() == MessageView::Subject)
&& ChatViewCommon::updateLastMsgTime(mv.dateTime()))
{
QString color = ColorOpt::instance()->color(infomrationalColorOpt).name();
appendText(QString(useMessageIcons_?"<img src=\"icon:log_icon_time\" />":"") +
QString("<font color=\"%1\">*** %2</font>").arg(color).arg(mv.dateTime().date().toString(Qt::ISODate)));
}
switch (mv.type()) {
case MessageView::Message:
if (isMuc_) {
renderMucMessage(mv);
} else {
renderMessage(mv);
}
break;
case MessageView::Subject:
if (isMuc_) {
renderMucSubject(mv);
} else {
renderSubject(mv);
}
break;
case MessageView::Urls:
renderUrls(mv);
break;
default: // System/Status
renderSysMessage(mv);
}
}
示例4: loadModelFile
bool EditableModelItemImpl::loadModelFile(const std::string& filename)
{
BodyPtr newBody;
MessageView* mv = MessageView::instance();
mv->beginStdioRedirect();
bodyLoader.setMessageSink(mv->cout(true));
newBody = bodyLoader.load(filename);
mv->endStdioRedirect();
if(newBody){
newBody->initializeState();
newBody->calcForwardKinematics();
Link* link = newBody->rootLink();
AbstractBodyLoaderPtr loader = bodyLoader.lastActualBodyLoader();
VRMLBodyLoader* vloader = dynamic_cast<VRMLBodyLoader*>(loader.get());
if (vloader) {
// VRMLBodyLoader supports retriveOriginalNode function
setLinkTree(link, vloader);
} else {
// Other loaders dont, so we wrap with inline node
VRMLProtoInstance* proto = new VRMLProtoInstance(new VRMLProto(""));
MFNode* children = new MFNode();
VRMLInlinePtr inl = new VRMLInline();
inl->urls.push_back(filename);
children->push_back(inl);
proto->fields["children"] = *children;
// first, create joint item
JointItemPtr item = new JointItem(link);
item->originalNode = proto;
self->addChildItem(item);
ItemTreeView::instance()->checkItem(item, true);
// next, create link item under the joint item
LinkItemPtr litem = new LinkItem(link);
litem->originalNode = proto;
litem->setName("link");
item->addChildItem(litem);
ItemTreeView::instance()->checkItem(litem, true);
}
for (int i = 0; i < newBody->numDevices(); i++) {
Device* dev = newBody->device(i);
SensorItemPtr sitem = new SensorItem(dev);
Item* parent = self->findItem<Item>(dev->link()->name());
if (parent) {
parent->addChildItem(sitem);
ItemTreeView::instance()->checkItem(sitem, true);
}
}
}
return (newBody);
}
示例5: renderMessage
void ChatView::renderMessage(const MessageView &mv)
{
QString timestr = formatTimeStamp(mv.dateTime());
QString color = colorString(mv.isLocal(), mv.isSpooled());
if (useMessageIcons_ && mv.isAwaitingReceipt()) {
document()->addResource(QTextDocument::ImageResource, QUrl(QString("icon:delivery") + mv.messageId()), logIconSend);
}
QString icon = useMessageIcons_?
(QString("<img src=\"%1\" />").arg(mv.isLocal()?
(mv.isAwaitingReceipt()?QString("icon:delivery") + mv.messageId():"icon:log_icon_send"):"icon:log_icon_receive")):"";
if (mv.isEmote()) {
appendText(icon + QString("<span style=\"color: %1\">").arg(color) + QString("[%1]").arg(timestr) + QString(" *%1 ").arg(TextUtil::escape(mv.nick())) + mv.formattedText() + "</span>");
} else {
if (PsiOptions::instance()->getOption("options.ui.chat.use-chat-says-style").toBool()) {
appendText(icon + QString("<span style=\"color: %1\">").arg(color) + QString("[%1] ").arg(timestr) + tr("%1 says:").arg(TextUtil::escape(mv.nick())) + "</span><br>" + mv.formattedText());
}
else {
appendText(icon + QString("<span style=\"color: %1\">").arg(color) + QString("[%1] <").arg(timestr) + TextUtil::escape(mv.nick()) + QString("></span> ") + mv.formattedText());
}
}
if (mv.isLocal()) {
deferredScroll();
}
}
示例6: renderMucSubject
void ChatView::renderMucSubject(const MessageView &mv)
{
QString timestr = formatTimeStamp(mv.dateTime());
QString ut = mv.formattedUserText();
QString color = ColorOpt::instance()->color(infomrationalColorOpt).name();
QString userTextColor = ColorOpt::instance()->color("options.ui.look.colors.messages.usertext").name();
appendText(QString(useMessageIcons_?"<img src=\"icon:log_icon_info\" />":"") +
QString("<font color=\"%1\">[%2] *** ").arg(color, timestr) + mv.formattedText() +
(ut.isEmpty()?"":":<br>") + "</font>" +
(ut.isEmpty()?"":QString(" <span style=\"color:%1;font-weight:bold\">%2</span>").arg(userTextColor, ut)));
}
示例7: statusMessage
MessageView MessageView::statusMessage(const QString &nick, int status,
const QString &statusText, int priority)
{
MessageView mv = MessageView::fromPlainText(QObject::tr("%1 is now %2")
.arg(nick, status2txt(status)),
Status);
mv.setNick(nick);
mv.setStatus(status);
mv.setStatusPriority(priority);
mv.setUserText(statusText);
return mv;
}
示例8: MessageView
void MessageDialog::setupDialog(std::string& message, std::string& buttonText1, std::string& buttonText2)
{
// int resId = 0;
// int resSubId = 0;
MessageView* messageView = new MessageView(this, getDialogRect(), message);
addView(messageView, VIEW_ID_MESSAGE_VIEW);
Rect messageViewArea = messageView->getViewArea();
int middleX = messageViewArea.width() / 2;
int middleY = messageViewArea.height() - BUTTON_V_OFFSET - BUTTON_SIZE_Y;
Point middlePoint(middleX, middleY);
if(!buttonText1.empty())
{
Point button1Point = middlePoint;
if(!buttonText2.empty())
{
// setup for 2 buttons
button1Point.x -= BUTTON_SIZE_X + BUTTON_SPACE/2;
}
else
{
// setup for 1 button
button1Point.x -= BUTTON_SIZE_X/2;
}
// create button1
Button* button1 = new Button(this, messageView->localToGlobal(button1Point), VIEW_ID_BUTTON_1);
button1->setText(buttonText1.c_str());
addView(button1, VIEW_ID_BUTTON_1);
if(!buttonText2.empty())
{
Point button2Point = middlePoint;
button2Point.x += BUTTON_SPACE/2;
// create button2
Button* button2 = new Button(this, messageView->localToGlobal(button2Point), VIEW_ID_BUTTON_2);
button2->setText(buttonText2.c_str());
addView(button2, VIEW_ID_BUTTON_2);
}
}
// TODO: remove these catan specific things
#if (defined(CATAN_CLIENT) || defined(CATAN_STANDALONE))
// Draw Catan Scroll Border around dialog
CatanDialogBorder* borderView = new CatanDialogBorder(this, getDialogRect());
addView(borderView, VIEW_ID_BORDER);
#endif
redraw();
}
示例9: renderMucMessage
void ChatView::renderMucMessage(const MessageView &mv)
{
const QString timestr = formatTimeStamp(mv.dateTime());
QString alerttagso, alerttagsc, nickcolor;
QString textcolor = palette().color(QPalette::Active, QPalette::Text).name();
QString icon = useMessageIcons_?
(QString("<img src=\"%1\" />").arg(mv.isLocal()?"icon:log_icon_delivered":"icon:log_icon_receive")):"";
if(mv.isAlert()) {
textcolor = "#FF0000";
alerttagso = "<b>";
alerttagsc = "</b>";
}
if(mv.isSpooled()) {
nickcolor = ColorOpt::instance()->color(infomrationalColorOpt).name();
} else {
nickcolor = getMucNickColor(mv.nick(), mv.isLocal());
}
if(mv.isEmote()) {
appendText(icon + QString("<font color=\"%1\">").arg(nickcolor) + QString("[%1]").arg(timestr) + QString(" *%1 ").arg(TextUtil::escape(mv.nick())) + alerttagso + mv.formattedText() + alerttagsc + "</font>");
}
else {
if(PsiOptions::instance()->getOption("options.ui.chat.use-chat-says-style").toBool()) {
appendText(icon + QString("<font color=\"%1\">").arg(nickcolor) + QString("[%1] ").arg(timestr) + QString("%1 says:").arg(TextUtil::escape(mv.nick())) + "</font><br>" + QString("<font color=\"%1\">").arg(textcolor) + alerttagso + mv.formattedText() + alerttagsc + "</font>");
}
else {
appendText(icon + QString("<font color=\"%1\">").arg(nickcolor) + QString("[%1] <").arg(timestr) + TextUtil::escape(mv.nick()) + QString("></font> ") + QString("<font color=\"%1\">").arg(textcolor) + alerttagso + mv.formattedText() + alerttagsc +"</font>");
}
}
if(mv.isLocal()) {
scrollToBottom();
}
}
示例10: MessageView
MessageView* SessionTabWidget::openView(const QString& receiver)
{
MessageView* view = d.views.value(receiver.toLower());
if (!view)
{
view = new MessageView(d.handler.session(), this);
view->setReceiver(receiver);
connect(view, SIGNAL(alert(MessageView*, bool)), this, SLOT(alertTab(MessageView*, bool)));
connect(view, SIGNAL(highlight(MessageView*, bool)), this, SLOT(highlightTab(MessageView*, bool)));
connect(view, SIGNAL(query(QString)), this, SLOT(openView(QString)));
connect(view, SIGNAL(aboutToQuit()), this, SLOT(onAboutToQuit()));
d.handler.addReceiver(receiver, view);
d.views.insert(receiver.toLower(), view);
addTab(view, receiver);
}
示例11: MessageView
/**
* 静态方法,创建一个场景,并将自定义的MessageView布景层加入到该场景中
* return 返回创建好的场景对象
*/
CCScene* MessageView::CreateScene() {
CCScene* scene = CCScene::create() ;
MessageView* msgView = new MessageView() ; // MessageView::create() ;
if (msgView && msgView->init())
{
msgView->init() ;
}
msgView->autorelease() ;
scene->addChild(msgView) ;
return scene ;
}
示例12: renderUrls
void ChatView::renderUrls(const MessageView &mv)
{
QMap<QString, QString> urls = mv.urls();
foreach (const QString &key, urls.keys()) {
appendText(QString("<b>") + tr("URL:") + "</b> " + QString("%1").arg(TextUtil::linkify(TextUtil::escape(key))));
if (!urls.value(key).isEmpty()) {
appendText(QString("<b>") + tr("Desc:") + "</b> " + QString("%1").arg(urls.value(key)));
}
}
}
示例13: loadModelFile
bool BodyItemImpl::loadModelFile(const std::string& filename)
{
MessageView* mv = MessageView::instance();
mv->beginStdioRedirect();
bodyLoader.setMessageSink(mv->cout(true));
BodyPtr newBody = bodyLoader.load(filename);
mv->endStdioRedirect();
if(newBody){
body = newBody;
body->setName(self->name());
body->initializeState();
}
initBody(false);
return (newBody);
}
示例14: execute
bool ExtCommandItem::execute()
{
bool result = false;
MessageView* mv = MessageView::instance();
if(!command_.empty()){
terminate();
string actualCommand(command_);
#ifdef _WIN32
if(filesystem::path(actualCommand).extension() != ".exe"){
actualCommand += ".exe";
}
// quote the command string to support a path including spaces
process.start(QString("\"") + actualCommand.c_str() + "\"");
#else
process.start(actualCommand.c_str());
#endif
if(process.waitForStarted()){
mv->putln(fmt(_("External command \"%1%\" has been executed by item \"%2%\"."))
% actualCommand % name());
if(waitingTimeAfterStarted_ > 0.0){
msleep(waitingTimeAfterStarted_ * 1000.0);
}
result = true;
} else {
mv->put(fmt(_("External command \"%1%\" cannot be executed.")) % actualCommand);
if(!boost::filesystem::exists(actualCommand)){
mv->putln(_(" The command does not exist."));
} else {
mv->putln("");
}
}
}
return result;
}
示例15: onItemAdded
void onItemAdded(Item* item)
{
MessageView* mv = MessageView::instance();
if(BodyItem* bodyItem = dynamic_cast<BodyItem*>(item)){
Body* body = bodyItem->body();
for(size_t i=0; i < body->numDevices(); ++i){
Device* device = body->device(i);
if(!camera){
camera = dynamic_pointer_cast<Camera>(device);
if(camera){
mv->putln(format("RTCVisionSensorSamplePlugin: Detected Camera \"%1%\" of %2%.")
% camera->name() % body->name());
visionSensorSampleRTC->setCameraLocalT(camera->T_local());
}
}
if(!rangeSensor){
rangeSensor = dynamic_pointer_cast<RangeSensor>(device);
if(rangeSensor){
mv->putln(format("RTCVisionSensorSamplePlugin: Detected RangeSensor \"%1%\" of %2%.")
% rangeSensor->name() % body->name());
visionSensorSampleRTC->setRangeSensorLocalT(rangeSensor->T_local());
}
}
}
}else if(PointSetItem* pointSetItem = dynamic_cast<PointSetItem*>(item)){
if(pointSetItem->name() == "RangeCameraPoints"){
pointSetFromRangeCamera = pointSetItem->pointSet();
mv->putln("RTCVisionSensorSamplePlugin: Detected PointSetItem \"RangeCameraPoints\"");
visionSensorSampleRTC->setPointSetFromRangeCamera(pointSetFromRangeCamera);
} else if(pointSetItem->name() == "RangeSensorPoints"){
pointSetFromRangeSensor = pointSetItem->pointSet();
mv->putln("RTCVisionSensorSamplePlugin: Detected PointSetItem \"RangeSensorPoints\"");
visionSensorSampleRTC->setPointSetFromRangeSensor(pointSetFromRangeSensor);
}
}
}