const TRaster32P &TColorStyle::getIcon(const TDimension &d) { checkErrorsByGL; if (!m_validIcon || !m_icon || m_icon->getSize() != d) { checkErrorsByGL; makeIcon(d); checkErrorsByGL; m_validIcon = true; } checkErrorsByGL; if (!m_icon) { checkErrorsByGL; TRaster32P icon(d); checkErrorsByGL; icon->fill(TPixel32::Black); checkErrorsByGL; int lx = icon->getLx(); checkErrorsByGL; int ly = icon->getLy(); checkErrorsByGL; for (int y = 0; y < ly; y++) { checkErrorsByGL; int x = ((lx - 1 - 10) * y / ly); checkErrorsByGL; icon->extractT(x, y, x + 5, y)->fill(TPixel32::Red); checkErrorsByGL; } checkErrorsByGL; m_icon = icon; checkErrorsByGL; } return m_icon; }
void PsiTrayIcon::animate() { if ( !icon_ ) return; QString cachedName = "PsiTray/" + PsiOptions::instance()->getOption("options.iconsets.status").toString() + "/" + icon_->name() + "/" + QString::number( icon_->frameNumber() ); QPixmap p; if ( !QPixmapCache::find(cachedName, p) ) { p = makeIcon(); QPixmapCache::insert( cachedName, p ); } trayicon_->setIcon(p); }
int QGroupList::read(QString Path, const QVector<QString>& vEnabledDE, bool EnableSudo, bool EnableSu) { clear(); QDir dir(Path); if (!dir.exists(Path)) return 0; QStringList DirList =dir.entryList(QStringList("*.desktop")); for(int i=0; i<DirList.size(); i++) { QCPItem* anItem = new QCPItem; if (anItem->readDE(dir.absoluteFilePath(DirList[i]), vEnabledDE)) { if ((anItem->isSudoRequired() && (!EnableSudo)) ||(anItem->isRootRequired() && (!EnableSu))) { delete anItem; } else { makeIcon(anItem); addItem(anItem); } } else delete anItem; }// for all files in dir setAcceptDrops(false); setDragEnabled(false); setIconSize(QSize(32, 32)); fitSize(); return count(); }