2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

New audio player done (without playlist).

This commit is contained in:
John Preston
2016-09-23 19:04:26 +03:00
parent a8f3582cb1
commit f970ac3163
57 changed files with 1358 additions and 495 deletions

View File

@@ -27,8 +27,10 @@ namespace codegen {
namespace common {
namespace {
QString WorkingPath = ".";
std::string relativeLocalPath(const QString &filepath) {
auto name = QFile::encodeName(QDir().relativeFilePath(filepath));
auto name = QFile::encodeName(QDir(WorkingPath).relativeFilePath(filepath));
return name.constData();
}
@@ -43,5 +45,9 @@ LogStream logError(int code, const QString &filepath, int line) {
return LogStream(std::cerr);
}
void logSetWorkingPath(const QString &workingpath) {
WorkingPath = workingpath;
}
} // namespace common
} // namespace codegen

View File

@@ -72,6 +72,8 @@ LogStream operator<<(LogStream &&stream, T &&value) {
// logError(kErrorFileTooLarge, filepath) << "file too large, size=" << size;
LogStream logError(int code, const QString &filepath, int line = 0);
void logSetWorkingPath(const QString &workingpath);
static constexpr int kErrorInternal = 666;
} // namespace common

View File

@@ -22,6 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include <ostream>
#include <QtCore/QCoreApplication>
#include <QtCore/QDir>
#include "codegen/common/logging.h"
namespace codegen {
@@ -32,6 +33,7 @@ constexpr int kErrorIncludePathExpected = 901;
constexpr int kErrorOutputPathExpected = 902;
constexpr int kErrorInputPathExpected = 903;
constexpr int kErrorSingleInputPathExpected = 904;
constexpr int kErrorWorkingPathExpected = 905;
} // namespace
@@ -77,6 +79,17 @@ Options parseOptions() {
} else if (arg.startsWith("-o")) {
result.outputPath = arg.mid(2);
// Working path
} else if (arg == "-w") {
if (++i == count) {
logError(kErrorWorkingPathExpected, "Command Line") << "working path expected after -w";
return Options();
} else {
common::logSetWorkingPath(args.at(i));
}
} else if (arg.startsWith("-w")) {
common::logSetWorkingPath(arg.mid(2));
// Input path
} else {
if (result.inputPath.isEmpty()) {