#include "mainwindow.h" #include #include #include #include // 编译出来的可执行程序复制到单独目录,然后执行 windeployqt 应用程序文件名 // 即可自动将依赖的动态库等复制到此目录中。有些文件是多余的,可以酌情删除。 int main(int argc, char *argv[]) { //#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) // QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); //#endif QApplication a(argc, argv); QGuiApplication::setApplicationDisplayName("TP-Player"); QCommandLineParser parser; const QCommandLineOption opt_help = parser.addHelpOption(); parser.addPositionalArgument("RESOURCE", "teleport record resource to be play."); if(!parser.parse(QCoreApplication::arguments())) { QMessageBox::warning(nullptr, QGuiApplication::applicationDisplayName(), //"

" + parser.errorText() + "

"
                             "

" + parser.errorText() + "

"
                             + parser.helpText() + "
"); return 1; } if(parser.isSet(opt_help)) { QMessageBox::warning(nullptr, QGuiApplication::applicationDisplayName(), "
"
                             + parser.helpText()
                             + "\n\n"
                             + "RESOURCE could be:\n"
                             + "    teleport record file (.tpr).\n"
                             + "    a directory contains .tpr file.\n"
                             + "    an URL for download teleport record file."
                             + "
"); return 2; } const QStringList args = parser.positionalArguments(); QString resource = args.at(0); qDebug() << resource; MainWindow w; w.set_resource(resource); w.show(); return a.exec(); }