File indexing completed on 2024-04-28 04:44:17

0001 /*
0002     SnoreNotify is a Notification Framework based on Qt
0003     Copyright (C) 2015  Hannah von Reth <vonreth@kde.org>
0004 
0005     SnoreNotify is free software: you can redistribute it and/or modify
0006     it under the terms of the GNU Lesser General Public License as published by
0007     the Free Software Foundation, either version 3 of the License, or
0008     (at your option) any later version.
0009 
0010     SnoreNotify is distributed in the hope that it will be useful,
0011     but WITHOUT ANY WARRANTY; without even the implied warranty of
0012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013     GNU Lesser General Public License for more details.
0014 
0015     You should have received a copy of the GNU Lesser General Public License
0016     along with SnoreNotify.  If not, see <http://www.gnu.org/licenses/>.
0017 */
0018 #include "libsnore/snore.h"
0019 #include "libsnore/snore_p.h"
0020 #include "libsnore/version.h"
0021 #include "settingswindow.h"
0022 
0023 #include "libsnore/snore_static_plugins.h"
0024 
0025 #include <QApplication>
0026 #include <QCommandLineParser>
0027 
0028 #include <iostream>
0029 
0030 using namespace Snore;
0031 using namespace std;
0032 
0033 int main(int argc, char *argv[])
0034 {
0035     QApplication app(argc, argv);
0036     app.setApplicationName(QStringLiteral("SnoreSettings"));
0037     app.setOrganizationName(QStringLiteral("SnoreNotify"));
0038     app.setApplicationVersion(Snore::Version::version());
0039 
0040     Snore::SnoreCore::instance().loadPlugins(Snore::SnorePlugin::All);
0041     Snore::SnoreCorePrivate::instance()->defaultApplication().hints().setValue("use-markup", QVariant::fromValue(true));
0042 
0043     QCommandLineParser parser;
0044     parser.setApplicationDescription(QStringLiteral("A settings interface for Snorenotify."));
0045     parser.addHelpOption();
0046     parser.addVersionOption();
0047 
0048     QCommandLineOption appNameCommand({QStringLiteral("a"), QStringLiteral("appName") } , QStringLiteral("Set the Name of the app <app> or global."), QStringLiteral("app"), QStringLiteral("global"));
0049     parser.addOption(appNameCommand);
0050 
0051     parser.process(app);
0052 
0053     QString appName = parser.value(appNameCommand);
0054 
0055     SettingsWindow *window = new SettingsWindow(appName);
0056     window->show();
0057     return qApp->exec();
0058 }