-rw-r--r-- | noncore/apps/keyz-cfg/cfgfile.cpp | 12 | ||||
-rw-r--r-- | noncore/apps/keyz-cfg/config.in | 2 | ||||
-rw-r--r-- | noncore/apps/keyz-cfg/keyz-cfg.pro | 16 | ||||
-rw-r--r-- | noncore/apps/keyz-cfg/zkb.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/keyz-cfg/zkbcfg.cpp | 15 |
5 files changed, 29 insertions, 20 deletions
diff --git a/noncore/apps/keyz-cfg/cfgfile.cpp b/noncore/apps/keyz-cfg/cfgfile.cpp index b0dc968..81d1ee1 100644 --- a/noncore/apps/keyz-cfg/cfgfile.cpp +++ b/noncore/apps/keyz-cfg/cfgfile.cpp @@ -1,27 +1,33 @@ -#include <qmessagebox.h> #include "cfgfile.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ +#include <qmessagebox.h> + // CfgEntry implementation CfgEntry::CfgEntry() { } CfgEntry::CfgEntry(const QString& f, const QString& l): file(f), label(l) { } const QString& CfgEntry::getFile() const { return file; } void CfgEntry::setFile(const QString& f) { file = f; } const QString& CfgEntry::getLabel() const { return label; } void CfgEntry::setLabel(const QString& f) { label = f; } @@ -74,60 +80,60 @@ int CfgFile::getAutorepeatPeriod() const { void CfgFile::setAutorepeatPeriod(int n) { arperiod = n; } // CfgParser implementation CfgParser::CfgParser() { } bool CfgParser::load(QString file, CfgFile& cfg) { QFile f(file); QXmlInputSource is(f); QXmlSimpleReader reader; CfgHandler p(*this); reader.setErrorHandler(this); reader.setContentHandler(&p); err = ""; ardelay = -1; arperiod = -1; reader.parse(is); if (!err.isEmpty()) { - qDebug(err); + odebug << err << oendl; return false; } QMap<QString, QString>::Iterator fit, lit; for(uint i = 0; i < includeList.count(); i++) { QString file = *includeList.at(i); fit = includes.find(file); QString prefix = fit.data(); QString label = ""; - qDebug("include: file=" + fit.key() + ", prefix=" + fit.data()); + odebug << "include: file=" + fit.key() + ", prefix=" + fit.data() << oendl; lit = labels.find(prefix+":*"); if (lit != labels.end()) { label = lit.data(); } cfg.replaceEntry(file, label); } if (ardelay != -1) { cfg.setAutorepeatDelay(ardelay); } if (arperiod != -1) { cfg.setAutorepeatPeriod(arperiod); } return true; } bool CfgParser::save(QString file, CfgFile& cfg) { FILE* f = fopen((const char*) file.local8Bit(), "w"); fprintf(f, "<keymap autorepeat-delay=\"%d\" autorepeat-period=\"%d\" " "author=\"keyzcfg\">\n", cfg.getAutorepeatDelay(), diff --git a/noncore/apps/keyz-cfg/config.in b/noncore/apps/keyz-cfg/config.in index 29a10f5..8e1be2d 100644 --- a/noncore/apps/keyz-cfg/config.in +++ b/noncore/apps/keyz-cfg/config.in @@ -1,4 +1,4 @@ config KEYZCFG boolean "keyz-cfg (configuration tool for keyz applet)" default "n" - depends ( LIBQPE || LIBQPE-X11 ) + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE diff --git a/noncore/apps/keyz-cfg/keyz-cfg.pro b/noncore/apps/keyz-cfg/keyz-cfg.pro index 44bbb5f..7ac604b 100644 --- a/noncore/apps/keyz-cfg/keyz-cfg.pro +++ b/noncore/apps/keyz-cfg/keyz-cfg.pro @@ -1,24 +1,24 @@ TEMPLATE = app DESTDIR = $(OPIEDIR)/bin CONFIG = qt warn_on HEADERS = zkb.h \ - zkbcfg.h \ - zkbnames.h \ - zkbxml.h \ - cfgdlg.h \ - cfgfile.h + zkbcfg.h \ + zkbnames.h \ + zkbxml.h \ + cfgdlg.h \ + cfgfile.h SOURCES = main.cpp \ cfgdlg.cpp \ cfgfile.cpp \ zkb.cpp \ zkbcfg.cpp \ - zkbnames.cpp \ - zkbxml.cpp + zkbnames.cpp \ + zkbxml.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe +LIBS += -lqpe -lopiecore2 TARGET = keyz-cfg include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/apps/keyz-cfg/zkb.cpp b/noncore/apps/keyz-cfg/zkb.cpp index f315d4b..8382615 100644 --- a/noncore/apps/keyz-cfg/zkb.cpp +++ b/noncore/apps/keyz-cfg/zkb.cpp @@ -343,49 +343,49 @@ QStringList Keymap::listLabels() { return ret; } State* Keymap::getStateByLabel(const QString& label) { QMap<QString, QString>::Iterator lit = labels.find(label); State* state = 0; if (lit == labels.end()) { return 0; } QString name = lit.data(); int n = name.find(":*"); if (n>=0 && n==(int)(name.length()-2)) { name=name.left(name.length() - 1); n = currentStateName.findRev(":"); if (n >= 0) { name += currentStateName.mid(n+1); } } -// qDebug("look for: %s\n", (const char*) name.utf8()); +// odebug << "look for: " << (const char*) name.utf8() << "\n" << oendl; QMap<QString, State*>::Iterator sit = states.find(name); if (sit != states.end()) { state = sit.data(); } return state; } bool Keymap::addState(const QString& name, State* state) { if (states.find(name) != states.end()) { return false; } states.insert(name, state); lsmapInSync = false; if (currentState == 0) { setCurrentState(state); } return true; } State* Keymap::getCurrentState() const { @@ -395,49 +395,49 @@ State* Keymap::getCurrentState() const { QString Keymap::getCurrentLabel() { return currentLabel; } bool Keymap::setCurrentState(State* state) { QMap<QString, State*>::Iterator it; for(it = states.begin(); it != states.end(); ++it) { State* s = it.data(); if (s == state) { currentState = s; currentStateName = it.key(); qDebug("state changed: %s\n", (const char*) currentStateName.utf8()); if (!lsmapInSync) { generateLabelStateMaps(); } QMap<State*, QString>::Iterator tit; tit = stateLabelMap.find(state); if (tit != stateLabelMap.end()) { currentLabel = tit.data(); } else { -// qDebug("no label for: " + currentStateName + "\n"); +// odebug << "no label for: " + currentStateName + "\n" << oendl; currentLabel = ""; } return true; } } return false; } bool Keymap::removeState(const QString& name, bool force) { QMap<QString, State*>::Iterator it = states.find(name); if (it == states.end()) { return false; } State* state = it.data(); QList<Action> acts = findStateUsage(state); if (!acts.isEmpty()) { if (!force) { return false; } else { diff --git a/noncore/apps/keyz-cfg/zkbcfg.cpp b/noncore/apps/keyz-cfg/zkbcfg.cpp index 0992b9a..f1d53ba 100644 --- a/noncore/apps/keyz-cfg/zkbcfg.cpp +++ b/noncore/apps/keyz-cfg/zkbcfg.cpp @@ -1,58 +1,61 @@ -#include <qfileinfo.h> - #include "zkbcfg.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ +#include <qfileinfo.h> // Implementation of XkbConfig class ZkbConfig::ZkbConfig(const QString& dir):path(dir) { } ZkbConfig::~ZkbConfig() { } bool ZkbConfig::load(const QString& file, Keymap& keymap, const QString& prefix) { bool ret; QFile f(path+"/"+file); QFileInfo fi(f); - qDebug("start loading file=%s\n", (const char*) file.utf8()); + odebug << "start loading file=" << (const char*) file.utf8() << "\n" << oendl; if (includedFiles.find(fi.absFilePath()) != includedFiles.end()) { return false; } includedFiles.insert(fi.absFilePath(), 1); QXmlInputSource is(f); QXmlSimpleReader reader; ZkbHandler h(*this, keymap, prefix); reader.setContentHandler(&h); reader.setErrorHandler(this); ret = reader.parse(is); includedFiles.remove(fi.absFilePath()); - qDebug("end loading file=%s : status=%s\n", (const char*) file.utf8(), - (const char*) err.utf8()); + odebug << "end loading file=" << file.utf8() << ": status=" << err.utf8() << oendl; return ret; } bool ZkbConfig::warning(const QXmlParseException& e) { QString tmp; tmp.sprintf("%d: warning: %s\n", e.lineNumber(), (const char*) e.message().utf8()); err += tmp; return true; } bool ZkbConfig::error(const QXmlParseException& e) { QString tmp; tmp.sprintf("%d: error: %s\n", e.lineNumber(), (const char*) e.message().utf8()); err += tmp; return true; } @@ -101,49 +104,49 @@ bool ZkbHandler::startIncludeElement(const QString& file, if (!ret) { setError("Error including file: " + file); } return ret; } bool ZkbHandler::startLabelElement(const QString& label, const QString& state) { if (!keymap.addLabel(label, prefix + state)) { err = "label " + label + " already defined"; return false; } return true; } bool ZkbHandler::startStateElement(const QString& name, const QString& parentName, bool dflt) { currentStateName = prefix + name; currentState = keymap.getStateByName(currentStateName); -// qDebug("state name=%s\n", (const char*) currentStateName.utf8()); +// odebug << "state name=" << (const char*) currentStateName.utf8() << "\n" << oendl; State* parent = 0; if (!parentName.isEmpty()) { QString pn = prefix + parentName; parent = keymap.getStateByName(pn); if (parent == 0) { err = currentStateName + ": undefined parent state: " + pn; return false; } } if (currentState == 0) { currentState = new State(parent); keymap.addState(currentStateName, currentState); } else { if (parent!=0) { currentState->setParent(parent); } } if (dflt) { keymap.setCurrentState(currentState); } |