Ejemplo n.º 1
0
ProgrammerDlg::ProgrammerDlg( const QString & picID, QWidget *parent, const char *name )
	: KDialogBase( parent, name, true, i18n("PIC Programmer"), Ok|Cancel )
{
	// Change the "Ok" button to a "Burn" button
	KGuiItem burnItem = KStdGuiItem::ok();
	burnItem.setText( i18n("Burn") );
	setButtonOK( burnItem );
	
	m_bAccepted = false;
	m_pProgrammerWidget = new ProgrammerWidget( this );
	m_pProgrammerSettings = new PicProgrammerSettings;
	
	// Setup the list of programmers
	KComboBox * programmerCombo = m_pProgrammerWidget->m_pProgrammerProgram;
	QStringList programmerNames = m_pProgrammerSettings->configNames( false );
	programmerCombo->insertStringList( programmerNames );
	programmerCombo->setSizeLimit( programmerNames.size() );
	programmerCombo->setCurrentText( KTLConfig::picProgrammerProgram() );
	
	// Sets up the list of ports
	m_pProgrammerWidget->m_pPicProgrammerPort->insertStringList( Port::ports( Port::ExistsAndRW ) );
	m_pProgrammerWidget->m_pPicProgrammerPort->setCurrentText( KTLConfig::picProgrammerPort() );
	
	// Set the pic type to the one requested
	if ( !picID.isEmpty() )
		m_pProgrammerWidget->m_pMicroSelect->setMicro( picID );
	
	setMainWidget( m_pProgrammerWidget );
}
Ejemplo n.º 2
0
void MicroSettingsDlg::slotRenamePinMap()
{
	KComboBox * combo = m_pWidget->pinMapCombo;
	
	QString oldName = combo->currentText();
	if ( oldName.isEmpty() )
		return;
	
	PinMappingNameValidator * validator = new PinMappingNameValidator( this, oldName );
	
	bool ok = false;
	QString newName = KInputDialog::getText( i18n("New Pin Map Name"), i18n("Name"), oldName, & ok, this, 0, validator );
	
	delete validator;
	
	if ( !ok )
		return;
	
	if ( newName == oldName )
		return;
	
	m_pinMappings[ newName ] = m_pinMappings[ oldName ];
	m_pinMappings.remove( oldName );
	
	combo->setCurrentText( newName );
}
Ejemplo n.º 3
0
QWidget *KFileMetaInfoWidget::makeStringWidget()
{
    if(m_validator && m_validator->inherits("KStringListValidator"))
    {
        KComboBox *b = new KComboBox(true, this, "metainfo combobox");
        KStringListValidator *val = static_cast< KStringListValidator * >(m_validator);
        b->insertStringList(val->stringList());
        b->setCurrentText(m_item.value().toString());
        connect(b, SIGNAL(activated(const QString &)), this, SLOT(slotComboChanged(const QString &)));
        b->setValidator(val);
        reparentValidator(b, val);
        return b;
    }