diff options
Diffstat (limited to 'csv/csv.cpp')
-rw-r--r-- | csv/csv.cpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/csv/csv.cpp b/csv/csv.cpp index 668da442..14bcb957 100644 --- a/csv/csv.cpp +++ b/csv/csv.cpp @@ -10,12 +10,11 @@ */ #include "csv.h" -#include "opentrack/library-path.hpp" +#include "opentrack-library-path.h" #include <QTextDecoder> #include <QFile> #include <QCoreApplication> #include <QString> - #include <QDebug> #include <utility> @@ -24,8 +23,8 @@ using std::move; const QTextCodec* CSV::m_codec = QTextCodec::codecForName("System"); -const QRegExp CSV::m_rx = QRegExp(QStringLiteral("((?:(?:[^;\\n]*;?)|(?:\"[^\"]*\";?))*)?\\n?")); -const QRegExp CSV::m_rx2 = QRegExp(QStringLiteral("(?:\"([^\"]*)\";?)|(?:([^;]*);?)?")); +const QRegExp CSV::m_rx = QRegExp(QString("((?:(?:[^;\\n]*;?)|(?:\"[^\"]*\";?))*)?\\n?")); +const QRegExp CSV::m_rx2 = QRegExp(QString("(?:\"([^\"]*)\";?)|(?:([^;]*);?)?")); CSV::CSV(QIODevice* device) : m_device(device), @@ -60,14 +59,14 @@ QString CSV::readLine() bool CSV::parseLine(QStringList& ret) { - QString line(move(readLine())); + QString line(readLine()); QStringList list; int pos2 = 0; if (line.size() == 0) { - ret = move(QStringList()); + ret = QStringList(); return m_device->size() > m_pos; } else @@ -76,9 +75,9 @@ bool CSV::parseLine(QStringList& ret) { QString col; if (m_rx2.cap(1).size() > 0) - col = move(m_rx2.cap(1)); + col = m_rx2.cap(1); else if (m_rx2.cap(2).size() > 0) - col = move(m_rx2.cap(2)); + col = m_rx2.cap(2); list << move(col); @@ -97,11 +96,11 @@ bool CSV::getGameData(int id, unsigned char* table, QString& gamename) for (int i = 0; i < 8; i++) table[i] = 0; - QString id_str(move(QString::number(id))); + QString id_str(QString::number(id)); - static const QString libexec_path(QStringLiteral("./") + - QString(opentrack_library_path) + - QStringLiteral("/settings/facetracknoir supported games.csv")); + static const QString libexec_path(QCoreApplication::applicationDirPath() + + QString(OPENTRACK_LIBRARY_PATH) + + QString("settings/facetracknoir supported games.csv")); QFile file(QCoreApplication::applicationDirPath() + libexec_path); @@ -134,9 +133,9 @@ bool CSV::getGameData(int id, unsigned char* table, QString& gamename) const QString proto(move(gameLine.at(3))); const QString name(move(gameLine.at(1))); - const QByteArray id_cstr = move(gameLine.at(7).toLatin1()); + const QByteArray id_cstr = gameLine.at(7).toLatin1(); - if (proto == QStringLiteral("V160")) + if (proto == QString("V160")) { /* nothing */ } |