File indexing completed on 2024-04-14 05:43:23
0001 /* 0002 0003 This file is part of the KFloppy program, part of the KDE project 0004 0005 Copyright (C) 1997 Bernd Johannes Wuebben <wuebben@math.cornell.edu> 0006 Copyright (C) 2004, 2005 Nicolas GOUTTE <goutte@kde.org> 0007 Copyright (C) 2015, 2016 Wolfgang Bauer <wbauer@tmo.at> 0008 0009 0010 This program is free software; you can redistribute it and/or modify 0011 it under the terms of the GNU General Public License as published by 0012 the Free Software Foundation; either version 2 of the License, or 0013 (at your option) any later version. 0014 0015 This program is distributed in the hope that it will be useful, 0016 but WITHOUT ANY WARRANTY; without even the implied warranty of 0017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0018 GNU General Public License for more details. 0019 0020 You should have received a copy of the GNU General Public License 0021 along with this program; if not, write to the Free Software 0022 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0023 0024 */ 0025 0026 #include <QApplication> 0027 #include <QCommandLineParser> 0028 0029 #include <KAboutData> 0030 #include <KCrash> 0031 #include <KLocalizedString> 0032 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) 0033 #include <Kdelibs4ConfigMigrator> 0034 #endif 0035 #include "floppy.h" 0036 0037 int main(int argc, char *argv[]) 0038 { 0039 QApplication app(argc, argv); 0040 // Not needed in Qt6 (and doesn't exist at all) 0041 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) 0042 QGuiApplication::setFallbackSessionManagementEnabled(false); 0043 0044 Kdelibs4ConfigMigrator migrator(QStringLiteral("kfloppy")); 0045 migrator.setConfigFiles(QStringList() << QStringLiteral("kfloppyrc")); 0046 migrator.migrate(); 0047 #endif 0048 0049 KLocalizedString::setApplicationDomain("kfloppy"); 0050 KAboutData aboutData(QStringLiteral("kfloppy"), 0051 i18n("KFloppy"), 0052 QStringLiteral(KFLOPPY_VERSION), 0053 i18n("KDE Floppy Disk Utility"), 0054 KAboutLicense::GPL, 0055 i18n("(c) 1997, Bernd Johannes Wuebben\n" 0056 "(c) 2001, Chris Howells\n" 0057 "(c) 2002, Adriaan de Groot\n" 0058 "(c) 2004, 2005, Nicolas Goutte\n" 0059 "(c) 2015, 2016, Wolfgang Bauer"), 0060 i18n("KFloppy helps you format floppies with the filesystem of your choice."), 0061 QStringLiteral("https://utils.kde.org/projects/kfloppy")); 0062 0063 aboutData.addAuthor(i18n("Bernd Johannes Wuebben"), i18n("Author and former maintainer"), QStringLiteral("wuebben@kde.org")); 0064 aboutData.addCredit(i18n("Chris Howells"), i18n("User interface re-design"), QStringLiteral("howells@kde.org")); 0065 aboutData.addCredit(i18n("Adriaan de Groot"), i18n("Add BSD support"), QStringLiteral("groot@kde.org")); 0066 aboutData.addCredit(i18n("Nicolas Goutte"), i18n("Make KFloppy work again for KDE 3.4"), QStringLiteral("goutte@kde.org")); 0067 aboutData.addCredit(i18n("Wolfgang Bauer"), i18n("Port KFloppy to KF5"), QStringLiteral("wbauer@tmo.at")); 0068 // necessary to make the "Translators" tab appear in the About dialog 0069 aboutData.setTranslator(i18nc("NAME OF TRANSLATORS", "Your names"), i18nc("EMAIL OF TRANSLATORS", "Your emails")); 0070 KAboutData::setApplicationData(aboutData); 0071 0072 KCrash::initialize(); 0073 0074 QCommandLineParser parser; 0075 aboutData.setupCommandLine(&parser); 0076 0077 parser.addPositionalArgument(QStringLiteral("[device]"), i18n("Default device")); 0078 parser.process(app); 0079 aboutData.processCommandLine(&parser); 0080 0081 const QStringList args = parser.positionalArguments(); 0082 QString device; 0083 if (args.count()) { 0084 device = args.at(0); 0085 } 0086 0087 auto floppy = new FloppyData(); 0088 bool autoformat = floppy->setInitialDevice(device); 0089 floppy->show(); 0090 if (autoformat) { 0091 floppy->format(); 0092 } 0093 return app.exec(); 0094 }