00001 /*************************************************************************** 00002 * Copyright (C) 2005 by David Saxton * 00003 * david@bluehaze.org * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 ***************************************************************************/ 00010 00011 #include "language.h" 00012 #include "microselectwidget.h" 00013 #include "picprogrammer.h" 00014 #include "port.h" 00015 #include "programmerdlg.h" 00016 #include "programmerwidget.h" 00017 #include "src/core/ktlconfig.h" 00018 00019 #include <kcombobox.h> 00020 #include <kguiitem.h> 00021 #include <klocale.h> 00022 #include <kstdguiitem.h> 00023 00024 ProgrammerDlg::ProgrammerDlg( const QString & picID, QWidget *parent, const char *name ) 00025 : KDialogBase( parent, name, true, i18n("PIC Programmer"), Ok|Cancel ) 00026 { 00027 // Change the "Ok" button to a "Burn" button 00028 KGuiItem burnItem = KStdGuiItem::ok(); 00029 burnItem.setText( i18n("Burn") ); 00030 setButtonOK( burnItem ); 00031 00032 m_bAccepted = false; 00033 m_pProgrammerWidget = new ProgrammerWidget( this ); 00034 m_pProgrammerSettings = new PicProgrammerSettings; 00035 00036 // Setup the list of programmers 00037 KComboBox * programmerCombo = m_pProgrammerWidget->m_pProgrammerProgram; 00038 QStringList programmerNames = m_pProgrammerSettings->configNames( false ); 00039 programmerCombo->insertStringList( programmerNames ); 00040 programmerCombo->setSizeLimit( programmerNames.size() ); 00041 programmerCombo->setCurrentText( KTLConfig::picProgrammerProgram() ); 00042 00043 // Sets up the list of ports 00044 m_pProgrammerWidget->m_pPicProgrammerPort->insertStringList( Port::ports( Port::ExistsAndRW ) ); 00045 m_pProgrammerWidget->m_pPicProgrammerPort->setCurrentText( KTLConfig::picProgrammerPort() ); 00046 00047 // Set the pic type to the one requested 00048 if ( !picID.isEmpty() ) 00049 m_pProgrammerWidget->m_pMicroSelect->setMicro( picID ); 00050 00051 setMainWidget( m_pProgrammerWidget ); 00052 } 00053 00054 00055 ProgrammerDlg::~ProgrammerDlg() 00056 { 00057 } 00058 00059 00060 void ProgrammerDlg::initOptions( ProcessOptions * options ) 00061 { 00062 if ( !options ) 00063 return; 00064 00065 options->m_picID = m_pProgrammerWidget->m_pMicroSelect->micro(); 00066 options->m_port = m_pProgrammerWidget->m_pPicProgrammerPort->currentText(); 00067 options->m_program = m_pProgrammerWidget->m_pProgrammerProgram->currentText(); 00068 } 00069 00070 00071 void ProgrammerDlg::accept() 00072 { 00073 m_bAccepted = true; 00074 hide(); 00075 } 00076 00077 00078 void ProgrammerDlg::reject() 00079 { 00080 m_bAccepted = false; 00081 } 00082 00083 00084 MicroSelectWidget * ProgrammerDlg::microSelect( ) const 00085 { 00086 return m_pProgrammerWidget->m_pMicroSelect; 00087 } 00088 00089 00090 #include "programmerdlg.moc"
1.5.1