summaryrefslogtreecommitdiffstats
path: root/src/gui/microsettingsdlg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/microsettingsdlg.cpp')
-rw-r--r--src/gui/microsettingsdlg.cpp142
1 files changed, 71 insertions, 71 deletions
diff --git a/src/gui/microsettingsdlg.cpp b/src/gui/microsettingsdlg.cpp
index c3915e8..78b585d 100644
--- a/src/gui/microsettingsdlg.cpp
+++ b/src/gui/microsettingsdlg.cpp
@@ -24,24 +24,24 @@
#include <kmessagebox.h>
#include <kpushbutton.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qregexp.h>
-#include <qtable.h>
-#include <qwhatsthis.h>
-
-MicroSettingsDlg::MicroSettingsDlg( MicroSettings * microSettings, QWidget *parent, const char *name )
- : KDialogBase( parent, name, true, i18n("PIC Settings"), KDialogBase::Ok|KDialogBase::Apply|KDialogBase::Cancel, KDialogBase::Ok, true )
+#include <tqgroupbox.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <tqregexp.h>
+#include <tqtable.h>
+#include <tqwhatsthis.h>
+
+MicroSettingsDlg::MicroSettingsDlg( MicroSettings * microSettings, TQWidget *tqparent, const char *name )
+ : KDialogBase( tqparent, name, true, i18n("PIC Settings"), KDialogBase::Ok|KDialogBase::Apply|KDialogBase::Cancel, KDialogBase::Ok, true )
{
m_pMicroSettings = microSettings;
m_pNewPinMappingWidget = 0l;
m_pNewPinMappingDlg = 0l;
m_pWidget = new MicroSettingsWidget(this);
- QWhatsThis::add( this, i18n("This dialog allows editing of the initial properties of the PIC") );
- QWhatsThis::add( m_pWidget->portsGroupBox, i18n("Edit the initial value of the ports here. For each binary number, the order from right-to-left is pins 0 through 7.<br><br>The \"Type (TRIS)\" edit shows the initial input/output state of the ports; 1 represents an input, and 0 an output.<br><br>The \"State (PORT)\" edit shows the initial high/low state of the ports; 1 represents a high, and 0 a low.") );
- QWhatsThis::add( m_pWidget->variables, i18n("Edit the initial value of the variables here.<br><br>Note that the value of the variable can only be in the range 0->255. These variables will be initialized before any other code is executed.") );
+ TQWhatsThis::add( this, i18n("This dialog allows editing of the initial properties of the PIC") );
+ TQWhatsThis::add( m_pWidget->portsGroupBox, i18n("Edit the initial value of the ports here. For each binary number, the order from right-to-left is pins 0 through 7.<br><br>The \"Type (TRIS)\" edit shows the initial input/output state of the ports; 1 represents an input, and 0 an output.<br><br>The \"State (PORT)\" edit shows the initial high/low state of the ports; 1 represents a high, and 0 a low.") );
+ TQWhatsThis::add( m_pWidget->variables, i18n("Edit the initial value of the variables here.<br><br>Note that the value of the variable can only be in the range 0->255. These variables will be initialized before any other code is executed.") );
//BEGIN Initialize initial port settings
@@ -51,14 +51,14 @@ MicroSettingsDlg::MicroSettingsDlg( MicroSettings * microSettings, QWidget *pare
m_portStateEdit.resize( m_portNames.size(), 0 );
uint row = 0;
- QStringList::iterator end = m_portNames.end();
- for ( QStringList::iterator it = m_portNames.begin(); it != end; ++it, ++row )
+ TQStringList::iterator end = m_portNames.end();
+ for ( TQStringList::iterator it = m_portNames.begin(); it != end; ++it, ++row )
{
//BEGIN Get current Type / State text
- QString portType = QString::number( microSettings->portType(*it), 2 );
- QString portState = QString::number( microSettings->portState(*it), 2 );
+ TQString portType = TQString::number( microSettings->portType(*it), 2 );
+ TQString portState = TQString::number( microSettings->portState(*it), 2 );
- QString fill;
+ TQString fill;
fill.fill( '0', 8-portType.length() );
portType.prepend(fill);
fill.fill( '0', 8-portState.length() );
@@ -66,17 +66,17 @@ MicroSettingsDlg::MicroSettingsDlg( MicroSettings * microSettings, QWidget *pare
//END Get current Type / State text
- QGroupBox * groupBox = new QGroupBox( *it, m_pWidget->portsGroupBox );
+ TQGroupBox * groupBox = new TQGroupBox( *it, m_pWidget->portsGroupBox );
groupBox->setColumnLayout(0, Qt::Vertical );
- groupBox->layout()->setSpacing( 6 );
- groupBox->layout()->setMargin( 11 );
- QGridLayout * groupBoxLayout = new QGridLayout( groupBox->layout() );
- groupBoxLayout->setAlignment( Qt::AlignTop );
+ groupBox->tqlayout()->setSpacing( 6 );
+ groupBox->tqlayout()->setMargin( 11 );
+ TQGridLayout * groupBoxLayout = new TQGridLayout( groupBox->tqlayout() );
+ groupBoxLayout->tqsetAlignment( TQt::AlignTop );
// TODO: replace this with i18n( "the type", "Type (TRIS register):" );
- groupBoxLayout->addWidget( new QLabel( i18n("Type (TRIS register):"), groupBox ), 0, 0 );
- groupBoxLayout->addWidget( new QLabel( i18n("State (PORT register):"), groupBox ), 1, 0 );
+ groupBoxLayout->addWidget( new TQLabel( i18n("Type (TRIS register):"), groupBox ), 0, 0 );
+ groupBoxLayout->addWidget( new TQLabel( i18n("State (PORT register):"), groupBox ), 1, 0 );
m_portTypeEdit[row] = new KLineEdit( portType, groupBox );
groupBoxLayout->addWidget( m_portTypeEdit[row], 0, 1 );
@@ -84,8 +84,8 @@ MicroSettingsDlg::MicroSettingsDlg( MicroSettings * microSettings, QWidget *pare
m_portStateEdit[row] = new KLineEdit( portState, groupBox );
groupBoxLayout->addWidget( m_portStateEdit[row], 1, 1 );
-// (dynamic_cast<QVBoxLayout*>(m_pWidget->portsGroupBox->layout()))->insertWidget( row, groupBox );
- (dynamic_cast<QVBoxLayout*>(m_pWidget->portsGroupBox->layout()))->addWidget( groupBox );
+// (dynamic_cast<TQVBoxLayout*>(m_pWidget->portsGroupBox->tqlayout()))->insertWidget( row, groupBox );
+ (dynamic_cast<TQVBoxLayout*>(m_pWidget->portsGroupBox->tqlayout()))->addWidget( groupBox );
}
//END Initialize initial port settings
@@ -99,10 +99,10 @@ MicroSettingsDlg::MicroSettingsDlg( MicroSettings * microSettings, QWidget *pare
m_pWidget->variables->setColumnStretchable( 0, true );
m_pWidget->variables->setColumnStretchable( 1, true );
- QStringList variables = microSettings->variableNames();
+ TQStringList variables = microSettings->variableNames();
row = 0;
end = variables.end();
- for ( QStringList::iterator it = variables.begin(); it != end; ++it )
+ for ( TQStringList::iterator it = variables.begin(); it != end; ++it )
{
VariableInfo *info = microSettings->variableInfo(*it);
if (info)
@@ -115,16 +115,16 @@ MicroSettingsDlg::MicroSettingsDlg( MicroSettings * microSettings, QWidget *pare
}
m_pWidget->variables->insertRows( row, 1 );
- connect( m_pWidget->variables, SIGNAL(valueChanged(int,int)), this, SLOT(checkAddVariableRow()) );
+ connect( m_pWidget->variables, TQT_SIGNAL(valueChanged(int,int)), this, TQT_SLOT(checkAddVariableRow()) );
//END Initialize initial variable settings
//BEGIN Initialize pin maps
- connect( m_pWidget->pinMapAdd, SIGNAL(clicked()), this, SLOT(slotCreatePinMap()) );
- connect( m_pWidget->pinMapModify, SIGNAL(clicked()), this, SLOT(slotModifyPinMap()) );
- connect( m_pWidget->pinMapRename, SIGNAL(clicked()), this, SLOT(slotRenamePinMap()) );
- connect( m_pWidget->pinMapRemove, SIGNAL(clicked()), this, SLOT(slotRemovePinMap()) );
+ connect( m_pWidget->pinMapAdd, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotCreatePinMap()) );
+ connect( m_pWidget->pinMapModify, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotModifyPinMap()) );
+ connect( m_pWidget->pinMapRename, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotRenamePinMap()) );
+ connect( m_pWidget->pinMapRemove, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotRemovePinMap()) );
m_pinMappings = microSettings->pinMappings();
m_pWidget->pinMapCombo->insertStringList( m_pinMappings.keys() );
@@ -138,7 +138,7 @@ MicroSettingsDlg::MicroSettingsDlg( MicroSettings * microSettings, QWidget *pare
m_pWidget->adjustSize();
adjustSize();
- connect( this, SIGNAL(applyClicked()), this, SLOT(slotSaveStuff()) );
+ connect( this, TQT_SIGNAL(applyClicked()), this, TQT_SLOT(slotSaveStuff()) );
}
@@ -174,64 +174,64 @@ void MicroSettingsDlg::reject()
}
-QValidator::State MicroSettingsDlg::validatePinMapName( QString & name ) const
+TQValidator::State MicroSettingsDlg::validatePinMapName( TQString & name ) const
{
- name.replace( ' ', '_' );
+ name.tqreplace( ' ', '_' );
if ( name.isEmpty() )
- return QValidator::Intermediate;
+ return TQValidator::Intermediate;
for ( unsigned i = 0; i < name.length(); ++i )
{
if ( !name[i].isLetterOrNumber() && name[i] != '_' )
- return QValidator::Invalid;
+ return TQValidator::Invalid;
}
if ( name[0].isNumber() )
- return QValidator::Intermediate;
+ return TQValidator::Intermediate;
if ( m_pWidget->pinMapCombo->contains( name ) )
- return QValidator::Intermediate;
+ return TQValidator::Intermediate;
- return QValidator::Acceptable;
+ return TQValidator::Acceptable;
}
-class PinMappingNameValidator : public QValidator
+class PinMappingNameValidator : public TQValidator
{
public:
/**
* Create a validator. If oldName is not empty, then the input is
* allowed to be oldName.
*/
- PinMappingNameValidator( MicroSettingsDlg * dlg, const QString & oldName = 0 )
- : QValidator(0)
+ PinMappingNameValidator( MicroSettingsDlg * dlg, const TQString & oldName = 0 )
+ : TQValidator(0)
{
m_pDlg = dlg;
m_oldName = oldName;
}
- virtual State validate( QString & input, int & ) const
+ virtual State validate( TQString & input, int & ) const
{
if ( (!m_oldName.isEmpty()) && (input == m_oldName) )
- return QValidator::Acceptable;
+ return TQValidator::Acceptable;
return m_pDlg->validatePinMapName( input );
}
protected:
MicroSettingsDlg * m_pDlg;
- QString m_oldName;
+ TQString m_oldName;
};
-void MicroSettingsDlg::slotCheckNewPinMappingName( const QString & name )
+void MicroSettingsDlg::slotCheckNewPinMappingName( const TQString & name )
{
// Validate name might change the name so that it is valid
- QString newName = name;
+ TQString newName = name;
if ( m_pNewPinMappingWidget )
- m_pNewPinMappingDlg->enableButtonOK( validatePinMapName( newName ) == QValidator::Acceptable );
+ m_pNewPinMappingDlg->enableButtonOK( validatePinMapName( newName ) == TQValidator::Acceptable );
if ( newName != name )
m_pNewPinMappingWidget->nameEdit->setText( newName );
@@ -248,18 +248,18 @@ void MicroSettingsDlg::slotCreatePinMap()
PinMappingNameValidator * validator = new PinMappingNameValidator( this );
m_pNewPinMappingWidget->nameEdit->setValidator( validator );
- connect( m_pNewPinMappingWidget->nameEdit, SIGNAL(textChanged(const QString &)), this, SLOT(slotCheckNewPinMappingName(const QString &)) );
+ connect( m_pNewPinMappingWidget->nameEdit, TQT_SIGNAL(textChanged(const TQString &)), this, TQT_SLOT(slotCheckNewPinMappingName(const TQString &)) );
slotCheckNewPinMappingName( 0 );
int accepted = m_pNewPinMappingDlg->exec();
unsigned selectedType = m_pNewPinMappingWidget->typeCombo->currentItem();
- QString name = m_pNewPinMappingWidget->nameEdit->text();
+ TQString name = m_pNewPinMappingWidget->nameEdit->text();
delete m_pNewPinMappingDlg;
delete validator;
m_pNewPinMappingDlg = 0l;
m_pNewPinMappingWidget = 0l;
- if ( accepted != QDialog::Accepted )
+ if ( accepted != TQDialog::Accepted )
return;
PinMapping::Type type = PinMapping::Invalid;
@@ -296,14 +296,14 @@ void MicroSettingsDlg::slotRenamePinMap()
{
KComboBox * combo = m_pWidget->pinMapCombo;
- QString oldName = combo->currentText();
+ TQString 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 );
+ TQString newName = KInputDialog::getText( i18n("New Pin Map Name"), i18n("Name"), oldName, & ok, this, 0, validator );
delete validator;
@@ -322,7 +322,7 @@ void MicroSettingsDlg::slotRenamePinMap()
void MicroSettingsDlg::slotModifyPinMap()
{
- QString name = m_pWidget->pinMapCombo->currentText();
+ TQString name = m_pWidget->pinMapCombo->currentText();
PinMapping pinMapping = m_pinMappings[ name ];
PinMapEditor * pinMapEditor = new PinMapEditor( & pinMapping, m_pMicroSettings->microInfo(), this, "PinMapEditor" );
@@ -330,7 +330,7 @@ void MicroSettingsDlg::slotModifyPinMap()
delete pinMapEditor;
- if ( accepted != QDialog::Accepted )
+ if ( accepted != TQDialog::Accepted )
return;
m_pinMappings[ name ] = pinMapping;
@@ -341,7 +341,7 @@ void MicroSettingsDlg::slotRemovePinMap()
{
KComboBox * combo = m_pWidget->pinMapCombo;
- QString pinMapID = combo->currentText();
+ TQString pinMapID = combo->currentText();
if ( pinMapID.isEmpty() )
return;
@@ -364,32 +364,32 @@ void MicroSettingsDlg::updatePinMapButtons()
void MicroSettingsDlg::savePort( int row )
{
- QString port = m_portNames[row];
+ TQString port = m_portNames[row];
int type, state;
- QString typeText = m_portTypeEdit[row]->text();
+ TQString typeText = m_portTypeEdit[row]->text();
bool typeOk = true;
- if ( typeText.startsWith( "0x", false ) ) type = typeText.remove(0,2).toInt( &typeOk, 16 );
- else if ( typeText.contains( QRegExp("[^01]") ) ) type = typeText.toInt( &typeOk, 10 );
+ if ( typeText.tqstartsWith( "0x", false ) ) type = typeText.remove(0,2).toInt( &typeOk, 16 );
+ else if ( typeText.tqcontains( TQRegExp("[^01]") ) ) type = typeText.toInt( &typeOk, 10 );
else type = typeText.toInt( &typeOk, 2 );
if ( !typeOk )
{
-// KMessageBox::sorry( this, i18n("Unregnised Port Type: %1").arg(typeText) );
+// KMessageBox::sorry( this, i18n("Unregnised Port Type: %1").tqarg(typeText) );
return;
}
- QString stateText = m_portStateEdit[row]->text();
+ TQString stateText = m_portStateEdit[row]->text();
bool stateOk = true;
- if ( stateText.startsWith( "0x", false ) ) state = stateText.remove(0,2).toInt( &stateOk, 16 );
- else if ( stateText.contains( QRegExp("[^01]") ) ) state = stateText.toInt( &stateOk, 10 );
+ if ( stateText.tqstartsWith( "0x", false ) ) state = stateText.remove(0,2).toInt( &stateOk, 16 );
+ else if ( stateText.tqcontains( TQRegExp("[^01]") ) ) state = stateText.toInt( &stateOk, 10 );
else state = stateText.toInt( &stateOk, 2 );
if ( !stateOk )
{
-// KMessageBox::sorry( this, i18n("Unregnised Port State: %1").arg(stateText) );
+// KMessageBox::sorry( this, i18n("Unregnised Port State: %1").tqarg(stateText) );
return;
}
@@ -400,18 +400,18 @@ void MicroSettingsDlg::savePort( int row )
void MicroSettingsDlg::saveVariable( int row )
{
- QString name = m_pWidget->variables->text( row, 0 );
+ TQString name = m_pWidget->variables->text( row, 0 );
if ( name.isEmpty() ) return;
- QString valueText = m_pWidget->variables->text( row, 1 );
+ TQString valueText = m_pWidget->variables->text( row, 1 );
int value;
bool ok = true;
- if ( valueText.startsWith( "0x", false ) ) value = valueText.remove(0,2).toInt( &ok, 16 );
+ if ( valueText.tqstartsWith( "0x", false ) ) value = valueText.remove(0,2).toInt( &ok, 16 );
else value = valueText.toInt( &ok, 10 );
if (!ok)
{
- KMessageBox::sorry( this, i18n("Invalid variable value: %1").arg(valueText) );
+ KMessageBox::sorry( this, i18n("Invalid variable value: %1").tqarg(valueText) );
return;
}