Exemple #1
0
FilesPage::FilesPage( QWidget* parent ) : PageBase( parent ), m_URLChanged( false )
{
	QWidget* page = new QWidget( this );
	QVBoxLayout* layout = new QVBoxLayout( page );
	layout->setSpacing( KDialog::spacingHint() );
	layout->setMargin( KDialog::marginHint() );

	m_firstGB = new QGroupBox( 1, Qt::Vertical, "You have to set this moron :)", page );
	m_firstURLComboBox = new KURLComboBox( KURLComboBox::Both, true, m_firstGB, "SourceURLComboBox" );
	m_firstURLRequester = new KURLRequester( m_firstURLComboBox, m_firstGB );
	m_firstURLRequester->setFocus();

	m_secondGB = new QGroupBox( 1, Qt::Vertical, "This too moron !", page );
	m_secondURLComboBox = new KURLComboBox( KURLComboBox::Both, true, m_secondGB, "DestURLComboBox" );
	m_secondURLRequester = new KURLRequester( m_secondURLComboBox, m_secondGB );

	connect( m_firstURLRequester, SIGNAL( urlSelected( const QString & ) ), SLOT( setSecondURL( const QString & ) ) );
	connect( m_secondURLRequester, SIGNAL( urlSelected( const QString & ) ), SLOT( setFirstURL( const QString & ) ) );

	m_thirdGB = new QGroupBox( 1, Qt::Vertical, i18n( "Encoding" ), page );
	m_encodingComboBox = new QComboBox( false, m_thirdGB, "encoding_combobox" );
	m_encodingComboBox->insertStringList( KGlobal::charsets()->availableEncodingNames() );

	layout->addWidget( m_firstGB );
	layout->addWidget( m_secondGB );
	layout->addWidget( m_thirdGB );

	layout->addStretch( 1 );
	page->setMinimumSize( sizeHintForWidget( page ) );

	addTab( page, i18n( "&Files" ) );
}
Exemple #2
0
void DiffPage::addFormatTab()
{
	QWidget* page   = new QWidget( this );
	QVBoxLayout* layout = new QVBoxLayout( page );
	layout->setSpacing( KDialog::spacingHint() );
	layout->setMargin( KDialog::marginHint() );

	// add diff modes
	m_modeButtonGroup = new QButtonGroup( page );
        QGroupBox *box = new QGroupBox( page );
	box->setWhatsThis( i18n( "Select the format of the output generated by diff. Unified is the one that is used most frequently because it is very readable. The KDE developers like this format the best so use it for sending patches." ) );
	layout->addWidget( box );
	QVBoxLayout* bgLayout = new QVBoxLayout( box );
	box->setTitle( i18n( "Output Format" ) );
	//m_modeButtonGroup->setMargin( KDialog::marginHint() );

        QRadioButton *radioButton = new QRadioButton( i18n( "Context" ), box );
        m_modeButtonGroup->addButton( radioButton, Kompare::Context);
	bgLayout->addWidget( radioButton );
        radioButton = new QRadioButton( i18n( "Normal" ),  box );
        m_modeButtonGroup->addButton( radioButton, Kompare::Normal);
        bgLayout->addWidget( radioButton );
        radioButton =  new QRadioButton( i18n( "Unified" ), box );
        m_modeButtonGroup->addButton( radioButton, Kompare::Unified);
        bgLayout->addWidget( radioButton );

	// #lines of context (loc)
	QGroupBox* groupBox = new QGroupBox( page );
        QHBoxLayout *groupLayout = new QHBoxLayout;
        groupBox->setLayout( groupLayout );
	layout->addWidget( groupBox );
	groupBox->setTitle( i18n( "Lines of Context" ) );
	groupBox->setWhatsThis( i18n( "The number of context lines is normally 2 or 3. This makes the diff readable and applicable in most cases. More than 3 lines will only bloat the diff unnecessarily." ) );
	//groupBox->setMargin( KDialog::marginHint() );

	QLabel* label = new QLabel( i18n( "Number of context lines:" ));
        groupLayout->addWidget( label );
	label->setWhatsThis( i18n( "The number of context lines is normally 2 or 3. This makes the diff readable and applicable in most cases. More than 3 lines will only bloat the diff unnecessarily." ) );
	m_locSpinBox = new QSpinBox( groupBox );
	m_locSpinBox->setRange( 0, 100 );
	groupLayout->addWidget( m_locSpinBox );
	m_locSpinBox->setWhatsThis( i18n( "The number of context lines is normally 2 or 3. This makes the diff readable and applicable in most cases. More than 3 lines will only bloat the diff unnecessarily." ) );
	label->setBuddy( m_locSpinBox );

	layout->addStretch( 1 );
	page->setMinimumSize( sizeHintForWidget( page ) );

	m_tabWidget->addTab( page, i18n( "Format" ) );
}
Exemple #3
0
void DiffPage::addExcludeTab()
{
	QWidget* page = new QWidget( this );
	QVBoxLayout* layout = new QVBoxLayout( page );
	layout->setSpacing( KDialog::spacingHint() );
	layout->setMargin( KDialog::marginHint() );

	m_excludeFilePatternGroupBox = new QGroupBox( page );
        m_excludeFilePatternGroupBox->setCheckable(true);
        QHBoxLayout *excludeFileLayout = new QHBoxLayout;
        m_excludeFilePatternGroupBox->setLayout( excludeFileLayout );
	m_excludeFilePatternGroupBox->setTitle( i18n( "File Pattern to Exclude" ) );
	m_excludeFilePatternGroupBox->setToolTip( i18n( "If this is checked you can enter a shell pattern in the text box on the right or select entries from the list." ) );
	m_excludeFilePatternEditListBox = new KEditListWidget;
        excludeFileLayout->addWidget( m_excludeFilePatternEditListBox );
	m_excludeFilePatternEditListBox->setObjectName( "exclude_file_pattern_editlistbox" );
	m_excludeFilePatternEditListBox->setButtons( KEditListWidget::Add|KEditListWidget::Remove );
	m_excludeFilePatternEditListBox->setCheckAtEntering( false );
	m_excludeFilePatternEditListBox->setToolTip( i18n( "Here you can enter or remove a shell pattern or select one or more entries from the list." ) );
	layout->addWidget( m_excludeFilePatternGroupBox );


	connect( m_excludeFilePatternGroupBox, SIGNAL(toggled(bool)), this, SLOT(slotExcludeFilePatternToggled(bool)));

	m_excludeFileNameGroupBox = new QGroupBox( page );
        m_excludeFileNameGroupBox->setCheckable( true );
        excludeFileLayout = new QHBoxLayout;
        m_excludeFileNameGroupBox->setLayout( excludeFileLayout );
	m_excludeFileNameGroupBox->setTitle( i18n( "File with Filenames to Exclude" ) );
	m_excludeFileNameGroupBox->setToolTip( i18n( "If this is checked you can enter a filename in the combo box below." ) );
	m_excludeFileURLComboBox  = new KUrlComboBox( KUrlComboBox::Files, true );
        excludeFileLayout->addWidget( m_excludeFileURLComboBox );
	m_excludeFileURLComboBox->setObjectName( "exclude_file_urlcombo" );
	m_excludeFileURLComboBox->setToolTip( i18n( "Here you can enter the URL of a file with shell patterns to ignore during the comparison of the folders." ) );
	m_excludeFileURLRequester = new KUrlRequester( m_excludeFileURLComboBox,m_excludeFileNameGroupBox );
        excludeFileLayout->addWidget( m_excludeFileURLRequester );
	m_excludeFileURLRequester->setObjectName("exclude_file_name_urlrequester" );
	m_excludeFileURLRequester->setToolTip( i18n( "Any file you select in the dialog that pops up when you click it will be put in the dialog to the left of this button." ) );
	layout->addWidget( m_excludeFileNameGroupBox );

	connect( m_excludeFileNameGroupBox, SIGNAL(toggled(bool)), this, SLOT(slotExcludeFileToggled(bool)));

	layout->addStretch( 1 );
	page->setMinimumSize( sizeHintForWidget( page ) );

	m_tabWidget->addTab( page, i18n( "Exclude" ) );
}
Exemple #4
0
FilesPage::FilesPage() : PageBase()
{
	QWidget* page = new QWidget( this );
	QVBoxLayout* layout = new QVBoxLayout( page );
	layout->setSpacing( KDialog::spacingHint() );
	layout->setMargin( KDialog::marginHint() );

	m_firstGB = new QGroupBox( "You have to set this moron :)", page );
	layout->addWidget( m_firstGB );
	QHBoxLayout* gb1Layout = new QHBoxLayout( m_firstGB );
	m_firstURLComboBox = new KUrlComboBox( KUrlComboBox::Both, true, m_firstGB );
	m_firstURLComboBox->setObjectName( "SourceURLComboBox" );
	m_firstURLRequester = new KUrlRequester( m_firstURLComboBox, m_firstGB );
	gb1Layout->addWidget( m_firstURLRequester );
	m_firstURLRequester->setFocus();

	m_secondGB = new QGroupBox( "This too moron !", page );
	layout->addWidget( m_secondGB );
	QHBoxLayout* gb2Layout = new QHBoxLayout( m_secondGB );
	m_secondURLComboBox = new KUrlComboBox( KUrlComboBox::Both, true, m_secondGB );
	m_secondURLComboBox->setObjectName( "DestURLComboBox" );
	m_secondURLRequester = new KUrlRequester( m_secondURLComboBox, m_secondGB );
	gb2Layout->addWidget( m_secondURLRequester );

	m_thirdGB = new QGroupBox( i18n( "Encoding" ), page );
	layout->addWidget( m_thirdGB );
	QHBoxLayout* gb3Layout = new QHBoxLayout( m_thirdGB );
	m_encodingComboBox = new KComboBox( false, m_thirdGB );
	m_encodingComboBox->setObjectName( "encoding_combobox" );
	m_encodingComboBox->insertItem( 0, "Default" );
	m_encodingComboBox->insertItems( 1, KGlobal::charsets()->availableEncodingNames() );
	gb3Layout->addWidget( m_encodingComboBox );

	layout->addWidget( m_firstGB );
	layout->addWidget( m_secondGB );
	layout->addWidget( m_thirdGB );

	layout->addStretch( 1 );
	page->setMinimumSize( sizeHintForWidget( page ) );

	//addTab( page, i18n( "&Files" ) );
}
Exemple #5
0
void DiffPage::addDiffTab()
{
	QWidget* page   = new QWidget( this );
	QVBoxLayout* layout = new QVBoxLayout( page );
	layout->setSpacing( KDialog::spacingHint() );
	layout->setMargin( KDialog::marginHint() );

	// add diff program selector
	m_diffProgramGroup = new QGroupBox( page );
	layout->addWidget( m_diffProgramGroup );
	QVBoxLayout* bgLayout = new QVBoxLayout( m_diffProgramGroup );
	m_diffProgramGroup->setTitle( i18n( "Diff Program" ) );
	//m_diffProgramGroup->setMargin( KDialog::marginHint() );

	m_diffURLRequester = new KUrlRequester( m_diffProgramGroup);
	m_diffURLRequester->setObjectName("diffURLRequester" );
	m_diffURLRequester->setWhatsThis( i18n( "You can select a different diff program here. On Solaris the standard diff program does not support all the options that the GNU version does. This way you can select that version." ) );
	bgLayout->addWidget( m_diffURLRequester );

	layout->addStretch( 1 );
	page->setMinimumSize( sizeHintForWidget( page ) );

	m_tabWidget->addTab( page, i18n( "Diff" ) );
}
Exemple #6
0
void DiffPage::addOptionsTab()
{
	QWidget* page   = new QWidget( this );
	QVBoxLayout* layout = new QVBoxLayout( page );
	layout->setSpacing( KDialog::spacingHint() );
	layout->setMargin( KDialog::marginHint() );

	// add diff options
	KButtonGroup* optionButtonGroup = new KButtonGroup( page );
	layout->addWidget( optionButtonGroup );
	QVBoxLayout* bgLayout = new QVBoxLayout( optionButtonGroup );
	optionButtonGroup->setTitle( i18n( "General" ) );
	//optionButtonGroup->setMargin( KDialog::marginHint() );

	m_newFilesCheckBox    = new QCheckBox( i18n( "&Treat new files as empty" ), optionButtonGroup );
	m_newFilesCheckBox->setToolTip( i18n( "This option corresponds to the -N diff option." ) );
	m_newFilesCheckBox->setWhatsThis( i18n( "With this option enabled diff will treat a file that only exists in one of the directories as empty in the other directory. This means that the file is compared with an empty file and because of this will appear as one big insertion or deletion." ) );
	bgLayout->addWidget( m_newFilesCheckBox );

	m_smallerCheckBox     = new QCheckBox( i18n( "&Look for smaller changes" ), optionButtonGroup );
	m_smallerCheckBox->setToolTip( i18n( "This corresponds to the -d diff option." ) );
	m_smallerCheckBox->setWhatsThis( i18n( "With this option enabled diff will try a little harder (at the cost of more memory) to find fewer changes." ) );
	bgLayout->addWidget( m_smallerCheckBox );
	m_largerCheckBox      = new QCheckBox( i18n( "O&ptimize for large files" ), optionButtonGroup );
	m_largerCheckBox->setToolTip( i18n( "This corresponds to the -H diff option." ) );
	m_largerCheckBox->setWhatsThis( i18n( "This option lets diff makes better diffs when using large files. The definition of large is nowhere to be found though." ) );
	bgLayout->addWidget( m_largerCheckBox );
	m_caseCheckBox        = new QCheckBox( i18n( "&Ignore changes in case" ), optionButtonGroup );
	m_caseCheckBox->setToolTip( i18n( "This corresponds to the -i diff option." ) );
	m_caseCheckBox->setWhatsThis( i18n( "With this option to ignore changes in case enabled, diff will not indicate a difference when something in one file is changed into SoMEthing in the other file." ) );
	bgLayout->addWidget( m_caseCheckBox );

	QHBoxLayout* groupLayout = new QHBoxLayout();
	layout->addLayout( groupLayout );
	groupLayout->setObjectName( "regexp_horizontal_layout" );
	groupLayout->setSpacing( -1 );
	groupLayout->setMargin( KDialog::marginHint() );

	m_ignoreRegExpCheckBox = new QCheckBox( i18n( "Ignore regexp:" ), page );
	m_ignoreRegExpCheckBox->setToolTip( i18n( "This option corresponds to the -I diff option." ) );
	m_ignoreRegExpCheckBox->setWhatsThis( i18n( "When this checkbox is enabled, an option to diff is given that will make diff ignore lines that match the regular expression." ) );
	groupLayout->addWidget( m_ignoreRegExpCheckBox );
	m_ignoreRegExpEdit = new KLineEdit( QString::null, page);	//krazy:exclude=nullstrassign for old broken gcc
	m_ignoreRegExpEdit->setObjectName("regexplineedit" );
	m_ignoreRegExpEdit->setToolTip( i18n( "Add the regular expression here that you want to use\nto ignore lines that match it." ) );
	groupLayout->addWidget( m_ignoreRegExpEdit );

	if ( !KServiceTypeTrader::self()->query("KRegExpEditor/KRegExpEditor").isEmpty() )
	{
		// Ok editor is available, use it
		QPushButton* ignoreRegExpEditButton = new QPushButton( i18n( "&Edit..." ), page);
		ignoreRegExpEditButton->setObjectName( "regexp_editor_button" );
		ignoreRegExpEditButton->setToolTip( i18n( "Clicking this will open a regular expression dialog where\nyou can graphically create regular expressions." ) );
		groupLayout->addWidget( ignoreRegExpEditButton );
		connect( ignoreRegExpEditButton, SIGNAL( clicked() ), this, SLOT( slotShowRegExpEditor() ) );
	}

	KButtonGroup* moreOptionButtonGroup = new KButtonGroup( page );
	layout->addWidget( moreOptionButtonGroup );
	bgLayout = new QVBoxLayout( moreOptionButtonGroup );
	moreOptionButtonGroup->setTitle( i18n( "Whitespace" ) );
	//moreOptionButtonGroup->setMargin( KDialog::marginHint() );

	m_tabsCheckBox        = new QCheckBox( i18n( "E&xpand tabs to spaces in output" ), moreOptionButtonGroup );
	m_tabsCheckBox->setToolTip( i18n( "This option corresponds to the -t diff option." ) );
	m_tabsCheckBox->setWhatsThis( i18n( "This option does not always produce the right result. Due to this expansion Kompare may have problems applying the change to the destination file." ) );
	bgLayout->addWidget( m_tabsCheckBox );
	m_linesCheckBox       = new QCheckBox( i18n( "I&gnore added or removed empty lines" ), moreOptionButtonGroup );
	m_linesCheckBox->setToolTip( i18n( "This option corresponds to the -B diff option." ) );
	m_linesCheckBox->setWhatsThis( i18n( "This can be very useful in situations where code has been reorganized and empty lines have been added or removed to improve legibility." ) );
	bgLayout->addWidget( m_linesCheckBox );
	m_whitespaceCheckBox  = new QCheckBox( i18n( "Ig&nore changes in the amount of whitespace" ), moreOptionButtonGroup );
	m_whitespaceCheckBox->setToolTip( i18n( "This option corresponds to the -b diff option." ) );
	m_whitespaceCheckBox->setWhatsThis( i18n( "If you are uninterested in differences arising due to, for example, changes in indentation, then use this option." ) );
	bgLayout->addWidget( m_whitespaceCheckBox );
	m_allWhitespaceCheckBox = new QCheckBox( i18n( "Ign&ore all whitespace" ), moreOptionButtonGroup );
	m_allWhitespaceCheckBox->setToolTip( i18n( "This option corresponds to the -w diff option." ) );
	m_allWhitespaceCheckBox->setWhatsThis( i18n( "This is useful for seeing the significant changes without being overwhelmed by all the white space changes." ) );
	bgLayout->addWidget( m_allWhitespaceCheckBox );
	m_ignoreTabExpansionCheckBox = new QCheckBox( i18n( "Igno&re changes due to tab expansion" ), moreOptionButtonGroup );
	m_ignoreTabExpansionCheckBox->setToolTip( i18n( "This option corresponds to the -E diff option." ) );
	m_ignoreTabExpansionCheckBox->setWhatsThis( i18n( "If there is a change because tabs have been expanded into spaces in the other file, then this option will make sure that these do not show up. Kompare currently has some problems applying such changes so be careful when you use this option." ) );
	bgLayout->addWidget( m_ignoreTabExpansionCheckBox );

	layout->addStretch( 1 );
	page->setMinimumSize( sizeHintForWidget( page ) );

	m_tabWidget->addTab( page, i18n( "Options" ) );
}
Exemple #7
0
ViewPage::ViewPage( QWidget* parent ) : PageBase( parent )
{
	QWidget*     page;
	QVBoxLayout* layout;
	QGroupBox*   colorGroupBox;
	QHGroupBox*  snolGroupBox;
	QHGroupBox*  tabGroupBox;
	QLabel*      label;

	page   = new QWidget( this );
	layout = new QVBoxLayout( page );
	layout->setSpacing( KDialog::spacingHint() );
	layout->setMargin( KDialog::marginHint() );

	// add a groupbox
	colorGroupBox = new QGroupBox( 2, Qt::Horizontal, i18n( "Colors" ), page );
	layout->addWidget( colorGroupBox );
	colorGroupBox->setMargin( KDialog::marginHint() );

	// add the removeColor
	label = new QLabel( i18n( "Removed color:" ), colorGroupBox );
	m_removedColorButton = new KColorButton( colorGroupBox );
	label->setBuddy( m_removedColorButton );

	// add the changeColor
	label = new QLabel( i18n( "Changed color:" ), colorGroupBox );
	m_changedColorButton = new KColorButton( colorGroupBox );
	label->setBuddy( m_changedColorButton );

	// add the addColor
	label = new QLabel( i18n( "Added color:" ), colorGroupBox );
	m_addedColorButton = new KColorButton( colorGroupBox );
	label->setBuddy( m_addedColorButton );

	// add the appliedColor
	label = new QLabel( i18n( "Applied color:" ), colorGroupBox );
	m_appliedColorButton = new KColorButton( colorGroupBox );
	label->setBuddy( m_appliedColorButton );

	// scroll number of lines (snol)
	snolGroupBox = new QHGroupBox( i18n( "Mouse Wheel" ), page );
	layout->addWidget( snolGroupBox );
	snolGroupBox->setMargin( KDialog::marginHint() );

	label            = new QLabel( i18n( "Number of lines:" ), snolGroupBox );
	m_snolSpinBox    = new QSpinBox( 0, 50, 1, snolGroupBox );
	label->setBuddy( m_snolSpinBox );

	// Temporarily here for testing...
	// number of spaces for a tab character stuff
	tabGroupBox = new QHGroupBox( i18n( "Tabs to Spaces" ), page );
	layout->addWidget( tabGroupBox );
	tabGroupBox->setMargin( KDialog::marginHint() );

	label = new QLabel( i18n( "Number of spaces to convert a tab character to:" ), tabGroupBox );
	m_tabSpinBox = new QSpinBox( 1, 16, 1, tabGroupBox );
	label->setBuddy( m_tabSpinBox );

	layout->addStretch( 1 );
	page->setMinimumSize( sizeHintForWidget( page ) );

	addTab( page, i18n( "A&ppearance" ) );

	page   = new QWidget( this );
	layout = new QVBoxLayout( page );
	layout->setSpacing( KDialog::spacingHint() );
	layout->setMargin( KDialog::marginHint() );

	QHGroupBox* gb = new QHGroupBox( i18n( "Text Font" ), page );
	layout->addWidget( gb );
	gb->setMargin( KDialog::marginHint() );

	label = new QLabel( i18n( "Font:" ), gb );
	m_fontCombo = new KFontCombo( gb, "fontcombo" );
	label->setBuddy( m_fontCombo );

	label = new QLabel( i18n( "Size:" ), gb );
	m_fontSizeSpinBox = new QSpinBox( 6, 24, 1, gb, "fontsize" );
	label->setBuddy( m_fontSizeSpinBox );

	layout->addStretch( 1 );
	page->setMinimumSize( sizeHintForWidget( page ) );

	addTab( page, i18n( "&Fonts" ) );
}