Changeset View
Changeset View
Standalone View
Standalone View
src/main.cpp
Show First 20 Lines • Show All 237 Lines • ▼ Show 20 Line(s) | 221 | #endif | |||
---|---|---|---|---|---|
238 | if (parser.value(QStringLiteral("mlt-log")) == QStringLiteral("verbose")) { | 238 | if (parser.value(QStringLiteral("mlt-log")) == QStringLiteral("verbose")) { | ||
239 | mlt_log_set_level(MLT_LOG_VERBOSE); | 239 | mlt_log_set_level(MLT_LOG_VERBOSE); | ||
240 | } else if (parser.value(QStringLiteral("mlt-log")) == QStringLiteral("debug")) { | 240 | } else if (parser.value(QStringLiteral("mlt-log")) == QStringLiteral("debug")) { | ||
241 | mlt_log_set_level(MLT_LOG_DEBUG); | 241 | mlt_log_set_level(MLT_LOG_DEBUG); | ||
242 | } | 242 | } | ||
243 | const QString clipsToLoad = parser.value(QStringLiteral("i")); | 243 | const QString clipsToLoad = parser.value(QStringLiteral("i")); | ||
244 | QUrl url; | 244 | QUrl url; | ||
245 | if (parser.positionalArguments().count() != 0) { | 245 | if (parser.positionalArguments().count() != 0) { | ||
246 | url = QUrl::fromLocalFile(parser.positionalArguments().at(0)); | 246 | const QString inputFilename = parser.positionalArguments().at(0); | ||
247 | // Make sure we get an absolute URL so that we can autosave correctly | 247 | const QFileInfo fileInfo(inputFilename); | ||
248 | QString currentPath = QDir::currentPath(); | 248 | url = QUrl(inputFilename); | ||
249 | QUrl startup = QUrl::fromLocalFile(currentPath.endsWith(QDir::separator()) ? currentPath : currentPath + QDir::separator()); | 249 | if (fileInfo.exists() || url.scheme().isEmpty()) { // easiest way to detect "invalid"/unintended URLs is no scheme | ||
250 | url = startup.resolved(url); | 250 | url = QUrl::fromLocalFile(fileInfo.absoluteFilePath()); | ||
251 | } | ||||
251 | } | 252 | } | ||
252 | qApp->processEvents(QEventLoop::AllEvents); | 253 | qApp->processEvents(QEventLoop::AllEvents); | ||
253 | Core::build(!parser.value(QStringLiteral("config")).isEmpty(), parser.value(QStringLiteral("mlt-path"))); | 254 | Core::build(!parser.value(QStringLiteral("config")).isEmpty(), parser.value(QStringLiteral("mlt-path"))); | ||
254 | pCore->initGUI(url, clipsToLoad); | 255 | pCore->initGUI(url, clipsToLoad); | ||
255 | splash.finish(pCore->window()); | 256 | splash.finish(pCore->window()); | ||
256 | int result = app.exec(); | 257 | int result = app.exec(); | ||
257 | Core::clean(); | 258 | Core::clean(); | ||
258 | 259 | | |||
Show All 25 Lines |