Esempio n. 1
0
void SummaryWidget::createDiskMaps()
{
    DiskList disks;

    const Q3CString free = i18n("Free").toLocal8Bit();
    const Q3CString used = i18n("Used").toLocal8Bit();

    KIconLoader loader;

    oldScheme = Config::scheme;
    Config::scheme = (Filelight::MapScheme)2000;

    for (DiskList::ConstIterator it = disks.begin(), end = disks.end(); it != end; ++it)
    {
        Disk const &disk = *it;

        if (disk.free == 0 && disk.used == 0)
            continue;

        QWidget *box = new QWidget(this);
        box->setLayout(new QVBoxLayout(box));
        //box->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum);
        RadialMap::Widget *map = new MyRadialMap(box);

//        QString text; QTextOStream(&text)
//            << "<img src='" << loader.iconPath(disk.icon, KIconLoader::Toolbar) << "'>"
//            << " &nbsp;" << disk.mount << " "
//            << "<i>(" << disk.device << ")</i>";

        QGridLayout* horizontalLayout = new QGridLayout(box);

        QLabel *icon = new QLabel(box);
        icon->setPixmap(KIcon(disk.icon).pixmap(32,32));
        horizontalLayout->addWidget(icon);

        QLabel *label = new QLabel(disk.mount + " (" + disk.device + ")", box);
        label->setAlignment(Qt::AlignCenter);
        horizontalLayout->addWidget(label);

        box->layout()->addWidget(map);
        box->layout()->addItem(horizontalLayout);

        layout()->addWidget(box);
        //box->show(); // will show its children too

        Directory *tree = new Directory(disk.mount.toLocal8Bit());
        tree->append(free, disk.free);
        tree->append(used, disk.used);

        map->create(tree); //must be done when visible

        connect(map, SIGNAL(activated(const KUrl&)), SIGNAL(activated(const KUrl&)));
    }
}
void
SummaryWidget::createDiskMaps()
{
    DiskList disks;

    const QCString free = i18n( "Free" ).local8Bit();
    const QCString used = i18n( "Used" ).local8Bit();

    KIconLoader loader;

    oldScheme = Config::scheme;
    Config::scheme = (Filelight::MapScheme)2000;

    for (DiskList::ConstIterator it = disks.begin(), end = disks.end(); it != end; ++it)
    {
        Disk const &disk = *it;

        if (disk.free == 0 && disk.used == 0)
            continue;

        QWidget *box = new QVBox( this );
        RadialMap::Widget *map = new MyRadialMap( box );

        QString text; QTextOStream( &text )
            << "<img src='" << loader.iconPath( disk.icon, KIcon::Toolbar ) << "'>"
            << " &nbsp;" << disk.mount << " "
            << "<i>(" << disk.device << ")</i>";

        QLabel *label = new QLabel( text, box );
        label->setAlignment( Qt::AlignCenter );
        label->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Maximum );

        box->show(); // will show its children too

        Directory *tree = new Directory( disk.mount.local8Bit() );
        tree->append( free, disk.free );
        tree->append( used, disk.used );

        map->create( tree ); //must be done when visible

        connect( map, SIGNAL(activated( const KURL& )), SIGNAL(activated( const KURL& )) );
    }
}