File indexing completed on 2024-10-06 11:07:53
0001 // SPDX-FileCopyrightText: 2021 Simon Persson <simon.persson@mykolab.com> 0002 // 0003 // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0004 0005 #include "purger.h" 0006 0007 #include <KAboutData> 0008 #include <KLocalizedString> 0009 0010 #include <QApplication> 0011 #include <QCommandLineOption> 0012 #include <QCommandLineParser> 0013 #include <QDir> 0014 0015 int main(int pArgCount, char **pArgArray) { 0016 QApplication lApp(pArgCount, pArgArray); 0017 QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true); 0018 0019 KLocalizedString::setApplicationDomain("kup"); 0020 0021 KAboutData lAbout(QStringLiteral("kuppurger"), xi18nc("@title", "Purger"), QStringLiteral("0.9.1"), 0022 i18n("Purger for bup archives."), 0023 KAboutLicense::GPL, i18n("Copyright (C) 2013-2021 Simon Persson")); 0024 lAbout.addAuthor(i18n("Simon Persson"), i18n("Maintainer"), "simon.persson@mykolab.com"); 0025 lAbout.setTranslator(xi18nc("NAME OF TRANSLATORS", "Your names"), xi18nc("EMAIL OF TRANSLATORS", "Your emails")); 0026 KAboutData::setApplicationData(lAbout); //this calls qApp.setApplicationName, setVersion, etc. 0027 0028 QCommandLineParser lParser; 0029 lParser.addOption(QCommandLineOption(QStringList() << QStringLiteral("b") << QStringLiteral("branch"), 0030 i18n("Name of the branch to be opened."), 0031 QStringLiteral("branch name"), QStringLiteral("kup"))); 0032 lParser.addPositionalArgument(QStringLiteral("<repository path>"), i18n("Path to the bup repository to be opened.")); 0033 0034 lAbout.setupCommandLine(&lParser); 0035 lParser.process(lApp); 0036 lAbout.processCommandLine(&lParser); 0037 0038 QStringList lPosArgs = lParser.positionalArguments(); 0039 if(lPosArgs.isEmpty()) { 0040 return 1; 0041 } 0042 QString lRepoPath = QDir(lPosArgs.takeFirst()).absolutePath(); 0043 if(lRepoPath.isEmpty()) { 0044 return 1; 0045 } 0046 auto lPurger = new Purger(lRepoPath, lParser.value(QStringLiteral("branch"))); 0047 lPurger->show(); 0048 return QApplication::exec(); 0049 }