00001 #include <kdialog.h>
00002 #include <klocale.h>
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "diffdialogbase.h"
00013
00014 #include <qvariant.h>
00015 #include <qpushbutton.h>
00016 #include <qbuttongroup.h>
00017 #include <qradiobutton.h>
00018 #include <qlineedit.h>
00019 #include <qlabel.h>
00020 #include <qframe.h>
00021 #include <qlayout.h>
00022 #include <qtooltip.h>
00023 #include <qwhatsthis.h>
00024
00025
00026
00027
00028
00029
00030
00031
00032 DiffDialogBase::DiffDialogBase( QWidget* parent, const char* name, bool modal, WFlags fl )
00033 : QDialog( parent, name, modal, fl )
00034 {
00035 if ( !name )
00036 setName( "DiffDialog" );
00037 setSizeGripEnabled( TRUE );
00038 DiffDialogLayout = new QVBoxLayout( this, 11, 6, "DiffDialogLayout");
00039
00040 buttonGroup1 = new QButtonGroup( this, "buttonGroup1" );
00041 buttonGroup1->setColumnLayout(0, Qt::Vertical );
00042 buttonGroup1->layout()->setSpacing( 6 );
00043 buttonGroup1->layout()->setMargin( 11 );
00044 buttonGroup1Layout = new QVBoxLayout( buttonGroup1->layout() );
00045 buttonGroup1Layout->setAlignment( Qt::AlignTop );
00046
00047 diffLocalHeadRadio = new QRadioButton( buttonGroup1, "diffLocalHeadRadio" );
00048 diffLocalHeadRadio->setChecked( TRUE );
00049 buttonGroup1Layout->addWidget( diffLocalHeadRadio );
00050
00051 diffLocalBaseRadio = new QRadioButton( buttonGroup1, "diffLocalBaseRadio" );
00052 diffLocalBaseRadio->setChecked( FALSE );
00053 buttonGroup1Layout->addWidget( diffLocalBaseRadio );
00054
00055 layout3 = new QHBoxLayout( 0, 0, 6, "layout3");
00056
00057 diffLocalOtherRadio = new QRadioButton( buttonGroup1, "diffLocalOtherRadio" );
00058 layout3->addWidget( diffLocalOtherRadio );
00059
00060 revOtherEdit = new QLineEdit( buttonGroup1, "revOtherEdit" );
00061 revOtherEdit->setEnabled( FALSE );
00062 layout3->addWidget( revOtherEdit );
00063 buttonGroup1Layout->addLayout( layout3 );
00064
00065 diffArbitraryRevRadio = new QRadioButton( buttonGroup1, "diffArbitraryRevRadio" );
00066 buttonGroup1Layout->addWidget( diffArbitraryRevRadio );
00067
00068 layout3_2 = new QGridLayout( 0, 1, 1, 0, 6, "layout3_2");
00069
00070 textLabel1 = new QLabel( buttonGroup1, "textLabel1" );
00071 textLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, textLabel1->sizePolicy().hasHeightForWidth() ) );
00072
00073 layout3_2->addWidget( textLabel1, 0, 0 );
00074
00075 revbEdit = new QLineEdit( buttonGroup1, "revbEdit" );
00076 revbEdit->setEnabled( FALSE );
00077
00078 layout3_2->addWidget( revbEdit, 1, 1 );
00079
00080 revaEdit = new QLineEdit( buttonGroup1, "revaEdit" );
00081 revaEdit->setEnabled( FALSE );
00082
00083 layout3_2->addWidget( revaEdit, 1, 0 );
00084
00085 textLabel2 = new QLabel( buttonGroup1, "textLabel2" );
00086 textLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, textLabel2->sizePolicy().hasHeightForWidth() ) );
00087
00088 layout3_2->addWidget( textLabel2, 0, 1 );
00089 buttonGroup1Layout->addLayout( layout3_2 );
00090 DiffDialogLayout->addWidget( buttonGroup1 );
00091
00092 line1 = new QFrame( this, "line1" );
00093 line1->setFrameShape( QFrame::HLine );
00094 line1->setFrameShadow( QFrame::Sunken );
00095 line1->setFrameShape( QFrame::HLine );
00096 DiffDialogLayout->addWidget( line1 );
00097
00098 layout2 = new QHBoxLayout( 0, 0, 6, "layout2");
00099 Horizontal_Spacing2 = new QSpacerItem( 130, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00100 layout2->addItem( Horizontal_Spacing2 );
00101
00102 buttonOk = new QPushButton( this, "buttonOk" );
00103 buttonOk->setAutoDefault( TRUE );
00104 buttonOk->setDefault( TRUE );
00105 layout2->addWidget( buttonOk );
00106
00107 buttonCancel = new QPushButton( this, "buttonCancel" );
00108 buttonCancel->setAutoDefault( TRUE );
00109 layout2->addWidget( buttonCancel );
00110 DiffDialogLayout->addLayout( layout2 );
00111 languageChange();
00112 resize( QSize(519, 246).expandedTo(minimumSizeHint()) );
00113 clearWState( WState_Polished );
00114
00115
00116 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
00117 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
00118 connect( diffArbitraryRevRadio, SIGNAL( toggled(bool) ), revaEdit, SLOT( setEnabled(bool) ) );
00119 connect( diffArbitraryRevRadio, SIGNAL( toggled(bool) ), revbEdit, SLOT( setEnabled(bool) ) );
00120 connect( diffLocalOtherRadio, SIGNAL( toggled(bool) ), revOtherEdit, SLOT( setEnabled(bool) ) );
00121
00122
00123 setTabOrder( diffLocalBaseRadio, diffLocalHeadRadio );
00124 setTabOrder( diffLocalHeadRadio, diffLocalOtherRadio );
00125 setTabOrder( diffLocalOtherRadio, revOtherEdit );
00126 setTabOrder( revOtherEdit, revaEdit );
00127 setTabOrder( revaEdit, revbEdit );
00128 setTabOrder( revbEdit, buttonOk );
00129 setTabOrder( buttonOk, buttonCancel );
00130 }
00131
00132
00133
00134
00135 DiffDialogBase::~DiffDialogBase()
00136 {
00137
00138 }
00139
00140
00141
00142
00143
00144 void DiffDialogBase::languageChange()
00145 {
00146 setCaption( tr2i18n( "Choose Revisions to Diff" ) );
00147 buttonGroup1->setTitle( tr2i18n( "Build Difference Between" ) );
00148 diffLocalHeadRadio->setText( tr2i18n( "Local copy and &HEAD" ) );
00149 diffLocalBaseRadio->setText( tr2i18n( "&Local copy and BASE" ) );
00150 diffLocalOtherRadio->setText( tr2i18n( "Local copy and an arbitrary &revision:" ) );
00151 diffArbitraryRevRadio->setText( tr2i18n( "&Two arbitrary revisions/tags:" ) );
00152 textLabel1->setText( tr2i18n( "Revision A:" ) );
00153 revbEdit->setText( QString::null );
00154 QToolTip::add( revbEdit, tr2i18n( "Second revision to compare (leave empty to diff against HEAD)" ) );
00155 QToolTip::add( revaEdit, tr2i18n( "First revision to compare" ) );
00156 textLabel2->setText( tr2i18n( "Revision B:" ) );
00157 buttonOk->setText( tr2i18n( "&OK" ) );
00158 buttonOk->setAccel( QKeySequence( QString::null ) );
00159 buttonCancel->setText( tr2i18n( "&Cancel" ) );
00160 buttonCancel->setAccel( QKeySequence( QString::null ) );
00161 }
00162
00163 #include "diffdialogbase.moc"