void MsgViewItem::SetEventLine() { QString s = EventDescription(msg); QString text; switch(msg->SubCommand()) { case ICQ_CMDxSUB_MSG: text = m_codec->toUnicode(msg->Text()); break; case ICQ_CMDxSUB_URL: text = m_codec->toUnicode(((CEventUrl *)msg)->Url()); break; case ICQ_CMDxSUB_CHAT: text = m_codec->toUnicode(((CEventChat *)msg)->Reason()); break; case ICQ_CMDxSUB_FILE: text = m_codec->toUnicode(((CEventFile *)msg)->Filename()); break; case ICQ_CMDxSUB_EMAILxALERT: text = m_codec->toUnicode(((CEventEmailAlert *)msg)->From()); break; default: break; } if (!text.isNull()) { int width = listView()->columnWidth(1); QFont f = listView()->font(); if (m_nEventId != -1) f.setBold(true); QFontMetrics fm(f); width -= fm.width(s) + fm.width(" [...]") + listView()->itemMargin() * 2; s += " ["; // We're going to take the event's message and display as much of it // as fits in the widget. If not everything fits, we'll append "..." uint length = text.length(); const QChar *c = text.unicode(); while (length--) { if (*c == '\n') break; // we only print the first line width -= fm.width(*c); if (width <= 0) { s += "..."; break; } s += *c; c++; } s += "]"; } setText(1, s); }
// Initializes FMOD Studio and loads all sound banks. Audio() : Listener(system) { // Create the FMOD Studio system. FmodCall(fmod::System::create(&system)); // Initialize the system. FmodCall(system->initialize( maxChannels, // max channels capable of playing audio FMOD_STUDIO_INIT_NORMAL, // studio-specific flags FMOD_INIT_3D_RIGHTHANDED, // regular flags nullptr)); // extra driver data vector<fmod::Bank*> banks; // For each file in the Sounds directory with a *.bank extension: for (const string& file : PathInfo(config::Sounds).FilesWithExtension("bank")) { // Load the sound bank from file. fmod::Bank* bank = nullptr; FmodCall(system->loadBankFile(file.c_str(), FMOD_STUDIO_LOAD_BANK_NORMAL, &bank)); banks.push_back(bank); } for (fmod::Bank* bank : banks) { // Get the number of events in the bank. int eventCount = 0; FmodCall(bank->getEventCount(&eventCount)); if (eventCount == 0) continue; // Get the list of event descriptions from the bank. auto eventArray = vector<fmod::EventDescription*>(static_cast<size_t>(eventCount), nullptr); FmodCall(bank->getEventList(eventArray.data(), eventArray.size(), nullptr)); // For each event description: for (fmod::EventDescription* eventDescription : eventArray) { // Get the path to the event, e.g. "event:/Ambience/Country" auto path = string(512, ' '); int retrieved = 0; FmodCall(eventDescription->getPath(&path[0], path.size(), &retrieved)); path.resize(static_cast<size_t>(retrieved - 1)); // - 1 to account for null character // Save the event description in the event map. eventDescriptionMap.emplace(path, EventDescription(eventDescription, path)); } } Note(*this); }