diff options
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp index cc149a4..b1736cc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,7 @@ #include "main.h" #include "mainwindow.h" #include "slxoutput.h" +#include "setdefault.h" #include <cstdio> #include <cstring> @@ -19,6 +20,7 @@ #include <QList> #include <QSet> #include <QTimer> +#include <QCommandLineParser> // libkf5pulseaudioqt-dev // Public @@ -76,6 +78,7 @@ static void addDevicePortToWindow(PulseAudioQt::Card *card, PulseAudioQt::Device volume = 65535; device->setVolume(volume); } + device->setMuted(false); } //knownCardPortCombos.insert(card->name() + ":" + port->name()); _mainWindow->getDevice(card, device, port, isOutput)->updateDeviceAndPort(defaultSinkAndPort, device->isMuted(), @@ -430,10 +433,26 @@ void enableSource(const QString &source, const QString &port) int main(int argc, char **argv) { QApplication a(argc, argv); - printf("Muh\n"); auto *i = PulseAudioQt::Context::instance(); - printf("Pa is %p = %d\n", i, (int)i->isValid()); - printf("Cards: %d\n", (int)i->cards().size()); + + a.setOrganizationName(QStringLiteral("slxmix")); + a.setApplicationVersion(QLatin1String("1.0.0.0.0")); + QCommandLineParser parser; + parser.setApplicationDescription(QObject::tr("SLXmix Volume Control")); + parser.addHelpOption(); + QCommandLineOption selectOption(QStringList() << QStringLiteral("output") << QStringLiteral("o"), + QObject::tr("Select a specific output configuration and quit. Will select the Profile/Sink/Port combo that best matches the list of given keywords, e.g. 'HDMI 1 5.1'"), + QStringLiteral("keywords")); + parser.addOption(selectOption); + parser.process(a); + // Select default output and exit + if (parser.isSet(selectOption)) { + QString what = parser.value(selectOption); + QTimer::singleShot(100, [what]() { + setDefaultOutput(what); + }); + return a.exec(); + } // There's no signal, or no way to check if we're connected to PA, so // just wait a bit and hope for the best. |