Ifdef two cmd arguments of snoresend that are currently only supported on windows.

This commit is contained in:
Hannah von Reth 2015-12-07 21:24:03 +01:00
parent 87f6d04cd4
commit 7c7bba556c
2 changed files with 5 additions and 2 deletions

View File

@ -66,7 +66,7 @@ public:
Frontend = 1 << 2, Frontend = 1 << 2,
/** /**
* General plugins, currently there are not plugins implemented. * General plugins, currently there are no plugins implemented.
*/ */
Plugin = 1 << 3, Plugin = 1 << 3,

View File

@ -104,12 +104,13 @@ int main(int argc, char *argv[])
QCommandLineOption silent(QStringList() << QStringLiteral("silent"), QStringLiteral("Don't print to stdout.")); QCommandLineOption silent(QStringList() << QStringLiteral("silent"), QStringLiteral("Don't print to stdout."));
parser.addOption(silent); parser.addOption(silent);
#ifdef Q_OS_WIN
QCommandLineOption _bringProcessToFront(QStringList() << QStringLiteral("bring-process-to-front"), QStringLiteral("Bring process with pid to front if notification is clicked."), QStringLiteral("pid")); QCommandLineOption _bringProcessToFront(QStringList() << QStringLiteral("bring-process-to-front"), QStringLiteral("Bring process with pid to front if notification is clicked."), QStringLiteral("pid"));
parser.addOption(_bringProcessToFront); parser.addOption(_bringProcessToFront);
QCommandLineOption _bringWindowToFront(QStringList() << QStringLiteral("bring-window-to-front"), QStringLiteral("Bring window with wid to front if notification is clicked."), QStringLiteral("wid")); QCommandLineOption _bringWindowToFront(QStringList() << QStringLiteral("bring-window-to-front"), QStringLiteral("Bring window with wid to front if notification is clicked."), QStringLiteral("wid"));
parser.addOption(_bringWindowToFront); parser.addOption(_bringWindowToFront);
#endif
parser.process(app); parser.process(app);
qCDebug(SNORE) << app.arguments(); qCDebug(SNORE) << app.arguments();
if (parser.isSet(title) && parser.isSet(message)) { if (parser.isSet(title) && parser.isSet(message)) {
@ -148,11 +149,13 @@ int main(int argc, char *argv[])
cout << qPrintable(reason) << endl; cout << qPrintable(reason) << endl;
} }
if (noti.closeReason() == Notification::Closed) { if (noti.closeReason() == Notification::Closed) {
#ifdef Q_OS_WIN
if (parser.isSet(_bringProcessToFront)) { if (parser.isSet(_bringProcessToFront)) {
bringToFront(parser.value(_bringProcessToFront)); bringToFront(parser.value(_bringProcessToFront));
} else if (parser.isSet(_bringWindowToFront)) { } else if (parser.isSet(_bringWindowToFront)) {
Utils::bringWindowToFront((HWND)parser.value(_bringWindowToFront).toULongLong(), true); Utils::bringWindowToFront((HWND)parser.value(_bringWindowToFront).toULongLong(), true);
} }
#endif
} }
returnCode = noti.closeReason(); returnCode = noti.closeReason();
}); });