Exemplo n.º 1
0
void StartupId::start_startupid( const QString& icon_P )
    {

    const QColor startup_colors[ StartupId::NUM_BLINKING_PIXMAPS ]
    = { Qt::black, Qt::darkGray, Qt::lightGray, Qt::white, Qt::white };


    QPixmap icon_pixmap = KGlobal::iconLoader()->loadIcon( icon_P, KIcon::Small, 0,
        KIcon::DefaultState, 0, true ); // return null pixmap if not found
    if( icon_pixmap.isNull())
        icon_pixmap = SmallIcon( "exec" );
    if( startup_widget == NULL )
        {
        startup_widget = new QWidget( NULL, NULL, WX11BypassWM );
        XSetWindowAttributes attr;
        attr.save_under = True; // useful saveunder if possible to avoid redrawing
        XChangeWindowAttributes( qt_xdisplay(), startup_widget->winId(), CWSaveUnder, &attr );
        }
    startup_widget->resize( icon_pixmap.width(), icon_pixmap.height());
    if( blinking )
        {
        startup_widget->clearMask();
        int window_w = icon_pixmap.width();
        int window_h = icon_pixmap.height();
        for( int i = 0;
             i < NUM_BLINKING_PIXMAPS;
             ++i )
            {
            pixmaps[ i ] = QPixmap( window_w, window_h );
            pixmaps[ i ].fill( startup_colors[ i ] );
            bitBlt( &pixmaps[ i ], 0, 0, &icon_pixmap );
            }
        color_index = 0;
        }
    else if( bouncing )
        {
        startup_widget->resize( 20, 20 );
        pixmaps[ 0 ] = scalePixmap( icon_pixmap, 16, 16 );
        pixmaps[ 1 ] = scalePixmap( icon_pixmap, 14, 18 );
        pixmaps[ 2 ] = scalePixmap( icon_pixmap, 12, 20 );
        pixmaps[ 3 ] = scalePixmap( icon_pixmap, 18, 14 );
        pixmaps[ 4 ] = scalePixmap( icon_pixmap, 20, 12 );
        frame = 0;
        }
    else
        {
        if( icon_pixmap.mask() != NULL )
            startup_widget->setMask( *icon_pixmap.mask());
        else
            startup_widget->clearMask();
        startup_widget->setBackgroundPixmap( icon_pixmap );
        startup_widget->erase();
        }
    update_startupid();
    }
