| 137 | |
| 138 | using namespace std; |
| 139 | int main(int argc, |
| 140 | char *argv[]) |
| 141 | { |
| 142 | // Locale workaround |
| 143 | auto systemLocale = QLocale::system(); |
| 144 | QLocale::setDefault(QLocale::c()); |
| 145 | setlocale(LC_NUMERIC, "C"); |
| 146 | |
| 147 | // Used for some crash handler magic & auto-start setup |
| 148 | findyourself_init(argv[0]); |
| 149 | char exepath[PATH_MAX]; |
| 150 | find_yourself(exepath, sizeof(exepath)); |
| 151 | // Ensure temp directory exists |
| 152 | mkdir("/tmp/jamesdsp/", S_IRWXU); |
| 153 | // Prepare crash handler if enabled |
| 154 | bool lastSessionCrashed = initCrashHandler(exepath); |
| 155 | |
| 156 | qRegisterMetaType<AppConfig::Key>(); |
| 157 | qRegisterMetaType<DspConfig::Key>(); |
| 158 | |
| 159 | qDBusRegisterMetaType<PresetRule>(); |
| 160 | qDBusRegisterMetaType<QList<PresetRule>>(); |
| 161 | qDBusRegisterMetaType<Route>(); |
| 162 | qDBusRegisterMetaType<QList<Route>>(); |
| 163 | qDBusRegisterMetaType<IOutputDevice>(); |
| 164 | qDBusRegisterMetaType<QList<IOutputDevice>>(); |
| 165 | |
| 166 | #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) |
| 167 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true); |
| 168 | QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true); |
| 169 | #endif |
| 170 | |
| 171 | QScopedPointer<QCoreApplication> app(new QCoreApplication(argc, argv)); |
| 172 | #ifndef HEADLESS |
| 173 | initTranslator(systemLocale); |
| 174 | #endif |
| 175 | |
| 176 | QCoreApplication::setApplicationName("jamesdsp"); |
| 177 | QCoreApplication::setApplicationVersion(APP_VERSION_FULL); |
| 178 | |
| 179 | QCommandLineOption help(QStringList() << "h" << "help", "Displays help on command line options"); |
| 180 | QCommandLineOption tray(QStringList() << "t" << "tray", "Start minimized in systray (GUI)"); |
| 181 | QCommandLineOption watch(QStringList() << "w" << "watch", "Watch audio.conf and apply changes made by external apps automatically (GUI)"); |
| 182 | QCommandLineOption lang(QStringList() << "l" << "lang", "Override language (example: de, es, uk, zh_CN)", "lang"); |
| 183 | QCommandLineOption spinlck(QStringList() << "d" << "spinlock-on-crash", "Wait for debugger in case of crash"); |
| 184 | QCommandLineOption silent(QStringList() << "s" << "silent", "Suppress log output"); |
| 185 | QCommandLineOption minVerbosity(QStringList() << "m" << "min-verbosity", "Minimum log verbosity (0 = Debug; ...; 5 = Critical)", "level"); |
| 186 | QCommandLineOption nocolor(QStringList() << "c" << "no-color", "Disable colored log output"); |
| 187 | |
| 188 | |
| 189 | QCommandLineParser parser; |
| 190 | parser.setApplicationDescription(QObject::tr("JamesDSP is an advanced audio processing engine available for Linux and Android systems.")); |
| 191 | parser.addHelpOption(); |
| 192 | parser.addVersionOption(); |
| 193 | |
| 194 | // GUI |
| 195 | parser.addOptions({tray, watch, lang}); |
| 196 |
nothing calls this directly
no test coverage detected