#include #include #include "MainWindow.h" #include "AudioEngine.h" #ifdef Q_OS_ANDROID #include void androidMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) { android_LogPriority priority = ANDROID_LOG_DEBUG; switch (type) { case QtDebugMsg: priority = ANDROID_LOG_DEBUG; break; case QtInfoMsg: priority = ANDROID_LOG_INFO; break; case QtWarningMsg: priority = ANDROID_LOG_WARN; break; case QtCriticalMsg: priority = ANDROID_LOG_ERROR; break; case QtFatalMsg: priority = ANDROID_LOG_FATAL; break; } __android_log_print(priority, "YrCrystals", "%s", qPrintable(msg)); } #endif int main(int argc, char *argv[]) { #ifdef Q_OS_ANDROID qInstallMessageHandler(androidMessageHandler); #endif QApplication app(argc, argv); QApplication::setApplicationName("Yr Crystals"); QApplication::setApplicationVersion("1.0"); qRegisterMetaType>("std::vector"); QPalette p = app.palette(); p.setColor(QPalette::Window, Qt::black); p.setColor(QPalette::WindowText, Qt::white); app.setPalette(p); QCommandLineParser parser; parser.setApplicationDescription("Yr Crystals Player"); parser.addHelpOption(); parser.addVersionOption(); QCommandLineOption recursiveOption(QStringList() << "r" << "recursive", "Recursively scan directory."); parser.addOption(recursiveOption); parser.addPositionalArgument("source", "Audio file or directory to play."); parser.process(app); QStringList args = parser.positionalArguments(); QString inputPath; if (!args.isEmpty()) inputPath = args.first(); bool recursive = parser.isSet(recursiveOption); MainWindow w; w.show(); if (!inputPath.isEmpty()) { w.loadPath(inputPath, recursive); } return app.exec(); }