Code reformatted using kde-dev-scripts/astyle-kdelibs

This commit is contained in:
Patrick von Reth 2014-09-11 14:49:19 +02:00
parent b996033ca1
commit b506f3486b
1 changed files with 20 additions and 28 deletions

View File

@ -9,12 +9,11 @@
#include <iostream>
using namespace Snore;
int main ( int argc, char *argv[] )
using namespace Snore;
int main(int argc, char *argv[])
{
QApplication app ( argc, argv );
QApplication app(argc, argv);
app.setApplicationName("snore-send");
app.setOrganizationName("snore-send");
app.setApplicationVersion(Snore::Version::version());
@ -31,49 +30,43 @@ int main ( int argc, char *argv[] )
parser.addOption(message);
QCommandLineOption applicationName(QStringList() << "a" << "application", "Set the notification applicattion.", "application", app.applicationName());
parser.addOption(applicationName);
QCommandLineOption alertName(QStringList() << "c" << "alert", "Set the notification alert class.","alert", "Default");
parser.addOption(applicationName);
QCommandLineOption alertName(QStringList() << "c" << "alert", "Set the notification alert class.", "alert", "Default");
parser.addOption(alertName);
QCommandLineOption iconPath(QStringList() << "i" << "icon", "Set the notification icon.","icon", ":/root/snore.png");
QCommandLineOption iconPath(QStringList() << "i" << "icon", "Set the notification icon.", "icon", ":/root/snore.png");
parser.addOption(iconPath);
QCommandLineOption backend(QStringList() << "b" << "backend", "Set the notification backend.","backend");
QCommandLineOption backend(QStringList() << "b" << "backend", "Set the notification backend.", "backend");
parser.addOption(backend);
QCommandLineOption silent(QStringList() << "silent", "Don't print to stdout.");
parser.addOption(silent);
parser.addOption(silent);
parser.process(app);
if(parser.isSet(title) && parser.isSet(message))
{
if (parser.isSet(title) && parser.isSet(message)) {
SnoreCore core;
core.loadPlugins(SnorePlugin::BACKEND);
if(parser.isSet(backend)?!core.setPrimaryNotificationBackend(parser.value(backend)):!core.setPrimaryNotificationBackend())
{
if (parser.isSet(backend) ? !core.setPrimaryNotificationBackend(parser.value(backend)) : !core.setPrimaryNotificationBackend()) {
std::cerr << "Failed to set backend: " << qPrintable(parser.value(backend)) << " avalible backends: " << qPrintable(core.notificationBackends().join(", ")) << std::endl;
return 1;
}
Icon icon(parser.value(iconPath));
Application application(parser.value(applicationName),icon);
Alert alert(parser.value(alertName),icon);
Application application(parser.value(applicationName), icon);
Alert alert(parser.value(alertName), icon);
application.addAlert(alert);
core.registerApplication(application);
Notification n(application, alert, parser.value(title), parser.value(message),icon);
Notification n(application, alert, parser.value(title), parser.value(message), icon);
core.broadcastNotification(n);
int returnCode = -1;
app.connect(&core, &SnoreCore::notificationClosed, [&](Notification noti){
if(!parser.isSet(silent))
{
app.connect(&core, &SnoreCore::notificationClosed, [&](Notification noti) {
if (!parser.isSet(silent)) {
QString reason;
QDebug(&reason) << noti.closeReason();
std::cout << qPrintable(reason) << std::endl;
@ -85,6 +78,5 @@ int main ( int argc, char *argv[] )
return returnCode;
}
parser.showHelp(1);
}
}