--- qsampler/trunk/src/qsamplerUtilities.cpp 2007/11/11 23:07:06 1476 +++ qsampler/trunk/src/qsamplerUtilities.cpp 2007/11/23 09:32:06 1513 @@ -22,10 +22,11 @@ #include "qsamplerUtilities.h" +#include "qsamplerOptions.h" #include "qsamplerMainForm.h" -#include -#include +#include + using namespace QSampler; @@ -84,11 +85,11 @@ // TODO: missing code for other systems like Windows { QRegExp regexp("%[0-9a-fA-F][0-9a-fA-F]"); - for (int i = path.find(regexp); i >= 0; i = path.find(regexp, i + 4)) + for (int i = path.indexOf(regexp); i >= 0; i = path.indexOf(regexp, i + 4)) path.replace(i, 1, "\\x"); } // replace POSIX path escape sequence (%%) by its raw character - for (int i = path.find("%%"); i >= 0; i = path.find("%%", ++i)) + for (int i = path.indexOf("%%"); i >= 0; i = path.indexOf("%%", ++i)) path.remove(i, 1); // replace all non-basic characters by LSCP escape sequences @@ -97,14 +98,14 @@ QRegExp regexp(QRegExp::escape("\\x") + "[0-9a-fA-F][0-9a-fA-F]"); for (int i = 0; i < int(path.length()); i++) { // first skip all previously added LSCP escape sequences - if (path.find(regexp, i) == i) { + if (path.indexOf(regexp, i) == i) { i += 3; continue; } // now match all non-alphanumerics // (we could exclude much more characters here, but that way // we're sure it just works^TM) - const char c = path.at(i).latin1(); + const char c = path.at(i).toLatin1(); if ( !(c >= '0' && c <= '9') && !(c >= 'a' && c <= 'z') && @@ -132,20 +133,20 @@ if (!_remoteSupportsEscapeSequences()) return path; // first escape all percent ('%') characters for POSIX - for (int i = path.find('%'); i >= 0; i = path.find('%', i+2)) + for (int i = path.indexOf('%'); i >= 0; i = path.indexOf('%', i+2)) path.replace(i, 1, "%%"); // resolve LSCP hex escape sequences (\xHH) QRegExp regexp(QRegExp::escape("\\x") + "[0-9a-fA-F][0-9a-fA-F]"); - for (int i = path.find(regexp); i >= 0; i = path.find(regexp, i + 4)) { - const QString sHex = path.mid(i+2, 2).lower(); + for (int i = path.indexOf(regexp); i >= 0; i = path.indexOf(regexp, i + 4)) { + const QString sHex = path.mid(i+2, 2).toLower(); // the slash has to be escaped for POSIX as well if (sHex == "2f") { path.replace(i, 4, "%2f"); continue; } // all other characters we simply decode - char cAscii = _hexsToNumber(sHex.at(1).latin1(), sHex.at(0).latin1()); + char cAscii = _hexsToNumber(sHex.at(1).toLatin1(), sHex.at(0).toLatin1()); path.replace(i, 4, cAscii); } @@ -159,10 +160,10 @@ // resolve LSCP hex escape sequences (\xHH) QRegExp regexp(QRegExp::escape("\\x") + "[0-9a-fA-F][0-9a-fA-F]"); - for (int i = txt.find(regexp); i >= 0; i = txt.find(regexp, i + 4)) { - const QString sHex = txt.mid(i+2, 2).lower(); + for (int i = txt.indexOf(regexp); i >= 0; i = txt.indexOf(regexp, i + 4)) { + const QString sHex = txt.mid(i+2, 2).toLower(); // decode into raw ASCII character - char cAscii = _hexsToNumber(sHex.at(1).latin1(), sHex.at(0).latin1()); + char cAscii = _hexsToNumber(sHex.at(1).toLatin1(), sHex.at(0).toLatin1()); txt.replace(i, 4, cAscii); }