@ -1,22 +1,22 @@
# include < qcombobox.h>
# include < qevent.h>
# include < qfile.h>
# include < qguardedptr.h>
# include < qlayout.h>
# include < qlineedit.h>
# include < qmap.h>
# include < qpushbutton.h>
# include < qradiobutton.h>
# include < qscrollview.h>
# include < qsizepolicy.h>
# include < qstring.h>
# include < qstringlist.h>
# include < qtextstream.h>
# include < qtimer.h>
# include < qtooltip.h>
# include < qvaluelist.h>
# include < qwhatsthis.h>
# include < qwidget.h>
# include < nt qcombobox.h>
# include < nt qevent.h>
# include < nt qfile.h>
# include < nt qguardedptr.h>
# include < nt qlayout.h>
# include < nt qlineedit.h>
# include < nt qmap.h>
# include < nt qpushbutton.h>
# include < nt qradiobutton.h>
# include < nt qscrollview.h>
# include < nt qsizepolicy.h>
# include < nt qstring.h>
# include < nt qstringlist.h>
# include < nt qtextstream.h>
# include < nt qtimer.h>
# include < nt qtooltip.h>
# include < nt qvaluelist.h>
# include < nt qwhatsthis.h>
# include < nt qwidget.h>
# include <kaccel.h>
# include <kaction.h>
@ -44,7 +44,7 @@
# include "kparanoidline.h"
# include "mathemagics.h"
Mathemagics : : Mathemagics ( QWidget * parent , const char * name , WFlags f )
Mathemagics : : Mathemagics ( T QWidget * parent , const char * name , WFlags f )
: KMainWindow ( parent , name , f )
{
noSave = false ;
@ -52,19 +52,19 @@ Mathemagics::Mathemagics(QWidget *parent, const char *name, WFlags f)
numStackLevels = 0 ;
stackLevels . setAutoDelete ( true ) ;
QWidget * dummy = new QWidget( this ) ;
T QWidget * dummy = new T QWidget( this ) ;
setCentralWidget ( dummy ) ;
QVBoxLayout * topLayout = new QVBoxLayout( dummy , 0 , KDialog : : spacingHint ( ) ) ;
T QVBoxLayout * topLayout = new T QVBoxLayout( dummy , 0 , KDialog : : spacingHint ( ) ) ;
topLevel = new QScrollView( dummy ) ;
topLevel = new T QScrollView( dummy ) ;
topLayout - > addWidget ( topLevel ) ;
boxParent = new QWidget( topLevel - > viewport ( ) ) ;
boxParent = new T QWidget( topLevel - > viewport ( ) ) ;
topLevel - > addChild ( boxParent ) ;
topLevel - > setResizePolicy ( QScrollView: : AutoOneFit ) ;
topLevel - > setResizePolicy ( T QScrollView: : AutoOneFit ) ;
bigBox = new QVBoxLayout( boxParent , KDialog : : marginHint ( ) , KDialog : : spacingHint ( ) ) ;
bigBox = new T QVBoxLayout( boxParent , KDialog : : marginHint ( ) , KDialog : : spacingHint ( ) ) ;
LineEdit = new EditAction ( i18n ( " Values " ) , 0 , this , SLOT ( slotEnter ( ) ) , actionCollection ( ) , " lineedit " ) ;
HistoryBox = new ComboAction ( i18n ( " History " ) , 0 , 0 , 0 , actionCollection ( ) , " history " ) ;
@ -76,7 +76,7 @@ Mathemagics::Mathemagics(QWidget *parent, const char *name, WFlags f)
topLayout - > addWidget ( keypad ) ;
connect ( keypad , SIGNAL ( closing ( ) ) , this , SLOT ( keypadClosing ( ) ) ) ;
connect ( keypad , SIGNAL ( insertChar ( const QString & ) ) , this , SLOT ( insertChar ( const QString & ) ) ) ;
connect ( keypad , SIGNAL ( insertChar ( const T QString & ) ) , this , SLOT ( insertChar ( const T QString & ) ) ) ;
connect ( keypad , SIGNAL ( add ( ) ) , this , SLOT ( slotAdd ( ) ) ) ;
connect ( keypad , SIGNAL ( subtract ( ) ) , this , SLOT ( slotSubtract ( ) ) ) ;
connect ( keypad , SIGNAL ( multiply ( ) ) , this , SLOT ( slotMultiply ( ) ) ) ;
@ -86,7 +86,7 @@ Mathemagics::Mathemagics(QWidget *parent, const char *name, WFlags f)
connect ( keypad , SIGNAL ( eex ( ) ) , this , SLOT ( slotEEX ( ) ) ) ;
keypad - > hide ( ) ;
QStringList options ( i18n ( " Degrees " ) ) ;
T QStringList options ( i18n ( " Degrees " ) ) ;
options . append ( i18n ( " Radians " ) ) ;
options . append ( i18n ( " Grads " ) ) ;
angGroup = new KListAction ( i18n ( " Angle " ) , 0 , 0 , 0 , actionCollection ( ) , " angle " ) ;
@ -100,7 +100,7 @@ Mathemagics::Mathemagics(QWidget *parent, const char *name, WFlags f)
baseGroup = new KListAction ( i18n ( " Base " ) , 0 , 0 , 0 , actionCollection ( ) , " base " ) ;
baseGroup - > setItems ( options ) ;
QStringList defaultFormulae ;
T QStringList defaultFormulae ;
formulae = new KListAction ( i18n ( " &Formulae " ) , 0 , 0 , 0 , actionCollection ( ) , " formulae " ) ;
# include "formulae"
formulae - > setItems ( defaultFormulae ) ;
@ -156,9 +156,9 @@ Mathemagics::Mathemagics(QWidget *parent, const char *name, WFlags f)
connect ( baseGroup , SIGNAL ( activated ( int ) ) , this , SLOT ( slotBaseChanged ( int ) ) ) ;
connect ( angGroup , SIGNAL ( activated ( int ) ) , this , SLOT ( slotAngleChanged ( int ) ) ) ;
connect ( formulae , SIGNAL ( activated ( const QString & ) ) , this , SLOT ( runFormula ( const QString & ) ) ) ;
connect ( formulae , SIGNAL ( activated ( const T QString & ) ) , this , SLOT ( runFormula ( const T QString & ) ) ) ;
connect ( HistoryBox - > combo ( ) , SIGNAL ( activated ( const QString& ) ) , this , SLOT ( slotPushHighlighted ( const QString& ) ) ) ;
connect ( HistoryBox - > combo ( ) , SIGNAL ( activated ( const T QString& ) ) , this , SLOT ( slotPushHighlighted ( const T QString& ) ) ) ;
connect ( LineEdit - > edit ( ) , SIGNAL ( backspacePressed ( ) ) , this , SLOT ( slotBackspace ( ) ) ) ;
@ -178,8 +178,8 @@ Mathemagics::Mathemagics(QWidget *parent, const char *name, WFlags f)
variables [ " gradkey " ] = 2 ;
defVariables . append ( " gradkey " ) ;
Stack = new QValueList< double > ;
SavedStack = new QValueList< double > ;
Stack = new T QValueList< double > ;
SavedStack = new T QValueList< double > ;
optionDialog = 0 ;
// how long do status msgs stay up? in ms
@ -195,10 +195,10 @@ Mathemagics::Mathemagics(QWidget *parent, const char *name, WFlags f)
kapp - > config ( ) - > setGroup ( " Session " ) ;
QStringList stackList = kapp - > config ( ) - > readListEntry ( " Stack " , ' , ' ) ;
T QStringList stackList = kapp - > config ( ) - > readListEntry ( " Stack " , ' , ' ) ;
int i ;
QStringList historyList = kapp - > config ( ) - > readListEntry ( " History " , ' , ' ) ;
T QStringList historyList = kapp - > config ( ) - > readListEntry ( " History " , ' , ' ) ;
int count = historyList . count ( ) ;
if ( historyList . first ( ) ! = " Nothing " & & count > 0 )
{
@ -243,7 +243,7 @@ void Mathemagics::keypadClosing()
keypadAct - > setChecked ( false ) ;
}
void Mathemagics : : insertChar ( const QString & s )
void Mathemagics : : insertChar ( const T QString & s )
{
LineEdit - > insert ( s ) ;
}
@ -269,7 +269,7 @@ void Mathemagics::updateStack()
level - > edit ( ) - > setText ( format ( * Stack - > at ( i - 1 ) ) ) ;
}
QTimer: : singleShot ( 100 , this , SLOT ( scrollToBottom ( ) ) ) ;
T QTimer: : singleShot ( 100 , this , SLOT ( scrollToBottom ( ) ) ) ;
}
void Mathemagics : : enter ( )
@ -282,13 +282,13 @@ void Mathemagics::enter()
bool oldNoSave = noSave ;
noSave = true ;
QStringList entryNums = this - > entryNums ;
T QStringList entryNums = this - > entryNums ;
this - > entryNums . clear ( ) ;
QString oldLineText = LineEdit - > edit ( ) - > text ( ) ;
T QString oldLineText = LineEdit - > edit ( ) - > text ( ) ;
LineEdit - > clear ( ) ;
for ( QStringList: : Iterator it = entryNums . begin ( ) ; it ! = entryNums . end ( ) ; + + it )
for ( T QStringList: : Iterator it = entryNums . begin ( ) ; it ! = entryNums . end ( ) ; + + it )
{
int eIndex ;
int eqIndex = ( * it ) . find ( ' = ' ) ;
@ -298,11 +298,11 @@ void Mathemagics::enter()
if ( eqIndex > = 0 & & ( dolIndex < 0 | | dolIndex > eqIndex ) ) // add equation
{
QString formulaName = ( * it ) . left ( eqIndex ) ;
T QString formulaName = ( * it ) . left ( eqIndex ) ;
if ( formulaName . isEmpty ( ) )
continue ;
QString formula = ( * it ) . right ( ( * it ) . length ( ) - eqIndex - 1 ) ;
T QString formula = ( * it ) . right ( ( * it ) . length ( ) - eqIndex - 1 ) ;
for ( + + it ; it ! = entryNums . end ( ) ; + + it )
{
@ -312,7 +312,7 @@ void Mathemagics::enter()
formulas [ formulaName ] = formula ;
QStringList newList ( formulae - > items ( ) ) ;
T QStringList newList ( formulae - > items ( ) ) ;
newList . remove ( formulaName ) ;
if ( ! formulaName . isEmpty ( ) )
@ -326,10 +326,10 @@ void Mathemagics::enter()
}
else if ( ( eIndex = ( * it ) . find ( ' E ' ) ) ! = - 1 & & ! notDec ) // E found
{
QString firstArg = ( * it ) . left ( eIndex ) ;
T QString firstArg = ( * it ) . left ( eIndex ) ;
if ( firstArg . isEmpty ( ) )
continue ;
QString secondArg = ( * it ) . right ( ( * it ) . length ( ) - eIndex - 1 ) ;
T QString secondArg = ( * it ) . right ( ( * it ) . length ( ) - eIndex - 1 ) ;
val = firstArg . toDouble ( & ok ) * pow ( 10 , secondArg . toDouble ( & ok ) ) ;
if ( ok )
{
@ -379,7 +379,7 @@ bool Mathemagics::parseArgs(unsigned int reqArgs, bool autoEnter, bool save)
if ( ! LineEdit - > text ( ) . isEmpty ( ) )
{
entryNums = QStringList: : split ( QChar( ' ' ) , LineEdit - > text ( ) ) ;
entryNums = T QStringList: : split ( T QChar( ' ' ) , LineEdit - > text ( ) ) ;
entryNumsCount = entryNums . count ( ) ;
}
@ -404,7 +404,7 @@ int Mathemagics::testArgs()
if ( ! LineEdit - > text ( ) . isEmpty ( ) )
{
entryNums = QStringList: : split ( QChar( ' ' ) , LineEdit - > text ( ) ) ;
entryNums = T QStringList: : split ( T QChar( ' ' ) , LineEdit - > text ( ) ) ;
entryNumsCount = entryNums . count ( ) ;
}
@ -422,7 +422,7 @@ void Mathemagics::saveStack()
void Mathemagics : : slotRestoreStack ( )
{
// a simple swap
QValueList< double > * SavedStackPtr = Stack ;
T QValueList< double > * SavedStackPtr = Stack ;
Stack = SavedStack ;
SavedStack = SavedStackPtr ;
@ -795,7 +795,7 @@ void Mathemagics::slotRaiseTen()
void Mathemagics : : slotEEX ( )
{
if ( base = = 10 | | base > = 15 )
LineEdit - > insert ( QString( " E " ) ) ;
LineEdit - > insert ( T QString( " E " ) ) ;
}
void Mathemagics : : slotPercent ( )
@ -829,7 +829,7 @@ void Mathemagics::slotModulo()
return ;
theResult = fmod ( * Stack - > at ( 1 ) , Stack - > first ( ) ) ;
changeStatus ( & theResult , QString( i18n ( " %1 mod " ) ) . arg ( * Stack - > at ( 1 ) ) , 1 ) ;
changeStatus ( & theResult , T QString( i18n ( " %1 mod " ) ) . arg ( * Stack - > at ( 1 ) ) , 1 ) ;
Stack - > pop_front ( ) ;
Stack - > first ( ) = theResult ;
@ -855,7 +855,7 @@ void Mathemagics::slotPower()
parseArgs ( 2 ) ;
theResult = pow ( * Stack - > at ( 1 ) , 1 / Stack - > first ( ) ) ;
changeStatus ( & theResult , QString( i18n ( " %1 root of " ) ) . arg ( format ( * Stack - > at ( 1 ) ) ) , true ) ;
changeStatus ( & theResult , T QString( i18n ( " %1 root of " ) ) . arg ( format ( * Stack - > at ( 1 ) ) ) , true ) ;
InvButton - > setChecked ( false ) ;
}
@ -872,7 +872,7 @@ void Mathemagics::slotPower()
parseArgs ( 2 ) ;
theResult = pow ( * Stack - > at ( 1 ) , Stack - > first ( ) ) ;
changeStatus ( & theResult , QString( i18n ( " %1 ^ " ) ) . arg ( format ( * Stack - > at ( 1 ) ) ) , 1 ) ;
changeStatus ( & theResult , T QString( i18n ( " %1 ^ " ) ) . arg ( format ( * Stack - > at ( 1 ) ) ) , 1 ) ;
}
Stack - > pop_front ( ) ;
@ -890,7 +890,7 @@ void Mathemagics::slotNegative()
}
else
{
QString text = LineEdit - > text ( ) ;
T QString text = LineEdit - > text ( ) ;
unsigned int cursPos = LineEdit - > edit ( ) - > cursorPosition ( ) ;
unsigned int length = text . length ( ) ;
@ -901,7 +901,7 @@ void Mathemagics::slotNegative()
if ( base = = 10 & & eindex ! = - 1 )
negIndex = eindex + 1 ;
if ( text . at ( negIndex ) = = QChar( ' - ' ) )
if ( text . at ( negIndex ) = = T QChar( ' - ' ) )
{
text . remove ( negIndex , 1 ) ;
LineEdit - > edit ( ) - > setText ( text ) ;
@ -923,7 +923,7 @@ void Mathemagics::slotAnd()
{
theResult = ( long int ) Stack - > first ( ) & ( long int ) * Stack - > at ( 1 ) ;
double pass = ( double ) theResult ;
changeStatus ( & pass , QString( i18n ( " %1 AND " ) ) . arg ( format ( * Stack - > at ( 1 ) ) ) , 1 ) ;
changeStatus ( & pass , T QString( i18n ( " %1 AND " ) ) . arg ( format ( * Stack - > at ( 1 ) ) ) , 1 ) ;
Stack - > pop_front ( ) ;
Stack - > pop_front ( ) ;
Stack - > prepend ( theResult ) ;
@ -939,7 +939,7 @@ void Mathemagics::slotXOr()
double theResult ;
theResult = ( long int ) Stack - > first ( ) ^ ( long int ) * Stack - > at ( 1 ) ;
changeStatus ( & theResult , QString( i18n ( " %1 XOR " ) ) . arg ( format ( * Stack - > at ( 1 ) ) ) , 1 ) ;
changeStatus ( & theResult , T QString( i18n ( " %1 XOR " ) ) . arg ( format ( * Stack - > at ( 1 ) ) ) , 1 ) ;
Stack - > pop_front ( ) ;
Stack - > pop_front ( ) ;
Stack - > prepend ( theResult ) ;
@ -952,7 +952,7 @@ void Mathemagics::slotOr()
double theResult ;
theResult = ( long int ) Stack - > first ( ) | ( long int ) * Stack - > at ( 1 ) ;
changeStatus ( & theResult , QString( i18n ( " %1 OR " ) ) . arg ( format ( * Stack - > at ( 1 ) ) ) , 1 ) ;
changeStatus ( & theResult , T QString( i18n ( " %1 OR " ) ) . arg ( format ( * Stack - > at ( 1 ) ) ) , 1 ) ;
Stack - > pop_front ( ) ;
Stack - > pop_front ( ) ;
Stack - > prepend ( theResult ) ;
@ -968,7 +968,7 @@ void Mathemagics::slotRsh()
double theResult ;
theResult = ( long int ) * Stack - > at ( 1 ) > > ( long int ) Stack - > first ( ) ;
changeStatus ( & theResult , QString( i18n ( " %1 RSH " ) ) . arg ( format ( * Stack - > at ( 1 ) ) ) , true ) ;
changeStatus ( & theResult , T QString( i18n ( " %1 RSH " ) ) . arg ( format ( * Stack - > at ( 1 ) ) ) , true ) ;
Stack - > pop_front ( ) ;
Stack - > pop_front ( ) ;
@ -985,7 +985,7 @@ void Mathemagics::slotLsh()
double theResult ;
theResult = ( long int ) * Stack - > at ( 1 ) < < ( long int ) Stack - > first ( ) ;
changeStatus ( & theResult , QString( i18n ( " %1 LSH " ) ) . arg ( format ( * Stack - > at ( 1 ) ) ) , true ) ;
changeStatus ( & theResult , T QString( i18n ( " %1 LSH " ) ) . arg ( format ( * Stack - > at ( 1 ) ) ) , true ) ;
Stack - > pop_front ( ) ;
Stack - > pop_front ( ) ;
@ -1045,9 +1045,9 @@ void Mathemagics::slotBackspace()
}
}
void Mathemagics : : closeEvent ( QCloseEvent * /*e*/ )
void Mathemagics : : closeEvent ( T QCloseEvent * /*e*/ )
{
QString list ;
T QString list ;
unsigned int i ;
kapp - > config ( ) - > setGroup ( " Session " ) ;
@ -1100,7 +1100,7 @@ void Mathemagics::slotConfigure()
void Mathemagics : : slotConfigureHide ( )
{
QTimer: : singleShot ( 0 , this , SLOT ( slotConfigureDestroy ( ) ) ) ;
T QTimer: : singleShot ( 0 , this , SLOT ( slotConfigureDestroy ( ) ) ) ;
}
void Mathemagics : : slotConfigureDestroy ( )
@ -1196,7 +1196,7 @@ void Mathemagics::slotUpdateStackLevel(int level)
{
saveStack ( ) ;
const QString stackText ( stackLevels . at ( level - 1 ) - > edit ( ) - > text ( ) ) ;
const T QString stackText ( stackLevels . at ( level - 1 ) - > edit ( ) - > text ( ) ) ;
if ( stackText . isEmpty ( ) )
{
Stack - > remove ( Stack - > at ( level - 1 ) ) ;
@ -1223,23 +1223,23 @@ void Mathemagics::slotRevert()
statusBar ( ) - > message ( i18n ( " Changes destroyed " ) , dispTime ) ;
}
double Mathemagics : : format ( QString theString , bool * ok )
double Mathemagics : : format ( T QString theString , bool * ok )
{
return ( base ! = 10 ? ( double ) theString . toInt ( ok , base ) : theString . toDouble ( ok ) ) ;
}
QString Mathemagics : : format ( double theDouble )
T QString Mathemagics : : format ( double theDouble )
{
if ( base ! = 10 )
{
QString convStr ;
T QString convStr ;
convStr . setNum ( ( int ) theDouble , base ) ;
if ( showPeriod )
convStr . append ( ' . ' ) ;
return convStr ;
}
QString decimal = QString: : number ( theDouble , ' f ' , formatPrec ) ;
T QString decimal = T QString: : number ( theDouble , ' f ' , formatPrec ) ;
// leave zeroes on
if ( fixedPrec )
@ -1363,7 +1363,7 @@ void Mathemagics::rolld(unsigned int index)
updateStack ( ) ;
}
void Mathemagics : : changeStatus ( QString text )
void Mathemagics : : changeStatus ( T QString text )
{
const unsigned int maxLength = 30 ;
@ -1372,7 +1372,7 @@ void Mathemagics::changeStatus(QString text)
if ( HistoryBox - > combo ( ) - > count ( ) > = histNum ) HistoryBox - > combo ( ) - > removeItem ( 0 ) ;
if ( histDetail )
text = QString( text + i18n ( " Base: %2; %3 " ) ) . arg ( base ) . arg ( theAngle ( ) ) ;
text = T QString( text + i18n ( " Base: %2; %3 " ) ) . arg ( base ) . arg ( theAngle ( ) ) ;
if ( text . length ( ) > maxLength )
{
@ -1389,7 +1389,7 @@ void Mathemagics::clearHistory()
HistoryBox - > combo ( ) - > clear ( ) ;
}
QString Mathemagics : : theAngle ( )
T QString Mathemagics : : theAngle ( )
{
switch ( angle )
{
@ -1406,7 +1406,7 @@ QString Mathemagics::theAngle()
return " Deg " ;
}
void Mathemagics : : slotPushHighlighted ( const QString& text )
void Mathemagics : : slotPushHighlighted ( const T QString& text )
{
saveStack ( ) ;
@ -1431,7 +1431,7 @@ void Mathemagics::error()
changeStatusError ( " Bad arguments " ) ;
}
void Mathemagics : : changeStatusError ( QString text )
void Mathemagics : : changeStatusError ( T QString text )
{
text . prepend ( i18n ( " Error: " ) ) ;
statusBar ( ) - > message ( text , dispTime ) ;
@ -1442,15 +1442,15 @@ void Mathemagics::changeStatusError(QString text)
void Mathemagics : : changeStatus ( double * res , char op )
{
changeStatus ( QString( i18n ( " %1 %2 %3 = %4 " ) ) . arg ( format ( * Stack - > at ( 1 ) ) ) . arg ( op ) . arg ( format ( Stack - > first ( ) ) ) . arg ( format ( * res ) ) ) ;
changeStatus ( T QString( i18n ( " %1 %2 %3 = %4 " ) ) . arg ( format ( * Stack - > at ( 1 ) ) ) . arg ( op ) . arg ( format ( Stack - > first ( ) ) ) . arg ( format ( * res ) ) ) ;
}
void Mathemagics : : changeStatus ( double * res , QString op , bool prepend )
void Mathemagics : : changeStatus ( double * res , T QString op , bool prepend )
{
if ( prepend )
changeStatus ( QString( i18n ( " %1%2 = %3 " ) ) . arg ( op ) . arg ( format ( Stack - > first ( ) ) ) . arg ( format ( * res ) ) ) ;
changeStatus ( T QString( i18n ( " %1%2 = %3 " ) ) . arg ( op ) . arg ( format ( Stack - > first ( ) ) ) . arg ( format ( * res ) ) ) ;
else
changeStatus ( QString( i18n ( " %1%2 = %3 " ) ) . arg ( format ( Stack - > first ( ) ) ) . arg ( op ) . arg ( format ( * res ) ) ) ;
changeStatus ( T QString( i18n ( " %1%2 = %3 " ) ) . arg ( format ( Stack - > first ( ) ) ) . arg ( op ) . arg ( format ( * res ) ) ) ;
}
void Mathemagics : : toggleKeypad ( bool on )
@ -1463,25 +1463,25 @@ void Mathemagics::toggleKeypad(bool on)
void Mathemagics : : slotOpen ( )
{
QString filename = KFileDialog : : getOpenFileName ( ) ;
T QString filename = KFileDialog : : getOpenFileName ( ) ;
if ( filename . isNull ( ) )
return ;
openFile ( filename ) ;
}
void Mathemagics : : openFile ( const QString & filename )
void Mathemagics : : openFile ( const T QString & filename )
{
QFile f ( filename ) ;
T QFile f ( filename ) ;
if ( ! f . open ( IO_ReadOnly ) )
return ;
enterMode = true ;
QTextStream t ( & f ) ;
T QTextStream t ( & f ) ;
while ( ! t . eof ( ) )
{
QString s = t . readLine ( ) ;
T QString s = t . readLine ( ) ;
// comments
if ( s . at ( 0 ) = = ' # ' )
@ -1489,7 +1489,7 @@ void Mathemagics::openFile(const QString &filename)
if ( ! s . isEmpty ( ) )
{
entryNums = QStringList: : split ( QChar( ' ' ) , s ) ;
entryNums = T QStringList: : split ( T QChar( ' ' ) , s ) ;
enter ( ) ;
}
}
@ -1498,13 +1498,13 @@ void Mathemagics::openFile(const QString &filename)
updateStack ( ) ;
}
void Mathemagics : : saveFile ( const QString & filename )
void Mathemagics : : saveFile ( const T QString & filename )
{
QFile f ( filename ) ;
T QFile f ( filename ) ;
if ( ! f . open ( IO_WriteOnly ) )
return ;
QTextStream t ( & f ) ;
T QTextStream t ( & f ) ;
t < < " # Saved by mathemagics " < < endl ;
@ -1518,7 +1518,7 @@ void Mathemagics::saveFile(const QString &filename)
bool already = false ;
QValueList< double > : : Iterator it = Stack - > end ( ) ;
T QValueList< double > : : Iterator it = Stack - > end ( ) ;
it - - ;
while ( 1 )
@ -1538,14 +1538,14 @@ void Mathemagics::saveFile(const QString &filename)
t < < endl ;
t < < " # functions " < < endl ;
for ( QMap< QString, QString> : : Iterator it = formulas . begin ( ) ; it ! = formulas . end ( ) ; + + it )
for ( T QMap< T QString, T QString> : : Iterator it = formulas . begin ( ) ; it ! = formulas . end ( ) ; + + it )
{
if ( defFormulas . contains ( it . key ( ) ) < = 0 )
t < < it . key ( ) < < " = " < < it . data ( ) < < endl ;
}
t < < " # variables " < < endl ;
for ( QMap< QString, double > : : Iterator it = variables . begin ( ) ; it ! = variables . end ( ) ; + + it )
for ( T QMap< T QString, double > : : Iterator it = variables . begin ( ) ; it ! = variables . end ( ) ; + + it )
{
if ( defVariables . contains ( it . key ( ) ) < = 0 )
t < < it . data ( ) < < " $ " < < it . key ( ) < < " = " < < endl ; ;
@ -1557,20 +1557,20 @@ void Mathemagics::saveFile(const QString &filename)
t < < ( HypButton - > isChecked ( ) ? " $true " : " $false " ) < < " sethyp " < < endl ;
}
void Mathemagics : : runFormula ( const QString & name )
void Mathemagics : : runFormula ( const T QString & name )
{
formulae - > setCurrentItem ( - 1 ) ;
QString s = formulas [ name ] ;
T QString s = formulas [ name ] ;
saveStack ( ) ;
bool oldNoSave = noSave ;
noSave = true ;
QStringList l = QStringList: : split ( ' ' , s ) ;
for ( QStringList: : Iterator it = l . begin ( ) ; it ! = l . end ( ) ; + + it )
T QStringList l = T QStringList: : split ( ' ' , s ) ;
for ( T QStringList: : Iterator it = l . begin ( ) ; it ! = l . end ( ) ; + + it )
{
QString command = ( * it ) ;
T QString command = ( * it ) ;
bool ok ;
double num = format ( command , & ok ) ;
@ -1588,7 +1588,7 @@ void Mathemagics::runFormula(const QString &name)
}
// tests and returns startswith, and removes the search string from string if matches
bool removeStartsWith ( QString & s , const QString & search )
bool removeStartsWith ( T QString & s , const T QString & search )
{
if ( s . startsWith ( search ) )
{
@ -1599,17 +1599,17 @@ bool removeStartsWith(QString &s, const QString &search)
return false ;
}
bool Mathemagics : : runCommand ( const QString & command )
bool Mathemagics : : runCommand ( const T QString & command )
{
// case insensitive
QString operateOn = command . lower ( ) ;
T QString operateOn = command . lower ( ) ;
// allows operators to be embedded in numbers
// this finds a number at beginning of command
while ( ! operateOn . isEmpty ( ) )
{
QChar firstChar ( operateOn . at ( 0 ) ) ;
T QChar firstChar ( operateOn . at ( 0 ) ) ;
if ( firstChar . isNumber ( ) )
{
for ( int i = operateOn . length ( ) ; i > 0 ; - - i )
@ -1628,7 +1628,7 @@ bool Mathemagics::runCommand(const QString &command)
if ( firstChar = = ' $ ' )
{
QString varName = operateOn . right ( operateOn . length ( ) - 1 ) ;
T QString varName = operateOn . right ( operateOn . length ( ) - 1 ) ;
if ( varName . isEmpty ( ) )
return false ;
@ -1821,9 +1821,9 @@ bool Mathemagics::runCommand(const QString &command)
{
bool found = false ;
// go through commands
for ( QMap< QString, QString> : : Iterator it = formulas . begin ( ) ; it ! = formulas . end ( ) & & ! found ; + + it )
for ( T QMap< T QString, T QString> : : Iterator it = formulas . begin ( ) ; it ! = formulas . end ( ) & & ! found ; + + it )
{
QString name = it . key ( ) ;
T QString name = it . key ( ) ;
if ( removeStartsWith ( operateOn , name ) )
{
runFormula ( name ) ;
@ -1865,7 +1865,7 @@ void Mathemagics::newToolBarConfig()
////////////////////////////////////////////////
EditAction : : EditAction ( const QString& text , int accel , const QObject * receiver , const char * member , QObject* parent , const char * name )
EditAction : : EditAction ( const T QString& text , int accel , const T QObject * receiver , const char * member , T QObject* parent , const char * name )
: KAction ( text , accel , parent , name )
{
m_receiver = receiver ;
@ -1876,7 +1876,7 @@ EditAction::~EditAction()
{
}
int EditAction : : plug ( QWidget * w , int index )
int EditAction : : plug ( T QWidget * w , int index )
{
KToolBar * toolBar = ( KToolBar * ) w ;
int id = KAction : : getToolButtonID ( ) ;
@ -1894,7 +1894,7 @@ int EditAction::plug(QWidget *w, int index)
return containerCount ( ) - 1 ;
}
void EditAction : : unplug ( QWidget * w )
void EditAction : : unplug ( T QWidget * w )
{
KToolBar * toolBar = ( KToolBar * ) w ;
int idx = findContainer ( w ) ;
@ -1908,24 +1908,24 @@ void EditAction::clear()
m_combo - > clear ( ) ;
}
void EditAction : : append ( QString text )
void EditAction : : append ( T QString text )
{
m_combo - > setText ( this - > text ( ) + text ) ;
}
void EditAction : : insert ( QString text )
void EditAction : : insert ( T QString text )
{
m_combo - > insert ( text ) ;
}
QGuardedPtr< KParanoidLine > EditAction : : edit ( )
T QGuardedPtr< KParanoidLine > EditAction : : edit ( )
{
return m_combo ;
}
////////////////////////////////////////////////
ComboAction : : ComboAction ( const QString& text , int accel , const QObject * receiver , const char * member , QObject* parent , const char * name )
ComboAction : : ComboAction ( const T QString& text , int accel , const T QObject * receiver , const char * member , T QObject* parent , const char * name )
: KAction ( text , accel , parent , name )
{
m_receiver = receiver ;
@ -1936,13 +1936,13 @@ ComboAction::~ComboAction()
{
}
int ComboAction : : plug ( QWidget * w , int index )
int ComboAction : : plug ( T QWidget * w , int index )
{
KToolBar * toolBar = ( KToolBar * ) w ;
int id = KAction : : getToolButtonID ( ) ;
QComboBox * comboBox = new QComboBox( toolBar , " search edit " ) ;
T QComboBox * comboBox = new T QComboBox( toolBar , " search edit " ) ;
toolBar - > insertWidget ( id , 70 , comboBox , index ) ;
if ( m_receiver )
connect ( comboBox , SIGNAL ( returnPressed ( ) ) , m_receiver , m_member ) ;
@ -1955,7 +1955,7 @@ int ComboAction::plug(QWidget *w, int index)
return containerCount ( ) - 1 ;
}
void ComboAction : : unplug ( QWidget * w )
void ComboAction : : unplug ( T QWidget * w )
{
KToolBar * toolBar = ( KToolBar * ) w ;
int idx = findContainer ( w ) ;
@ -1965,7 +1965,7 @@ void ComboAction::unplug(QWidget *w)
m_combo = 0L ;
}
QGuardedPtr< QComboBox> ComboAction : : combo ( )
T QGuardedPtr< T QComboBox> ComboAction : : combo ( )
{
return m_combo ;
}