Ejemplo n.º 1
0
// paint a ROUND RAISED led lamp
void KLed::paintRaised()
{
  if ( paintCachedPixmap() )
    return;

  QPainter paint;
  QColor color;
  QBrush brush;
  QPen pen;

  // Initialize coordinates, width, and height of the LED
  int width = ledWidth();

  int scale = 3;
  QPixmap *tmpMap = 0;

  width *= scale;

  tmpMap = new QPixmap( width + 6, width + 6 );
  tmpMap->fill( palette().color( backgroundRole() ) );
  paint.begin( tmpMap );
  paint.setRenderHint(QPainter::Antialiasing);

  // Set the color of the LED according to given parameters
  color = ( d->state == On ? d->color : d->offColor );

  // Set the brush to SolidPattern, this fills the entire area
  // of the ellipse which is drawn first
  brush.setStyle( Qt::SolidPattern );
  brush.setColor( color );
  paint.setBrush( brush ); // Assign the brush to the painter

  // Draws a "flat" LED with the given color:
  paint.drawEllipse( scale, scale, width - scale * 2, width - scale * 2 );

  // Draw the bright light spot of the LED now, using modified "old"
  // painter routine taken from KDEUI's KLed widget:

  // Setting the new width of the pen is essential to avoid "pixelized"
  // shadow like it can be observed with the old LED code
  pen.setWidth( 2 * scale );

  // shrink the light on the LED to a size about 2/3 of the complete LED
  int pos = width / 5 + 1;
  int light_width = width;
  light_width *= 2;
  light_width /= 3;

  // Calculate the LED's "light factor":
  int light_quote = ( 130 * 2 / ( light_width ? light_width : 1 ) ) + 100;

  // Now draw the bright spot on the LED:
  while ( light_width ) {
    color = color.light( light_quote );  // make color lighter
    pen.setColor( color );  // set color as pen color
    paint.setPen( pen );  // select the pen for drawing
    paint.drawEllipse( pos, pos, light_width, light_width );  // draw the ellipse (circle)
    light_width--;

    if ( !light_width )
      break;

    paint.drawEllipse( pos, pos, light_width, light_width );
    light_width--;

    if ( !light_width )
      break;

    paint.drawEllipse( pos, pos, light_width, light_width );
    pos++;
    light_width--;
  }

  // Drawing of bright spot finished, now draw a thin gray border
  // around the LED; it looks nicer that way. We do this here to
  // avoid that the border can be erased by the bright spot of the LED

  pen.setWidth( 2 * scale + 1 );
  color = palette().color( QPalette::Dark );
  pen.setColor( color );  // Set the pen accordingly
  paint.setPen( pen );  // Select pen for drawing
  brush.setStyle( Qt::NoBrush );  // Switch off the brush
  paint.setBrush( brush );  // This avoids filling of the ellipse

  paint.drawEllipse( 2, 2, width, width );

  paint.end();

  // painting done
  QPixmap *&dest = ( d->state == On ? d->onMap : d->offMap );
  QImage i = tmpMap->toImage();
  width /= 3;
  i = i.scaled( width, width, Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
  delete tmpMap;

  dest = new QPixmap( QPixmap::fromImage( i ) );
  paint.begin( this );
  paint.drawPixmap( 0, 0, *dest );
  paint.end();
}
Ejemplo n.º 2
0
void ELabel::display()
{
	QPalette palette = this->palette();
	if (val.type() == QVariant::Bool)
	{
		if (val.toBool())
		{
			if (palette.color(backgroundRole()) != m_trueColor || text() != m_trueString)
			{
				palette.setColor(backgroundRole(), m_trueColor);
				setPalette(palette);
				setText(m_trueString);
			}
		}
		else
		{
//			qDebug() << "val.toBool() e` falso!";
			if (palette.color(backgroundRole()) != m_falseColor || m_falseString != text())
			{
				palette.setColor(backgroundRole(), m_falseColor);
				setPalette(palette);
				setText(m_falseString);
			}
		}
	}
	//else if (val.type() == QVariant::UInt)
	else if (val.canConvert(QVariant::UInt) && (v_colors.size()) && (!val.toString().contains("###")))
	{
		/* Look for the value `val' inside the v_values 
		 * vector, to see if a string and a color were 
		 * configured for that value.
		 */
		int index = v_values.indexOf(val.toUInt());
		if (index != -1)
		{
			if(palette.color(backgroundRole()) != v_colors[index])
			{
				palette.setColor(backgroundRole(), v_colors[index]);
				setPalette(palette);
			}
			setText(v_strings[index]);
		}
		else /* No string nor a colour for that value! */
		{
			if(palette.color(backgroundRole()) != QColor("white"))
			{
				palette.setColor(backgroundRole(), QColor("white") );
				setPalette(palette);
			}
			setText(QString("No match for value %1!").arg(val.toUInt() ) );
		}
//		setPalette(pal);
	}
	else
	{
		QString s = val.toString();
		if (s.contains("###"))
		{
			if(palette.color(backgroundRole()) != QColor("white"))
			{
				pal.setColor(backgroundRole(), Qt::white);
				setPalette(pal);
			}
		}
		setText(val.toString());
	}
	qDebug() << "text(): " << text() << "m_trueString: " << m_trueString << "m_falseString: " << m_falseString;
//	QLabel::paintEvent(e);
}
Ejemplo n.º 3
0
sf2InstrumentView::sf2InstrumentView( Instrument * _instrument, QWidget * _parent ) :
	InstrumentView( _instrument, _parent )
{
//	QVBoxLayout * vl = new QVBoxLayout( this );
//	QHBoxLayout * hl = new QHBoxLayout();

	sf2Instrument* k = castModel<sf2Instrument>();

	connect( &k->m_bankNum, SIGNAL( dataChanged() ), this, SLOT( updatePatchName() ) );
	connect( &k->m_patchNum, SIGNAL( dataChanged() ), this, SLOT( updatePatchName() ) );

	// File Button
	m_fileDialogButton = new PixmapButton( this );
	m_fileDialogButton->setCursor( QCursor( Qt::PointingHandCursor ) );
	m_fileDialogButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "fileselect_on" ) );
	m_fileDialogButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "fileselect_off" ) );
	m_fileDialogButton->move( 217, 107 );

	connect( m_fileDialogButton, SIGNAL( clicked() ), this, SLOT( showFileDialog() ) );

	ToolTip::add( m_fileDialogButton, tr( "Open other SoundFont file" ) );

	m_fileDialogButton->setWhatsThis( tr( "Click here to open another SF2 file" ) );

	// Patch Button
	m_patchDialogButton = new PixmapButton( this );
	m_patchDialogButton->setCursor( QCursor( Qt::PointingHandCursor ) );
	m_patchDialogButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "patches_on" ) );
	m_patchDialogButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "patches_off" ) );
	m_patchDialogButton->setEnabled( false );
	m_patchDialogButton->move( 217, 125 );

	connect( m_patchDialogButton, SIGNAL( clicked() ), this, SLOT( showPatchDialog() ) );

	ToolTip::add( m_patchDialogButton, tr( "Choose the patch" ) );


	// LCDs
	m_bankNumLcd = new LcdSpinBox( 3, "21pink", this );
	m_bankNumLcd->move(131, 62);
//	m_bankNumLcd->addTextForValue( -1, "---" );
//	m_bankNumLcd->setEnabled( false );

	m_patchNumLcd = new LcdSpinBox( 3, "21pink", this );
	m_patchNumLcd->move(190, 62);
//	m_patchNumLcd->addTextForValue( -1, "---" );
//	m_patchNumLcd->setEnabled( false );

	/*hl->addWidget( m_fileDialogButton );
	hl->addWidget( m_bankNumLcd );
	hl->addWidget( m_patchNumLcd );
	hl->addWidget( m_patchDialogButton );

	vl->addLayout( hl );*/

	// Next row

	//hl = new QHBoxLayout();

	m_filenameLabel = new QLabel( this );
	m_filenameLabel->setGeometry( 58, 109, 156, 11 );
	m_patchLabel = new QLabel( this );
	m_patchLabel->setGeometry( 58, 127, 156, 11 );

	//hl->addWidget( m_filenameLabel );
//	vl->addLayout( hl );

	// Gain
	m_gainKnob = new sf2Knob( this );
	m_gainKnob->setHintText( tr("Gain"), "" );
	m_gainKnob->move( 86, 55 );
//	vl->addWidget( m_gainKnob );

	// Reverb
//	hl = new QHBoxLayout();


	m_reverbButton = new PixmapButton( this );
	m_reverbButton->setCheckable( true );
	m_reverbButton->move( 14, 180 );
	m_reverbButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "reverb_on" ) );
	m_reverbButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "reverb_off" ) );
	ToolTip::add( m_reverbButton, tr( "Apply reverb (if supported)" ) );
	m_reverbButton->setWhatsThis(
		tr( "This button enables the reverb effect. "
			"This is useful for cool effects, but only works on "
			"files that support it." ) );


	m_reverbRoomSizeKnob = new sf2Knob( this );
	m_reverbRoomSizeKnob->setHintText( tr("Reverb Roomsize:"), "" );
	m_reverbRoomSizeKnob->move( 93, 160 );

	m_reverbDampingKnob = new sf2Knob( this );
	m_reverbDampingKnob->setHintText( tr("Reverb Damping:"), "" );
	m_reverbDampingKnob->move( 130, 160 );

	m_reverbWidthKnob = new sf2Knob( this );
	m_reverbWidthKnob->setHintText( tr("Reverb Width:"), "" );
	m_reverbWidthKnob->move( 167, 160 );

	m_reverbLevelKnob = new sf2Knob( this );
	m_reverbLevelKnob->setHintText( tr("Reverb Level:"), "" );
	m_reverbLevelKnob->move( 204, 160 );

/*	hl->addWidget( m_reverbOnLed );
	hl->addWidget( m_reverbRoomSizeKnob );
	hl->addWidget( m_reverbDampingKnob );
	hl->addWidget( m_reverbWidthKnob );
	hl->addWidget( m_reverbLevelKnob );

	vl->addLayout( hl );
*/

	// Chorus
//	hl = new QHBoxLayout();

	m_chorusButton = new PixmapButton( this );
	m_chorusButton->setCheckable( true );
	m_chorusButton->move( 14, 226 );
	m_chorusButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "chorus_on" ) );
	m_chorusButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "chorus_off" ) );
	ToolTip::add( m_chorusButton, tr( "Apply chorus (if supported)" ) );
	m_chorusButton->setWhatsThis(
		tr( "This button enables the chorus effect. "
			"This is useful for cool echo effects, but only works on "
			"files that support it." ) );

	m_chorusNumKnob = new sf2Knob( this );
	m_chorusNumKnob->setHintText( tr("Chorus Lines:"), "" );
	m_chorusNumKnob->move( 93, 206 );

	m_chorusLevelKnob = new sf2Knob( this );
	m_chorusLevelKnob->setHintText( tr("Chorus Level:"), "" );
	m_chorusLevelKnob->move( 130 , 206 );

	m_chorusSpeedKnob = new sf2Knob( this );
	m_chorusSpeedKnob->setHintText( tr("Chorus Speed:"), "" );
	m_chorusSpeedKnob->move( 167 , 206 );

	m_chorusDepthKnob = new sf2Knob( this );
	m_chorusDepthKnob->setHintText( tr("Chorus Depth:"), "" );
	m_chorusDepthKnob->move( 204 , 206 );