Exemplo n.º 2
0
void StyledButton::setScale( bool on )
{
    if ( s == on )
	return;

    s = on;
    scalePixmap();
}
Exemplo n.º 3
0
void StyledButton::setPixmap( const QPixmap & pm )
{
    if ( !pm.isNull() ) {
	delete pix;
	pix = new QPixmap( pm );
    } else {
	delete pix;
	pix = 0;
    }
    scalePixmap();
}
Exemplo n.º 4
0
void GraphicsView::setPixmap(QPixmap pxm)
{
    pixmap = pxm;

    freqZoomFactor = (double) viewport()->height() / pixmap.height();
    timeZoomFactor = (double) viewport()->width() / pixmap.width();

    minFreqZoomFactor = freqZoomFactor;
    minTimeZoomFactor = timeZoomFactor;

    scalePixmap();
    emit selectedItemChanged(helpString);
}
Exemplo n.º 5
0
void MovieLabel::resizeEvent(QResizeEvent * event)
{
    imagesProcessor->setSize(event->size());
    scalePixmap();
}
Exemplo n.º 6
0
void StyledButton::resizeEvent( QResizeEvent* e )
{
    scalePixmap();
    QButton::resizeEvent( e );
}
Exemplo n.º 7
0
void StartupId::start_startupid( const QString& icon_P )
    {

    const QColor startup_colors[ StartupId::NUM_BLINKING_PIXMAPS ]
    = { Qt::black, Qt::darkGray, Qt::lightGray, Qt::white, Qt::white };


    QPixmap icon_pixmap = KIconLoader::global()->loadIcon( icon_P, KIconLoader::Small, 0,
        KIconLoader::DefaultState, QStringList(), 0, true ); // return null pixmap if not found
    if( icon_pixmap.isNull())
        icon_pixmap = SmallIcon( QLatin1String( "system-run" ) );
    if( startup_window == None )
        {
        XSetWindowAttributes attrs;
        attrs.override_redirect = True;
        attrs.save_under = True; // useful saveunder if possible to avoid redrawing
        attrs.colormap = QX11Info::appColormap();
        attrs.background_pixel = WhitePixel( QX11Info::display(), QX11Info::appScreen());
        attrs.border_pixel = BlackPixel( QX11Info::display(), QX11Info::appScreen());
        startup_window = XCreateWindow( QX11Info::display(), DefaultRootWindow( QX11Info::display()),
            0, 0, 1, 1, 0, QX11Info::appDepth(), InputOutput, static_cast< Visual* >( QX11Info::appVisual()),
            CWOverrideRedirect | CWSaveUnder | CWColormap | CWBackPixel | CWBorderPixel, &attrs );
        XClassHint class_hint;
        QByteArray cls = QApplication::applicationName().toLatin1();
        class_hint.res_name = cls.data();
        class_hint.res_class = const_cast< char* >( QX11Info::appClass());
        XSetWMProperties( QX11Info::display(), startup_window, NULL, NULL, NULL, 0, NULL, NULL, &class_hint );
        XChangeProperty( QX11Info::display(), winId(),
            XInternAtom( QX11Info::display(), "WM_WINDOW_ROLE", False ), XA_STRING, 8, PropModeReplace,
            (unsigned char *)"startupfeedback", strlen( "startupfeedback" ));
        }
    XResizeWindow( QX11Info::display(), startup_window, icon_pixmap.width(), icon_pixmap.height());
    if( blinking )
        { // no mask
        XShapeCombineMask( QX11Info::display(), startup_window, ShapeBounding, 0, 0, None, ShapeSet );
        int window_w = icon_pixmap.width();
        int window_h = icon_pixmap.height();
        for( int i = 0;
             i < NUM_BLINKING_PIXMAPS;
             ++i )
            {
            pixmaps[ i ] = QPixmap( window_w, window_h );
            pixmaps[ i ].fill( startup_colors[ i ] );
            QPainter p( &pixmaps[ i ] );
            p.drawPixmap( 0, 0, icon_pixmap );
            p.end();
            }
        color_index = 0;
        }
    else if( bouncing )
        {
        XResizeWindow( QX11Info::display(), startup_window, 20, 20 );
        pixmaps[ 0 ] = make24bpp( scalePixmap( icon_pixmap, 16, 16 ));
        pixmaps[ 1 ] = make24bpp( scalePixmap( icon_pixmap, 14, 18 ));
        pixmaps[ 2 ] = make24bpp( scalePixmap( icon_pixmap, 12, 20 ));
        pixmaps[ 3 ] = make24bpp( scalePixmap( icon_pixmap, 18, 14 ));
        pixmaps[ 4 ] = make24bpp( scalePixmap( icon_pixmap, 20, 12 ));
        frame = 0;
        }
    else
        {
        icon_pixmap = make24bpp( icon_pixmap );
        if( !icon_pixmap.mask().isNull() ) // set mask
            XShapeCombineMask( QX11Info::display(), startup_window, ShapeBounding, 0, 0,
                icon_pixmap.mask().handle(), ShapeSet );
        else // clear mask
            XShapeCombineMask( QX11Info::display(), startup_window, ShapeBounding, 0, 0, None, ShapeSet );
        XSetWindowBackgroundPixmap( QX11Info::display(), startup_window, icon_pixmap.handle());
        XClearWindow( QX11Info::display(), startup_window );
        }
    update_startupid();
    }