/*** Olive - Non-Linear Video Editor Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . ***/ /** \mainpage Olive Video Editor - Code Documentation * * This documentation is a primarily a developer resource. For information on using Olive, visit the website * https://www.olivevideoeditor.org/ * * Use the navigation above to find documentation on classes or source files. */ extern "C" { #include #include } #include #include #include #include #include #include "core.h" #include "common/commandlineparser.h" #include "common/debug.h" #include "node/project/serializer/serializer.h" #include "version.h" #ifdef _WIN32 #include #include #include #include #endif #ifdef USE_CRASHPAD #include "common/crashpadinterface.h" #endif // USE_CRASHPAD int decompress_project(const QString &project) { if (project.isEmpty()) { printf("%s\n", QCoreApplication::translate("main", "No project filename set to decompress").toUtf8().constData()); return 1; } QFile project_file(project); if (!project_file.open(QFile::ReadOnly)) { printf("%s\n", QCoreApplication::translate("main", "Failed to open file \"%1\"").arg(project).toUtf8().constData()); return 1; } printf("%s\n", QCoreApplication::translate("main", "Decompressing project...").toUtf8().constData()); if (!olive::ProjectSerializer::CheckCompressedID(&project_file)) { printf("%s\n", QCoreApplication::translate("main", "Failed to decompress, project may be corrupt").toUtf8().constData()); return 1; } QByteArray b = project_file.readAll(); project_file.close(); QByteArray decompressed = qUncompress(b); if (decompressed.isEmpty()) { printf("%s\n", QCoreApplication::translate("main", "Failed to decompress, project may be corrupt").toUtf8().constData()); return 1; } QFileInfo info(project); QString filename; QString append; int append_num = 0; do { filename = info.dir().filePath(info.completeBaseName().append(append).append(QStringLiteral(".ovexml"))); append_num++; append = QStringLiteral("-%1").arg(append_num); } while(QFileInfo::exists(filename)); printf("%s\n", QCoreApplication::translate("main", "Outputting to file \"%1\"").arg(filename).toUtf8().constData()); QFile out(filename); if (!out.open(QFile::WriteOnly)) { printf("%s\n", QCoreApplication::translate("main", "Failed to open output file \"%1\"").arg(filename).toUtf8().constData()); return 1; } out.write(decompressed); out.close(); printf("%s\n", QCoreApplication::translate("main", "Decompressed successfully").toUtf8().constData()); return 0; } int main(int argc, char *argv[]) { // Set up debug handler qInstallMessageHandler(olive::DebugHandler); // Set application metadata QCoreApplication::setOrganizationName("olivevideoeditor.org"); QCoreApplication::setOrganizationDomain("olivevideoeditor.org"); QCoreApplication::setApplicationName("Olive"); QGuiApplication::setDesktopFileName("org.olivevideoeditor.Olive"); QCoreApplication::setApplicationVersion(olive::kAppVersionLong); // // Parse command line arguments // QVector args; #if defined(_WIN32) && defined(UNICODE) int wargc; LPWSTR *wargv = CommandLineToArgvW(GetCommandLineW(), &wargc); args.resize(wargc); for (int i=0; i