/*
	hl->addWidget( m_chorusOnLed );
	hl->addWidget( m_chorusNumKnob);
	hl->addWidget( m_chorusLevelKnob);
	hl->addWidget( m_chorusSpeedKnob);
	hl->addWidget( m_chorusDepthKnob);

	vl->addLayout( hl );
*/
	setAutoFillBackground( true );
	QPalette pal;
	pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) );
	setPalette( pal );

	updateFilename();

}
BitcrushControlDialog::BitcrushControlDialog( BitcrushControls * controls ) :
	EffectControlDialog( controls )
{
	setAutoFillBackground( true );
	QPalette pal;
	pal.setBrush( backgroundRole(),	PLUGIN_NAME::getIconPixmap( "artwork" ) );
	setPalette( pal );
	setFixedSize( 215, 120 );
	
	// labels
	QLabel * inLabel = new QLabel( tr( "IN" ), this );
	inLabel->move( 12, 10);
	
	QLabel * outLabel = new QLabel( tr( "OUT" ), this );
	outLabel->move( 176, 10 );
	
	// input knobs
	Knob * inGain = new Knob( knobBright_26, this );
	inGain->move( 12, 25 );
	inGain->setModel( & controls->m_inGain );
	inGain->setLabel( tr( "GAIN" ) );
	inGain->setHintText( tr( "Input Gain:" ) + " ", " dBV" );
	
	Knob * inNoise = new Knob( knobBright_26, this );
	inNoise->move( 12, 70 );
	inNoise->setModel( & controls->m_inNoise );
	inNoise->setLabel( tr( "NOIS" ) );
	inNoise->setHintText( tr( "Input Noise:" ) + " ", "%" );
	
	
	// output knobs
	Knob * outGain = new Knob( knobBright_26, this );
	outGain->move( 176, 25 );
	outGain->setModel( & controls->m_outGain );
	outGain->setLabel( tr( "GAIN" ) );
	outGain->setHintText( tr( "Output Gain:" ) + " ", " dBV" );
	
	Knob * outClip = new Knob( knobBright_26, this );
	outClip->move( 176, 70 );
	outClip->setModel( & controls->m_outClip );
	outClip->setLabel( tr( "CLIP" ) );
	outClip->setHintText( tr( "Output Clip:" ) + " ", "%" );
	
	
	// leds
	LedCheckBox * rateEnabled = new LedCheckBox( tr( "Rate" ), this, tr( "Rate Enabled" ), LedCheckBox::Green );
	rateEnabled->move( 50, 30 );
	rateEnabled->setModel( & controls->m_rateEnabled );
	ToolTip::add( rateEnabled, tr( "Enable samplerate-crushing" ) );
	
	LedCheckBox * depthEnabled = new LedCheckBox( tr( "Depth" ), this, tr( "Depth Enabled" ), LedCheckBox::Green );
	depthEnabled->move( 50, 80 );
	depthEnabled->setModel( & controls->m_depthEnabled );
	ToolTip::add( depthEnabled, tr( "Enable bitdepth-crushing" ) );
	
	
	// rate crushing knobs
	Knob * rate = new Knob( knobBright_26, this );
	rate->move( 100, 20 );
	rate->setModel( & controls->m_rate );
	rate->setLabel( tr( "Rate" ) );
	rate->setHintText( tr( "Sample rate:" ) + " ", " Hz" );
	
	Knob * stereoDiff = new Knob( knobBright_26, this );
	stereoDiff->move( 140, 20 );
	stereoDiff->setModel( & controls->m_stereoDiff );
	stereoDiff->setLabel( tr( "STD" ) );
	stereoDiff->setHintText( tr( "Stereo difference:" ) + " ", "%" );
	
	
	// depth crushing knob
	Knob * levels = new Knob( knobBright_26, this );
	levels->move( 140, 70 );
	levels->setModel( & controls->m_levels );
	levels->setLabel( tr( "Levels" ) );
	levels->setHintText( tr( "Levels:" ) + " ", "" );
}
Ejemplo n.º 5
0
void QwtPlot::printLegend(QPainter *painter, const QRect &rect) const
{
    if ( !legend() || legend()->isEmpty() )
        return;

    QLayout *l = legend()->contentsWidget()->layout();
    if ( l == 0 || !l->inherits("QwtDynGridLayout") )
        return;

    QwtDynGridLayout *legendLayout = (QwtDynGridLayout *)l;

    uint numCols = legendLayout->columnsForWidth(rect.width());
#if QT_VERSION < 0x040000
    QValueList<QRect> itemRects = 
        legendLayout->layoutItems(rect, numCols);
#else
    QList<QRect> itemRects = 
        legendLayout->layoutItems(rect, numCols);
#endif

    int index = 0;

#if QT_VERSION < 0x040000
    QLayoutIterator layoutIterator = legendLayout->iterator();
    for ( QLayoutItem *item = layoutIterator.current(); 
        item != 0; item = ++layoutIterator)
    {
#else
    for ( int i = 0; i < legendLayout->count(); i++ )
    {
        QLayoutItem *item = legendLayout->itemAt(i);
#endif
        QWidget *w = item->widget();
        if ( w )
        {
            painter->save();
            painter->setClipping(true);
            QwtPainter::setClipRect(painter, itemRects[index]);

            printLegendItem(painter, w, itemRects[index]);

            index++;
            painter->restore();
        }
    }
}

/*!
  Print the legend item into a given rectangle.

  \param painter Painter
  \param w Widget representing a legend item
  \param rect Bounding rectangle
*/

void QwtPlot::printLegendItem(QPainter *painter, 
    const QWidget *w, const QRect &rect) const
{
    if ( w->inherits("QwtLegendItem") )
    {
        QwtLegendItem *item = (QwtLegendItem *)w;

        painter->setFont(item->font());
        item->drawItem(painter, rect);
    }
}

/*!
  \brief Paint a scale into a given rectangle.
  Paint the scale into a given rectangle.

  \param painter Painter
  \param axisId Axis
  \param startDist Start border distance
  \param endDist End border distance
  \param baseDist Base distance
  \param rect Bounding rectangle
*/

void QwtPlot::printScale(QPainter *painter,
    int axisId, int startDist, int endDist, int baseDist, 
    const QRect &rect) const
{
    if (!axisEnabled(axisId))
        return;

    QwtScaleDraw::Alignment align;
    int x, y, w;

    switch(axisId)
    {
        case yLeft:
        {
            x = rect.right() - baseDist + 1;
            y = rect.y() + startDist;
            w = rect.height() - startDist - endDist;
            align = QwtScaleDraw::LeftScale;
            break;
        }
        case yRight:
        {
            x = rect.left() + baseDist;
            y = rect.y() + startDist;
            w = rect.height() - startDist - endDist;
            align = QwtScaleDraw::RightScale;
            break;
        }
        case xTop:
        {
            x = rect.left() + startDist;
            y = rect.bottom() - baseDist + 1;
            w = rect.width() - startDist - endDist;
            align = QwtScaleDraw::TopScale;
            break;
        }
        case xBottom:
        {
            x = rect.left() + startDist;
            y = rect.top() + baseDist;
            w = rect.width() - startDist - endDist;
            align = QwtScaleDraw::BottomScale;
            break;
        }
        default:
            return;
    }

    const QwtScaleWidget *scaleWidget = axisWidget(axisId);
    scaleWidget->drawTitle(painter, align, rect);

    painter->save();
    painter->setFont(scaleWidget->font());

    QwtScaleDraw *sd = (QwtScaleDraw *)scaleWidget->scaleDraw();
    const QPoint sdPos = sd->pos();
    const int sdLength = sd->length();

    sd->move(x, y);
    sd->setLength(w);

#if QT_VERSION < 0x040000
    sd->draw(painter, scaleWidget->palette().active());
#else
    QPalette palette = scaleWidget->palette();
    palette.setCurrentColorGroup(QPalette::Active);
    sd->draw(painter, palette);
#endif
    // reset previous values
    sd->move(sdPos); 
    sd->setLength(sdLength); 

    painter->restore();
}

/*!
  Print the canvas into a given rectangle.

  \param painter Painter
  \param map Maps mapping between plot and paint device coordinates
  \param canvasRect Bounding rectangle
  \param pfilter Print filter
  \sa QwtPlotPrintFilter
*/

void QwtPlot::printCanvas(QPainter *painter, const QRect &canvasRect,
    const QwtArray<QwtScaleMap> &map, const QwtPlotPrintFilter &pfilter) const
{
    if ( pfilter.options() & QwtPlotPrintFilter::PrintCanvasBackground )
    {
        painter->setPen(Qt::NoPen);

        QBrush bgBrush;
#if QT_VERSION >= 0x040000
            bgBrush = canvas()->palette().brush(backgroundRole());
#else
        QColorGroup::ColorRole role =
            QPalette::backgroundRoleFromMode( backgroundMode() ); 
        bgBrush = canvas()->colorGroup().brush( role );
#endif
        painter->setBrush(bgBrush);
        
        int x1 = 0;
        int x2 = 0;
        int y1 = 0;
        int y2 = 0;

#if QT_VERSION >= 0x040000
        switch(painter->device()->paintEngine()->type())
        {
            case QPaintEngine::PostScript:
                x2 = 1;
                y2 = 1;
                break;
            default:;
        }
#endif

        const QwtMetricsMap map = QwtPainter::metricsMap();
        x1 = map.screenToLayoutX(x1);
        x2 = map.screenToLayoutX(x2);
        y1 = map.screenToLayoutY(y1);
        y2 = map.screenToLayoutY(y2);

        QwtPainter::drawRect(painter, 
            canvasRect.x() + x1, canvasRect.y() + y1, 
            canvasRect.width() - x2, canvasRect.height() - y2); 
    }
    else
    {
        // Paint the canvas borders instead.
        painter->setPen(QPen(Qt::black));
        painter->setBrush(QBrush(Qt::NoBrush));
        QwtPainter::drawRect(painter, canvasRect); 
    }


    painter->setClipping(true);
    QwtPainter::setClipRect(painter, canvasRect);

    drawItems(painter, canvasRect, map, pfilter);
}
void MainWindow::setupDockWidgets(const QMap<QString, QSize> &customSizeHints)
{
    qRegisterMetaType<QDockWidget::DockWidgetFeatures>();

    mapper = new QSignalMapper(this);
    connect(mapper, SIGNAL(mapped(int)), this, SLOT(setCorner(int)));

    QMenu *corner_menu = dockWidgetMenu->addMenu(tr("Top left corner"));
    QActionGroup *group = new QActionGroup(this);
    group->setExclusive(true);
    ::addAction(corner_menu, tr("Top dock area"), group, mapper, 0);
    ::addAction(corner_menu, tr("Left dock area"), group, mapper, 1);

    corner_menu = dockWidgetMenu->addMenu(tr("Top right corner"));
    group = new QActionGroup(this);
    group->setExclusive(true);
    ::addAction(corner_menu, tr("Top dock area"), group, mapper, 2);
    ::addAction(corner_menu, tr("Right dock area"), group, mapper, 3);

    corner_menu = dockWidgetMenu->addMenu(tr("Bottom left corner"));
    group = new QActionGroup(this);
    group->setExclusive(true);
    ::addAction(corner_menu, tr("Bottom dock area"), group, mapper, 4);
    ::addAction(corner_menu, tr("Left dock area"), group, mapper, 5);

    corner_menu = dockWidgetMenu->addMenu(tr("Bottom right corner"));
    group = new QActionGroup(this);
    group->setExclusive(true);
    ::addAction(corner_menu, tr("Bottom dock area"), group, mapper, 6);
    ::addAction(corner_menu, tr("Right dock area"), group, mapper, 7);

    dockWidgetMenu->addSeparator();

    static const struct Set {
        const char * name;
        uint flags;
        Qt::DockWidgetArea area;
    } sets [] = {
#ifndef Q_WS_MAC
        { "Black", 0, Qt::LeftDockWidgetArea },
#else
        { "Black", Qt::Drawer, Qt::LeftDockWidgetArea },
#endif
        { "White", 0, Qt::RightDockWidgetArea },
        { "Red", 0, Qt::TopDockWidgetArea },
        { "Green", 0, Qt::TopDockWidgetArea },
        { "Blue", 0, Qt::BottomDockWidgetArea },
        { "Yellow", 0, Qt::BottomDockWidgetArea }
    };
    const int setCount = sizeof(sets) / sizeof(Set);

    for (int i = 0; i < setCount; ++i) {
        ColorSwatch *swatch = new ColorSwatch(tr(sets[i].name), this, Qt::WindowFlags(sets[i].flags));
        if (i%2)
            swatch->setWindowIcon(QIcon(QPixmap(":/res/qt.png")));
        if (qstrcmp(sets[i].name, "Blue") == 0) {
            BlueTitleBar *titlebar = new BlueTitleBar(swatch);
            swatch->setTitleBarWidget(titlebar);
            connect(swatch, SIGNAL(topLevelChanged(bool)), titlebar, SLOT(updateMask()));
            connect(swatch, SIGNAL(featuresChanged(QDockWidget::DockWidgetFeatures)), titlebar, SLOT(updateMask()), Qt::QueuedConnection);

#ifdef Q_WS_QWS
            QPalette pal = palette();
            pal.setBrush(backgroundRole(), QColor(0,0,0,0));
            swatch->setPalette(pal);
#endif
        }

        QString name = QString::fromLatin1(sets[i].name);
        if (customSizeHints.contains(name))
            swatch->setCustomSizeHint(customSizeHints.value(name));

        addDockWidget(sets[i].area, swatch);
        dockWidgetMenu->addMenu(swatch->menu);
    }

    createDockWidgetAction = new QAction(tr("Add dock widget..."), this);
    connect(createDockWidgetAction, SIGNAL(triggered()), this, SLOT(createDockWidget()));
    destroyDockWidgetMenu = new QMenu(tr("Destroy dock widget"), this);
    destroyDockWidgetMenu->setEnabled(false);
    connect(destroyDockWidgetMenu, SIGNAL(triggered(QAction*)), this, SLOT(destroyDockWidget(QAction*)));

    dockWidgetMenu->addSeparator();
    dockWidgetMenu->addAction(createDockWidgetAction);
    dockWidgetMenu->addMenu(destroyDockWidgetMenu);
}
//
// Draw chart
//
void RealtimeChart::drawChart()
{
    // Create an XYChart object 600 x 270 pixels in size, with light white (ffffff)
    // background, white (000000) border, no raised effect, and with a rounded frame.
    XYChart *c = new XYChart(645, 270, 0xffffff, 0xffffff, 0);
    QColor bgColor = palette().color(backgroundRole()).rgb();
    //c->setRoundedFrame((bgColor.red() << 16) + (bgColor.green() << 8) + bgColor.blue());

    // Set the plotarea at (55, 62) and of size 520 x 175 pixels. Use white (ffffff)
    // background. Enable both horizontal and vertical grids by setting their colors to
    // grey (cccccc). Set clipping mode to clip the data lines to the plot area.
    c->setPlotArea(55, 62, 580, 185, 0xffffff, -1, -1, 0xcccccc, 0xcccccc);
    c->setClipping();

    // Add a title to the chart using 15 pts Times New Roman Bold Italic font, with a light
    // grey (dddddd) background, black (000000) border, and a glass like raised effect.
    c->addTitle(m_mainTitle, "arialbd.ttf", 15);

    // Add a legend box at the top of the plot area with 9pts Arial Bold font. We set the
    // legend box to the same width as the plot area and use grid layout (as opposed to
    // flow or top/down layout). This distributes the 3 legend icons evenly on top of the
    // plot area.
    LegendBox *b = c->addLegend2(55, 33, 3, "arialbd.ttf", 9);
    b->setBackground(Chart::Transparent, Chart::Transparent);
    b->setWidth(580);

    // Configure the y-axis with a 10pts Arial Bold axis title
    c->yAxis()->setTitle(m_yTitle, "arialbd.ttf", 10);

    // Configure the x-axis to auto-scale with at least 75 pixels between major tick and
    // 15  pixels between minor ticks. This shows more minor grid lines on the chart.
    c->xAxis()->setTickDensity(75, 15);

    // Set the axes width to 2 pixels
    c->xAxis()->setWidth(2);
    c->yAxis()->setWidth(2);

    // Now we add the data to the chart.
    double lastTime = m_timeStamps[sampleSize - 1];
    if (lastTime != Chart::NoValue)
    {
        // Set up the x-axis to show the time range in the data buffer
        c->xAxis()->setDateScale(lastTime - DataInterval * sampleSize / 1000, lastTime);

        // Set the x-axis label format
        c->xAxis()->setLabelFormat("{value|hh:nn:ss}");

        // Create a line layer to plot the lines
        LineLayer *layer = c->addLineLayer();

        // The x-coordinates are the timeStamps.
        layer->setXData(DoubleArray(m_timeStamps, sampleSize));

        // The 3 data series are used to draw 3 lines. Here we put the latest data values
        // as part of the data set name, so you can see them updated in the legend box.
        char buffer[1024];

        sprintf(buffer, "%s: <*bgColor=FFCCCC*> %.2f ", m_labelA, m_dataSeriesA[sampleSize - 1]);
        layer->addDataSet(DoubleArray(m_dataSeriesA, sampleSize), 0xff0000, buffer);

        sprintf(buffer, "%s: <*bgColor=CCFFCC*> %.2f ", m_labelB, m_dataSeriesB[sampleSize - 1]);
        layer->addDataSet(DoubleArray(m_dataSeriesB, sampleSize), 0x00cc00, buffer);
    }

    // Set the chart image to the WinChartViewer
    m_ChartViewer->setChart(c);
    delete c;
}
PeakControllerEffectControlDialog::PeakControllerEffectControlDialog(
				PeakControllerEffectControls * _controls ) :
	EffectControlDialog( _controls )
{
	setAutoFillBackground( true );
	QPalette pal;
	pal.setBrush( backgroundRole(),
				PLUGIN_NAME::getIconPixmap( "artwork" ) );
	setPalette( pal );

	QVBoxLayout * tl = new QVBoxLayout( this );
	tl->setContentsMargins( 5, 30, 5, 8 );

	QHBoxLayout * l = new QHBoxLayout;
	l->setSpacing( 4 );
	m_baseKnob = new Knob( knobBright_26, this );
	m_baseKnob->setLabel( tr( "BASE" ) );
	m_baseKnob->setModel( &_controls->m_baseModel );
	m_baseKnob->setHintText( tr( "Base amount:" ) , "" );

	m_amountKnob = new Knob( knobBright_26, this );
	m_amountKnob->setLabel( tr( "AMNT" ) );
	m_amountKnob->setModel( &_controls->m_amountModel );
	m_amountKnob->setHintText( tr( "Modulation amount:" ) , "" );

	m_amountMultKnob = new Knob( knobBright_26, this );
	m_amountMultKnob->setLabel( tr( "MULT" ) );
	m_amountMultKnob->setModel( &_controls->m_amountMultModel );
	m_amountMultKnob->setHintText( tr( "Amount Multiplicator:" ) , "" );

	m_attackKnob = new Knob( knobBright_26, this );
	m_attackKnob->setLabel( tr( "ATCK" ) );
	m_attackKnob->setModel( &_controls->m_attackModel );
	m_attackKnob->setHintText( tr( "Attack:" ) , "" );

	m_decayKnob = new Knob( knobBright_26, this );
	m_decayKnob->setLabel( tr( "DCAY" ) );
	m_decayKnob->setModel( &_controls->m_decayModel );
	m_decayKnob->setHintText( tr( "Release:" ) , "" );
	
	m_tresholdKnob = new Knob( knobBright_26, this );
	m_tresholdKnob->setLabel( tr( "TRES" ) );
	m_tresholdKnob->setModel( &_controls->m_tresholdModel );
	m_tresholdKnob->setHintText( tr( "Treshold:" ) , "" );

	l->addWidget( m_baseKnob );
	l->addWidget( m_amountKnob );
	l->addWidget( m_amountMultKnob );
	l->addWidget( m_attackKnob );
	l->addWidget( m_decayKnob );
	l->addWidget( m_tresholdKnob );
	l->addStretch(); // expand, so other widgets have minimum width
	tl->addLayout( l );

	QVBoxLayout * l2 = new QVBoxLayout; // = 2nd vbox

	m_muteLed = new LedCheckBox( "Mute Effect", this );
	m_muteLed->setModel( &_controls->m_muteModel );

	m_absLed = new LedCheckBox( "Absolute Value", this );
	m_absLed->setModel( &_controls->m_absModel );

	l2->addWidget( m_muteLed );
	l2->addWidget( m_absLed );
	l2->addStretch(); // expand, so other widgets have minimum height
	tl->addLayout( l2 );

	setLayout( tl );
}
Ejemplo n.º 9
0
UIInput::UIInput(QString title, QString showMsg, QString regExp, int length, QDialog *parent, Qt::WindowFlags f):
    QDialog(parent,f)
{

    QPixmap bg;
    bg.load(":/images/commonbg.png");
    QPalette palette;
    palette.setBrush(backgroundRole(),QBrush(bg));
    this->setPalette(palette);
    this->setAutoFillBackground(true);
    this->setAttribute(Qt::WA_DeleteOnClose);
    this->setGeometry(20,FRAME420_THVALUE+50,FRAME420_WIDTH,FRAME420_HEIGHT-50);
    this->setFixedSize(FRAME420_WIDTH-40,FRAME420_HEIGHT-80);
    this->setStyleSheet("QDialog{border: 6px solid silver;}");

    //--------------define--------------------//
    lbHead=new QLabel();
    QFont fontH("Helvetica",18,QFont::Bold);
    lbHead->setFont(fontH);
    lbHead->setAlignment(Qt::AlignCenter);
    lbHead->setMinimumHeight(40);
    lbHead->setMaximumHeight(40);
    lbHead->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
    lbHead->setText(title);
    lbHead->setStyleSheet("background-color: rgb(0, 153, 255);");

    lbMsg=new QLabel();
    QFont fontL("Helvetica",14,QFont::Bold);
    lbMsg->setAlignment(Qt::AlignCenter);
    lbMsg->setFont(fontL);
    lbMsg->setText(showMsg);

    leInput=new QLineEdit();
    leInput->setFont(fontL);
    leInput->setAlignment(Qt::AlignCenter);
    leInput->setMinimumHeight(35);
    leInput->setStyleSheet("border: 3px solid silver;border-radius: 6px;");
    leInput->setMaxLength(length);
    if(regExp!="0")
    {
        const QString  REGEX_AMOUNT = regExp;
        QRegExp regx(REGEX_AMOUNT);
        QValidator *validator = new QRegExpValidator(regx, leInput);
        leInput->setValidator(validator);
    }

    btnSubmit=new QPushButton;
    btnSubmit->setText(tr("Apply"));
    btnSubmit->setFont(fontL);
    btnSubmit->setMinimumHeight(30);
    btnSubmit->setStyleSheet(BTN_GREEN_STYLE);

    btnCancel=new QPushButton;
    btnCancel->setText(tr("Cancel"));
    btnCancel->setFont(fontL);
    btnCancel->setMinimumHeight(30);
    btnCancel->setStyleSheet(BTN_BLUE_STYLE);


    // -----------layout------------//
    QSpacerItem *sp1=new QSpacerItem(1,1,QSizePolicy::Expanding,QSizePolicy::Expanding);
    QSpacerItem *sp2=new QSpacerItem(1,1,QSizePolicy::Expanding,QSizePolicy::Expanding);

    QHBoxLayout *h1Lay=new QHBoxLayout();
    h1Lay->addSpacing(6);
    h1Lay->addWidget(lbHead);
    h1Lay->addSpacing(6);

    QVBoxLayout *v1Lay=new QVBoxLayout();
    v1Lay->addItem(sp1);
    v1Lay->addWidget(lbMsg);
    v1Lay->addWidget(leInput);
    v1Lay->addItem(sp2);

    QHBoxLayout *hLay=new QHBoxLayout();
    hLay->addSpacing(10);
    hLay->addLayout(v1Lay);
    hLay->addSpacing(10);

    QHBoxLayout *h2Lay=new QHBoxLayout();
    h2Lay->addSpacing(10);
    h2Lay->addWidget(btnCancel);
    h2Lay->addWidget(btnSubmit);
    h2Lay->addSpacing(10);

    QVBoxLayout *layout=new QVBoxLayout(this);
    layout->addSpacing(6);
    layout->addLayout(h1Lay);
    layout->addLayout(hLay);
    layout->addLayout(h2Lay);

    layout->setContentsMargins(0,0,0,10);


    // connect
    connect(btnCancel,SIGNAL(clicked()),this,SLOT(slotCancel()));
    connect(btnSubmit,SIGNAL(clicked()),this,SLOT(slotSubmit()));
    connect(leInput,SIGNAL(textChanged(QString)),this,SLOT(restartTimer()));

    this->setAutoClose(g_constantParam.TIMEOUT_UI);
}
Ejemplo n.º 10
0
BitcrushControlDialog::BitcrushControlDialog( BitcrushControls * controls ) :
	EffectControlDialog( controls )
{
	setAutoFillBackground( true );
	QPalette pal;
	pal.setBrush( backgroundRole(),	PLUGIN_NAME::getIconPixmap( "artwork" ) );
	setPalette( pal );
	setFixedSize( 181, 128 );
	
	// labels
	QLabel * inLabel = new QLabel( tr( "IN" ), this );
	inLabel->move( 24, 15 );
	
	QLabel * outLabel = new QLabel( tr( "OUT" ), this );
	outLabel->move( 139, 15 );
	
	// input knobs
	Knob * inGain = new Knob( knobBright_26, this );
	inGain->move( 16, 32 );
	inGain->setModel( & controls->m_inGain );
	inGain->setLabel( tr( "GAIN" ) );
	inGain->setHintText( tr( "Input gain:" ) , " dBFS" );
	
	Knob * inNoise = new Knob( knobBright_26, this );
	inNoise->move( 14, 76 );
	inNoise->setModel( & controls->m_inNoise );
	inNoise->setLabel( tr( "NOISE" ) );
	inNoise->setHintText( tr( "Input noise:" ) , "%" );
	
	
	// output knobs
	Knob * outGain = new Knob( knobBright_26, this );
	outGain->move( 138, 32 );
	outGain->setModel( & controls->m_outGain );
	outGain->setLabel( tr( "GAIN" ) );
	outGain->setHintText( tr( "Output gain:" ) , " dBFS" );
	
	Knob * outClip = new Knob( knobBright_26, this );
	outClip->move( 138, 76 );
	outClip->setModel( & controls->m_outClip );
	outClip->setLabel( tr( "CLIP" ) );
	outClip->setHintText( tr( "Output clip:" ) , "%" );
	
	
	// leds
	LedCheckBox * rateEnabled = new LedCheckBox( "", this, tr( "Rate enabled" ), LedCheckBox::Green );
	rateEnabled->move( 64, 14 );
	rateEnabled->setModel( & controls->m_rateEnabled );
	ToolTip::add( rateEnabled, tr( "Enable sample-rate crushing" ) );
	
	LedCheckBox * depthEnabled = new LedCheckBox( "", this, tr( "Depth enabled" ), LedCheckBox::Green );
	depthEnabled->move( 101, 14 );
	depthEnabled->setModel( & controls->m_depthEnabled );
	ToolTip::add( depthEnabled, tr( "Enable bit-depth crushing" ) );
	
	
	// rate crushing knobs
	Knob * rate = new Knob( knobBright_26, this );
	rate->move( 59, 32 );
	rate->setModel( & controls->m_rate );
	rate->setLabel( tr( "FREQ" ) );
	rate->setHintText( tr( "Sample rate:" ) , " Hz" );
	
	Knob * stereoDiff = new Knob( knobBright_26, this );
	stereoDiff->move( 72, 76 );
	stereoDiff->setModel( & controls->m_stereoDiff );
	stereoDiff->setLabel( tr( "STEREO" ) );
	stereoDiff->setHintText( tr( "Stereo difference:" ) , "%" );
	
	
	// depth crushing knob
	Knob * levels = new Knob( knobBright_26, this );
	levels->move( 92, 32 );
	levels->setModel( & controls->m_levels );
	levels->setLabel( tr( "QUANT" ) );
	levels->setHintText( tr( "Levels:" ) , "" );
}
Ejemplo n.º 11
0
void KexiRecordMarker::paintEvent(QPaintEvent *)
{
    QPainter p(this);
    QRect r(rect());

    int first = (r.top() + d->offset) / d->rowHeight;
    int last  = (r.bottom() + d->offset) / d->rowHeight;
    if (last > (d->rows - 1 + (d->showInsertRow ? 1 : 0)))
        last = d->rows - 1 + (d->showInsertRow ? 1 : 0);

    p.setBrush(palette().brush(backgroundRole()));
    p.save();
    for (int i = first; i <= last; i++) {
        int y = ((d->rowHeight * i) - d->offset);
        p.drawRect(r);
        QStyleOptionHeader optionHeader;
        optionHeader.initFrom(this);
        optionHeader.orientation = Qt::Vertical;
        optionHeader.state |= QStyle::State_Raised;
        if (isEnabled())
            optionHeader.state |= QStyle::State_Enabled;
        if (window()->isActiveWindow())
            optionHeader.state |= QStyle::State_Active;
        optionHeader.rect = QRect(0, y, width(), d->rowHeight);
        optionHeader.section = 0;
        // alter background for selected or highlighted row
        QColor alteredColor;
//! @todo Qt4: blend entire QBrush?
        if (d->currentRow == i) {
            alteredColor = KexiUtils::blendedColors(
                               palette().color(QPalette::Window), d->selectionBackgroundBrush.color(), 2, 1);
        }
        else if (d->highlightedRecord == i) {
            alteredColor = KexiUtils::blendedColors(
                               palette().color(QPalette::Window), d->selectionBackgroundBrush.color(), 4, 1);
            optionHeader.state |= QStyle::State_MouseOver;
        }

        if (alteredColor.isValid()) {
            optionHeader.palette.setBrush(QPalette::Button, d->selectionBackgroundBrush);
            optionHeader.palette.setColor(QPalette::Button, alteredColor);
            //set background color as well (e.g. for thinkeramik)
            optionHeader.palette.setBrush(QPalette::Window, d->selectionBackgroundBrush);
            optionHeader.palette.setColor(QPalette::Window, alteredColor);
        }
        style()->drawControl(
            QStyle::CE_Header,
            &optionHeader,
            &p,
            this);
    }
    p.restore();

    if (d->editRow != -1 && d->editRow >= first && d->editRow <= (last/*+1 for insert row*/)) {
        //show pen when editing
        int ofs = d->rowHeight / 4;
        int pos = ((d->rowHeight * (d->currentRow >= 0 ? d->currentRow : 0)) - d->offset) - ofs / 2 + 1;
        p.drawPixmap((d->rowHeight - KexiRecordMarker_static->pen.width()) / 2,
                    (d->rowHeight - KexiRecordMarker_static->pen.height()) / 2 + pos, KexiRecordMarker_static->pen);
    } else if (d->currentRow >= first && d->currentRow <= last
               && (!d->showInsertRow || (d->showInsertRow && d->currentRow < last))) { /*don't display marker for 'insert' row*/
        //show marker
        p.setBrush(palette().brush(foregroundRole()));
        p.setPen(QPen(Qt::NoPen));
        QPolygon points(3);
        int ofs = d->rowHeight / 4;
        int ofs2 = (width() - ofs) / 2;
        int pos = ((d->rowHeight * d->currentRow) - d->offset) - ofs / 2 + 2;
        points.putPoints(0, 3, ofs2, pos + ofs, ofs2 + ofs, pos + ofs*2,
                         ofs2, pos + ofs*3);
        p.drawPolygon(points);
    }
    if (d->showInsertRow && d->editRow < last
            && last == (d->rows - 1 + (d->showInsertRow ? 1 : 0))) {
        //show plus sign
        int pos = ((d->rowHeight * last) - d->offset) + (d->rowHeight - KexiRecordMarker_static->plus.height()) / 2;
        p.drawPixmap((width() - KexiRecordMarker_static->plus.width()) / 2, pos, KexiRecordMarker_static->plus);
    }
}
Ejemplo n.º 12
0
lb302SynthView::lb302SynthView( Instrument * _instrument, QWidget * _parent ) :
	InstrumentView( _instrument, _parent )
{
	// GUI
	m_vcfCutKnob = new Knob( knobBright_26, this );
	m_vcfCutKnob->move( 75, 130 );
	m_vcfCutKnob->setHintText( tr( "Cutoff Freq:" ), "" );
	m_vcfCutKnob->setLabel( "" );

	m_vcfResKnob = new Knob( knobBright_26, this );
	m_vcfResKnob->move( 120, 130 );
	m_vcfResKnob->setHintText( tr( "Resonance:" ), "" );
	m_vcfResKnob->setLabel( "" );

	m_vcfModKnob = new Knob( knobBright_26, this );
	m_vcfModKnob->move( 165, 130 );
	m_vcfModKnob->setHintText( tr( "Env Mod:" ), "" );
	m_vcfModKnob->setLabel( "" );

	m_vcfDecKnob = new Knob( knobBright_26, this );
	m_vcfDecKnob->move( 210, 130 );
	m_vcfDecKnob->setHintText( tr( "Decay:" ), "" );
	m_vcfDecKnob->setLabel( "" );

	m_slideToggle = new LedCheckBox( "", this );
	m_slideToggle->move( 10, 180 );

/*	m_accentToggle = new LedCheckBox( "", this );
	m_accentToggle->move( 10, 200 );
	m_accentToggle->setDisabled(true);*/ // accent removed pending real implementation - no need for non-functional buttons

	m_deadToggle = new LedCheckBox( "", this );
	m_deadToggle->move( 10, 200 );

	m_db24Toggle = new LedCheckBox( "", this );
	m_db24Toggle->setWhatsThis(
			tr( "303-es-que, 24dB/octave, 3 pole filter" ) );
	m_db24Toggle->move( 10, 150);


	m_slideDecKnob = new Knob( knobBright_26, this );
	m_slideDecKnob->move( 210, 75 );
	m_slideDecKnob->setHintText( tr( "Slide Decay:" ), "" );
	m_slideDecKnob->setLabel( "");

	m_distKnob = new Knob( knobBright_26, this );
	m_distKnob->move( 210, 190 );
	m_distKnob->setHintText( tr( "DIST:" ), "" );
	m_distKnob->setLabel( tr( ""));


	// Shapes
	// move to 120,75
	const int waveBtnX = 10;
	const int waveBtnY = 96;
	PixmapButton * sawWaveBtn = new PixmapButton( this, tr( "Saw wave" ) );
	sawWaveBtn->move( waveBtnX, waveBtnY );
	sawWaveBtn->setActiveGraphic( embed::getIconPixmap(
						"saw_wave_active" ) );
	sawWaveBtn->setInactiveGraphic( embed::getIconPixmap(
						"saw_wave_inactive" ) );
	ToolTip::add( sawWaveBtn,
			tr( "Click here for a saw-wave." ) );

	PixmapButton * triangleWaveBtn =
		new PixmapButton( this, tr( "Triangle wave" ) );
	triangleWaveBtn->move( waveBtnX+(16*1), waveBtnY );
	triangleWaveBtn->setActiveGraphic(
		embed::getIconPixmap( "triangle_wave_active" ) );
	triangleWaveBtn->setInactiveGraphic(
		embed::getIconPixmap( "triangle_wave_inactive" ) );
	ToolTip::add( triangleWaveBtn,
			tr( "Click here for a triangle-wave." ) );

	PixmapButton * sqrWaveBtn = new PixmapButton( this, tr( "Square wave" ) );
	sqrWaveBtn->move( waveBtnX+(16*2), waveBtnY );
	sqrWaveBtn->setActiveGraphic( embed::getIconPixmap(
					"square_wave_active" ) );
	sqrWaveBtn->setInactiveGraphic( embed::getIconPixmap(
					"square_wave_inactive" ) );
	ToolTip::add( sqrWaveBtn,
			tr( "Click here for a square-wave." ) );

	PixmapButton * roundSqrWaveBtn =
		new PixmapButton( this, tr( "Rounded square wave" ) );
	roundSqrWaveBtn->move( waveBtnX+(16*3), waveBtnY );
	roundSqrWaveBtn->setActiveGraphic( embed::getIconPixmap(
					"round_square_wave_active" ) );
	roundSqrWaveBtn->setInactiveGraphic( embed::getIconPixmap(
					"round_square_wave_inactive" ) );
	ToolTip::add( roundSqrWaveBtn,
			tr( "Click here for a square-wave with a rounded end." ) );

	PixmapButton * moogWaveBtn =
		new PixmapButton( this, tr( "Moog wave" ) );
	moogWaveBtn->move( waveBtnX+(16*4), waveBtnY );
	moogWaveBtn->setActiveGraphic(
		embed::getIconPixmap( "moog_saw_wave_active" ) );
	moogWaveBtn->setInactiveGraphic(
		embed::getIconPixmap( "moog_saw_wave_inactive" ) );
	ToolTip::add( moogWaveBtn,
			tr( "Click here for a moog-like wave." ) );

	PixmapButton * sinWaveBtn = new PixmapButton( this, tr( "Sine wave" ) );
	sinWaveBtn->move( waveBtnX+(16*5), waveBtnY );
	sinWaveBtn->setActiveGraphic( embed::getIconPixmap(
						"sin_wave_active" ) );
	sinWaveBtn->setInactiveGraphic( embed::getIconPixmap(
						"sin_wave_inactive" ) );
	ToolTip::add( sinWaveBtn,
			tr( "Click for a sine-wave." ) );

	PixmapButton * exponentialWaveBtn =
		new PixmapButton( this, tr( "White noise wave" ) );
	exponentialWaveBtn->move( waveBtnX+(16*6), waveBtnY );
	exponentialWaveBtn->setActiveGraphic(
		embed::getIconPixmap( "exp_wave_active" ) );
	exponentialWaveBtn->setInactiveGraphic(
		embed::getIconPixmap( "exp_wave_inactive" ) );
	ToolTip::add( exponentialWaveBtn,
			tr( "Click here for an exponential wave." ) );


	PixmapButton * whiteNoiseWaveBtn =
		new PixmapButton( this, tr( "White noise wave" ) );
	whiteNoiseWaveBtn->move( waveBtnX+(16*7), waveBtnY );
	whiteNoiseWaveBtn->setActiveGraphic(
		embed::getIconPixmap( "white_noise_wave_active" ) );
	whiteNoiseWaveBtn->setInactiveGraphic(
		embed::getIconPixmap( "white_noise_wave_inactive" ) );
	ToolTip::add( whiteNoiseWaveBtn,
			tr( "Click here for white-noise." ) );

	PixmapButton * blSawWaveBtn =
		new PixmapButton( this, tr( "Bandlimited saw wave" ) );
	blSawWaveBtn->move( waveBtnX+(16*9)-8, waveBtnY );
	blSawWaveBtn->setActiveGraphic(
		embed::getIconPixmap( "saw_wave_active" ) );
	blSawWaveBtn->setInactiveGraphic(
		embed::getIconPixmap( "saw_wave_inactive" ) );
	ToolTip::add( blSawWaveBtn,
			tr( "Click here for bandlimited saw wave." ) );

	PixmapButton * blSquareWaveBtn =
		new PixmapButton( this, tr( "Bandlimited square wave" ) );
	blSquareWaveBtn->move( waveBtnX+(16*10)-8, waveBtnY );
	blSquareWaveBtn->setActiveGraphic(
		embed::getIconPixmap( "square_wave_active" ) );
	blSquareWaveBtn->setInactiveGraphic(
		embed::getIconPixmap( "square_wave_inactive" ) );
	ToolTip::add( blSquareWaveBtn,
			tr( "Click here for bandlimited square wave." ) );

	PixmapButton * blTriangleWaveBtn =
		new PixmapButton( this, tr( "Bandlimited triangle wave" ) );
	blTriangleWaveBtn->move( waveBtnX+(16*11)-8, waveBtnY );
	blTriangleWaveBtn->setActiveGraphic(
		embed::getIconPixmap( "triangle_wave_active" ) );
	blTriangleWaveBtn->setInactiveGraphic(
		embed::getIconPixmap( "triangle_wave_inactive" ) );
	ToolTip::add( blTriangleWaveBtn,
			tr( "Click here for bandlimited triangle wave." ) );

	PixmapButton * blMoogWaveBtn =
		new PixmapButton( this, tr( "Bandlimited moog saw wave" ) );
	blMoogWaveBtn->move( waveBtnX+(16*12)-8, waveBtnY );
	blMoogWaveBtn->setActiveGraphic(
		embed::getIconPixmap( "moog_saw_wave_active" ) );
	blMoogWaveBtn->setInactiveGraphic(
		embed::getIconPixmap( "moog_saw_wave_inactive" ) );
	ToolTip::add( blMoogWaveBtn,
			tr( "Click here for bandlimited moog saw wave." ) );


	m_waveBtnGrp = new automatableButtonGroup( this );
	m_waveBtnGrp->addButton( sawWaveBtn );
	m_waveBtnGrp->addButton( triangleWaveBtn );
	m_waveBtnGrp->addButton( sqrWaveBtn );
	m_waveBtnGrp->addButton( roundSqrWaveBtn );
	m_waveBtnGrp->addButton( moogWaveBtn );
	m_waveBtnGrp->addButton( sinWaveBtn );
	m_waveBtnGrp->addButton( exponentialWaveBtn );
	m_waveBtnGrp->addButton( whiteNoiseWaveBtn );
	m_waveBtnGrp->addButton( blSawWaveBtn );
	m_waveBtnGrp->addButton( blSquareWaveBtn );
	m_waveBtnGrp->addButton( blTriangleWaveBtn );
	m_waveBtnGrp->addButton( blMoogWaveBtn );

	setAutoFillBackground( true );
	QPalette pal;
	pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap(
			"artwork" ) );
	setPalette( pal );
}
Ejemplo n.º 13
0
AboutDialog::AboutDialog()
: KviTalTabDialog(0)
{
	setWindowTitle(__tr2qs_ctx("About KVIrc...","about"));
	setOkButton(__tr2qs_ctx("Close","about"));

	// About tab
	QString buffer;
	g_pApp->findImage(buffer,"kvi_splash.png");

	QPixmap pix(buffer);

	QWidget * w = new QWidget(this);
	QGridLayout * g = new QGridLayout(w);

	QLabel * l = new QLabel(w);
	l->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
	QPalette p = l->palette();
	p.setColor(backgroundRole(), Qt::black);
	l->setPalette(p);
	l->setAlignment(Qt::AlignCenter);
	l->setPixmap(pix);

	g->addWidget(l,0,0);

	QString aboutString= "<b>KVIrc " KVI_VERSION " '" KVI_RELEASE_NAME "'</b><br>";
	aboutString += __tr2qs_ctx("Forged by the <b>KVIrc Development Team</b>","about");

	l = new QLabel(aboutString,w);
	l->setAlignment(Qt::AlignCenter);
	g->addWidget(l,1,0);

	addTab(w,__tr2qs_ctx("About","about"));


	// Info tab
	w = new QWidget(this);
	g = new QGridLayout(w);

	QTextEdit * v = new QTextEdit(w);
	v->setReadOnly(true);
	g->addWidget(v,0,0);

	// Get info
	QString infoString = "<b>KVIrc " KVI_VERSION " '" KVI_RELEASE_NAME "'</b><br><br>";
	infoString += "<b>";
	infoString += __tr2qs_ctx("Runtime Info","about");
	infoString += ":</b><br>";
	infoString += __tr2qs_ctx("System Name","about");
	infoString += ": ";
	infoString += KviOsInfo::name();
#ifndef COMPILE_ON_MAC
	infoString += " ";
	infoString += KviOsInfo::release();
#endif
	infoString += "<br>";
	infoString += __tr2qs_ctx("System Version","about");
	infoString += ": ";
	infoString += KviOsInfo::version();
	infoString += "<br>";
	infoString += __tr2qs_ctx("Architecture","about");
	infoString += ": ";
	infoString += KviOsInfo::machine();
	infoString += "<br><br>";
	infoString += "<b>";
	infoString += __tr2qs_ctx("Build Info","about");
	infoString += ":</b><br>";
	infoString += __tr2qs_ctx("Build Date","about");
	infoString += ": ";
	infoString += KviBuildInfo::buildDate();
	infoString += "<br>";
	infoString += __tr2qs_ctx("Sources Date","about");
	infoString += ": ";
	infoString += KviBuildInfo::buildSourcesDate();
	infoString += "<br>";
	infoString += __tr2qs_ctx("Revision Number","about");
	infoString += ": ";
	infoString += KviBuildInfo::buildRevision();
	infoString += "<br>";
	infoString += __tr2qs_ctx("System Name","about");
	infoString += ": ";
	infoString += KviBuildInfo::buildSystem();
	infoString += "<br>";
	infoString += __tr2qs_ctx("CPU Name","about");
	infoString += ": ";
	infoString += KviBuildInfo::buildCPU();
	infoString += "<br>";
	infoString += __tr2qs_ctx("Build Command","about");
	infoString += ": ";
	infoString += KviBuildInfo::buildCommand();
	infoString += "<br>";
	infoString += __tr2qs_ctx("Build Flags","about");
	infoString += ": <br>&nbsp;&nbsp;&nbsp;";
	QString flags = KviBuildInfo::buildFlags();
	infoString += flags.replace(QRegExp(";"),"<br>&nbsp;&nbsp;&nbsp;");
	infoString += "<br>";
	infoString += __tr2qs_ctx("Compiler Name","about");
	infoString += ": ";
	infoString += KviBuildInfo::buildCompiler();
	infoString += "<br>";
	infoString += __tr2qs_ctx("Compiler Flags","about");
	infoString += ": ";
	infoString += KviBuildInfo::buildCompilerFlags();

	v->setText(infoString);

	addTab(w,__tr2qs_ctx("Executable Information","about"));


	// Honor & Glory tab
	w = new QWidget(this);
	g = new QGridLayout(w);

	v = new QTextEdit(w);
	v->setReadOnly(true);
	g->addWidget(v,0,0);

	v->setText(g_szAboutText);

	addTab(w,__tr2qs_ctx("Honor && Glory","about"));


	// License tab
	w = new QWidget(this);
	g = new QGridLayout(w);

	v = new QTextEdit(w);
	v->setReadOnly(true);
	v->setWordWrapMode(QTextOption::NoWrap);
	g->addWidget(v,0,0);

	QString szLicense;

	QString szLicensePath;
	g_pApp->getGlobalKvircDirectory(szLicensePath,KviApplication::License,"COPYING");

	if(!KviFileUtils::loadFile(szLicensePath,szLicense))
	{
		szLicense = __tr2qs_ctx("Oops... Can't find the license file...\n" \
			"It MUST be included in the distribution...\n" \
			"Please report to <pragma at kvirc dot net>","about");
	}

	v->setText(szLicense);

	addTab(w,__tr2qs_ctx("License","about"));


	connect(this,SIGNAL(applyButtonPressed()),this,SLOT(closeButtonPressed()));
}
Ejemplo n.º 14
0
// paint a ROUND SUNKEN led lamp
void KLed::paintSunken()
{
  if ( paintCachedPixmap() )
    return;

  QPainter paint;
  QColor color;
  QBrush brush;
  QPen pen;

  // First of all we want to know what area should be updated
  // Initialize coordinates, width, and height of the LED
  int width = ledWidth();

  int scale = 3;
  QPixmap *tmpMap = 0;

  width *= scale;

  tmpMap = new QPixmap( width, width );
  tmpMap->fill( palette().color( backgroundRole() ) );
  paint.begin( tmpMap );
  paint.setRenderHint(QPainter::Antialiasing);

  // Set the color of the LED according to given parameters
  color = ( d->state == On ) ? d->color : d->offColor;

  // Set the brush to SolidPattern, this fills the entire area
  // of the ellipse which is drawn first
  brush.setStyle( Qt::SolidPattern );
  brush.setColor( color );
  paint.setBrush( brush );  // Assign the brush to the painter

  // Draws a "flat" LED with the given color:
  paint.drawEllipse( scale, scale, width - scale * 2, width - scale * 2 );

  // Draw the bright light spot of the LED now, using modified "old"
  // painter routine taken from KDEUI's KLed widget:

  // Setting the new width of the pen is essential to avoid "pixelized"
  // shadow like it can be observed with the old LED code
  pen.setWidth( 2 * scale );

  // shrink the light on the LED to a size about 2/3 of the complete LED
  int pos = width / 5 + 1;
  int light_width = width;
  light_width *= 2;
  light_width /= 3;

  // Calculate the LED's "light factor":
  int light_quote = ( 130 * 2 / ( light_width ? light_width : 1 ) ) + 100;

  // Now draw the bright spot on the LED:
  while ( light_width ) {
    color = color.light( light_quote );                      // make color lighter
    pen.setColor( color );                                   // set color as pen color
    paint.setPen( pen );                                     // select the pen for drawing
    paint.drawEllipse( pos, pos, light_width, light_width ); // draw the ellipse (circle)
    light_width--;

    if ( !light_width )
      break;

    paint.drawEllipse( pos, pos, light_width, light_width );
    light_width--;

    if ( !light_width )
      break;

    paint.drawEllipse( pos, pos, light_width, light_width );
    pos++;
    light_width--;
  }

  // Drawing of bright spot finished, now draw a thin border
  // around the LED which resembles a shadow with light coming
  // from the upper left.

  pen.setWidth( 2 * scale + 1 ); // ### shouldn't this value be smaller for smaller LEDs?
  brush.setStyle( Qt::NoBrush );              // Switch off the brush
  paint.setBrush( brush );                        // This avoids filling of the ellipse

  // Set the initial color value to QColorGroup(palette()).light() (bright) and start
  // drawing the shadow border at 45° (45*16 = 720).

  int angle = -720;
  color = palette().color( QPalette::Light );

  for ( int arc = 120; arc < 2880; arc += 240 ) {
    pen.setColor( color );
    paint.setPen( pen );
    int w = width - pen.width() / 2 - scale + 1;
    paint.drawArc( pen.width() / 2, pen.width() / 2, w, w, angle + arc, 240 );
    paint.drawArc( pen.width() / 2, pen.width() / 2, w, w, angle - arc, 240 );
    color = color.dark( 110 ); //FIXME: this should somehow use the contrast value
  }  // end for ( angle = 720; angle < 6480; angle += 160 )

  paint.end();

  // painting done

  QPixmap *&dest = ( d->state == On ? d->onMap : d->offMap );
  QImage i = tmpMap->toImage();
  width /= 3;
  i = i.scaled( width, width, Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
  delete tmpMap;

  dest = new QPixmap( QPixmap::fromImage( i ) );
  paint.begin( this );
  paint.setCompositionMode(QPainter::CompositionMode_Source);
  paint.drawPixmap( 0, 0, *dest );
  paint.end();
}
Ejemplo n.º 15
0
HomeWindow::HomeWindow(Context *context, QString name, QString /* windowtitle */) :
    GcWindow(context), context(context), name(name), active(false),
    clicked(NULL), dropPending(false), chartCursor(-2), loaded(false)
{
    // setup control area
    QWidget *cw = new QWidget(this);
    cw->setContentsMargins(0,0,0,0);

    QVBoxLayout *cl = new QVBoxLayout(cw);
    cl->setSpacing(0);
    cl->setContentsMargins(0,0,0,0);

    QLabel *titleLabel = new QLabel("Title", this);
    QHBoxLayout *hl = new QHBoxLayout;
    hl->setSpacing(5);
    hl->setContentsMargins(0,0,0,0);

    titleEdit = new QLineEdit(this);
    titleEdit->setEnabled(false);
    controlStack = new QStackedWidget(this);
    controlStack->setContentsMargins(0,0,0,0);
    hl->addWidget(titleLabel);
    hl->addWidget(titleEdit);
    cl->addLayout(hl);
    cl->addSpacing(15);
    cl->addWidget(controlStack);
    setControls(cw);

    setProperty("isManager", true);
    setAcceptDrops(true);

    QVBoxLayout *layout = new QVBoxLayout(this);

    QFont bigandbold;
    bigandbold.setPointSize(bigandbold.pointSize() + 2);
    bigandbold.setWeight(QFont::Bold);

    QHBoxLayout *titleBar = new QHBoxLayout;

    QLabel *space = new QLabel("", this);
    space->setFixedHeight(20);
    titleBar->addWidget(space);

    style = new QStackedWidget(this);
    style->setAutoFillBackground(false);
    layout->setSpacing(0);
    layout->setContentsMargins(0,0,0,0);
    layout->addWidget(style);

    QPalette palette;
    palette.setBrush(backgroundRole(), QColor("#B3B4B6"));
    setAutoFillBackground(false);

    // each style has its own container widget
    QWidget *tabArea = new QWidget(this);
    tabArea->setContentsMargins(0,0,0,0); // no spacing now, used to be 20px
    QVBoxLayout *tabLayout = new QVBoxLayout(tabArea);
    tabLayout->setContentsMargins(0,0,0,0);
    tabLayout->setSpacing(0);
    tabbed = new QStackedWidget(this);

    chartbar = new ChartBar(context);
    tabLayout->addWidget(chartbar);
    tabLayout->addWidget(tabbed);
    style->addWidget(tabArea);

    // tiled
    tileWidget = new QWidget(this);
    tileWidget->setAutoFillBackground(false);
    tileWidget->setPalette(palette);
    tileWidget->setContentsMargins(0,0,0,0);

    tileGrid = new QGridLayout(tileWidget);
    tileGrid->setSpacing(0);

    tileArea = new QScrollArea(this);
    tileArea->setAutoFillBackground(false);
    tileArea->setPalette(palette);
    tileArea->setWidgetResizable(true);
    tileArea->setWidget(tileWidget);
    tileArea->setFrameStyle(QFrame::NoFrame);
    tileArea->setContentsMargins(0,0,0,0);
    style->addWidget(tileArea);

    winWidget = new QWidget(this);
    winWidget->setAutoFillBackground(false);
    winWidget->setContentsMargins(0,0,0,0);
    winWidget->setPalette(palette);

    winFlow = new GcWindowLayout(winWidget, 0, tileSpacing, tileSpacing);
    winFlow->setContentsMargins(tileMargin,tileMargin,tileMargin,tileMargin);

    winArea = new QScrollArea(this);
    winArea->setAutoFillBackground(false);
    winArea->setPalette(palette);
    winArea->setWidgetResizable(true);
    winArea->setWidget(winWidget);
    winArea->setFrameStyle(QFrame::NoFrame);
    winArea->setContentsMargins(0,0,0,0);
    style->addWidget(winArea);
    winWidget->installEventFilter(this); // to draw cursor
    winWidget->setMouseTracking(true); // to draw cursor

    // enable right click to add a chart
    winArea->setContextMenuPolicy(Qt::CustomContextMenu);
    tabArea->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(winArea,SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(rightClick(const QPoint &)));
    connect(tabArea,SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(rightClick(const QPoint &)));

    currentStyle=-1;
    styleChanged(2);

    connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideSelected()));
    connect(this, SIGNAL(dateRangeChanged(DateRange)), this, SLOT(dateRangeChanged(DateRange)));
    connect(context, SIGNAL(configChanged()), this, SLOT(configChanged()));
    //connect(tabbed, SIGNAL(currentChanged(int)), this, SLOT(tabSelected(int)));
    //connect(tabbed, SIGNAL(tabCloseRequested(int)), this, SLOT(removeChart(int)));
    //connect(tb, SIGNAL(tabMoved(int,int)), this, SLOT(tabMoved(int,int)));
    connect(chartbar, SIGNAL(currentIndexChanged(int)), this, SLOT(tabSelected(int)));
    connect(titleEdit, SIGNAL(textChanged(const QString&)), SLOT(titleChanged()));

    installEventFilter(this);
    application->installEventFilter(this);
}
Ejemplo n.º 16
0
//设置全局界面元素以及部件透明度
void MusicWindow::setElement_BackGround()
{
    //文件夹下面的图片
    QPixmap fit_Button;
    QPixmap small_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/small.png"));
    QPixmap mode_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/order.png"));
    QPixmap play_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/pause1.png"));
    QPixmap last_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/last1.png"));
    QPixmap next_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/next1.png"));
    QPixmap add_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/open.png"));
    QPixmap theme_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/theme1.png"));
    QPixmap mark_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/open.png"));
    QPixmap close_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/close.png"));
    QPixmap browser_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/browser.png"));
    QPixmap login_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/login.png"));
    QPixmap speaker_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/speaker.png"));
    QPixmap download_Button(QString::fromUtf8("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/download.png"));

    //设置表格背景、初始化
    titlePalette.setColor(QPalette::Base, Qt::gray);

    ui->storeView->setPalette(titlePalette);
    ui->favoriteView->setPalette(titlePalette);
    ui->storeView->setStyleSheet("background-color:qconicalgradient(cx:0.5, cy:0.5, angle:0, stop:0.368182 rgba(198,198,198,75))");
    ui->storeView->hide();
    ui->webView->hide();
    ui->favoriteView->setStyleSheet("background-color:qconicalgradient(cx:0.5, cy:0.5, angle:0, stop:0.368182 rgba(198,198,198,75))");
    ui->favoriteView->hide();
    ui->browserButton->hide();
    ui->storeButton->hide();
    ui->favoriteButton->hide();

    //设置界面按钮的图片以及图标大小
    fit_Button = small_Button.scaled(163,163).scaled(21, 21, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
    ui->smallButton->setIcon(QIcon(fit_Button));
    ui->smallButton->setIconSize(QSize(21, 21));
    ui->smallButton->setFlat(true);
    ui->smallButton->setStyleSheet("border: 0px");
    ui->smallButton->setToolTip(QString("最小化窗口"));

    fit_Button = mode_Button.scaled(163,163).scaled(31, 31, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
    ui->modeButton->setIcon(QIcon(fit_Button));
    ui->modeButton->setIconSize(QSize(31, 31));
    ui->modeButton->setFlat(true);
    ui->modeButton->setStyleSheet("border: 0px");
    ui->modeButton->setToolTip(QString("顺序播放"));

    fit_Button = play_Button.scaled(163,163).scaled(41, 41, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
    ui->playButton->setIcon(QIcon(fit_Button));
    ui->playButton->setIconSize(QSize(41, 41));
    ui->playButton->setFlat(true);
    ui->playButton->setStyleSheet("border: 0px");
    ui->playButton->setToolTip(QString("播放/暂停"));

    fit_Button = last_Button.scaled(163,163).scaled(41, 41, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
    ui->lastButton->setIcon(QIcon(fit_Button));
    ui->lastButton->setIconSize(QSize(41, 41));
    ui->lastButton->setFlat(true);
    ui->lastButton->setStyleSheet("border: 0px");
    ui->lastButton->setToolTip(QString("上一曲Ctrl+L"));

    fit_Button = next_Button.scaled(163,163).scaled(41, 41, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
    ui->nextButton->setIcon(QIcon(fit_Button));
    ui->nextButton->setIconSize(QSize(41, 41));
    ui->nextButton->setFlat(true);
    ui->nextButton->setStyleSheet("border: 0px");
    ui->nextButton->setToolTip(QString("下一曲Ctrl+R"));

    fit_Button = add_Button.scaled(163,163).scaled(36, 36, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
    ui->addButton->setIcon(QIcon(fit_Button));
    ui->addButton->setIconSize(QSize(36, 36));
    ui->addButton->setFlat(true);
    ui->addButton->setStyleSheet("border: 0px");
    ui->addButton->setToolTip(QString("add songs"));

    fit_Button = theme_Button.scaled(163,163).scaled(36, 36, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
    ui->setApearenceButton->setIcon(QIcon(fit_Button));
    ui->setApearenceButton->setIconSize(QSize(36, 36));
    ui->setApearenceButton->setFlat(true);
    ui->setApearenceButton->setStyleSheet("border: 0px");
    ui->setApearenceButton->setToolTip(QString("更换主题"));

    fit_Button = mark_Button.scaled(163,163).scaled(27, 27, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
    ui->markButton->setIcon(QIcon(fit_Button));
    ui->markButton->setIconSize(QSize(27, 27));
    ui->markButton->setFlat(true);
    ui->markButton->setStyleSheet("border: 0px");
    ui->markButton->setToolTip(QString("move to favorite"));

    fit_Button = close_Button.scaled(163,163).scaled(29, 29, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
    ui->quitButton->setIcon(QIcon(fit_Button));
    ui->quitButton->setIconSize(QSize(29, 29));
    ui->quitButton->setFlat(true);
    ui->quitButton->setStyleSheet("border: 0px");
    ui->quitButton->setToolTip(QString("close "));

    fit_Button = browser_Button.scaled(163,163).scaled(34, 34, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
    ui->browserHideButton->setIcon(QIcon(fit_Button));
    ui->browserHideButton->setIconSize(QSize(34, 34));
    ui->browserHideButton->setFlat(true);
    ui->browserHideButton->setStyleSheet("border: 0px");
    ui->browserHideButton->setToolTip(QString("浏览网页"));

    fit_Button = login_Button.scaled(163,163).scaled(39, 30, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
    ui->loginButton->setIcon(QIcon(fit_Button));
    ui->loginButton->setIconSize(QSize(39, 30));
    ui->loginButton->setFlat(true);
    ui->loginButton->setStyleSheet("border: 0px");
    ui->loginButton->setToolTip(QString("登陆"));

    fit_Button = speaker_Button.scaled(163,163).scaled(35, 35,  Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
    ui->muteButton->setIcon(QIcon(fit_Button));
    ui->muteButton->setIconSize(QSize(35, 35));
    ui->muteButton->setFlat(true);
    ui->muteButton->setStyleSheet("border: 0px");
    ui->muteButton->setToolTip(QString("静音"));

    fit_Button = download_Button.scaled(163,163).scaled(25,25,Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
    ui->downloadButton->setIcon(QIcon(fit_Button));
    ui->downloadButton->setIconSize(QSize(25,25));
    ui->downloadButton->setFlat(true);
    ui->downloadButton->setStyleSheet("border:0px");
    ui->downloadButton->setToolTip(QString(" 下载"));

    ui->lyricButton->setToolTip(QString("歌词"));
    titlePalette = ui->browserButton->palette();
    titlePalette.setColor(QPalette::ButtonText, Qt::white);

    ui->browserButton->setToolTip(QString("网络"));
    ui->browserButton->setPalette(titlePalette);
    ui->browserButton->setStyleSheet("background-color:qconicalgradient(cx:0.5, cy:0.5, angle:0, stop:0.368182 rgba(198,198,198,75))");

    ui->storeButton->setToolTip(QString("mosic store"));
    ui->storeButton->setPalette(titlePalette);
    ui->storeButton->setStyleSheet("background-color:qconicalgradient(cx:0.5, cy:0.5, angle:0, stop:0.368182 rgba(198,198,198,75))");
    ui->favoriteButton->setToolTip(QString("我喜欢的歌曲"));
    ui->favoriteButton->setPalette(titlePalette);
    ui->favoriteButton->setStyleSheet("background-color:qconicalgradient(cx:0.5, cy:0.5, angle:0, stop:0.368182 rgba(198,198,198,75))");

    titlePalette = ui->musicTitle->palette();
    titlePalette.setColor(QPalette::WindowText, Qt::white);
    ui->musicTitle->setPalette(titlePalette);
    ui->lyricButton->setStyleSheet("background-color:qconicalgradient(cx:0.5, cy:0.5, angle:0, stop:0.368182 rgba(198,198,198,75))");
    ui->volumeSlider->setStyleSheet("background-color:qconicalgradient(cx:0.5, cy:0.5, angle:0, stop:0.368182 rgba(198,198,198,75))");
    ui->volumeSlider->setTickPosition(QSlider::TicksRight);

    titlePalette = ui->label->palette();
    titlePalette.setColor(QPalette::WindowText, Qt::white);
    ui->label->setPalette(titlePalette);

    titlePalette = ui->playStatusText->palette();
    titlePalette.setColor(QPalette::WindowText, Qt::white);
    ui->playStatusText->setPalette(titlePalette);

    titlePalette = ui->listWidget->palette();
    titlePalette.setColor(QPalette::Base, Qt::lightGray);
    ui->listWidget->setPalette(titlePalette);
    //StyleSheet字符串用来设置模版样式
    ui->listWidget->setStyleSheet("background-color:qconicalgradient(cx:0.5, cy:0.5, angle:0, stop:0.368182 rgba(198,198,198,75))");

    //设置主窗口
    this->setWindowOpacity(0.9);
    this->setWindowFlags(Qt::FramelessWindowHint); //无边框窗口
    this->setWindowTitle("Qt MusicPlayer");
    this->setWindowIcon(QIcon("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/title.png"));
    themeChoise = "pure_zise.png";
    themeToUse = "C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Backgroud/" + themeChoise;
    QPixmap pixmap(/*QString::fromUtf8*/themeToUse);//文件夹下面的图片
    titlePalette = this->palette();
    titlePalette.setBrush(backgroundRole(), QBrush(pixmap));
    this->setPalette(titlePalette);

    //设置全局快捷键动作
    search = new QAction( QString("搜索歌曲"),this);
    search->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F));
    search->setIcon(QIcon("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/search.png"));
    this->addAction(search);
    ui->searchEdit->hide();
    this->connect(search, SIGNAL(triggered()), this, SLOT(songsSearch()));

    last_song = new QAction(ui->lastButton);
    last_song->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Left));
    ui->lastButton->addAction(last_song);
    ui->lastButton->connect(last_song, SIGNAL(triggered()), this, SLOT(lastSong()));

    next_song = new QAction(ui->nextButton);
    next_song->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Right));
    ui->nextButton->addAction(next_song);
    ui->nextButton->connect(next_song, SIGNAL(triggered()), this, SLOT(nextSong()));

    pause_song = new QAction(ui->playButton);
    pause_song->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Space));
    ui->playButton->addAction(pause_song);
    ui->playButton->connect(pause_song, SIGNAL(triggered()), this, SLOT(playEvent()));

    small_window = new QAction(this);
    small_window->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Down));
    this->addAction(small_window);
    this->connect(small_window, SIGNAL(triggered()), this, SLOT(showMinimized()));

    full_window = new QAction(ui->browserHideButton);
    full_window->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Up));
    ui->browserHideButton->addAction(full_window);
    ui->browserHideButton->connect(full_window, SIGNAL(triggered()), this, SLOT(browserSet()));

    showMini = new QAction( QString("最小化"),this);
    showMini->setIcon(QIcon("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/mini.png"));
    connect(showMini, SIGNAL(triggered()), this, SLOT(showMinimized()));

    quit = new QAction(QString("close"), this);
    quit->setIcon(QIcon("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/close.png"));
    connect(quit, SIGNAL(triggered()), this, SLOT(warning()));

    login = new QAction(QString("登陆"), this);
    login->setIcon(QIcon("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/login.png"));
    connect(login, SIGNAL(triggered()), this, SLOT(user_login()));

    clearList  = new QAction(QString("清空列表"), this);
    clearList->setIcon(QIcon("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/clear.png"));
    connect(clearList, SIGNAL(triggered()), this, SLOT(clear_List()));

    download = new QAction(QString("下载歌曲"), this);
    download->setIcon(QIcon("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/download.png"));
    connect(download,SIGNAL(triggered()), this, SLOT(download_File()));

    information = new QAction(QString("关于"), this);
    information->setIcon(QIcon("C:/Qt/Qt5.4.1/projects/QT_MusicPlayer/Images/Icon/information.png"));
    connect(information, SIGNAL(triggered()), this, SLOT(about()));
}
Ejemplo n.º 17
0
void OverlayWidget::setBackgroundColor(const QColor &color)
{
    QPalette p = palette();
    p.setColor(backgroundRole(), color);
    setPalette(p);
}
Ejemplo n.º 18
0
lb303SynthView::lb303SynthView( Instrument * _instrument, QWidget * _parent ) :
	InstrumentView( _instrument, _parent )
{
	// GUI
	m_vcfCutKnob = new knob( knobBright_26, this );
	m_vcfCutKnob->move( 75, 130 );
	m_vcfCutKnob->setHintText( tr( "Cutoff Freq:" ) + " ", "" );
	m_vcfCutKnob->setLabel( tr("CUT") );

	m_vcfResKnob = new knob( knobBright_26, this );
	m_vcfResKnob->move( 120, 130 );
	m_vcfResKnob->setHintText( tr( "Resonance:" ) + " ", "" );
	m_vcfResKnob->setLabel( tr("RES") );

	m_vcfModKnob = new knob( knobBright_26, this );
	m_vcfModKnob->move( 165, 130 );
	m_vcfModKnob->setHintText( tr( "Env Mod:" ) + " ", "" );
	m_vcfModKnob->setLabel( tr("ENV MOD") );

	m_vcfDecKnob = new knob( knobBright_26, this );
	m_vcfDecKnob->move( 210, 130 );
	m_vcfDecKnob->setHintText( tr( "Decay:" ) + " ", "" );
	m_vcfDecKnob->setLabel( tr("DEC") );

	m_slideToggle = new ledCheckBox( "Slide", this );
	m_slideToggle->move( 10, 180 );

	m_accentToggle = new ledCheckBox( "Accent", this );
	m_accentToggle->move( 10, 200 );
	m_accentToggle->setDisabled(true);

	m_deadToggle = new ledCheckBox( "Dead", this );
	m_deadToggle->move( 10, 220 );

	m_db24Toggle = new ledCheckBox( "24dB/oct", this );
	m_db24Toggle->setWhatsThis( 
			tr( "303-es-que, 24dB/octave, 3 pole filter" ) );
	m_db24Toggle->move( 10, 150);


	m_slideDecKnob = new knob( knobBright_26, this );
	m_slideDecKnob->move( 210, 75 );
	m_slideDecKnob->setHintText( tr( "Slide Decay:" ) + " ", "" );
	m_slideDecKnob->setLabel( tr( "SLIDE"));

	m_distKnob = new knob( knobBright_26, this );
	m_distKnob->move( 210, 190 );
	m_distKnob->setHintText( tr( "DIST:" ) + " ", "" );
	m_distKnob->setLabel( tr( "DIST"));


	m_waveKnob = new knob( knobBright_26, this );
	m_waveKnob->move( 120, 75 );
	m_waveKnob->setHintText( tr( "WAVE:" ) + " ", "" );
	m_waveKnob->setLabel( tr( "WAVE"));


	setAutoFillBackground( true );
	QPalette pal;
	pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap(
			"artwork" ) );
	setPalette( pal );
}
Ejemplo n.º 19
0
MultitapEchoControlDialog::MultitapEchoControlDialog( MultitapEchoControls * controls ) :
	EffectControlDialog( controls )
{
	setAutoFillBackground( true );
	QPalette pal;
	pal.setBrush( backgroundRole(),	PLUGIN_NAME::getIconPixmap( "artwork" ) );
	setPalette( pal );
	setFixedSize( 245, 300 );
	
	// graph widgets
	
	Graph * ampGraph = new Graph( this, Graph::BarStyle, 204, 105 );
	Graph * lpGraph = new Graph( this, Graph::BarStyle, 204, 105 );
	
	ampGraph->move( 30, 10 );
	lpGraph->move( 30, 125 );
	
	ampGraph->setModel( & controls->m_ampGraph );
	lpGraph->setModel( & controls->m_lpGraph );
	
	pal = QPalette();
	pal.setBrush( backgroundRole(),	PLUGIN_NAME::getIconPixmap("graph_bg") );
	
	ampGraph->setAutoFillBackground( true );
	ampGraph->setPalette( pal );
	ampGraph->setGraphColor( QColor( 11, 213, 86) );
	ampGraph -> setMaximumSize( 204, 105 );
	
	lpGraph->setAutoFillBackground( true );
	lpGraph->setPalette( pal );
	lpGraph->setGraphColor( QColor( 0, 200, 187) );
	lpGraph -> setMaximumSize( 204, 105 );
	
	// steps spinbox
	
	LcdSpinBox * steps = new LcdSpinBox( 2, this, "Steps" );
	steps->move( 20, 245 );
	steps->setModel( & controls->m_steps );
	
	// knobs

	TempoSyncKnob * stepLength = new TempoSyncKnob( knobBright_26, this );
	stepLength->move( 100, 245 );
	stepLength->setModel( & controls->m_stepLength );
	stepLength->setLabel( tr( "Length" ) );
	stepLength->setHintText( tr( "Step length:" ) , " ms" );
	
	Knob * dryGain = new Knob( knobBright_26, this );
	dryGain->move( 150, 245 );
	dryGain->setModel( & controls->m_dryGain );
	dryGain->setLabel( tr( "Dry" ) );
	dryGain->setHintText( tr( "Dry Gain:" ) , " dBFS" );

	Knob * stages = new Knob( knobBright_26, this );
	stages->move( 200, 245 );
	stages->setModel( & controls->m_stages );
	stages->setLabel( tr( "Stages" ) );
	stages->setHintText( tr( "Lowpass stages:" ) , "x" );
	// switch led
	
	LedCheckBox * swapInputs = new LedCheckBox( "Swap inputs", this, tr( "Swap inputs" ), LedCheckBox::Green );
	swapInputs->move( 20, 275 );
	swapInputs->setModel( & controls->m_swapInputs );
	ToolTip::add( swapInputs, tr( "Swap left and right input channel for reflections" ) );
}
Ejemplo n.º 20
0
void QwtPlot::printLegend(QPainter *painter, const QRect &rect) const
{
    if ( !legend() || legend()->isEmpty() )
        return;

    QLayout *l = legend()->contentsWidget()->layout();
    if ( l == 0 || !l->inherits("QwtDynGridLayout") )
        return;

    QwtDynGridLayout *legendLayout = (QwtDynGridLayout *)l;

    uint numCols = legendLayout->columnsForWidth(rect.width());
#if QT_VERSION < 0x040000
    QValueList<QRect> itemRects = 
        legendLayout->layoutItems(rect, numCols);
#else
    QList<QRect> itemRects = 
        legendLayout->layoutItems(rect, numCols);
#endif

    int index = 0;

#if QT_VERSION < 0x040000
    QLayoutIterator layoutIterator = legendLayout->iterator();
    for ( QLayoutItem *item = layoutIterator.current(); 
        item != 0; item = ++layoutIterator)
    {
#else
    for ( int i = 0; i < legendLayout->count(); i++ )
    {
        QLayoutItem *item = legendLayout->itemAt(i);
#endif
        QWidget *w = item->widget();
        if ( w )
        {
            painter->save();
            painter->setClipping(true);
            QwtPainter::setClipRect(painter, itemRects[index]);

            printLegendItem(painter, w, itemRects[index]);

            index++;
            painter->restore();
        }
    }
}

/*!
  Print the legend item into a given rectangle.

  \param painter Painter
  \param w Widget representing a legend item
  \param rect Bounding rectangle
*/

void QwtPlot::printLegendItem(QPainter *painter, 
    const QWidget *w, const QRect &rect) const
{
    if ( w->inherits("QwtLegendItem") )
    {
        QwtLegendItem *item = (QwtLegendItem *)w;

        painter->setFont(item->font());
        item->drawItem(painter, rect);
    }
}

/*!
  \brief Paint a scale into a given rectangle.
  Paint the scale into a given rectangle.

  \param painter Painter
  \param axisId Axis
  \param startDist Start border distance
  \param endDist End border distance
  \param baseDist Base distance
  \param rect Bounding rectangle
*/

void QwtPlot::printScale(QPainter *painter,
    int axisId, int startDist, int endDist, int baseDist, 
    const QRect &rect) const
{
    if (!axisEnabled(axisId))
        return;

    const QwtScaleWidget *scaleWidget = axisWidget(axisId);
    if ( scaleWidget->isColorBarEnabled() 
        && scaleWidget->colorBarWidth() > 0)
    {
        const QwtMetricsMap map = QwtPainter::metricsMap();

        QRect r = map.layoutToScreen(rect);
        r.setWidth(r.width() - 1);
        r.setHeight(r.height() - 1);

        scaleWidget->drawColorBar(painter, scaleWidget->colorBarRect(r));

        const int off = scaleWidget->colorBarWidth() + scaleWidget->spacing();
        if ( scaleWidget->scaleDraw()->orientation() == Qt::Horizontal )
            baseDist += map.screenToLayoutY(off);
        else
            baseDist += map.screenToLayoutX(off);
    }

    QwtScaleDraw::Alignment align;
    int x, y, w;

    switch(axisId)
    {
        case yLeft:
        {
            x = rect.right() - baseDist;
            y = rect.y() + startDist;
            w = rect.height() - startDist - endDist;
            align = QwtScaleDraw::LeftScale;
            break;
        }
        case yRight:
        {
            x = rect.left() + baseDist;
            y = rect.y() + startDist;
            w = rect.height() - startDist - endDist;
            align = QwtScaleDraw::RightScale;
            break;
        }
        case xTop:
        {
            x = rect.left() + startDist;
            y = rect.bottom() - baseDist;
            w = rect.width() - startDist - endDist;
            align = QwtScaleDraw::TopScale;
            break;
        }
        case xBottom:
        {
            x = rect.left() + startDist;
            y = rect.top() + baseDist;
            w = rect.width() - startDist - endDist;
            align = QwtScaleDraw::BottomScale;
            break;
        }
        default:
            return;
    }

    scaleWidget->drawTitle(painter, align, rect);

    painter->save();
    painter->setFont(scaleWidget->font());

    QPen pen = painter->pen();
    pen.setWidth(scaleWidget->penWidth());
    painter->setPen(pen);

    QwtScaleDraw *sd = (QwtScaleDraw *)scaleWidget->scaleDraw();
    const QPoint sdPos = sd->pos();
    const int sdLength = sd->length();

    sd->move(x, y);
    sd->setLength(w);

#if QT_VERSION < 0x040000
    sd->draw(painter, scaleWidget->palette().active());
#else
    QPalette palette = scaleWidget->palette();
    palette.setCurrentColorGroup(QPalette::Active);
    sd->draw(painter, palette);
#endif
    // reset previous values
    sd->move(sdPos); 
    sd->setLength(sdLength); 

    painter->restore();
}

/*!
  Print the canvas into a given rectangle.

  \param painter Painter
  \param map Maps mapping between plot and paint device coordinates
  \param boundingRect Bounding rectangle
  \param canvasRect Canvas rectangle
  \param pfilter Print filter
  \sa QwtPlotPrintFilter
*/

void QwtPlot::printCanvas(QPainter *painter, 
    const QRect &boundingRect, const QRect &canvasRect,
    const QwtScaleMap map[axisCnt], const QwtPlotPrintFilter &pfilter) const
{
    if ( pfilter.options() & QwtPlotPrintFilter::PrintBackground )
    {
        QBrush bgBrush;
#if QT_VERSION >= 0x040000
            bgBrush = canvas()->palette().brush(backgroundRole());
#else
        QColorGroup::ColorRole role =
            QPalette::backgroundRoleFromMode( backgroundMode() );
        bgBrush = canvas()->colorGroup().brush( role );
#endif
        QRect r = boundingRect;
        if ( !(pfilter.options() & QwtPlotPrintFilter::PrintFrameWithScales) )
        {
            r = canvasRect;
#if QT_VERSION >= 0x040000
            // Unfortunately the paint engines do no always the same
            const QPaintEngine *pe = painter->paintEngine();
            if ( pe )
            {
                switch(painter->paintEngine()->type() )
                {
                    case QPaintEngine::Raster:
                    case QPaintEngine::X11:
                        break;
                    default:
                        r.setWidth(r.width() - 1);
                        r.setHeight(r.height() - 1);
                        break;
                }
            }
#else
            if ( painter->device()->isExtDev() )
            {
                r.setWidth(r.width() - 1);
                r.setHeight(r.height() - 1);    
            }
#endif
        }

        QwtPainter::fillRect(painter, r, bgBrush);
    }

    if ( pfilter.options() & QwtPlotPrintFilter::PrintFrameWithScales )
    {
        painter->save();
        painter->setPen(QPen(Qt::black));
        painter->setBrush(QBrush(Qt::NoBrush));
        QwtPainter::drawRect(painter, boundingRect);
        painter->restore();
    }

    painter->setClipping(true);
    QwtPainter::setClipRect(painter, canvasRect);

    drawItems(painter, canvasRect, map, pfilter);
}
Ejemplo n.º 21
0
void QwtPlotCanvas::drawCanvas( QPainter *painter, bool withBackground ) 
{
    bool hackStyledBackground = false;

    if ( withBackground && testAttribute( Qt::WA_StyledBackground ) 
        && testPaintAttribute( HackStyledBackground ) )
    {
        // Antialiasing rounded borders is done by
        // inserting pixels with colors between the 
        // border color and the color on the canvas,
        // When the border is painted before the plot items
        // these colors are interpolated for the canvas
        // and the plot items need to be clipped excluding
        // the anialiased pixels. In situations, where
        // the plot items fill the area at the rounded
        // borders this is noticeable.
        // The only way to avoid these annoying "artefacts"
        // is to paint the border on top of the plot items.

        if ( d_data->styleSheet.hasBorder &&
            !d_data->styleSheet.borderPath.isEmpty() )
        {
            // We have a border with at least one rounded corner
            hackStyledBackground = true;
        }
    }

    if ( withBackground )
    {
        painter->save();

        if ( testAttribute( Qt::WA_StyledBackground ) )
        {
            if ( hackStyledBackground )
            {
                // paint background without border

                painter->setPen( Qt::NoPen );
                painter->setBrush( d_data->styleSheet.background.brush ); 
                painter->setBrushOrigin( d_data->styleSheet.background.origin );
                painter->setClipPath( d_data->styleSheet.borderPath );
                painter->drawRect( contentsRect() );
            }
            else
            {
                qwtDrawStyledBackground( this, painter );
            }
        }
        else if ( autoFillBackground() )
        {
            painter->setPen( Qt::NoPen );
            painter->setBrush( palette().brush( backgroundRole() ) );

            if ( d_data->borderRadius > 0.0 )
            {
                if ( frameWidth() > 0 )
                {
                    painter->setClipPath( borderPath( rect() ) );
                    painter->drawRect( rect() );
                }
                else
                {
                    painter->setRenderHint( QPainter::Antialiasing, true );
                    painter->drawPath( borderPath( rect() ) );
                }
            }
            else
            {
                painter->drawRect( contentsRect() );
            }
        }

        painter->restore();
    }

    painter->save();

    if ( !d_data->styleSheet.borderPath.isEmpty() )
    {
        painter->setClipPath( 
            d_data->styleSheet.borderPath, Qt::IntersectClip );
    }
    else
    {
        if ( d_data->borderRadius > 0.0 )
            painter->setClipPath( borderPath( rect() ), Qt::IntersectClip );
        else
            painter->setClipRect( contentsRect(), Qt::IntersectClip );
    }

    plot()->drawCanvas( painter );

    painter->restore();

    if ( withBackground && hackStyledBackground )
    {
        // Now paint the border on top
        QStyleOptionFrame opt;
        opt.initFrom(this);
        style()->drawPrimitive( QStyle::PE_Frame, &opt, painter, this);
    }
}
Ejemplo n.º 22
0
QgsGrassNewMapset::QgsGrassNewMapset( QgisInterface *iface,
                                      QgsGrassPlugin *plugin, QWidget * parent,
                                      Qt::WindowFlags f ) :
    QWizard( parent, f ),
    QgsGrassNewMapsetBase()
{
  QgsDebugMsg( "QgsGrassNewMapset()" );

  setupUi( this );
#ifdef Q_OS_MAC
  setWizardStyle( QWizard::ClassicStyle );
#endif

  mRunning = true;
  mIface = iface;
  mProjectionSelector = 0;
  mPreviousPage = -1;
  mRegionModified = false;

  QString mapPath = ":/images/grass/world.png";
  QgsDebugMsg( QString( "mapPath = %1" ).arg( mapPath ) );

  //mPixmap = QPixmap( *(mRegionMap->pixmap()) );
  mPixmap.load( mapPath );
  QgsDebugMsg( QString( "mPixmap.isNull() = %1" ).arg( mPixmap.isNull() ) );

  mRegionsInited = false;
  mPlugin = plugin;

  setError( mDatabaseErrorLabel, "" );
  setError( mLocationErrorLabel, "" );
  setError( mProjErrorLabel, "" );
  setError( mRegionErrorLabel, "" );
  setError( mMapsetErrorLabel, "" );

  const QColor& paletteBackgroundColor = palette().color( backgroundRole() );
  QPalette palette = mDatabaseText->palette();
  palette.setColor( mDatabaseText->backgroundRole(), paletteBackgroundColor );
  mDatabaseText->setPalette( palette );
  palette = mLocationText->palette();
  palette.setColor( mLocationText->backgroundRole(), paletteBackgroundColor );
  mLocationText->setPalette( palette );
  palette = mRegionText->palette();
  palette.setColor( mRegionText->backgroundRole(), paletteBackgroundColor );
  mRegionText->setPalette( palette );
  palette = mMapsetText->palette();
  palette.setColor( mMapsetText->backgroundRole(), paletteBackgroundColor );
  mMapsetText->setPalette( palette );

  // DATABASE
  QSettings settings;
  QString db = settings.value( "/GRASS/lastGisdbase" ).toString();
  if ( !db.isNull() )
  {
    mDatabaseLineEdit->setText( db );
  }
  else
  {
    mDatabaseLineEdit->setText( QDir::currentPath() );
  }
  databaseChanged();

  // Create example tree structure
  mTreeListView->clear();
  QTreeWidgetItem *dbi = new QTreeWidgetItem( mTreeListView, QStringList() << "OurDatabase" << tr( "Database" ) );
  dbi->setExpanded( true );

  QTreeWidgetItem *l = new QTreeWidgetItem( dbi, QStringList() << "Mexico" << tr( "Location 1" ) );
  l->setExpanded( true );
  QTreeWidgetItem *m = new QTreeWidgetItem( l, QStringList() << "PERMANENT" << tr( "System mapset" ) );
  m->setExpanded( true );
  m = new QTreeWidgetItem( l, QStringList() << "Alejandra" << tr( "User's mapset" ) );
  m->setExpanded( true );
  m = new QTreeWidgetItem( l, QStringList() << "Juan" << tr( "User's mapset" ) );
  m->setExpanded( true );

  l = new QTreeWidgetItem( dbi, QStringList() << "New Zealand" << tr( "Location 2" ) );
  l->setExpanded( true );
  m = new QTreeWidgetItem( l, QStringList() << "PERMANENT" << tr( "System mapset" ) );
  m->setExpanded( true );
  m = new QTreeWidgetItem( l, QStringList() << "Cimrman" << tr( "User's mapset" ) );
  m->setExpanded( true );

  // LOCATION
  QRegExp rx;
  rx.setPattern( "[A-Za-z0-9_.]+" );
  mLocationLineEdit->setValidator( new QRegExpValidator( rx, mLocationLineEdit ) );

  // CRS

  // MAPSET
  mMapsetsListView->clear();
  mMapsetLineEdit->setValidator( new QRegExpValidator( rx, mMapsetLineEdit ) );

  // FINISH

  connect( this, SIGNAL( currentIdChanged( int ) ),
           this, SLOT( pageSelected( int ) ) );
}
Ejemplo n.º 23
0
ZynAddSubFxView::ZynAddSubFxView( Instrument * _instrument, QWidget * _parent ) :
	InstrumentView( _instrument, _parent )
{
	setAutoFillBackground( true );
	QPalette pal;
	pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap(
								"artwork" ) );
	setPalette( pal );

	QGridLayout * l = new QGridLayout( this );
	l->setContentsMargins( 20, 80, 10, 10 );
	l->setVerticalSpacing( 16 );
	l->setHorizontalSpacing( 10 );

	m_portamento = new Knob( knobBright_26, this );
	m_portamento->setHintText( tr( "Portamento:" ), "" );
	m_portamento->setLabel( tr( "PORT" ) );

	m_filterFreq = new Knob( knobBright_26, this );
	m_filterFreq->setHintText( tr( "Filter Frequency:" ), "" );
	m_filterFreq->setLabel( tr( "FREQ" ) );

	m_filterQ = new Knob( knobBright_26, this );
	m_filterQ->setHintText( tr( "Filter Resonance:" ), "" );
	m_filterQ->setLabel( tr( "RES" ) );

	m_bandwidth = new Knob( knobBright_26, this );
	m_bandwidth->setHintText( tr( "Bandwidth:" ), "" );
	m_bandwidth->setLabel( tr( "BW" ) );

	m_fmGain = new Knob( knobBright_26, this );
	m_fmGain->setHintText( tr( "FM Gain:" ), "" );
	m_fmGain->setLabel( tr( "FM GAIN" ) );

	m_resCenterFreq = new Knob( knobBright_26, this );
	m_resCenterFreq->setHintText( tr( "Resonance center frequency:" ), "" );
	m_resCenterFreq->setLabel( tr( "RES CF" ) );

	m_resBandwidth = new Knob( knobBright_26, this );
	m_resBandwidth->setHintText( tr( "Resonance bandwidth:" ), "" );
	m_resBandwidth->setLabel( tr( "RES BW" ) );

	m_forwardMidiCC = new LedCheckBox( tr( "Forward MIDI Control Changes" ), this );

	m_toggleUIButton = new QPushButton( tr( "Show GUI" ), this );
	m_toggleUIButton->setCheckable( true );
#ifdef LMMS_BUILD_APPLE
	m_toggleUIButton->setEnabled( false );
#endif
	m_toggleUIButton->setChecked( false );
	m_toggleUIButton->setIcon( embed::getIconPixmap( "zoom" ) );
	m_toggleUIButton->setFont( pointSize<8>( m_toggleUIButton->font() ) );
	connect( m_toggleUIButton, SIGNAL( toggled( bool ) ), this,
							SLOT( toggleUI() ) );
	m_toggleUIButton->setWhatsThis(
		tr( "Click here to show or hide the graphical user interface "
			"(GUI) of ZynAddSubFX." ) );

	l->addWidget( m_toggleUIButton, 0, 0, 1, 4 );
	l->setRowStretch( 1, 5 );
	l->addWidget( m_portamento, 2, 0 );
	l->addWidget( m_filterFreq, 2, 1 );
	l->addWidget( m_filterQ, 2, 2 );
	l->addWidget( m_bandwidth, 2, 3 );
	l->addWidget( m_fmGain, 3, 0 );
	l->addWidget( m_resCenterFreq, 3, 1 );
	l->addWidget( m_resBandwidth, 3, 2 );
	l->addWidget( m_forwardMidiCC, 4, 0, 1, 4 );

	l->setRowStretch( 5, 10 );
	l->setColumnStretch( 4, 10 );

	setAcceptDrops( true );
}
Ejemplo n.º 24
0
UIConfigPay::UIConfigPay(QDialog *parent,Qt::WindowFlags f) :
    QDialog(parent,f)
{
    QPixmap bg;
    bg.load(":/images/commonbg.png");
    QPalette palette;
    palette.setBrush(backgroundRole(),QBrush(bg));
    this->setPalette(palette);
    this->setAutoFillBackground(true);
    this->setAttribute(Qt::WA_DeleteOnClose);
    this->setGeometry(0,FRAME420_THVALUE,FRAME420_WIDTH,FRAME420_HEIGHT);

    this->setFixedSize(FRAME420_WIDTH,FRAME420_HEIGHT);
    QFont font("Helvetica",12,QFont::Bold);
    QFont font2("Helvetica",14,QFont::Bold);
    QFont fontH("Helvetica",16,QFont::Bold);

    //--------------------   HEAD ----------------------//
    lbHead=new QLabel();
    lbHead->setText(tr("Payment Configuration"));
    lbHead->setFont(fontH);
    lbHead->setAlignment(Qt::AlignCenter);
    lbHead->setMinimumHeight(40);
    lbHead->setStyleSheet(HEAD_STYLE);

    lbSeHead=new QLabel();
    lbSeHead->setText(tr("Input Fields Configuration"));
    lbSeHead->setFont(fontH);
    lbSeHead->setAlignment(Qt::AlignCenter);
    lbSeHead->setMinimumHeight(40);
    lbSeHead->setStyleSheet(HEAD_STYLE);

    //--------------------   DEFINE ----------------------//
    lbVendorID=new QLabel();
    lbVendorID->setMinimumWidth(FRAME420_WIDTH-RIGHT_WHITE);
    lbVendorName=new QLabel();
    lbVendorAccNo=new QLabel();
    lbText1=new QLabel();
    lbText2=new QLabel();
    lbText3=new QLabel();
    lbText4=new QLabel();
    lbText5=new QLabel();

    leVendorID=new QLineEdit();
    leVendorName=new QLineEdit();
    leVendorAccNo=new QLineEdit();
    leText1=new QLineEdit();
    leText2=new QLineEdit();
    leText3=new QLineEdit();
    leText4=new QLineEdit();
    leText5=new QLineEdit();

    chkText1=new QCheckBox();
    chkText2=new QCheckBox();
    chkText3=new QCheckBox();
    chkText4=new QCheckBox();
    chkText5=new QCheckBox();

    //--------------------   TEXT ----------------------//
    lbVendorID->setText(tr("Vendor ID:"));
    lbVendorName->setText(tr("Vendor Name:"));
    lbVendorAccNo->setText(tr("Vendor Account No:"));
    lbText1->setText(tr("Text Label Input Field #1:"));
    lbText2->setText(tr("Text Label Input Field #2:"));
    lbText3->setText(tr("Text Label Input Field #3:"));
    lbText4->setText(tr("Text Label Input Field #4:"));
    lbText5->setText(tr("Text Label Input Field #5:"));
    chkText1->setText(tr("Display Input Field #1:"));
    chkText2->setText(tr("Display Input Field #2:"));
    chkText3->setText(tr("Display Input Field #3:"));
    chkText4->setText(tr("Display Input Field #4:"));
    chkText5->setText(tr("Display Input Field #5:"));

    //--------------------   LAYOUT ----------------------//
    QVBoxLayout *v1Lay=new QVBoxLayout();
    v1Lay->addWidget(lbVendorID);
    v1Lay->addWidget(leVendorID);
    v1Lay->addWidget(lbVendorName);
    v1Lay->addWidget(leVendorName);
    v1Lay->addWidget(lbVendorAccNo);
    v1Lay->addWidget(leVendorAccNo);
    v1Lay->addWidget(chkText1);
    v1Lay->addWidget(lbText1);
    v1Lay->addWidget(leText1);
    v1Lay->addWidget(chkText2);
    v1Lay->addWidget(lbText2);
    v1Lay->addWidget(leText2);
    v1Lay->addWidget(chkText3);
    v1Lay->addWidget(lbText3);
    v1Lay->addWidget(leText3);
    v1Lay->addWidget(chkText4);
    v1Lay->addWidget(lbText4);
    v1Lay->addWidget(leText4);
    v1Lay->addWidget(chkText5);
    v1Lay->addWidget(lbText5);
    v1Lay->addWidget(leText5);


    //--------------------   CANCEL & SUBMIT ----------------------//
    btnCancel=new QPushButton();
    btnSubmit=new QPushButton();
    btnCancel->setText(tr("Cancel"));
    btnSubmit->setText(tr("Submit"));
    btnCancel->setFont(font2);
    btnSubmit->setFont(font2);
    btnCancel->setMinimumHeight(30);
    btnSubmit->setMinimumHeight(30);
    btnCancel->setStyleSheet("color: rgb(255, 255, 255);	background-color: rgb(0, 153, 255);border-radius: 6px;");
    btnSubmit->setStyleSheet("color: rgb(0, 0, 0);	background-color: rgb(0, 255, 0);border-radius: 6px;");


    QHBoxLayout *h1Lay=new QHBoxLayout();
    h1Lay->addSpacing(10);
    h1Lay->addWidget(btnCancel);
    h1Lay->addWidget(btnSubmit);
    h1Lay->addSpacing(10);


    // ---------------ScrollArea----------- //
    scArea=new QScrollArea();
    scWidget=new QWidget();
    hBar=new QScrollBar();
    vBar=new QScrollBar();

    QVBoxLayout *scLayout=new QVBoxLayout(scWidget);
    scLayout->addLayout(v1Lay);


    scWidget->setMaximumWidth(FRAME420_WIDTH-5);
    scWidget->setFont(font);
    scWidget->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
    vBar->setStyleSheet("QScrollBar:vertical {"
                        "border:0px solid grey;"
                        "width: 3px;"
                        "}"
                        " QScrollBar::handle:vertical {"
                        " background: #8080FF;"
                        " border: 2px solid grey;"
                        " border-radius:5px;"
                        " min-height: 10px;"
                        " }"
                        " QScrollBar::add-line:vertical {"
                        " height: 0px;"
                        " subcontrol-position: bottom;"
                        " }"
                        " QScrollBar::sub-line:vertical {"
                        " height: 0px;"
                        " subcontrol-position: top;"
                        " }"
                        "QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {"
                        " background: none;"
                        "}"
                        "QScrollArea"
                        "{"
                           "border:0;"
                            "background:rgb(64,64,71);"
                        "}");

    scArea->setVerticalScrollBar(vBar);
    scArea->setHorizontalScrollBar(hBar);
    scArea->setFrameShape(QFrame::NoFrame);
    scArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    scArea->setWidget(scWidget);

//    scArea->ensureVisible(240,320,240,320);

    // ------------------------------------------- //

    QVBoxLayout *layout=new QVBoxLayout(this);
    layout->addWidget(lbHead);
    layout->addWidget(scArea);
    layout->addLayout(h1Lay);
    layout->setContentsMargins(0,0,0,5);

    connect(btnCancel, SIGNAL(clicked()), this, SLOT(close()));

    this->setAutoClose(g_constantParam.TIMEOUT_UI);

}
Ejemplo n.º 25
0
void gpSessionView::InitLayout()
{
    // layout to hold the two main vboxlayouts;
    QHBoxLayout* pMainLayout = new QHBoxLayout;

    QVBoxLayout* pThumbLayout = new QVBoxLayout;
    QVBoxLayout* pImageLayout = new QVBoxLayout;

    // Create the image section
    m_pImageLabel = new QLabel;

    // This pixmap is set so that the label will demand the max size possible
    QPixmap placeHolderPixmap(GP_IMAGE_SECTION_WIDTH, GP_IMAGE_SECTION_WIDTH);
    m_pImageLabel->setPixmap(placeHolderPixmap);

    m_pImageLabel->setMaximumWidth(GP_IMAGE_SECTION_WIDTH);
    m_pImageLabel->setMaximumHeight(GP_IMAGE_SECTION_WIDTH);

    // Create the frame analysis section:
    m_pCurrentFrameCaptionLabel = new QLabel(GPU_STR_dashboard_MainImageCaptionRunning);
    m_pCurrentFrameCaptionLabel->setStyleSheet(AF_STR_captionLabelStyleSheetMain);

    m_pCurrentFrameDetailsLabel = new QLabel;
    QLabel* pPropsHTMLLabelCaption = new QLabel(GPU_STR_dashboard_ExecutionCaption);
    m_pCurrentFrameDetailsLabel->setStyleSheet("font-weight: bold; color: gray; font-size: 15px;");

    pPropsHTMLLabelCaption->setStyleSheet(AF_STR_captionLabelStyleSheetMain);
    m_pPropsHTMLLabel = new QLabel;
    m_pPropsHTMLLabel->setTextFormat(Qt::RichText);

    QFrame* pImageFrameWidget = new QFrame;
    QPalette p = pImageFrameWidget->palette();
    p.setColor(backgroundRole(), Qt::white);
    p.setColor(QPalette::Base, Qt::white);
    p.setColor(QPalette::Shadow, Qt::red);
    pImageFrameWidget->setAutoFillBackground(true);
    pImageFrameWidget->setPalette(p);
    pImageFrameWidget->setLineWidth(1);
    pImageFrameWidget->setMidLineWidth(1);
    pImageFrameWidget->setFrameStyle(QFrame::Panel | QFrame::Raised);


    QVBoxLayout* pImageFrameLayout = new QVBoxLayout;
    m_pCurrentFrameDetailsLabel->setContentsMargins(0, 0, 0, 0);

    pImageFrameLayout->addWidget(m_pCurrentFrameDetailsLabel, 0, Qt::AlignCenter);
    pImageFrameLayout->addWidget(m_pImageLabel, 0, Qt::AlignCenter);
    pImageFrameWidget->setLayout(pImageFrameLayout);

    pImageLayout->addWidget(m_pCurrentFrameCaptionLabel);
    pImageLayout->addSpacing(4);
    pImageLayout->addWidget(pImageFrameWidget);
    pImageLayout->addStretch();
    pImageLayout->addWidget(pPropsHTMLLabelCaption);
    pImageLayout->addWidget(m_pPropsHTMLLabel);

    FillExecutionDetails();

    // Create the frame analysis section:
    m_pCapturedFramesCaptionLabel = new QLabel(GPU_STR_dashboard_CapturedFramesCaption);
    m_pCapturedFramesCaptionLabel->setStyleSheet(AF_STR_captionLabelStyleSheetMain);

#define GP_SessionViewButtonStyle "QToolButton { border: 1px solid transparent; background-color: transparent; font-weight: bold; color: gray; }" \
    "QToolButton:hover { border: 1px solid gray; background-color: #CDE6F7; color: black;}"

    QHBoxLayout* pButtonsLayout = new QHBoxLayout;
    pButtonsLayout->addStretch();

    m_pCaptureButton = new QToolButton;
    m_pCaptureButton->setText(GPU_STR_dashboard_CaptureButton);
    m_pCaptureButton->setStyleSheet(GP_SessionViewButtonStyle);
    m_pCaptureButton->setToolTip(GPU_STR_dashboard_CaptureTooltip);

    m_pStopButton = new QToolButton;
    m_pStopButton->setStyleSheet(GP_SessionViewButtonStyle);
    m_pStopButton->setText(GPU_STR_dashboard_StopButton);
    m_pStopButton->setToolTip(GPU_STR_dashboard_StopTooltip);

    m_pOpenTimelineButton = new QToolButton;
    m_pOpenTimelineButton->setStyleSheet(GP_SessionViewButtonStyle);
    m_pOpenTimelineButton->setText(GPU_STR_dashboard_OpenTimelineButton);
    m_pOpenTimelineButton->setToolTip(GPU_STR_dashboard_OpenTimelineTooltip);

    bool rc = connect(m_pCaptureButton, SIGNAL(clicked()), this, SLOT(OnCaptureButtonClick()));
    GT_ASSERT(rc);

    rc = connect(m_pStopButton, SIGNAL(clicked()), this, SLOT(OnStopButtonClick()));
    GT_ASSERT(rc);

    rc = connect(m_pOpenTimelineButton, SIGNAL(clicked()), this, SLOT(OnOpenTimelineButtonClick()));
    GT_ASSERT(rc);

    QPixmap captureButtonIcon;
    acIconSize largerButtonIcon = acGetScaledIconSize(AC_32x32_ICON);
    int iconDim = acIconSizeToPixelSize(largerButtonIcon);
    QSize iconSize(iconDim, iconDim);
    acSetIconInPixmap(captureButtonIcon, AC_ICON_EXECUTION_CAPTURE, largerButtonIcon);
    m_pCaptureButton->setIcon(captureButtonIcon);
    m_pCaptureButton->setIconSize(iconSize);
    m_pCaptureButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    m_pCaptureButton->setFixedWidth(acScalePixelSizeToDisplayDPI(GP_SESSION_VIEW_BUTTON_SIZE));

    QPixmap stopButtonIcon;
    acSetIconInPixmap(stopButtonIcon, AC_ICON_EXECUTION_STOP, largerButtonIcon);
    m_pStopButton->setIcon(stopButtonIcon);
    m_pStopButton->setIconSize(iconSize);
    m_pStopButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    m_pStopButton->setFixedWidth(acScalePixelSizeToDisplayDPI(GP_SESSION_VIEW_BUTTON_SIZE));

    QPixmap openTimelineButtonIcon;
    acSetIconInPixmap(openTimelineButtonIcon, AC_ICON_FRAME_ANALYSIS_APP_TREE_TIMELINE, largerButtonIcon);
    m_pOpenTimelineButton->setIcon(openTimelineButtonIcon);
    m_pOpenTimelineButton->setIconSize(iconSize);
    m_pOpenTimelineButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    m_pOpenTimelineButton->setFixedWidth(acScalePixelSizeToDisplayDPI(GP_SESSION_VIEW_BUTTON_SIZE));

#if AMDT_BUILD_CONFIGURATION == AMDT_DEBUG_BUILD
    m_pSimulateUserCaptureButton = new QToolButton;
    m_pSimulateUserCaptureButton->setText("Capture Simulate");
    QImage captureInv(captureButtonIcon.toImage());
    captureInv.invertPixels(QImage::InvertRgb);
    m_pSimulateUserCaptureButton->setIcon(QPixmap::fromImage(captureInv));
    m_pSimulateUserCaptureButton->setIconSize(iconSize);
    m_pSimulateUserCaptureButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    m_pSimulateUserCaptureButton->setStyleSheet(GP_SessionViewButtonStyle);
    rc = connect(m_pSimulateUserCaptureButton, SIGNAL(clicked()), this, SLOT(OnSimulateCaptureButtonClick()));
    GT_ASSERT(rc);
    // pButtonsLayout->addWidget(m_pSimulateUserCaptureButton);
#endif

    pButtonsLayout->addWidget(m_pCaptureButton);
    pButtonsLayout->addWidget(m_pStopButton);
    pButtonsLayout->addWidget(m_pOpenTimelineButton);
    pButtonsLayout->addStretch();
    pImageFrameLayout->addLayout(pButtonsLayout, Qt::AlignCenter | Qt::AlignVCenter);
    pImageFrameLayout->addStretch();

    // Initialize and fill the thumbnail view
    m_pSnapshotsThumbView = new acThumbnailView;
    m_pSnapshotsThumbView->SetItemTooltip(GPU_STR_dashboard_ItemTooltip);

    rc = connect(m_pSnapshotsThumbView, SIGNAL(ItemDoubleClicked(const QVariant&)), this, SLOT(OnItemDoubleClicked(const QVariant&)));
    GT_ASSERT(rc);
    rc = connect(m_pSnapshotsThumbView, SIGNAL(ItemPressed(const QVariant&)), this, SLOT(OnItemPressed(const QVariant&)));
    GT_ASSERT(rc);

    pThumbLayout->addWidget(m_pCapturedFramesCaptionLabel);
    pThumbLayout->addWidget(m_pSnapshotsThumbView, Qt::AlignLeft);

    QWidget* pLeftWidget = new QWidget;
    QWidget* pRightWidget = new QWidget;
    pLeftWidget->setLayout(pImageLayout);
    pRightWidget->setLayout(pThumbLayout);
    pLeftWidget->setMinimumWidth(200);
    pRightWidget->setMinimumWidth(200);

    pMainLayout->addWidget(pLeftWidget, 0);
    pMainLayout->addWidget(pRightWidget, 1);

    setLayout(pMainLayout);
}
dynProcControlDialog::dynProcControlDialog(
					dynProcControls * _controls ) :
	EffectControlDialog( _controls )
{
	setAutoFillBackground( true );
	QPalette pal;
	pal.setBrush( backgroundRole(),
				PLUGIN_NAME::getIconPixmap( "artwork" ) );
	setPalette( pal );
	setFixedSize( 224, 340 );

	graph * waveGraph = new graph( this, graph::LinearNonCyclicStyle, 204, 205 );
	waveGraph -> move( 10, 32 );
	waveGraph -> setModel( &_controls -> m_wavegraphModel );
	waveGraph -> setAutoFillBackground( true );
	pal = QPalette();
	pal.setBrush( backgroundRole(),
			PLUGIN_NAME::getIconPixmap("wavegraph") );
	waveGraph->setPalette( pal );
	waveGraph->setGraphColor( QColor( 170, 255, 255 ) );
	waveGraph -> setMaximumSize( 204, 205 );

	knob * inputKnob = new knob( knobBright_26, this);
	inputKnob -> setVolumeKnob( true );
	inputKnob -> setVolumeRatio( 1.0 );
	inputKnob -> move( 14, 251 );
	inputKnob->setModel( &_controls->m_inputModel );
	inputKnob->setLabel( tr( "INPUT" ) );
	inputKnob->setHintText( tr( "Input gain:" ) + " ", "" );

	knob * outputKnob = new knob( knobBright_26, this );
	outputKnob -> setVolumeKnob( true );
	outputKnob -> setVolumeRatio( 1.0 );
	outputKnob -> move( 54, 251 );
	outputKnob->setModel( &_controls->m_outputModel );
	outputKnob->setLabel( tr( "OUTPUT" ) );
	outputKnob->setHintText( tr( "Output gain:" ) + " ", "" );
	
	knob * attackKnob = new knob( knobBright_26, this);
	attackKnob -> move( 11, 291 );
	attackKnob->setModel( &_controls->m_attackModel );
	attackKnob->setLabel( tr( "ATTACK" ) );
	attackKnob->setHintText( tr( "Peak attack time:" ) + " ", "ms" );

	knob * releaseKnob = new knob( knobBright_26, this );
	releaseKnob -> move( 52, 291 );
	releaseKnob->setModel( &_controls->m_releaseModel );
	releaseKnob->setLabel( tr( "RELEASE" ) );
	releaseKnob->setHintText( tr( "Peak release time:" ) + " ", "ms" );

//waveform control buttons

	pixmapButton * resetButton = new pixmapButton( this, tr("Reset waveform") );
	resetButton -> move( 164, 251 );
	resetButton -> resize( 12, 48 );
	resetButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "reset_active" ) );
	resetButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "reset_inactive" ) );
	toolTip::add( resetButton, tr( "Click here to reset the wavegraph back to default" ) );

	pixmapButton * smoothButton = new pixmapButton( this, tr("Smooth waveform") );
	smoothButton -> move( 164, 267 );
	smoothButton -> resize( 12, 48 );
	smoothButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "smooth_active" ) );
	smoothButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "smooth_inactive" ) );
	toolTip::add( smoothButton, tr( "Click here to apply smoothing to wavegraph" ) );

	pixmapButton * addOneButton = new pixmapButton( this, tr("Increase wavegraph amplitude by 1dB") );
	addOneButton -> move( 133, 251 );
	addOneButton -> resize( 12, 29 );
	addOneButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "add1_active" ) );
	addOneButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "add1_inactive" ) );
	toolTip::add( addOneButton, tr( "Click here to increase wavegraph amplitude by 1dB" ) );

	pixmapButton * subOneButton = new pixmapButton( this, tr("Decrease wavegraph amplitude by 1dB") );
	subOneButton -> move( 133, 267 );
	subOneButton -> resize( 12, 29 );
	subOneButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "sub1_active" ) );
	subOneButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "sub1_inactive" ) );
	toolTip::add( subOneButton, tr( "Click here to decrease wavegraph amplitude by 1dB" ) );

