summaryrefslogtreecommitdiffstats
path: root/src/piklab-prog
diff options
context:
space:
mode:
Diffstat (limited to 'src/piklab-prog')
-rw-r--r--src/piklab-prog/cli_debug_manager.h1
-rw-r--r--src/piklab-prog/cli_interactive.cpp88
-rw-r--r--src/piklab-prog/cli_interactive.h23
-rw-r--r--src/piklab-prog/cli_prog_manager.cpp4
-rw-r--r--src/piklab-prog/cli_prog_manager.h3
-rw-r--r--src/piklab-prog/cli_purl.cpp10
-rw-r--r--src/piklab-prog/cmdline.cpp80
-rw-r--r--src/piklab-prog/cmdline.h17
8 files changed, 108 insertions, 118 deletions
diff --git a/src/piklab-prog/cli_debug_manager.h b/src/piklab-prog/cli_debug_manager.h
index 8da14fa..10c61ec 100644
--- a/src/piklab-prog/cli_debug_manager.h
+++ b/src/piklab-prog/cli_debug_manager.h
@@ -17,6 +17,7 @@ namespace Debugger
class CliManager : public Manager
{
Q_OBJECT
+ TQ_OBJECT
public:
CliManager() {}
virtual PURL::Url coffUrl() const { return CLI::_coffUrl; }
diff --git a/src/piklab-prog/cli_interactive.cpp b/src/piklab-prog/cli_interactive.cpp
index 148ba62..872a53e 100644
--- a/src/piklab-prog/cli_interactive.cpp
+++ b/src/piklab-prog/cli_interactive.cpp
@@ -15,7 +15,7 @@
# include <stdio.h>
#endif
#include <signal.h>
-#include <qtimer.h>
+#include <tqtimer.h>
#include <stdlib.h>
#include "progs/base/generic_prog.h"
@@ -74,8 +74,8 @@ void CLI::Interactive::signalHandler(int n)
_interactive->redisplayPrompt();
}
-CLI::Interactive::Interactive(QObject *parent)
- : QObject(parent, "interactive")
+CLI::Interactive::Interactive(TQObject *tqparent)
+ : TQObject(tqparent, "interactive")
{
setView(_view);
::signal(SIGINT, signalHandler);
@@ -84,7 +84,7 @@ CLI::Interactive::Interactive(QObject *parent)
#else
_stdin.open(IO_ReadOnly, stdin);
#endif
- QTimer::singleShot(0, this, SLOT(displayPrompt()));
+ TQTimer::singleShot(0, this, TQT_SLOT(displayPrompt()));
}
void CLI::Interactive::redisplayPrompt()
@@ -101,7 +101,7 @@ void CLI::Interactive::displayPrompt()
{
#if defined(HAVE_READLINE)
char *line = readline("> ");
- _input = QString(line);
+ _input = TQString(line);
if ( !_input.isEmpty() ) add_history(line);
free(line);
#else
@@ -109,14 +109,14 @@ void CLI::Interactive::displayPrompt()
fflush(stdout);
char buffer[1000];
_stdin.readLine(buffer, 1000);
- _input = QString(buffer);
+ _input = TQString(buffer);
#endif
lineRead();
}
-CLI::ExitCode CLI::Interactive::processLine(const QString &s)
+CLI::ExitCode CLI::Interactive::processLine(const TQString &s)
{
- QStringList words = QStringList::split(" ", s);
+ TQStringList words = TQStringList::split(" ", s);
if ( words.count()==0 ) return ARG_ERROR;
if ( words[0]=="command-list" || words[0]=="property-list" || words[0]=="range-list"
|| isPropertyList(words[0]) ) return static_cast<Main *>(_main)->list(words[0]);
@@ -131,24 +131,24 @@ CLI::ExitCode CLI::Interactive::processLine(const QString &s)
const CommandData *data = findCommandData(words[0]);
if ( words[0]=="quit" ) return EXITING;
if ( words[0]=="set" ) {
- if ( words.count()==2 ) return static_cast<Main *>(_main)->executeSetCommand(words[1], QString::null);
+ if ( words.count()==2 ) return static_cast<Main *>(_main)->executeSetCommand(words[1], TQString());
if ( words.count()!=3 ) return errorExit(i18n("This command takes two arguments."), ARG_ERROR);
return static_cast<Main *>(_main)->executeSetCommand(words[1], words[2]);
}
if ( words[0]=="unset" ) {
if ( words.count()!=2 ) return errorExit(i18n("This command takes one argument."), ARG_ERROR);
- return static_cast<Main *>(_main)->executeSetCommand(words[1], QString::null);
+ return static_cast<Main *>(_main)->executeSetCommand(words[1], TQString());
}
if ( words[0]=="get" ) {
if ( words.count()!=2 ) return errorExit(i18n("This command takes one argument."), ARG_ERROR);
- QString s = static_cast<Main *>(_main)->executeGetCommand(words[1]);
+ TQString s = static_cast<Main *>(_main)->executeGetCommand(words[1]);
if ( !s.isEmpty() ) log(Log::LineType::Normal, words[1] + ": " + s);
return OK;
}
if ( words[0]=="help" ) return static_cast<Main *>(_main)->list("command-list");
if ( words[0]=="x" ) {
if ( words.count()!=2 && words.count()!=3 ) return errorExit(i18n("This command takes one or two argument."), ARG_ERROR);
- return executeRegister(words[1], words.count()==3 ? words[2] : QString::null);
+ return executeRegister(words[1], words.count()==3 ? words[2] : TQString());
}
if ( words[0]=="break" ) {
if ( words.count()==3 ) {
@@ -158,11 +158,11 @@ CLI::ExitCode CLI::Interactive::processLine(const QString &s)
if ( !ok ) return errorExit(i18n("Number format not recognized."), ARG_ERROR);
PURL::Url dummy;
Breakpoint::Data data(dummy, address);
- if ( Breakpoint::list().contains(data) ) return okExit(i18n("Breakpoint already set at %1.").arg(toHexLabel(address, nbChars(NumberBase::Hex, address))));
+ if ( Breakpoint::list().tqcontains(data) ) return okExit(i18n("Breakpoint already set at %1.").tqarg(toHexLabel(address, nbChars(NumberBase::Hex, address))));
Breakpoint::list().append(data);
Breakpoint::list().setAddress(data, address);
Breakpoint::list().setState(data, Breakpoint::Active);
- return okExit(i18n("Breakpoint set at %1.").arg(toHexLabel(address, nbChars(NumberBase::Hex, address))));
+ return okExit(i18n("Breakpoint set at %1.").tqarg(toHexLabel(address, nbChars(NumberBase::Hex, address))));
}
return errorExit(i18n("The first argument should be \"e\"."), ARG_ERROR);
}
@@ -174,11 +174,11 @@ CLI::ExitCode CLI::Interactive::processLine(const QString &s)
if (_device) nbc = _device->nbCharsAddress();
else for (uint i=0; i<nb; i++) {
Address address = Breakpoint::list().address(Breakpoint::list().data(i));
- nbc = QMAX(nbc, nbChars(NumberBase::Hex, address.toUInt()));
+ nbc = TQMAX(nbc, nbChars(NumberBase::Hex, address.toUInt()));
}
for (uint i=0; i<nb; i++) {
Address address = Breakpoint::list().address(Breakpoint::list().data(i));
- log(Log::LineType::Normal, QString(" #%1: %2").arg(i).arg(toHexLabel(address, nbc)));
+ log(Log::LineType::Normal, TQString(" #%1: %2").tqarg(i).tqarg(toHexLabel(address, nbc)));
}
return OK;
}
@@ -198,7 +198,7 @@ CLI::ExitCode CLI::Interactive::processLine(const QString &s)
Breakpoint::Data data = Breakpoint::list().data(i);
Address address = Breakpoint::list().address(data);
Breakpoint::list().remove(data);
- return okExit(i18n("Breakpoint at %1 removed.").arg(toHexLabelAbs(address)));
+ return okExit(i18n("Breakpoint at %1 removed.").tqarg(toHexLabelAbs(address)));
}
if ( words[0]=="raw-com" ) {
if ( words.count()!=2 ) return errorExit(i18n("This command needs a commands filename."), ARG_ERROR);
@@ -225,17 +225,13 @@ CLI::ExitCode CLI::Interactive::processLine(const QString &s)
void CLI::Interactive::lineRead()
{
- QString s = _input.stripWhiteSpace();
- _input = QString::null;
+ TQString s = _input.stripWhiteSpace();
+ _input = TQString();
if ( processLine(s)==EXITING ) {
-#if QT_VERSION<0x040000
- qApp->exit(OK);
-#else
- QCoreApplication::exit(OK);
-#endif
+ tqApp->exit(OK);
return;
}
- QTimer::singleShot(0, this, SLOT(displayPrompt()));
+ TQTimer::singleShot(0, this, TQT_SLOT(displayPrompt()));
}
CLI::ExitCode CLI::Interactive::registerList()
@@ -246,11 +242,11 @@ CLI::ExitCode CLI::Interactive::registerList()
const Coff::Object *coff = Debugger::manager->coff();
const Pic::RegistersData &rdata = data.registersData();
log(Log::LineType::Normal, i18n("Special Function Registers:"));
- QValueVector<Pic::RegisterNameData> list = Pic::sfrList(data);
- for (uint i=0; i<uint(list.count()); i++) log(Log::LineType::Normal, QString(" %1: %2").arg(toHexLabel(list[i].data().address(), rdata.nbCharsAddress())).arg(list[i].label()));
+ TQValueVector<Pic::RegisterNameData> list = Pic::sfrList(data);
+ for (uint i=0; i<uint(list.count()); i++) log(Log::LineType::Normal, TQString(" %1: %2").tqarg(toHexLabel(list[i].data().address(), rdata.nbCharsAddress())).tqarg(list[i].label()));
log(Log::LineType::Normal, i18n("General Purpose Registers:"));
list = Pic::gprList(data, coff);
- for (uint i=0; i<uint(list.count()); i++) log(Log::LineType::Normal, QString(" %1: %2").arg(toHexLabel(list[i].data().address(), rdata.nbCharsAddress())).arg(list[i].label()));
+ for (uint i=0; i<uint(list.count()); i++) log(Log::LineType::Normal, TQString(" %1: %2").tqarg(toHexLabel(list[i].data().address(), rdata.nbCharsAddress())).tqarg(list[i].label()));
return OK;
}
@@ -262,13 +258,13 @@ CLI::ExitCode CLI::Interactive::variableList()
if ( _device->group().name()!="pic" ) return errorExit(i18n("No register."), NOT_SUPPORTED_ERROR);
const Pic::Data &data = static_cast<const Pic::Data &>(*_device);
const Pic::RegistersData &rdata = data.registersData();
- QValueVector<Pic::RegisterNameData> list = Pic::variableList(data, *coff);
+ TQValueVector<Pic::RegisterNameData> list = Pic::variableList(data, *coff);
if ( list.count()==0 ) log(Log::LineType::Normal, i18n("No variable."));
- for (uint i=0; i<uint(list.count()); i++) log(Log::LineType::Normal, QString(" %1: %2").arg(toHexLabel(list[i].data().address(), rdata.nbCharsAddress())).arg(list[i].label()));
+ for (uint i=0; i<uint(list.count()); i++) log(Log::LineType::Normal, TQString(" %1: %2").tqarg(toHexLabel(list[i].data().address(), rdata.nbCharsAddress())).tqarg(list[i].label()));
return OK;
}
-Address CLI::Interactive::findRegisterAddress(const QString &name)
+Address CLI::Interactive::findRegisterAddress(const TQString &name)
{
const Pic::Data &data = static_cast<const Pic::Data &>(*_device);
const Coff::Object *coff = Debugger::manager->coff();
@@ -279,15 +275,15 @@ Address CLI::Interactive::findRegisterAddress(const QString &name)
if ( address>rdata.addressFromIndex(rdata.nbRegisters()-1) ) return Address();
return address;
}
- QValueVector<Pic::RegisterNameData> sfrs = Pic::sfrList(data);
+ TQValueVector<Pic::RegisterNameData> sfrs = Pic::sfrList(data);
for (uint i=0; i<uint(sfrs.count()); i++) if ( name.lower()==sfrs[i].label().lower() ) return sfrs[i].data().address();
if ( coff==0 ) return Address();
- QMap<QString, Address> variables = coff->variables();
- if ( variables.contains(name) ) return variables[name];
+ TQMap<TQString, Address> variables = coff->variables();
+ if ( variables.tqcontains(name) ) return variables[name];
return Address();
}
-CLI::ExitCode CLI::Interactive::executeRegister(const QString &name, const QString &value)
+CLI::ExitCode CLI::Interactive::executeRegister(const TQString &name, const TQString &value)
{
if ( Debugger::manager->debugger()==0 ) return errorExit(i18n("You need to start the debugging session first (with \"start\")."), ARG_ERROR);
const Pic::Data &data = static_cast<const Pic::Data &>(*_device);
@@ -296,7 +292,7 @@ CLI::ExitCode CLI::Interactive::executeRegister(const QString &name, const QStri
bool ok;
ulong v = fromAnyLabel(value, &ok);
if ( !ok ) return errorExit(i18n("Number format not recognized."), ARG_ERROR);
- if ( v>maxValue(NumberBase::Hex, nbChars) ) return errorExit(i18n("The given value is too large (max: %1).").arg(toHexLabel(maxValue(NumberBase::Hex, nbChars), nbChars)), ARG_ERROR);
+ if ( v>maxValue(NumberBase::Hex, nbChars) ) return errorExit(i18n("The given value is too large (max: %1).").tqarg(toHexLabel(maxValue(NumberBase::Hex, nbChars), nbChars)), ARG_ERROR);
Register::TypeData rtd;
if ( name.lower()=="w" || name.lower()=="wreg" )
rtd = static_cast<Debugger::PicBase *>(Debugger::manager->debugger())->deviceSpecific()->wregTypeData();
@@ -309,38 +305,32 @@ CLI::ExitCode CLI::Interactive::executeRegister(const QString &name, const QStri
}
if ( value.isEmpty() ) {
if ( !Debugger::manager->readRegister(rtd) ) return ARG_ERROR;
- return okExit(i18n("%1 = %2").arg(name.upper()).arg(toHexLabel(Register::list().value(rtd), nbChars)));
+ return okExit(i18n("%1 = %2").tqarg(name.upper()).tqarg(toHexLabel(Register::list().value(rtd), nbChars)));
}
return (Debugger::manager->writeRegister(rtd, v) ? OK : EXEC_ERROR);
}
-CLI::ExitCode CLI::Interactive::executeRawCommands(const QString &filename)
+CLI::ExitCode CLI::Interactive::executeRawCommands(const TQString &filename)
{
- QFile file(filename);
- if ( !file.open(IO_ReadOnly) ) return errorExit(i18n("Could not open filename \"%1\".").arg(filename), ARG_ERROR);
+ TQFile file(filename);
+ if ( !file.open(IO_ReadOnly) ) return errorExit(i18n("Could not open filename \"%1\".").tqarg(filename), ARG_ERROR);
if ( Programmer::manager->programmer()==0 ) {
Programmer::manager->createProgrammer(_device);
if ( !Programmer::manager->programmer()->simpleConnectHardware() ) return EXEC_ERROR;
}
Programmer::Base *programmer = Programmer::manager->programmer();
for (;;) {
- QString s;
-#if QT_VERSION<0x040000
+ TQString s;
if ( file.readLine(s, 1000)==-1 ) break;
-#else
- char buffer[1000];
- if ( file.readLine(buffer, 1000)==-1 ) break;
- s += buffer;
-#endif
bool write = !s.startsWith(" ");
s = s.stripWhiteSpace();
if ( s.isEmpty() ) continue;
if (write) {
if ( !programmer->hardware()->rawWrite(s) ) return EXEC_ERROR;
} else {
- QString rs;
+ TQString rs;
if ( !programmer->hardware()->rawRead(s.length(), rs) ) return EXEC_ERROR;
- if ( rs!=s ) log(Log::LineType::Warning, i18n("Read string is different than expected: %1 (%2).").arg(rs).arg(s));
+ if ( rs!=s ) log(Log::LineType::Warning, i18n("Read string is different than expected: %1 (%2).").tqarg(rs).tqarg(s));
}
}
return okExit(i18n("End of command file reached."));
diff --git a/src/piklab-prog/cli_interactive.h b/src/piklab-prog/cli_interactive.h
index fad6e9d..8509fc0 100644
--- a/src/piklab-prog/cli_interactive.h
+++ b/src/piklab-prog/cli_interactive.h
@@ -9,7 +9,7 @@
#ifndef CLI_INTERACTIVE_H
#define CLI_INTERACTIVE_H
-#include <qfile.h>
+#include <tqfile.h>
#include "common/global/global.h"
#include "common/cli/cli_global.h"
#include "common/global/log.h"
@@ -20,30 +20,31 @@ namespace CLI
//----------------------------------------------------------------------------
enum CommandProperty { NoCommandProperty = 0, NeedProgrammer = 1, InputHex = 2,
OutputHex = 4, NeedDevice = 8 };
-Q_DECLARE_FLAGS(CommandProperties, CommandProperty)
-Q_DECLARE_OPERATORS_FOR_FLAGS(CommandProperties)
+TQ_DECLARE_FLAGS(CommandProperties, CommandProperty)
+TQ_DECLARE_OPERATORS_FOR_FLAGS(CommandProperties)
//----------------------------------------------------------------------------
-class Interactive : public QObject, public Log::Base
+class Interactive : public TQObject, public Log::Base
{
Q_OBJECT
+ TQ_OBJECT
public:
- Interactive(QObject *parent);
+ Interactive(TQObject *tqparent);
void redisplayPrompt();
private slots:
void displayPrompt();
private:
- QFile _stdin;
- QString _input;
+ TQFile _stdin;
+ TQString _input;
void lineRead();
- ExitCode processLine(const QString &s);
- ExitCode executeRegister(const QString &name, const QString &value);
+ ExitCode processLine(const TQString &s);
+ ExitCode executeRegister(const TQString &name, const TQString &value);
ExitCode registerList();
ExitCode variableList();
- ExitCode executeRawCommands(const QString &filename);
- Address findRegisterAddress(const QString &name);
+ ExitCode executeRawCommands(const TQString &filename);
+ Address findRegisterAddress(const TQString &name);
ExitCode start();
static void signalHandler(int n);
};
diff --git a/src/piklab-prog/cli_prog_manager.cpp b/src/piklab-prog/cli_prog_manager.cpp
index 472757a..f8b73d1 100644
--- a/src/piklab-prog/cli_prog_manager.cpp
+++ b/src/piklab-prog/cli_prog_manager.cpp
@@ -22,10 +22,10 @@ Port::Description Programmer::CliManager::portDescription() const
log->log(Log::LineType::Information, i18n("Using port from configuration file."));
return Programmer::GroupConfig::portDescription(group());
}
- if ( CLI::_port=="usb" ) return Port::Description(PortType::USB, QString::null);
+ if ( CLI::_port=="usb" ) return Port::Description(PortType::USB, TQString());
PortType type = Port::findType(CLI::_port);
if ( type==PortType::Nb_Types ) {
- log->log(Log::LineType::Warning, i18n("Could not find device \"%1\" as serial or parallel port. Will try to open as serial port.").arg(CLI::_port));
+ log->log(Log::LineType::Warning, i18n("Could not find device \"%1\" as serial or parallel port. Will try to open as serial port.").tqarg(CLI::_port));
type = PortType::Serial;
}
return Port::Description(type, CLI::_port);
diff --git a/src/piklab-prog/cli_prog_manager.h b/src/piklab-prog/cli_prog_manager.h
index 27775a4..b5b37f2 100644
--- a/src/piklab-prog/cli_prog_manager.h
+++ b/src/piklab-prog/cli_prog_manager.h
@@ -18,8 +18,9 @@ namespace Programmer
class CliManager : public Manager
{
Q_OBJECT
+ TQ_OBJECT
public:
- CliManager(QObject *parent) : Manager(parent), _state(Idle) {}
+ CliManager(TQObject *tqparent) : Manager(tqparent), _state(Idle) {}
Port::Description portDescription() const;
virtual void createProgrammer(const Device::Data *data);
diff --git a/src/piklab-prog/cli_purl.cpp b/src/piklab-prog/cli_purl.cpp
index 2cd38a5..954e00c 100644
--- a/src/piklab-prog/cli_purl.cpp
+++ b/src/piklab-prog/cli_purl.cpp
@@ -8,12 +8,12 @@
***************************************************************************/
#include "common/global/purl.h"
-#include <qfileinfo.h>
-#include <qdatetime.h>
+#include <tqfileinfo.h>
+#include <tqdatetime.h>
bool PURL::Base::probablyExists() const
{
- QFileInfo fi(_url.path());
+ TQFileInfo fi(_url.path());
return fi.exists();
}
@@ -21,9 +21,9 @@ bool PURL::Url::isDestinationUpToDate(FileType type) const
{
if ( !(data().properties & Source) ) return true;
Url dest = toFileType(type);
- QFileInfo sfi(_url.path());
+ TQFileInfo sfi(_url.path());
if ( !sfi.exists() ) return true; // source does not exists
- QFileInfo dfi(dest._url.path());
+ TQFileInfo dfi(dest._url.path());
if ( !dfi.exists() ) return false; // destination does not exists
return sfi.lastModified()<dfi.lastModified();
}
diff --git a/src/piklab-prog/cmdline.cpp b/src/piklab-prog/cmdline.cpp
index 2ec4530..ec2cd38 100644
--- a/src/piklab-prog/cmdline.cpp
+++ b/src/piklab-prog/cmdline.cpp
@@ -15,7 +15,7 @@
# include <stdio.h>
#endif
#include <signal.h>
-#include <qtimer.h>
+#include <tqtimer.h>
#include "devices/list/device_list.h"
#include "devices/base/device_group.h"
@@ -63,7 +63,7 @@ const KCmdLineOptions CLI::OPTIONS[] = {
const Programmer::Group *CLI::_progGroup = 0;
const Device::Data *CLI::_device = 0;
HexBuffer::Format CLI::_format = HexBuffer::IHX32;
-QString CLI::_port, CLI::_targetSelfPowered, CLI::_hardware;
+TQString CLI::_port, CLI::_targetSelfPowered, CLI::_hardware;
PURL::Directory CLI::_firmwareDir;
PURL::Url CLI::_hexUrl, CLI::_coffUrl;
Device::Memory *CLI::_memory = 0;
@@ -74,7 +74,7 @@ CLI::ExitCode CLI::Main::formatList()
{
log(Log::LineType::Normal, i18n("Supported hex file formats:"));
for (uint i=0; i<HexBuffer::Nb_Formats; i++)
- log(Log::LineType::Normal, QString(" ") + HexBuffer::FORMATS[i]);
+ log(Log::LineType::Normal, TQString(" ") + HexBuffer::FORMATS[i]);
return OK;
}
@@ -83,7 +83,7 @@ CLI::ExitCode CLI::Main::programmerList()
log(Log::LineType::Normal, i18n("Supported programmers:"));
Programmer::Lister::ConstIterator it;
for (it=Programmer::lister().begin(); it!=Programmer::lister().end(); it++)
- log(Log::LineType::Normal, " " + QString(it.data()->name()));
+ log(Log::LineType::Normal, " " + TQString(it.data()->name()));
return OK;
}
@@ -96,8 +96,8 @@ CLI::ExitCode CLI::Main::hardwareList()
if ( config==0 ) continue;
FOR_EACH(PortType, type) {
if ( !it.data()->isPortSupported(type) ) continue;
- log(Log::LineType::Normal, "-" + QString(it.data()->name()) + " [" + type.label() + "]:");
- QStringList list = config->hardwareNames(type);
+ log(Log::LineType::Normal, "-" + TQString(it.data()->name()) + " [" + type.label() + "]:");
+ TQStringList list = config->hardwareNames(type);
for (uint k=0; k<uint(list.count()); k++) log(Log::LineType::Normal, " " + list[k]);
}
delete config;
@@ -107,16 +107,16 @@ CLI::ExitCode CLI::Main::hardwareList()
CLI::ExitCode CLI::Main::deviceList()
{
- QValueVector<QString> devices;
+ TQValueVector<TQString> devices;
if ( _progGroup==0 ) {
log(Log::LineType::Normal, i18n("Supported devices:"));
devices = Programmer::lister().supportedDevices();
} else {
- log(Log::LineType::Normal, i18n("Supported devices for \"%1\":").arg(_progGroup->label()));
+ log(Log::LineType::Normal, i18n("Supported devices for \"%1\":").tqarg(_progGroup->label()));
devices = _progGroup->supportedDevices();
}
qHeapSort(devices);
- QString s;
+ TQString s;
for (uint i=0; i<uint(devices.count()); i++) s += " " + devices[i];
log(Log::LineType::Normal, s + "\n");
return OK;
@@ -124,16 +124,16 @@ CLI::ExitCode CLI::Main::deviceList()
CLI::ExitCode CLI::Main::portList()
{
- if (_progGroup) log(Log::LineType::Normal, i18n("Detected ports supported by \"%1\":").arg(_progGroup->label()));
+ if (_progGroup) log(Log::LineType::Normal, i18n("Detected ports supported by \"%1\":").tqarg(_progGroup->label()));
else log(Log::LineType::Normal, i18n("Detected ports:"));
FOR_EACH(PortType, type) {
if ( _progGroup && !_progGroup->isPortSupported(type) ) continue;
- QString s = "- " + type.label() + ":";
+ TQString s = "- " + type.label() + ":";
if ( !Port::isAvailable(type) ) {
log(Log::LineType::Normal, s + i18n(" support disabled."));
continue;
}
- QStringList list = Port::probedDeviceList(type);
+ TQStringList list = Port::probedDeviceList(type);
if ( list.count()==0 ) log(Log::LineType::Normal, s + i18n(" no port detected."));
else {
log(Log::LineType::Normal, s);
@@ -146,11 +146,11 @@ CLI::ExitCode CLI::Main::portList()
CLI::ExitCode CLI::Main::rangeList()
{
log(Log::LineType::Normal, i18n("Memory ranges for PIC/dsPIC devices:"));
- FOR_EACH(Pic::MemoryRangeType, type) log(Log::LineType::Normal, QString(" %1").arg(type.key()));
+ FOR_EACH(Pic::MemoryRangeType, type) log(Log::LineType::Normal, TQString(" %1").tqarg(type.key()));
return OK;
}
-CLI::ExitCode CLI::Main::prepareCommand(const QString &command)
+CLI::ExitCode CLI::Main::prepareCommand(const TQString &command)
{
const CommandData *data = findCommandData(command);
CommandProperties properties = static_cast<CommandProperties>(data->properties);
@@ -167,12 +167,12 @@ CLI::ExitCode CLI::Main::prepareCommand(const QString &command)
if ( properties & InputHex ) {
if (_memory) {
if ( !file.openForRead() ) return FILE_ERROR;
- QStringList errors, warnings;
+ TQStringList errors, warnings;
Device::Memory::WarningTypes warningTypes;
if ( !_memory->load(file.stream(), errors, warningTypes, warnings) )
- return errorExit(i18n("Could not load hex file \"%1\".").arg(errors[0]), FILE_ERROR);
+ return errorExit(i18n("Could not load hex file \"%1\".").tqarg(errors[0]), FILE_ERROR);
if ( warningTypes!=Device::Memory::NoWarning )
- log(Log::LineType::Warning, i18n("Hex file seems incompatible with device \"%1\".").arg(warnings.join(" ")));
+ log(Log::LineType::Warning, i18n("Hex file seems incompatible with device \"%1\".").tqarg(warnings.join(" ")));
}
} else if ( properties & OutputHex ) {
if ( !_force && _hexUrl.exists() ) return errorExit(i18n("Output hex filename already exists."), FILE_ERROR);
@@ -196,7 +196,7 @@ CLI::Main::~Main()
delete _range;
}
-CLI::ExitCode CLI::Main::list(const QString &command)
+CLI::ExitCode CLI::Main::list(const TQString &command)
{
if ( MainBase::list(command)==OK ) return OK;
if ( command=="format-list" ) return formatList();
@@ -226,12 +226,8 @@ CLI::ExitCode CLI::Main::prepareRun(bool &interactive)
if (interactive) {
_interactive = new Interactive(this);
log(Log::LineType::Normal, i18n("Interactive mode: type help for help"));
- log(Log::LineType::Normal, QString::null);
-#if QT_VERSION<0x040000
- return ExitCode(qApp->exec());
-#else
- return ExitCode(QCoreApplication::exec());
-#endif
+ log(Log::LineType::Normal, TQString());
+ return ExitCode(tqApp->exec());
}
// range
@@ -242,7 +238,7 @@ CLI::ExitCode CLI::Main::prepareRun(bool &interactive)
return OK;
}
-CLI::ExitCode CLI::Main::extractRange(const QString &range)
+CLI::ExitCode CLI::Main::extractRange(const TQString &range)
{
delete _range;
_range = 0;
@@ -261,7 +257,7 @@ CLI::ExitCode CLI::Main::extractRange(const QString &range)
return OK;
}
-CLI::ExitCode CLI::Main::executeCommand(const QString &command)
+CLI::ExitCode CLI::Main::executeCommand(const TQString &command)
{
Programmer::Base *programmer = Programmer::manager->programmer();
if ( command=="connect" ) return (Programmer::manager->connectDevice() ? OK : EXEC_ERROR);
@@ -303,7 +299,7 @@ CLI::ExitCode CLI::Main::executeCommand(const QString &command)
PURL::File file(_hexUrl, *_view);
if ( !file.openForWrite() ) return FILE_ERROR;
if ( !_memory->save(file.stream(), _format) )
- return errorExit(i18n("Error while writing file \"%1\".").arg(_hexUrl.pretty()), FILE_ERROR);
+ return errorExit(i18n("Error while writing file \"%1\".").tqarg(_hexUrl.pretty()), FILE_ERROR);
return OK;
}
if ( command=="erase" ) {
@@ -332,25 +328,25 @@ CLI::ExitCode CLI::Main::checkProgrammer()
if ( _progGroup->isSoftware() && _progGroup->supportedDevices().isEmpty() )
return errorExit(i18n("Please check installation of selected software debugger."), NOT_SUPPORTED_ERROR);
if ( _device && !_progGroup->isSupported(_device->name()) )
- return errorExit(i18n("The selected device \"%1\" is not supported by the selected programmer.").arg(_device->name()), NOT_SUPPORTED_ERROR);
+ return errorExit(i18n("The selected device \"%1\" is not supported by the selected programmer.").tqarg(_device->name()), NOT_SUPPORTED_ERROR);
if ( !_hardware.isEmpty() ) {
::Hardware::Config *config = _progGroup->hardwareConfig();
Port::Description pd = static_cast<Programmer::CliManager *>(Programmer::manager)->portDescription();
- bool ok = (config==0 || config->hardwareNames(pd.type).contains(_hardware));
+ bool ok = (config==0 || config->hardwareNames(pd.type).tqcontains(_hardware));
delete config;
- if ( !ok ) return errorExit(i18n("The selected programmer does not supported the specified hardware configuration (\"%1\").").arg(_hardware), NOT_SUPPORTED_ERROR);
+ if ( !ok ) return errorExit(i18n("The selected programmer does not supported the specified hardware configuration (\"%1\").").tqarg(_hardware), NOT_SUPPORTED_ERROR);
}
return OK;
}
-CLI::ExitCode CLI::Main::executeSetCommand(const QString &property, const QString &value)
+CLI::ExitCode CLI::Main::executeSetCommand(const TQString &property, const TQString &value)
{
if ( property=="programmer" ) {
_progGroup = 0;
if ( value.isEmpty() ) return OK;
_progGroup = Programmer::lister().group(value.lower());
if (_progGroup) return checkProgrammer();
- return errorExit(i18n("Unknown programmer \"%1\".").arg(value.lower()), ARG_ERROR);
+ return errorExit(i18n("Unknown programmer \"%1\".").tqarg(value.lower()), ARG_ERROR);
}
if ( property=="hardware" ) { _hardware = value; return OK; }
if ( property=="device" || property=="processor" ) {
@@ -358,10 +354,10 @@ CLI::ExitCode CLI::Main::executeSetCommand(const QString &property, const QStrin
_device = 0;
return OK;
}
- QString s = value.upper();
+ TQString s = value.upper();
_device = Device::lister().data(s);
Debugger::manager->updateDevice();
- if ( _device==0 ) return errorExit(i18n("Unknown device \"%1\".").arg(s), ARG_ERROR);
+ if ( _device==0 ) return errorExit(i18n("Unknown device \"%1\".").tqarg(s), ARG_ERROR);
Debugger::manager->init();
return checkProgrammer();
}
@@ -370,13 +366,13 @@ CLI::ExitCode CLI::Main::executeSetCommand(const QString &property, const QStrin
_format = HexBuffer::IHX32;
return OK;
}
- QString s = value.lower();
+ TQString s = value.lower();
for (uint i=0; i<HexBuffer::Nb_Formats; i++)
if ( s==HexBuffer::FORMATS[i] ) {
_format = HexBuffer::Format(i);
return OK;
}
- return errorExit(i18n("Unknown hex file format \"%1\".").arg(s), ARG_ERROR);
+ return errorExit(i18n("Unknown hex file format \"%1\".").tqarg(s), ARG_ERROR);
}
if ( property=="port" ) { _port = value; return OK; }
if ( property=="firmware-dir" ) { _firmwareDir = value; return OK; }
@@ -394,10 +390,10 @@ CLI::ExitCode CLI::Main::executeSetCommand(const QString &property, const QStrin
if ( _device && !Debugger::manager->init() ) return ARG_ERROR;
return OK;
}
- return errorExit(i18n("Unknown property \"%1\"").arg(property), ARG_ERROR);
+ return errorExit(i18n("Unknown property \"%1\"").tqarg(property), ARG_ERROR);
}
-QString CLI::Main::executeGetCommand(const QString &property)
+TQString CLI::Main::executeGetCommand(const TQString &property)
{
if ( property=="programmer" ) {
if ( _progGroup==0 ) return i18n("<not set>");
@@ -421,7 +417,7 @@ QString CLI::Main::executeGetCommand(const QString &property)
if ( !_port.isEmpty() ) return _port;
if ( _progGroup==0 ) return i18n("<not set>");
Port::Description pd = Programmer::GroupConfig::portDescription(*_progGroup);
- QString s = pd.type.key();
+ TQString s = pd.type.key();
if (pd.type.data().withDevice) s += " (" + pd.device + ")";
return s + " " + i18n("<from config>");
}
@@ -432,7 +428,7 @@ QString CLI::Main::executeGetCommand(const QString &property)
}
if ( property=="target-self-powered" ) {
if ( !_targetSelfPowered.isEmpty() ) return _targetSelfPowered;
- return QString(readConfigEntry(Programmer::Config::TargetSelfPowered).toBool() ? "true" : "false") + " " + i18n("<from config>");
+ return TQString(readConfigEntry(Programmer::Config::TargetSelfPowered).toBool() ? "true" : "false") + " " + i18n("<from config>");
}
if ( property=="hex" ) {
if ( !_hexUrl.isEmpty() ) return _hexUrl.pretty();
@@ -442,8 +438,8 @@ QString CLI::Main::executeGetCommand(const QString &property)
if ( !_coffUrl.isEmpty() ) return _coffUrl.pretty();
return i18n("<not set>");
}
- log(Log::LineType::SoftError, i18n("Unknown property \"%1\"").arg(property));
- return QString::null;
+ log(Log::LineType::SoftError, i18n("Unknown property \"%1\"").tqarg(property));
+ return TQString();
}
//-----------------------------------------------------------------------------
diff --git a/src/piklab-prog/cmdline.h b/src/piklab-prog/cmdline.h
index 03d4091..6390ace 100644
--- a/src/piklab-prog/cmdline.h
+++ b/src/piklab-prog/cmdline.h
@@ -21,16 +21,17 @@ namespace CLI
class Main : public MainBase
{
Q_OBJECT
+ TQ_OBJECT
public:
Main();
virtual ~Main();
virtual ExitCode prepareRun(bool &interactive);
- virtual ExitCode prepareCommand(const QString &command);
- virtual ExitCode executeCommand(const QString &command);
- virtual ExitCode executeSetCommand(const QString &property, const QString &value);
- virtual QString executeGetCommand(const QString &property);
- virtual ExitCode list(const QString &command);
- ExitCode extractRange(const QString &range);
+ virtual ExitCode prepareCommand(const TQString &command);
+ virtual ExitCode executeCommand(const TQString &command);
+ virtual ExitCode executeSetCommand(const TQString &property, const TQString &value);
+ virtual TQString executeGetCommand(const TQString &property);
+ virtual ExitCode list(const TQString &command);
+ ExitCode extractRange(const TQString &range);
private:
Device::MemoryRange *_range;
@@ -45,10 +46,10 @@ private:
};
extern const Programmer::Group *_progGroup;
-extern QString _hardware;
+extern TQString _hardware;
extern const Device::Data *_device;
extern HexBuffer::Format _format;
-extern QString _port, _targetSelfPowered;
+extern TQString _port, _targetSelfPowered;
extern PURL::Directory _firmwareDir;
extern PURL::Url _hexUrl, _coffUrl;
extern Device::Memory *_memory;