add data dir arg

pull/34892/head
Trey Moen 1 month ago
parent 282cebc71b
commit 1c837ddd3b
  1. 11
      tools/clip/application.cc
  2. 2
      tools/clip/application.h

@ -26,10 +26,15 @@ Application::Application(int argc, char *argv[], QObject *parent) : QObject(pare
const QCommandLineOption output({"o", "output"}, "output file", "output");
parser.addOption(output);
const QCommandLineOption data_dir_arg({"d", "data_dir"}, "data directory", "data_dir");
parser.addOption(data_dir_arg);
parser.addPositionalArgument("route", "route string");
parser.process(*app);
const QString data_dir = parser.value(data_dir_arg);
int startTime = 0;
if (parser.isSet(start)) {
bool ok;
@ -77,7 +82,7 @@ Application::Application(int argc, char *argv[], QObject *parent) : QObject(pare
recorderThread->start();
// Initialize and start replay
initReplay(route.toStdString());
initReplay(route.toStdString(), data_dir.isEmpty() ? "" : data_dir.toStdString());
replayThread = QThread::create([this, startTime] { startReplay(startTime); });
replayThread->start();
@ -124,10 +129,10 @@ Application::Application(int argc, char *argv[], QObject *parent) : QObject(pare
window->setAttribute(Qt::WA_StaticContents);
}
void Application::initReplay(const std::string& route) {
void Application::initReplay(const std::string& route, const std::string& data_dir) {
std::vector<std::string> allow;
std::vector<std::string> block;
replay = std::make_unique<Replay>(route, allow, block, nullptr, REPLAY_FLAG_NONE);
replay = std::make_unique<Replay>(route, allow, block, nullptr, REPLAY_FLAG_NONE, data_dir);
replay->setSegmentCacheLimit(1);
}

@ -15,7 +15,7 @@ public:
void close() const;
private:
void initReplay(const std::string& route);
void initReplay(const std::string& route, const std::string& data_dir = "");
void startReplay(int start = 0);
QApplication *app;

Loading…
Cancel
Save