//stereomode switches
	pixmapButton * smMaxButton = new pixmapButton( this, tr( "Stereomode Maximum" ) );
	smMaxButton -> move( 165, 290 );
	smMaxButton -> resize( 48, 13 );
	smMaxButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "max_active" ) );
	smMaxButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "max_inactive" ) );
	toolTip::add( smMaxButton, tr( "Process based on the maximum of both stereo channels" ) );
	
	pixmapButton * smAvgButton = new pixmapButton( this, tr( "Stereomode Average" ) );
	smAvgButton -> move( 165, 290 + 13 );
	smAvgButton -> resize( 48, 13 );
	smAvgButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "avg_active" ) );
	smAvgButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "avg_inactive" ) );
	toolTip::add( smAvgButton, tr( "Process based on the average of both stereo channels" ) );

	pixmapButton * smUnlButton = new pixmapButton( this, tr( "Stereomode Unlinked" ) );
	smUnlButton -> move( 165, 290 + (13*2) );
	smUnlButton -> resize( 48, 13 );
	smUnlButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "unl_active" ) );
	smUnlButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "unl_inactive" ) );
	toolTip::add( smUnlButton, tr( "Process each stereo channel independently" ) );
	
	automatableButtonGroup * smGroup = new automatableButtonGroup( this );
	smGroup -> addButton( smMaxButton );
	smGroup -> addButton( smAvgButton );
	smGroup -> addButton( smUnlButton );
	smGroup -> setModel( &_controls -> m_stereomodeModel );

	connect( resetButton, SIGNAL (clicked () ),
			_controls, SLOT ( resetClicked() ) );
	connect( smoothButton, SIGNAL (clicked () ),
			_controls, SLOT ( smoothClicked() ) );
	connect( addOneButton, SIGNAL( clicked() ),
			_controls, SLOT( addOneClicked() ) );
	connect( subOneButton, SIGNAL( clicked() ),
			_controls, SLOT( subOneClicked() ) );
}
Ejemplo n.º 27
0
void ArthurFrame::paintEvent(QPaintEvent *e)
{
    static QImage *static_image = 0;
    QPainter painter;
    if (preferImage()
#ifdef QT_OPENGL_SUPPORT
        && !m_use_opengl
#endif
        ) {
        if (!static_image || static_image->size() != size()) {
            delete static_image;
            static_image = new QImage(size(), QImage::Format_RGB32);
        }
        painter.begin(static_image);

        int o = 10;

        QBrush bg = palette().brush(QPalette::Background);
        painter.fillRect(0, 0, o, o, bg);
        painter.fillRect(width() - o, 0, o, o, bg);
        painter.fillRect(0, height() - o, o, o, bg);
        painter.fillRect(width() - o, height() - o, o, o, bg);
    } else {
#ifdef QT_OPENGL_SUPPORT
        if (m_use_opengl) {
            painter.begin(glw);
            painter.fillRect(QRectF(0, 0, glw->width(), glw->height()), palette().color(backgroundRole()));
        } else {
            painter.begin(this);
        }
#else
        painter.begin(this);
#endif
    }

    painter.setClipRect(e->rect());

    painter.setRenderHint(QPainter::Antialiasing);

    QPainterPath clipPath;

    QRect r = rect();
    qreal left = r.x() + 1;
    qreal top = r.y() + 1;
    qreal right = r.right();
    qreal bottom = r.bottom();
    qreal radius2 = 8 * 2;

    clipPath.moveTo(right - radius2, top);
    clipPath.arcTo(right - radius2, top, radius2, radius2, 90, -90);
    clipPath.arcTo(right - radius2, bottom - radius2, radius2, radius2, 0, -90);
    clipPath.arcTo(left, bottom - radius2, radius2, radius2, 270, -90);
    clipPath.arcTo(left, top, radius2, radius2, 180, -90);
    clipPath.closeSubpath();

    painter.save();
    painter.setClipPath(clipPath, Qt::IntersectClip);

    painter.drawTiledPixmap(rect(), m_tile);

    // client painting

    paint(&painter);

    painter.restore();

    painter.save();
    if (m_show_doc)
        paintDescription(&painter);
    painter.restore();

    int level = 180;
    painter.setPen(QPen(QColor(level, level, level), 2));
    painter.setBrush(Qt::NoBrush);
    painter.drawPath(clipPath);

    if (preferImage()
#ifdef QT_OPENGL_SUPPORT
        && !m_use_opengl
#endif
        ) {
        painter.end();
        painter.begin(this);
        painter.drawImage(e->rect(), *static_image, e->rect());
    }

#ifdef QT_OPENGL_SUPPORT
    if (m_use_opengl && (inherits("PathDeformRenderer") || inherits("PathStrokeRenderer") || inherits("CompositionRenderer") || m_show_doc))
        glw->swapBuffers();
#endif
}
Ejemplo n.º 28
0
void DDateTable::paintCell(QPainter* painter, int row, int col)
{
    double w    = (width() / (double) d->numDayColumns) - 1;
    double h    = (height() / (double) d->numWeekRows) - 1;
    QRectF cell = QRectF(0, 0, w, h);
    QString cellText;
    QPen pen;
    QColor cellBackgroundColor, cellTextColor;
    QFont cellFont  = QFontDatabase::systemFont(QFontDatabase::GeneralFont);
    bool workingDay = false;
    int cellWeekDay, pos;

    //Calculate the position of the cell in the grid
    pos = d->numDayColumns * (row - 1) + col;

    //Calculate what day of the week the cell is
    if (col + locale().firstDayOfWeek() <= d->numDayColumns)
    {
        cellWeekDay = col + locale().firstDayOfWeek();
    }
    else
    {
        cellWeekDay = col + locale().firstDayOfWeek() - d->numDayColumns;
    }

    //FIXME This is wrong if the widget is not using the global!
    //See if cell day is normally a working day
    if (locale().weekdays().first() <= locale().weekdays().last())
    {
        if (cellWeekDay >= locale().weekdays().first() &&
            cellWeekDay <= locale().weekdays().last())
        {
            workingDay = true;
        }
    }
    else
    {
        if (cellWeekDay >= locale().weekdays().first() ||
            cellWeekDay <= locale().weekdays().last())
        {
            workingDay = true;
        }
    }

    if (row == 0)
    {
        //We are drawing a header cell

        //If not a normal working day, then use "do not work today" color
        if (workingDay)
        {
            cellTextColor = palette().color(QPalette::WindowText);
        }
        else
        {
            cellTextColor = Qt::darkRed;
        }

        cellBackgroundColor = palette().color(QPalette::Window);

        //Set the text to the short day name and bold it
        cellFont.setBold(true);
        cellText = locale().dayName(cellWeekDay, QLocale::ShortFormat);

    }
    else
    {
        //We are drawing a day cell

        //Calculate the date the cell represents
        QDate cellDate = dateFromPos(pos);
        bool validDay  = cellDate.isValid();

        // Draw the day number in the cell, if the date is not valid then we don't want to show it
        if (validDay)
        {
            cellText = QString::number(cellDate.day());
        }
        else
        {
            cellText = QLatin1String("");
        }

        if (! validDay || cellDate.month() != d->date.month())
        {
            // we are either
            // ° painting an invalid day
            // ° painting a day of the previous month or
            // ° painting a day of the following month or
            cellBackgroundColor = palette().color(backgroundRole());
            cellTextColor       = palette().color(QPalette::Disabled, QPalette::Text);
        }
        else
        {
            //Paint a day of the current month

            // Background Colour priorities will be (high-to-low):
            // * Selected Day Background Colour
            // * Customized Day Background Colour
            // * Normal Day Background Colour

            // Background Shape priorities will be (high-to-low):
            // * Customized Day Shape
            // * Normal Day Shape

            // Text Colour priorities will be (high-to-low):
            // * Customized Day Colour
            // * Day of Pray Colour (Red letter)
            // * Selected Day Colour
            // * Normal Day Colour

            //Determine various characteristics of the cell date
            bool selectedDay = (cellDate == date());
            bool currentDay  = (cellDate == QDate::currentDate());
            bool dayOfPray   = (cellDate.dayOfWeek() == Qt::Sunday);
            // TODO: Uncomment if QLocale ever gets the feature...
            //bool dayOfPray = ( cellDate.dayOfWeek() == locale().dayOfPray() );
            bool customDay   = (d->useCustomColors && d->customPaintingModes.contains(cellDate.toJulianDay()));

            //Default values for a normal cell
            cellBackgroundColor = palette().color(backgroundRole());
            cellTextColor = palette().color(foregroundRole());

            // If we are drawing the current date, then draw it bold and active
            if (currentDay)
            {
                cellFont.setBold(true);
                cellTextColor = palette().color(QPalette::LinkVisited);
            }

            // if we are drawing the day cell currently selected in the table
            if (selectedDay)
            {
                // set the background to highlighted
                cellBackgroundColor = palette().color(QPalette::Highlight);
                cellTextColor = palette().color(QPalette::HighlightedText);
            }

            //If custom colors or shape are required for this date
            if (customDay)
            {
                Private::DatePaintingMode mode = d->customPaintingModes[cellDate.toJulianDay()];

                if (mode.bgMode != NoBgMode)
                {
                    if (!selectedDay)
                    {
                        cellBackgroundColor = mode.bgColor;
                    }
                }

                cellTextColor = mode.fgColor;
            }

            //If the cell day is the day of religious observance, then always color text red unless Custom overrides
            if (! customDay && dayOfPray)
            {
                cellTextColor = Qt::darkRed;
            }

        }
    }

    //Draw the background
    if (row == 0)
    {
        painter->setPen(cellBackgroundColor);
        painter->setBrush(cellBackgroundColor);
        painter->drawRect(cell);
    }
    else if (cellBackgroundColor != palette().color(backgroundRole()) || pos == d->hoveredPos)
    {
        QStyleOptionViewItem opt;
        opt.initFrom(this);
        opt.rect = cell.toRect();

        if (cellBackgroundColor != palette().color(backgroundRole()))
        {
            opt.palette.setBrush(QPalette::Highlight, cellBackgroundColor);
            opt.state |= QStyle::State_Selected;
        }

        if (pos == d->hoveredPos && opt.state & QStyle::State_Enabled)
        {
            opt.state |= QStyle::State_MouseOver;
        }
        else
        {
            opt.state &= ~QStyle::State_MouseOver;
        }

        opt.showDecorationSelected = true;
        opt.viewItemPosition       = QStyleOptionViewItem::OnlyOne;
        style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, this);
    }

    //Draw the text
    painter->setPen(cellTextColor);
    painter->setFont(cellFont);
    painter->drawText(cell, Qt::AlignCenter, cellText, &cell);

    //Draw the base line
    if (row == 0)
    {
        painter->setPen(palette().color(foregroundRole()));
        painter->drawLine(QPointF(0, h), QPointF(w, h));
    }

    // If the day cell we just drew is bigger than the current max cell sizes,
    // then adjust the max to the current cell
    if (cell.width() > d->maxCell.width())
    {
        d->maxCell.setWidth(cell.width());
    }

    if (cell.height() > d->maxCell.height())
    {
        d->maxCell.setHeight(cell.height());
    }
}
Ejemplo n.º 29
0
KNewStuff2Download::KNewStuff2Download()
    : QWidget()
{
    m_engine = NULL;
    m_activefeed = NULL;
    m_activeentry = NULL;

    resize(800, 600);
    setWindowTitle("KNewStuff2 Download Dialog Test");

    QPushButton *installbutton = new QPushButton("Install");
    connect(installbutton, SIGNAL(clicked()), SLOT(slotInstall()));

    QPushButton *closebutton = new QPushButton("Close");
    connect(closebutton, SIGNAL(clicked()), SLOT(close()));

    m_providerlist = new QListWidget();
    m_providerlist->setFixedWidth(200);

    m_feeds = new QTabWidget();

#if 0
    frame = new QFrame(this);
    frame->setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
    QPalette palette = this->palette();
    palette.setColor(backgroundRole(), palette.color(QPalette::Base));
    frame->setPalette(palette);
    frame->setLineWidth(1);
    frame->setMidLineWidth(0);

    recentButton = new KNSButton(frame);
    recentButton->setIcon(QIcon::fromTheme("alarmclock"));
    recentButton->setText("Most recent");

    estimatedButton = new KNSButton(frame);
    estimatedButton->setIcon(QIcon::fromTheme("favorites"));
    estimatedButton->setText("Most estimated");

    wantedButton = new KNSButton(frame);
    wantedButton->setIcon(QIcon::fromTheme("kget"));
    wantedButton->setText("Most wanted");

    connect(recentButton, SIGNAL(toggled(bool)), this, SLOT(buttonToggled(bool)));
    connect(estimatedButton, SIGNAL(toggled(bool)), this, SLOT(buttonToggled(bool)));
    connect(wantedButton, SIGNAL(toggled(bool)), this, SLOT(buttonToggled(bool)));

    frame->setMinimumHeight(40);
    recentButton->setChecked(true);
#endif

    QHBoxLayout *hbox = new QHBoxLayout();
    hbox->addWidget(m_providerlist);
    hbox->addWidget(m_feeds);

    QVBoxLayout *vbox = new QVBoxLayout();
    setLayout(vbox);
    vbox->addLayout(hbox);
    vbox->addWidget(installbutton);
    vbox->addWidget(closebutton);

    show();
}
Ejemplo n.º 30
0
PopupView::PopupView(const QModelIndex &index, const QPoint &pos,
                     const bool &showPreview, const QStringList &previewPlugins,
                     const IconView *parentView)
    : QWidget(0, Qt::X11BypassWindowManagerHint),
      m_view(0),
      m_parentView(parentView),
      m_busyWidget(0),
      m_iconView(0),
      m_parentViewModel(0),
      m_dirModel(0),
      m_model(0),
      m_actionCollection(this),
      m_newMenu(0),
      m_itemActions(0),
      m_showingMenu(false),
      m_showPreview(showPreview),
      m_delayedClose(false),
      m_previewPlugins(previewPlugins)
{
    setAttribute(Qt::WA_TranslucentBackground);
#ifdef Q_WS_X11
    if (KWindowSystem::compositingActive()) {
        setAttribute(Qt::WA_NoSystemBackground, false);
    }
#endif

#ifdef Q_WS_WIN
    setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Tool);
