CvsProcessWidget::CvsProcessWidget( CvsService_stub *service, CvsServicePart *part, QWidget *parent, const char *name )
    : DCOPObject( "CvsProcessWidgetDCOPIface" ),
    QTextEdit( parent, name ),
	m_part( part ), m_service( service ), m_job( 0 )
{
    setReadOnly( true );
    setTextFormat( Qt::LogText );

    QStyleSheetItem *style = 0;
    style = new QStyleSheetItem( styleSheet(), "goodtag" );
    style->setColor( "black" );

    style = new QStyleSheetItem( styleSheet(), "errortag" );
    style->setColor( "red" );
    style->setFontWeight( QFont::Bold );

    style = new QStyleSheetItem( styleSheet(), "infotag" );
    style->setColor( "blue" );

    style = new QStyleSheetItem( styleSheet(), "cvs_conflict" );
    style->setColor( "red" );

    style = new QStyleSheetItem( styleSheet(), "cvs_added" );
    style->setColor( "green" );

    style = new QStyleSheetItem( styleSheet(), "cvs_removed" );
    style->setColor( "yellow" );

    style = new QStyleSheetItem( styleSheet(), "cvs_updated" );
    style->setColor( "lightblue" );

    style = new QStyleSheetItem( styleSheet(), "cvs_modified" );
    style->setColor( "darkgreen" );

    style = new QStyleSheetItem( styleSheet(), "cvs_unknown" );
    style->setColor( "gray" );
}
Beispiel #2
0
void CSSConfig::slotPreview()
{

  QStyleSheetItem *h1 = new QStyleSheetItem(QStyleSheet::defaultSheet(), "h1");
  QStyleSheetItem *h2 = new QStyleSheetItem(QStyleSheet::defaultSheet(), "h2");
  QStyleSheetItem *h3 = new QStyleSheetItem(QStyleSheet::defaultSheet(), "h3");
  QStyleSheetItem *text = new QStyleSheetItem(QStyleSheet::defaultSheet(), "p");

  // Fontsize

  int bfs = customDialog->basefontsize->currentText().toInt();
  text->setFontSize(bfs);
  if (customDialog->dontScale->isChecked())
    {
      h1->setFontSize(bfs);
      h2->setFontSize(bfs);
      h3->setFontSize(bfs);
    }
  else
    {
      h1->setFontSize(static_cast<int>(bfs * 1.8));
      h2->setFontSize(static_cast<int>(bfs * 1.6));
      h3->setFontSize(static_cast<int>(bfs * 1.4));
    }

  // Colors

  QColor back, fore;

  if (customDialog->blackOnWhite->isChecked())
    {
      back = Qt::white;
      fore = Qt::black;
    }
  else if (customDialog->whiteOnBlack->isChecked())
    {
      back = Qt::black;
      fore = Qt::white;
    }
  else
    {
      back = customDialog->backgroundColor->color();
      fore = customDialog->foregroundColor->color();
    }

  h1->setColor(fore);
  h2->setColor(fore);
  h3->setColor(fore);
  text->setColor(fore);

  // Fonts

  h1->setFontFamily(customDialog->fontFamily->currentText());
  h2->setFontFamily(customDialog->fontFamily->currentText());
  h3->setFontFamily(customDialog->fontFamily->currentText());
  text->setFontFamily(customDialog->fontFamily->currentText());

  // Show the preview
  PreviewDialog *dlg = new PreviewDialog(this, 0, true);
  dlg->preview->setPaper(back);
  dlg->preview->viewport()->setFont(QFont(KGlobalSettings::generalFont().family(), bfs));

  dlg->exec();

  delete dlg;
}