summaryrefslogtreecommitdiff
path: root/noncore/tools
authormickeyl <mickeyl>2004-04-04 13:54:40 (UTC)
committer mickeyl <mickeyl>2004-04-04 13:54:40 (UTC)
commit16cf79e90b5217f8d4bfce2a0fa817ae4b73db36 (patch) (side-by-side diff)
tree0701eae15aa606a0211a2fccfde0eafdac69357c /noncore/tools
parent8d2d2664e5f544b8292806e617deb7a0e4170dc0 (diff)
downloadopie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.zip
opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.gz
opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.bz2
convert to Opie Debugging Framework
Diffstat (limited to 'noncore/tools') (more/less context) (show whitespace changes)
-rw-r--r--noncore/tools/calc2/engine.cpp10
-rw-r--r--noncore/tools/calculator/calculator.pro0
-rw-r--r--noncore/tools/calculator/calculatorimpl.cpp11
-rw-r--r--noncore/tools/formatter/formatter.cpp36
-rw-r--r--noncore/tools/formatter/formatter.pro0
5 files changed, 33 insertions, 24 deletions
diff --git a/noncore/tools/calc2/engine.cpp b/noncore/tools/calc2/engine.cpp
index a9a47c4..e843e29 100644
--- a/noncore/tools/calc2/engine.cpp
+++ b/noncore/tools/calc2/engine.cpp
@@ -96,17 +96,17 @@ void Engine::pushValue (char v)
case rFraction:
break;
default:
displayString.append(v);
num.i=displayString.toInt(&ok, calcBase());
};
if (!ok) {
state = sError;
- qDebug("pushValue() - num->string conversion");
+ odebug << "pushValue() - num->string conversion" << oendl;
} else {
const QString constString = displayString;
emit(display(constString));
};
} else if (state == sStart) {
softReset();
displayString.truncate(0);
@@ -122,39 +122,39 @@ void Engine::del ()
{
bool ok;
switch (currentRep) {
case rDouble:
displayString.truncate(displayString.length());
num.dbl=displayString.toDouble(&ok);
break;
case rFraction:
- qDebug("not available");
+ odebug << "not available" << oendl;
break;
default:
displayString.truncate(displayString.length());
num.i = displayString.toInt(&ok, calcBase());
};
if (!ok) {
state = sError;
- qDebug("del() - num->string conversion");
+ odebug << "del() - num->string conversion" << oendl;
} else {
const QString constString = displayString;
emit(display(constString));
};
}
void Engine::displayData(Data d) {
switch (currentRep) {
case rDouble:
displayString.setNum(d.dbl);
break;
case rFraction:
- qDebug("fractional display not yet impl");
+ odebug << "fractional display not yet impl" << oendl;
break;
default:
displayString.setNum(d.i, calcBase());
break;
};
const QString constString= displayString;
emit(display(constString));
}
@@ -167,17 +167,17 @@ int Engine::calcBase () {
case rOct:
return 8;
case rDec:
return 10;
case rHex:
return 16;
default:
state = sError;
- qDebug("Error - attempt to calc base for non-integer");
+ odebug << "Error - attempt to calc base for non-integer" << oendl;
return 10;
};
}
// Special instruction for internal use only
class iOpenBrace:public Instruction {
public:
iOpenBrace (Engine *e):Instruction (100) {engine = e;};
diff --git a/noncore/tools/calculator/calculator.pro b/noncore/tools/calculator/calculator.pro
index ae6a666..78d4519 100644
--- a/noncore/tools/calculator/calculator.pro
+++ b/noncore/tools/calculator/calculator.pro
diff --git a/noncore/tools/calculator/calculatorimpl.cpp b/noncore/tools/calculator/calculatorimpl.cpp
index dead03d..05cb9b5 100644
--- a/noncore/tools/calculator/calculatorimpl.cpp
+++ b/noncore/tools/calculator/calculatorimpl.cpp
@@ -21,30 +21,37 @@
/*
* 01/14/2002 Charles-Edouard Ruault <ce@ruault.com>
* Added support for Temperature conversions.
*/
// Sat 03-09-2002 L.J. Potter added the inlined pixmaps here
#include "calculatorimpl.h"
+/* OPIE */
+#include <opie2/odebug.h>
#include <qpe/resource.h>
#include <qpe/qmath.h>
#include <qpe/qpeapplication.h>
+using namespace Opie::Core;
+/* QT */
#include <qpushbutton.h>
#include <qcombobox.h>
#include <qlabel.h>
#include <qfont.h>
#include <qlayout.h>
#include <qstringlist.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qmessagebox.h>
+
+/* STD */
#include <math.h>
+
/* XPM */
static char *oneoverx_xpm[] = {
/* width height num_colors chars_per_pixel */
" 13 11 2 1",
/* colors */
". c None",
"# c #000000",
/* pixels */
@@ -228,17 +235,17 @@ CalculatorImpl::CalculatorImpl( QWidget * parent, const char * name,
ComboBoxFunction->insertItem(captions.last());
// now add in the conversion modes
// when the menu gets done, these should be in a submenu
QString tmp = QPEApplication::qpeDir();
tmp += "etc/unit_conversion.dat";
QFile myfile(tmp);
if ( !myfile.open( IO_Translate | IO_ReadOnly ) ) {
- qDebug("Data file unit_conversion.dat not found\nNo conversion features will be available\n"+tmp);
+ odebug << "Data file unit_conversion.dat not found\nNo conversion features will be available\n"+tmp << oendl;
// disable the f button if no conv file available
ComboBoxFunction->setEnabled(FALSE);
}
else {
QString line, line2;
QTextStream ts(&myfile);
// first pass, see how many conversion types there are in order to allocate for them
@@ -502,17 +509,17 @@ void CalculatorImpl::execOp( Operation i )
state = sNewNumber;
return;
}
case oCloseBrace: {
if ( numOpenBraces == 0 )
return;
processStack( oAdd );
if ( operationStack.top().operation != oOpenBrace )
- qDebug( "Calculator: internal Error" );
+ odebug << "Calculator: internal Error" << oendl;
operationStack.pop();
state = sNewNumber;
numOpenBraces--;
break;
}
case oPoint:
flPoint = TRUE;
diff --git a/noncore/tools/formatter/formatter.cpp b/noncore/tools/formatter/formatter.cpp
index 4204d73..642196e 100644
--- a/noncore/tools/formatter/formatter.cpp
+++ b/noncore/tools/formatter/formatter.cpp
@@ -6,23 +6,24 @@
**
****************************************************************************/
#include "formatter.h"
#include "inputDialog.h"
#include "output.h"
/* OPIE */
-#include <qtoolbar.h>
+#include <opie2/odebug.h>
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qpe/mimetype.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/storage.h>
+using namespace Opie::Core;
/* QT */
#include <qmenubar.h>
#include <qmultilineedit.h>
#include <qstring.h>
#include <qlist.h>
#include <qstringlist.h>
#include <qdir.h>
@@ -30,16 +31,17 @@
#include <qtstream.h>
#include <qcombobox.h>
#include <qpopupmenu.h>
#include <qmessagebox.h>
#include <qregexp.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
+#include <qtoolbar.h>
#include <qtabwidget.h>
#include <qwidget.h>
#include <qlayout.h>
#include <qvariant.h>
/* STD */
#include <unistd.h>
#include <stdio.h>
@@ -233,60 +235,60 @@ void FormatterApp::doFormat()
FILE *fp;
char line[130];
outDlg->OutputEdit->append( tr("Trying to umount %1.").arg( currentText) );
outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
sleep(1);
- qDebug("Command is "+umountS);
+ odebug << "Command is "+umountS << oendl;
fp = popen( (const char *) umountS, "r");
- // qDebug("%d", fp);
+ // odebug << "" << fp << "" << oendl;
if ( !fp )
{
- qDebug("Could not execute '" + umountS + "'! err=%d\n" +(QString)strerror(errno), err);
+ odebug << "Could not execute '" + umountS + "'! err=" << err << "\n" +(QString)strerror(errno) << oendl;
QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") );
pclose(fp);
return;
}
else
{
// outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted."));
// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
while ( fgets( line, sizeof line, fp))
{
if( ((QString)line).find("busy",0,TRUE) != -1)
{
- qDebug("Could not find '" + umountS);
+ odebug << "Could not find '" + umountS << oendl;
QMessageBox::warning( this, tr("Formatter"), tr("Could not umount.\nDevice is busy!"), tr("&OK") );
pclose(fp);
return;
}
else
{
QString lineStr = line;
lineStr=lineStr.left(lineStr.length()-1);
outDlg->OutputEdit->append(lineStr);
outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
}
}
}
pclose(fp);
- qDebug("Command would be: "+cmd);
+ odebug << "Command would be: "+cmd << oendl;
outDlg->OutputEdit->append( tr("Trying to format.") );
outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
fp = popen( (const char *) cmd, "r");
while ( fgets( line, sizeof line, fp))
{
if( ((QString)line).find("No such device",0,TRUE) != -1)
{
- qDebug("No such device '" + umountS);
+ odebug << "No such device '" + umountS << oendl;
QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") );
pclose(fp);
// outDlg->OutputEdit->append("No such device");
// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
return;
}
else
{
@@ -300,17 +302,17 @@ void FormatterApp::doFormat()
outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
pclose(fp);
outDlg->OutputEdit->append( tr("Trying to mount %1.").arg( currentText) );
outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
fp = popen( (const char *) remountS, "r");
if ( !fp)
{
- qDebug("Could not execute '" + remountS + "'! err=%d\n" +(QString)strerror(errno), err);
+ odebug << "Could not execute '" + remountS + "'! err=" << err << "\n" +(QString)strerror(errno) << oendl;
QMessageBox::warning( this, tr("Formatter"), tr("Card mount failed!"), tr("&OK") );
}
else
{
outDlg->OutputEdit->append(tr("%1\nhas been successfully mounted.").arg( currentText ));
while ( fgets( line, sizeof line, fp))
{
@@ -375,17 +377,17 @@ void FormatterApp::storageComboSelected(int index )
QString currentText = storageComboBox->text(index);
QString nameS = currentText.left( currentText.find("->",0,TRUE));
TextLabel4->setText( tr( "Storage Type: %1").arg( nameS) );
currentText = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4);
QString fsType = getFileSystemType((const QString &) currentText);
- // qDebug(fsType);
+ // odebug << fsType << oendl;
for(int i = 0; i < fileSystemsCombo->count(); i++)
{
if( fsType == fileSystemsCombo->text(i))
fileSystemsCombo->setCurrentItem(i);
}
// deviceComboSelected(index);
}
@@ -459,17 +461,17 @@ void FormatterApp::parsetab(const QString &fileName)
if(deviceName != "none")
{
if( fsList.contains(filesystemType) == 0
& filesystemType.find("proc",0,TRUE) == -1
& filesystemType.find("cramfs",0,TRUE) == -1
& filesystemType.find("auto",0,TRUE) == -1)
fsList << filesystemType;
deviceList << deviceName;
- qDebug(deviceName+"::"+filesystemType);
+ odebug << deviceName+"::"+filesystemType << oendl;
fileSystemTypeList << deviceName+"::"+filesystemType;
}
}
}
endmntent( mntfp );
// } else if(fileName == "/etc/fstab") {
// QFile f("/etc/fstab");
// if ( f.open(IO_ReadOnly) ) {
@@ -501,17 +503,17 @@ QString FormatterApp::getFileSystemType(const QString &currentText)
parsetab("/etc/mtab"); //why did TT forget filesystem type?
for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it )
{
QString temp = (*it);
if( temp.find( currentText,0,TRUE) != -1)
{
return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
- // qDebug(fsType);
+ // odebug << fsType << oendl;
}
}
return "";
}
bool FormatterApp::doFsck()
{
@@ -528,49 +530,49 @@ bool FormatterApp::doFsck()
// QString umountS = "umount -v /floppy 2>&1";
// QString remountS = "mount -v /floppy 2>&1";
// selectedDevice ="/dev/fd0";
// #endif
QString fsType = getFileSystemType((const QString &)selectedDevice);
QString cmd;
- qDebug( selectedDevice +" "+ fsType);
+ odebug << selectedDevice +" "+ fsType << oendl;
if(fsType == "vfat") cmd = "dosfsck -vy ";
if(fsType == "ext2") cmd = "e2fsck -cpvy ";
cmd += selectedDevice + " 2>&1";
outDlg = new Output(this, tr("Formatter Output"),FALSE);
QPEApplication::showDialog( outDlg );
qApp->processEvents();
FILE *fp;
char line[130];
outDlg->OutputEdit->append( tr("Trying to umount."));
outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
sleep(1);
- // qDebug("Command is "+umountS);
+ // odebug << "Command is "+umountS << oendl;
fp = popen( (const char *) umountS, "r");
- // qDebug("%d", fp);
+ // odebug << "" << fp << "" << oendl;
if ( !fp )
{
- qDebug("Could not execute '" + umountS + "'!\n" +(QString)strerror(errno));
+ odebug << "Could not execute '" + umountS + "'!\n" +(QString)strerror(errno) << oendl;
QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") );
pclose(fp);
return false;
}
else
{
// outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted."));
// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
while ( fgets( line, sizeof line, fp))
{
if( ((QString)line).find("busy",0,TRUE) != -1)
{
- qDebug("Could not find '" + umountS);
+ odebug << "Could not find '" + umountS << oendl;
QMessageBox::warning( this, tr("Formatter"),
tr("Could not umount.\nDevice is busy!"), tr("&OK") );
pclose(fp);
return false;
}
else
{
QString lineStr = line;
@@ -582,17 +584,17 @@ bool FormatterApp::doFsck()
}
pclose(fp);
/////////////////////////////////////
fp = popen( (const char *) cmd, "r");
while ( fgets( line, sizeof line, fp))
{
if( ((QString)line).find("No such device",0,TRUE) != -1)
{
- qDebug("No such device '" + umountS);
+ odebug << "No such device '" + umountS << oendl;
QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") );
pclose(fp);
// outDlg->OutputEdit->append("No such device");
// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
return false;
}
else
{
diff --git a/noncore/tools/formatter/formatter.pro b/noncore/tools/formatter/formatter.pro
index 913cca8..f6d34c7 100644
--- a/noncore/tools/formatter/formatter.pro
+++ b/noncore/tools/formatter/formatter.pro