#endif

    KWindowSystem::setState(effectiveWinId(), NET::SkipTaskbar | NET::SkipPager);

    setAcceptDrops(true);

    QPalette pal = palette();
    pal.setColor(backgroundRole(), Qt::transparent);
    pal.setColor(QPalette::Text, Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
    setPalette(pal);

    m_parentViewModel = static_cast<const ProxyModel*>(index.model());

    KFileItem item = m_parentViewModel->itemForIndex(index);
    if (item.isDesktopFile()) {
        KDesktopFile file(item.localPath());
        m_url = file.readUrl();
    } else {
        m_url = item.targetUrl();
    }

    m_background = new Plasma::FrameSvg(this);
    m_background->setImagePath("dialogs/background");

    int left   = m_background->marginSize(Plasma::LeftMargin);
    int top    = m_background->marginSize(Plasma::TopMargin);
    int right  = m_background->marginSize(Plasma::RightMargin);
    int bottom = m_background->marginSize(Plasma::BottomMargin);

    setContentsMargins(left, top, right, bottom);

    resize(parentView->sizeForRowsColumns(2, 3) + QSize(left + right, top + bottom));

    const QRect available = QApplication::desktop()->availableGeometry(pos);
    QPoint pt = pos;

    if (pt.x() + width() > available.right()) {
        pt.rx() -= width();
    }
    if (pt.x() < available.left()) {
        pt.rx() = available.left();
    }

    if (pt.y() + height() > available.bottom()) {
        pt.ry() -= height();
    }
    if (pt.y() < available.top()) {
        pt.ry() = available.top();
    }

    Plasma::WindowEffects::overrideShadow(winId(), true);

    move(pt);
    show();

    QTimer::singleShot(10, this, SLOT(init()));
    s_lastOpenClose.restart();
}