本文整理汇总了C++中Status::AddIcon方法的典型用法代码示例。如果您正苦于以下问题:C++ Status::AddIcon方法的具体用法?C++ Status::AddIcon怎么用?C++ Status::AddIcon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Status
的用法示例。
在下文中一共展示了Status::AddIcon方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
std::map<std::string, Status*> Status::GetAllStatusses()
{
if (s_allStatusses.size() == 0)
{
IImageManager* imageManager = PlatformSpecific::GetImageManager();
//otherwise open status XML file
typedef vector<XMLNode*>::const_iterator SI;
vector<XMLNode*> statusNodes = BmeClient::GetPreferences()->GetIconPrefs()->GetStatusNodes();
for (SI s = statusNodes.begin(); s != statusNodes.end(); ++s)
{
XMLNode* statusNode = *s;
if (statusNode->Name() == "status")
{
vector<XMLNode*> children = statusNode->Children();
Status* status = new Status();
for (SI c = children.begin(); c != children.end(); ++c)
{
XMLNode* statusChild = *c;
if (statusChild->Name() == "icon")
{
std::string iconPath = statusChild->StringValue();
IPath* iconFullPath = PlatformSpecific::GetPathManager()->GetIconPrefsPath()->Append(iconPath);
Image* statusIcon = imageManager->GetImageFromFile(iconFullPath->ToString());
status->AddIcon(statusIcon);
delete iconFullPath;
}
else if (statusChild->Name() == "message")
{
status->SetStatusName(statusChild->StringValue());
}
else if (statusChild->Name() == "protocol")
{
status->SetAbbreviation(statusChild->StringValue());
}
else if (statusChild->Name() == "visible")
{
bool userChoice = atoi(statusChild->StringValue().c_str());
status->SetUserChoice(userChoice);
}
else if (statusChild->Name() == "color")
{
}
}
s_allStatusses[status->GetAbbreviation()] = (status);
}
}
delete imageManager;
}
return s_allStatusses;
}
示例2: LoadStatusses
status_t LoadStatusses(BPath statFilePath)
{
status_t error = B_OK;
//open file
BFile statFile(statFilePath.Path(), B_READ_ONLY);
error = statFile.InitCheck();
if (error != B_ERROR)
{
StringList *tokenList = new StringList();
//read line
off_t fileSize;
if (statFile.GetSize(&fileSize) == B_OK)
{
ssize_t bytesRead = 0;
BString* token = new BString("");
bool newToken = false;
do
{
char c[2];
bytesRead += statFile.Read(c,1);
c[1] = '\0';
if (c[0] == '\t' || c[0] == '\n')
{
//clear token
if (!newToken)
{
//add token to list
tokenList->AddItem(token);
token = new BString("");
newToken = true;
}
}
else
{
token->Append(c);
newToken = false;
}
}
while (bytesRead < fileSize);
}
int32 startIndex = -1;
int32 endIndex = -1;
for (int32 i = 0; i < tokenList->CountItems(); i++)
{
if ((*tokenList)[i].ICompare("<status>") == 0)
startIndex = i;
else if ((*tokenList)[i].ICompare("</status>") == 0)
{
endIndex = i;
break;
}
}
if (startIndex != -1 && endIndex != -1)
{
//start past the <status> tag
startIndex++;
for (int32 i = startIndex; i < endIndex; i++)
{
int32 lastLineIndex = i + 4;
if (lastLineIndex < endIndex)
{
//parse lines
BString bitmapString = (*tokenList)[i];
BString statusName = (*tokenList)[i+1];
BString abbreviation = (*tokenList)[i+2];
bool userChoice = atoi((*tokenList)[i+3].String());
BString colourString = (*tokenList)[i+4];
i += 4;
//construct bitmap path
BPath bitmapPath;
statFilePath.GetParent(&bitmapPath);
bitmapPath.Append(bitmapString.String());
BBitmap *icon = BTranslationUtils::GetBitmap(bitmapPath.Path());
//construct status object
Status *status = FindStatus(abbreviation);
if (status != NULL)
{
status->AddIcon(icon);
}
else
{
//remove brackets from colourString
colourString.RemoveAll("{");
colourString.RemoveAll("}");
int32 colours[4];
int32 startIndex = 0;
for (int i = 0; i < 4; i++)
{
int32 commaIndex = colourString.FindFirst(",",startIndex);
if (commaIndex != B_ERROR)
{
BString colourValue;
colourString.CopyInto(colourValue,startIndex, commaIndex-startIndex);
colours[i] = atoi(colourValue.String());
startIndex = commaIndex + 1;
//.........这里部分代码省略.........