lightpreview: hack in quote parsing for qbsp/vis/light args
This commit is contained in:
parent
295dc4a537
commit
229f9fed25
|
|
@ -174,6 +174,9 @@ void GLView::renderBSP(const QString &file, const mbsp_t &bsp)
|
||||||
// FIXME: move to a lightpreview_settings
|
// FIXME: move to a lightpreview_settings
|
||||||
settings::common_settings settings;
|
settings::common_settings settings;
|
||||||
|
|
||||||
|
// FIXME: copy the -path args from light
|
||||||
|
settings.paths.copy_from(light_options.paths);
|
||||||
|
|
||||||
bsp.loadversion->game->init_filesystem(file.toStdString(), settings);
|
bsp.loadversion->game->init_filesystem(file.toStdString(), settings);
|
||||||
img::load_textures(&bsp, settings);
|
img::load_textures(&bsp, settings);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ See file, 'COPYING', for details.
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
#include <QDragEnterEvent>
|
#include <QDragEnterEvent>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QFileSystemWatcher>
|
#include <QFileSystemWatcher>
|
||||||
|
|
@ -182,9 +183,21 @@ static std::vector<std::string> ParseArgs(const QLineEdit *line_edit)
|
||||||
if (text.isEmpty())
|
if (text.isEmpty())
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
for (const auto &str : text.split(' ')) {
|
bool inside_quotes = false;
|
||||||
qDebug() << "got token " << str;
|
for (const auto &str : text.split('"')) {
|
||||||
result.push_back(str.toStdString());
|
qDebug() << "got token " << str << " inside quote? " << inside_quotes;
|
||||||
|
|
||||||
|
if (inside_quotes) {
|
||||||
|
result.push_back(str.toStdString());
|
||||||
|
} else {
|
||||||
|
// split by spaces
|
||||||
|
for (const auto &str2 : str.split(' ', QString::SkipEmptyParts)) {
|
||||||
|
qDebug() << "got sub token " << str2;
|
||||||
|
result.push_back(str2.toStdString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inside_quotes = !inside_quotes;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue