Пример #1
0
   void DesktopView::loadIcons()
   {
       QDir desktop(QDir::homePath()+"/Desktop");
       desktop.setFilter(QDir::Files | QDir::NoDotAndDotDot);
       desktop.setSorting(QDir::Size | QDir::Reversed);
       QFileInfoList list = desktop.entryInfoList();

     //  d->iconWatcher->setFuture(QtConcurrent::mapped(list, LoadIcon(d->iconprovider, d->row, d->column)));

       for (int i = 0; i < list.size(); i++) {
         QFileInfo fileInfo = list.at(i);
         QPixmap iconpixmap (DesktopWidget::applicationDirPath() +
            "/share/plexy/skins/widgets/widget01/Icon.png");
         //TODO
         //Shared pointer please

         Icon * icon = new Icon(d->iconprovider, QRect(0,0,iconpixmap.width(),iconpixmap.height()));
         icon->setContent(fileInfo.absoluteFilePath());
         if(icon->isValid()) {
         scene()->addItem(icon);
         icon->setPos(d->row,d->column);
         icon->show();
         d->icons.append(icon);
         } else {
             delete icon;
         }
       }

   }
Пример #2
0
void IconProvider::remove(Icon icon)
{
    if (!icon.isValid())
        return;

    auto id = icon.id();
    FridaIcon *iconHandle;
    {
        QMutexLocker locker(&m_mutex);
        iconHandle = m_icons[id];
        m_icons.remove(id);
    }
    g_object_unref(iconHandle);
}