// Implementation of the QTreeLegendDialog class.
#include "qtreelegenddialog.h"
QTreeLegendDialog::QTreeLegendDialog( QWidget* parent )
: QDialog( parent ), ok( NULL )
{
setCaption( "P4QTree Legend" );
mainlayout = new QVBoxLayout( this, 5, 10 );
// "Integration Action" groupbox
colorbox = new QGroupBox( 1, Horizontal, "Integration Action", this );
collabelb = new QLabel( "\t\t\tbranch", colorbox );
collabelc = new QLabel( "\t\t\tcopy ", colorbox );
collabelm = new QLabel( "\t\t\tmerge ", colorbox );
collabeli = new QLabel( "\t\t\tignore", colorbox );
collabele = new QLabel( "\t\t\tedited", colorbox );
mainlayout->addWidget( colorbox );
// "Contribution" groupbox
weightbox = new QGroupBox( 1, Horizontal, "Contribution", this );
weightlabel1 = new QLabel( "\t\t\tall ", weightbox );
weightlabel2 = new QLabel( "\t\t\tsome ", weightbox );
weightlabel3 = new QLabel( "\t\t\tnone ", weightbox );
mainlayout->addWidget( weightbox );
// Functionality blurb
QString blurb;
blurb += "Double-click items for extra info.\n";
blurb += "Drag and drop revs to display diffs.";
blurblabel = new QLabel( blurb, this );
mainlayout->addWidget( blurblabel );
// Ok button
bottomlayout = new QHBoxLayout( mainlayout );
bottomlayout->addStretch( -1 );
ok = new QPushButton( "OK", this );
bottomlayout->addWidget( ok );
bottomlayout->addStretch( -1 );
connect( ok, SIGNAL( clicked() ), this, SLOT( accept() ) );
ok->setAutoDefault( TRUE );
ok->setFocus();
setFixedSize( sizeHint() );
}
QTreeLegendDialog::~QTreeLegendDialog()
{
}
void QTreeLegendDialog::paintEvent( QPaintEvent* e )
{
QPainter p;
p.begin( collabelb );
p.setPen( QPen ( QColor( TREE_COLARROWB ), TREE_ARRWIDTH, SolidLine ) );
p.drawLine( 0, collabelb->height()/2, 100, collabelb->height()/2 );
p.end();
p.begin( collabelc );
p.setPen( QPen ( QColor( TREE_COLARROWC ), TREE_ARRWIDTH, SolidLine ) );
p.drawLine( 0, collabelc->height()/2, 100, collabelc->height()/2 );
p.end();
p.begin( collabele );
p.setPen( QPen ( QColor( TREE_COLARROWE ), TREE_ARRWIDTH, SolidLine ) );
p.drawLine( 0, collabele->height()/2, 100, collabele->height()/2 );
p.end();
p.begin( collabeli );
p.setPen( QPen ( QColor( TREE_COLARROWI), TREE_ARRWIDTH, SolidLine ) );
p.drawLine( 0, collabeli->height()/2, 100, collabeli->height()/2 );
p.end();
p.begin( collabelm );
p.setPen( QPen ( QColor( TREE_COLARROWM ), TREE_ARRWIDTH, SolidLine ) );
p.drawLine( 0, collabelm->height()/2, 100, collabelm->height()/2 );
p.end();
p.begin( weightlabel1 );
p.setPen( QPen ( QColor( "black" ), TREE_ARRWIDTH*3/3, SolidLine ) );
p.drawLine( 0, collabelm->height()/2, 100, collabelm->height()/2 );
p.end();
p.begin( weightlabel2 );
p.setPen( QPen ( QColor( "black" ), TREE_ARRWIDTH*2/3, SolidLine ) );
p.drawLine( 0, collabelm->height()/2, 100, collabelm->height()/2 );
p.end();
p.begin( weightlabel3 );
p.setPen( QPen ( QColor( "black" ), TREE_ARRWIDTH*1/3, DashLine ) );
p.drawLine( 0, collabelm->height()/2, 100, collabelm->height()/2 );
p.end();
}