// Set icons to the current theme void CoordinateCapture::setCurrentTheme( QString theThemeName ) { mQActionPointer->setIcon( QIcon( getIconPath( "coordinate_capture.png" ) ) ); mpTrackMouseButton->setIcon( QIcon( getIconPath( "tracking.png" ) ) ); mpCaptureButton->setIcon( QIcon( getIconPath( "coordinate_capture.png" ) ) ); mypUserCrsToolButton->setIcon( QIcon( getIconPath( "geographic.png" ) ) ); mypCRSLabel->setPixmap( QPixmap( getIconPath( "transformed.png" ) ) ); }
void AlchemyWindow::open() { openContainer(MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); setFilter(ContainerBase::Filter_Ingredients); // pick the best available apparatus MWWorld::ContainerStore& store = MWWorld::Class::get(mPtr).getContainerStore(mPtr); MWWorld::Ptr bestAlbemic; MWWorld::Ptr bestMortarPestle; MWWorld::Ptr bestCalcinator; MWWorld::Ptr bestRetort; for (MWWorld::ContainerStoreIterator it(store.begin(MWWorld::ContainerStore::Type_Apparatus)); it != store.end(); ++it) { MWWorld::LiveCellRef<ESM::Apparatus>* ref = it->get<ESM::Apparatus>(); if (ref->base->mData.mType == ESM::Apparatus::Albemic && (bestAlbemic.isEmpty() || ref->base->mData.mQuality > bestAlbemic.get<ESM::Apparatus>()->base->mData.mQuality)) bestAlbemic = *it; else if (ref->base->mData.mType == ESM::Apparatus::MortarPestle && (bestMortarPestle.isEmpty() || ref->base->mData.mQuality > bestMortarPestle.get<ESM::Apparatus>()->base->mData.mQuality)) bestMortarPestle = *it; else if (ref->base->mData.mType == ESM::Apparatus::Calcinator && (bestCalcinator.isEmpty() || ref->base->mData.mQuality > bestCalcinator.get<ESM::Apparatus>()->base->mData.mQuality)) bestCalcinator = *it; else if (ref->base->mData.mType == ESM::Apparatus::Retort && (bestRetort.isEmpty() || ref->base->mData.mQuality > bestRetort.get<ESM::Apparatus>()->base->mData.mQuality)) bestRetort = *it; } if (!bestMortarPestle.isEmpty()) { mApparatus1->setUserString("ToolTipType", "ItemPtr"); mApparatus1->setUserData(bestMortarPestle); mApparatus1->setImageTexture(getIconPath(bestMortarPestle)); } if (!bestAlbemic.isEmpty()) { mApparatus2->setUserString("ToolTipType", "ItemPtr"); mApparatus2->setUserData(bestAlbemic); mApparatus2->setImageTexture(getIconPath(bestAlbemic)); } if (!bestCalcinator.isEmpty()) { mApparatus3->setUserString("ToolTipType", "ItemPtr"); mApparatus3->setUserData(bestCalcinator); mApparatus3->setImageTexture(getIconPath(bestCalcinator)); } if (!bestRetort.isEmpty()) { mApparatus4->setUserString("ToolTipType", "ItemPtr"); mApparatus4->setUserData(bestRetort); mApparatus4->setImageTexture(getIconPath(bestRetort)); } }
// Set icons to the current theme void CoordinateCapture::setCurrentTheme( const QString &themeName ) { Q_UNUSED( themeName ); if ( mQActionPointer ) mQActionPointer->setIcon( QIcon( getIconPath( "coordinate_capture.png" ) ) ); if ( mpDockWidget ) { mpTrackMouseButton->setIcon( QIcon( getIconPath( "tracking.svg" ) ) ); mpCaptureButton->setIcon( QIcon( getIconPath( "coordinate_capture.png" ) ) ); mypUserCrsToolButton->setIcon( QIcon( getIconPath( "mIconProjectionEnabled.svg" ) ) ); mypCRSLabel->setPixmap( QPixmap( getIconPath( QStringLiteral( "transformed.svg" ) ) ) ); } }
void AlchemyWindow::open() { mAlchemy.setAlchemist (MWBase::Environment::get().getWorld()->getPlayerPtr()); InventoryItemModel* model = new InventoryItemModel(MWBase::Environment::get().getWorld()->getPlayerPtr()); mSortModel = new SortFilterItemModel(model); mSortModel->setFilter(SortFilterItemModel::Filter_OnlyIngredients); mItemView->setModel (mSortModel); mNameEdit->setCaption(""); int index = 0; mAlchemy.setAlchemist (MWBase::Environment::get().getWorld()->getPlayerPtr()); for (MWMechanics::Alchemy::TToolsIterator iter (mAlchemy.beginTools()); iter!=mAlchemy.endTools() && index<static_cast<int> (mApparatus.size()); ++iter, ++index) { if (!iter->isEmpty()) { mApparatus.at (index)->setUserString ("ToolTipType", "ItemPtr"); mApparatus.at (index)->setUserData (*iter); mApparatus.at (index)->setImageTexture (getIconPath (*iter)); } } update(); }
void DesktopFileModel::fillDataReally() { beginResetModel(); _modelData.clear(); endResetModel(); QStringList desktopPath; desktopPath << "/usr/share/applications"; desktopPath << QString("%1/.local/share/applications").arg(QDir::homePath()); foreach (const QString &path, desktopPath) { QDir desktopDir(path); foreach (const QString &desktop, desktopDir.entryList(QStringList() << "*.desktop", QDir::Files, QDir::NoSort)) { MDesktopEntry entry(QString("%1/%2").arg(path).arg(desktop)); if (entry.isValid() && entry.type() == "Application") { if (!_showHidden && (entry.icon().isEmpty() || entry.icon() == "icon-launcher-dummy" || entry.noDisplay())) { continue; } beginInsertRows(QModelIndex(), rowCount(), rowCount()); QVariantMap data; data["name"] = entry.name(); data["icon"] = getIconPath(entry.icon()); data["path"] = entry.fileName(); // qDebug() << "added:" << entry.fileName(); _modelData.append(data); endInsertRows(); } QCoreApplication::processEvents(); } }
void Win32TaskbarManager::setOverlayIcon(const Common::String &name, const Common::String &description) { //warning("[Win32TaskbarManager::setOverlayIcon] Setting overlay icon to: %s (%s)", name.c_str(), description.c_str()); if (_taskbar == NULL) return; if (name.empty()) { _taskbar->SetOverlayIcon(getHwnd(), NULL, L""); return; } // Compute full icon path Common::String path = getIconPath(name); if (path.empty()) return; HICON pIcon = (HICON)::LoadImage(NULL, path.c_str(), IMAGE_ICON, 16, 16, LR_LOADFROMFILE); if (!pIcon) { warning("[Win32TaskbarManager::setOverlayIcon] Cannot load icon!"); return; } // Sets the overlay icon LPWSTR desc = ansiToUnicode(description.c_str()); _taskbar->SetOverlayIcon(getHwnd(), pIcon, desc); DestroyIcon(pIcon); delete[] desc; }
QString KIconLoader::getIconPath( const QString &name, bool always_valid) { QString full_path; QFileInfo finfo; if( name.left(1) == "/" ){ full_path = name; } else{ QStrListIterator it( pixmap_dirs ); while ( it.current() ){ full_path = it.current(); full_path.detach(); full_path += '/'; full_path += name; finfo.setFile( full_path ); if ( finfo.exists() ) break; ++it; } if ( (always_valid) && (!it.current()) ){ // Let's be recursive (but just once at most) full_path = getIconPath( "unknown.xpm" , false); } } return full_path; }
void AlchemyWindow::onSelectedItemImpl(MWWorld::Ptr item) { MyGUI::ImageBox* add = NULL; // don't allow to add an ingredient that is already added // (which could happen if two similiar ingredients don't stack because of script / owner) bool alreadyAdded = false; std::string name = MWWorld::Class::get(item).getName(item); if (mIngredient1->isUserString("ToolTipType")) { MWWorld::Ptr item2 = *mIngredient1->getUserData<MWWorld::Ptr>(); std::string name2 = MWWorld::Class::get(item2).getName(item2); if (name == name2) alreadyAdded = true; } if (mIngredient2->isUserString("ToolTipType")) { MWWorld::Ptr item2 = *mIngredient2->getUserData<MWWorld::Ptr>(); std::string name2 = MWWorld::Class::get(item2).getName(item2); if (name == name2) alreadyAdded = true; } if (mIngredient3->isUserString("ToolTipType")) { MWWorld::Ptr item2 = *mIngredient3->getUserData<MWWorld::Ptr>(); std::string name2 = MWWorld::Class::get(item2).getName(item2); if (name == name2) alreadyAdded = true; } if (mIngredient4->isUserString("ToolTipType")) { MWWorld::Ptr item2 = *mIngredient4->getUserData<MWWorld::Ptr>(); std::string name2 = MWWorld::Class::get(item2).getName(item2); if (name == name2) alreadyAdded = true; } if (alreadyAdded) return; if (!mIngredient1->isUserString("ToolTipType")) add = mIngredient1; if (add == NULL && !mIngredient2->isUserString("ToolTipType")) add = mIngredient2; if (add == NULL && !mIngredient3->isUserString("ToolTipType")) add = mIngredient3; if (add == NULL && !mIngredient4->isUserString("ToolTipType")) add = mIngredient4; if (add != NULL) { add->setUserString("ToolTipType", "ItemPtr"); add->setUserData(item); add->setImageTexture(getIconPath(item)); drawItems(); update(); std::string sound = MWWorld::Class::get(item).getUpSoundId(item); MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); } }
void AlchemyWindow::update() { MWMechanics::Alchemy::TIngredientsIterator it = mAlchemy.beginIngredients (); for (int i=0; i<4; ++i) { MyGUI::ImageBox* ingredient = mIngredients[i]; MWWorld::Ptr item; if (it != mAlchemy.endIngredients ()) { item = *it; ++it; } if (ingredient->getChildCount()) MyGUI::Gui::getInstance().destroyWidget(ingredient->getChildAt(0)); ingredient->setImageTexture(""); ingredient->clearUserStrings (); if (item.isEmpty ()) continue; ingredient->setUserString("ToolTipType", "ItemPtr"); ingredient->setUserData(item); ingredient->setImageTexture(getIconPath(item)); MyGUI::TextBox* text = ingredient->createWidget<MyGUI::TextBox>("SandBrightText", MyGUI::IntCoord(0, 14, 32, 18), MyGUI::Align::Default, std::string("Label")); text->setTextAlign(MyGUI::Align::Right); text->setNeedMouseFocus(false); text->setTextShadow(true); text->setTextShadowColour(MyGUI::Colour(0,0,0)); text->setCaption(getCountString(ingredient->getUserData<MWWorld::Ptr>()->getRefData().getCount())); } drawItems(); std::vector<ESM::ENAMstruct> effects; ESM::EffectList list; list.mList = effects; for (MWMechanics::Alchemy::TEffectsIterator it = mAlchemy.beginEffects (); it != mAlchemy.endEffects (); ++it) { list.mList.push_back(*it); } while (mEffectsBox->getChildCount()) MyGUI::Gui::getInstance().destroyWidget(mEffectsBox->getChildAt(0)); MyGUI::IntCoord coord(0, 0, mEffectsBox->getWidth(), 24); Widgets::MWEffectListPtr effectsWidget = mEffectsBox->createWidget<Widgets::MWEffectList> ("MW_StatName", coord, MyGUI::Align::Left | MyGUI::Align::Top); effectsWidget->setWindowManager(&mWindowManager); Widgets::SpellEffectList _list = Widgets::MWEffectList::effectListFromESM(&list); effectsWidget->setEffectList(_list); std::vector<MyGUI::Widget*> effectItems; effectsWidget->createEffectWidgets(effectItems, mEffectsBox, coord, false, 0); effectsWidget->setCoord(coord); }
void VerbyPlugin::addCatItem(QString text, QList<CatItem>* results, QString fullName, QString shortName, QString iconName) { if (text.length() == 0 || isMatch(shortName, text)) { CatItem item = CatItem(fullName, shortName, HASH_VERBY, getIconPath() + iconName); item.usage = (*settings)->value("verby/" + shortName.replace(" ", "") , 0).toInt(); results->push_back(item); } }
void controlyPlugin::addCatItem(QString text, QList<CatItem>* results, QString fullName, QString shortName) { if (text.length() == 0 || isMatch(shortName, text)) { CatItem& item = CatItem(fullName, shortName, HASH_controly, getIconPath() + fullName.toLower() + ".png"); item.usage = (*settings)->value("controly/" + shortName.replace(" ", "") , 0).toInt(); results->push_back(item); } }
void Win32TaskbarManager::addRecent(const Common::String &name, const Common::String &description) { //warning("[Win32TaskbarManager::addRecent] Adding recent list entry: %s (%s)", name.c_str(), description.c_str()); if (_taskbar == NULL) return; // ANSI version doesn't seem to work correctly with Win7 jump lists, so explicitly use Unicode interface. IShellLinkW *link; // Get the ScummVM executable path. WCHAR path[MAX_PATH]; GetModuleFileNameW(NULL, path, MAX_PATH); // Create a shell link. if (SUCCEEDED(CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC, IID_IShellLinkW, reinterpret_cast<void **> (&link)))) { // Convert game name and description to Unicode. LPWSTR game = ansiToUnicode(name.c_str()); LPWSTR desc = ansiToUnicode(description.c_str()); // Set link properties. link->SetPath(path); link->SetArguments(game); Common::String iconPath = getIconPath(name); if (iconPath.empty()) { link->SetIconLocation(path, 0); // No game-specific icon available } else { LPWSTR icon = ansiToUnicode(iconPath.c_str()); link->SetIconLocation(icon, 0); delete[] icon; } // The link's display name must be set via property store. IPropertyStore* propStore; HRESULT hr = link->QueryInterface(IID_IPropertyStore, reinterpret_cast<void **> (&(propStore))); if (SUCCEEDED(hr)) { PROPVARIANT pv; pv.vt = VT_LPWSTR; pv.pwszVal = desc; hr = propStore->SetValue(PKEY_Title, pv); propStore->Commit(); propStore->Release(); } // SHAddToRecentDocs will cause the games to be added to the Recent list, allowing the user to pin them. SHAddToRecentDocs(SHARD_LINK, link); link->Release(); delete[] game; delete[] desc; } }
bool EvaImageResource::loadIcon() { QString path = getIconPath() + "/eva.theme"; QDir d; if(!d.exists(path)){ themePath = ""; // if theme not exist, load default one path = getIconPath() + "/eva.theme"; } QFile file( path); if(!file.open(IO_ReadOnly)){ return false; } QTextStream stream(&file); QString line, imagePath; QStringList lineList; while(!stream.atEnd()){ line = stream.readLine().stripWhiteSpace(); lineList = QStringList::split(":", line); if(lineList.size() != 2) continue; lineList[0].stripWhiteSpace(); imagePath = getIconPath() + "/" + lineList[1].stripWhiteSpace(); if(lineList[0] == "LOGIN_MNG"){ loginMng = QMovie(imagePath); continue; } QPixmap img(imagePath); if(!img.isNull()){ iconList[lineList[0]] = img; iconFileNameMap[lineList[0]] = lineList[1].stripWhiteSpace(); } } file.close(); return true; }
void VerbyPlugin::getResults(QList<InputData>* inputData, QList<CatItem>* results) { if (inputData->count() == 2) { if (inputData->first().hasLabel(HASH_DIR)) { results->push_back(CatItem("Properties", "Directory properties", HASH_VERBY, getIconPath() + "properties.png")); } else if (inputData->first().hasLabel(HASH_FILE)) { results->push_back(CatItem("Open containing folder", "Open containing folder", HASH_VERBY, getIconPath() + "opencontainer.png")); results->push_back(CatItem("Properties", "File properties", HASH_VERBY, getIconPath() + "properties.png")); } else if (inputData->first().hasLabel(HASH_LINK)) { results->push_back(CatItem("Run", "Run", HASH_VERBY, getIconPath() + "run.png")); results->push_back(CatItem("Run as", "Run as a different user", HASH_VERBY, getIconPath() + "run.png")); results->push_back(CatItem("Open containing folder", "Open containing folder", HASH_VERBY, getIconPath() + "opencontainer.png")); results->push_back(CatItem("Open shortcut folder", "Open shortcut folder", HASH_VERBY, getIconPath() + "opencontainer.png")); results->push_back(CatItem("Copy path", "Copy path to clipboard", HASH_VERBY, getIconPath() + "copy.png")); results->push_back(CatItem("Properties", "File properties", HASH_VERBY, getIconPath() + "properties.png")); inputData->first().setID(HASH_VERBY); inputData->first().getTopResult().id = HASH_VERBY; } else { return; } if (inputData->last().hasText()) results->push_front(CatItem(inputData->last().getText(), inputData->last().getText(), 0, inputData->first().getTopResult().icon)); } }
/// Retrieve image item according to the signal sended by music player. void StatusBarItemMusicPlayer::setImage(int state) { if (state == HIDE_PLAYER) { if(sys::SysStatus::instance().isMusicPlayerRunning()) { img_ = QImage(getIconPath(":/images/music_player_playing.png")); } else { img_ = QImage(""); } } else if(state == MUSIC_PLAYING) { state_ = state; img_ = QImage(getIconPath(":/images/music_player_playing.png")); } else if(state == MUSIC_PAUSED) { state_ = state; img_ = QImage(getIconPath(":/images/music_player_paused.png")); } else if(state == MUSIC_STOPPED && sys::SysStatus::instance().isMusicPlayerRunning()) { state_ = state; img_ = QImage(getIconPath(":/images/music_player_stopped.png")); } else if(state == STOP_PLAYER || !sys::SysStatus::instance().isMusicPlayerRunning()) { state_ = 0; img_ = QImage(""); } setFixedWidth(img_.width()); }
QPixmap KIconLoader::loadInternal ( const QString &name, int w, int h ){ QPixmap *pix; KPixmap new_xpm; int index; if ( (index = name_list.find(name)) < 0){ pix = new QPixmap; new_xpm.load( getIconPath(name), 0L, KPixmap::LowColor ); *pix = new_xpm; if( !(pix->isNull()) ){ name_list.append(name); pixmap_list.append(pix); } else { delete pix; return new_xpm; } } else{ pix = pixmap_list.at(index); } if (pix && !pix->isNull() && w > 0 && h > 0 && (pix->width() > w || pix->height() > h)){ QWMatrix m; m.scale(w/(float)pix->width(), h/(float)pix->height()); return pix->xForm(m); } return *pix; }
void AlchemyWindow::open() { openContainer (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); // this sets mPtr setFilter (ContainerBase::Filter_Ingredients); mAlchemy.setAlchemist (mPtr); int index = 0; for (MWMechanics::Alchemy::TToolsIterator iter (mAlchemy.beginTools()); iter!=mAlchemy.endTools() && index<static_cast<int> (mApparatus.size()); ++iter, ++index) { if (!iter->isEmpty()) { mApparatus.at (index)->setUserString ("ToolTipType", "ItemPtr"); mApparatus.at (index)->setUserData (*iter); mApparatus.at (index)->setImageTexture (getIconPath (*iter)); } } update(); }
void VerbyPlugin::getResults(QList<InputData>* inputData, QList<CatItem>* results) { if (inputData->count() == 2) { QString text = inputData->at(1).getText(); if (inputData->first().hasLabel(HASH_DIR)) { addCatItem(text, results, "Properties", "Directory properties", "properties.png"); } else if (inputData->first().hasLabel(HASH_FILE)) { addCatItem(text, results, "Open containing folder", "Open containing folder", "opencontainer.png"); addCatItem(text, results, "Properties", "File properties", "properties.png"); } else if (inputData->first().hasLabel(HASH_LINK)) { addCatItem(text, results, "Run as", "Run as a different user", "run.png"); addCatItem(text, results, "Open containing folder", "Open containing folder", "opencontainer.png"); addCatItem(text, results, "Open shortcut folder", "Open shortcut folder", "opencontainer.png"); addCatItem(text, results, "Copy path", "Copy path to clipboard", "copy.png"); addCatItem(text, results, "Properties", "File properties", "properties.png"); } else { return; } // Mark the item as a Verby item so that Verby has a chance to process it before Launchy inputData->first().setID(HASH_VERBY); inputData->first().getTopResult().id = HASH_VERBY; // ensure there's always an item at the top of the list for launching with parameters. results->push_front(CatItem( "Run", inputData->last().getText(), INT_MAX, getIconPath() + "run.png")); } }
QString controlyPlugin::getIcon() { return getIconPath() + "/plugins/icons/controly.png"; }
//eigentliche laderoutine Xfire_icon_cache Xfire_icon_mng::LoadGameIcon(unsigned int gameid) { Xfire_icon_cache entry = { 0 }; //shortname char shortname[255] = ""; if (!getIniValue(gameid, "ShortName", shortname)) return entry; //spielid zuweisen entry.gameid = gameid; //Icons.dll noch nicht geladen?!? if (!hIconDll) { //versuch die Icons.dll zuladen char path[MAX_PATH] = ""; if (!getIconPath(path)) return entry; strcat_s(path, MAX_PATH, IconsdllName); hIconDll = LoadLibraryA(path); } //dll konnte geladen werden if (hIconDll) { char resourcename[255]; //kurznamen des spiels uppercasen und .ICO anhängen mir_snprintf(resourcename, _countof(resourcename), "XF_%s.ICO", shortname); Xfire_base::strtoupper(resourcename); //versuche die resource zufinden HRSRC hrsrc = FindResourceA(hIconDll, resourcename, "ICONS"); if (hrsrc) { //aus der resource ein HICON erstellen int size = SizeofResource(hIconDll, hrsrc); //iconresource laden HGLOBAL hglobal = LoadResource(hIconDll, hrsrc); if (hglobal) { //lock LPVOID data = LockResource(hglobal); if (data) { //erzeuge ein handle für das icon und ab in den cache damit entry.hicon = this->createHICONfromdata(data, size); UnlockResource(hglobal); } FreeResource(hglobal); } } } //kein icon in der dll, dann aus dem internet laden if (!entry.hicon) entry.hicon = downloadIcon(shortname); //wenn ein hicon erzeugt wurde, dann handle erstellen und in den cache laden if (entry.hicon) entry.handle = this->createIconHandle(entry.hicon); //eintrag in den cache, selbst wenn kein icon geladen werden konnte this->iconcache.push_back(entry); return entry; }
const QString EvaImageResource::getIconFullPath(QString name) { QMap<QString, QString>::Iterator iter = iconFileNameMap.find(name); if(iter== iconFileNameMap.end()) return ""; return getIconPath() + "/" + iter.data(); }
QString VerbyPlugin::getIcon() { return getIconPath() + "verby.png"; }