initial commit
This commit is contained in:
commit
02648e86c3
13
main.cpp
Normal file
13
main.cpp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#include <QApplication>
|
||||||
|
#include "trayicon.h"
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QApplication a(argc, argv);
|
||||||
|
a.setApplicationName(QStringLiteral("Set audio card profile..."));
|
||||||
|
|
||||||
|
auto ic = new TrayIcon(&a);
|
||||||
|
ic->show();
|
||||||
|
|
||||||
|
return a.exec();
|
||||||
|
}
|
19
pa-card-profile-tray.pro
Normal file
19
pa-card-profile-tray.pro
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
QT += core gui widgets
|
||||||
|
|
||||||
|
TARGET = pa-card-profile-tray
|
||||||
|
TEMPLATE = app
|
||||||
|
|
||||||
|
PKGCONFIG += libpulse
|
||||||
|
LIBS += -lpulse
|
||||||
|
|
||||||
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
|
SOURCES += main.cpp \
|
||||||
|
trayicon.cpp \
|
||||||
|
qpulse.cpp \
|
||||||
|
threadedmainlooplock.cpp
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
trayicon.h \
|
||||||
|
qpulse.h \
|
||||||
|
threadedmainlooplock.h
|
336
pa-card-profile-tray.pro.user
Normal file
336
pa-card-profile-tray.pro.user
Normal file
@ -0,0 +1,336 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE QtCreatorProject>
|
||||||
|
<!-- Written by QtCreator 4.6.2, 2018-09-30T21:13:55. -->
|
||||||
|
<qtcreator>
|
||||||
|
<data>
|
||||||
|
<variable>EnvironmentId</variable>
|
||||||
|
<value type="QByteArray">{67050bf3-78d3-448a-82be-9e893e07d9a7}</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
|
<value type="int">0</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||||
|
<valuemap type="QVariantMap">
|
||||||
|
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
|
||||||
|
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
|
||||||
|
<value type="QString" key="language">Cpp</value>
|
||||||
|
<valuemap type="QVariantMap" key="value">
|
||||||
|
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
|
||||||
|
</valuemap>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
|
||||||
|
<value type="QString" key="language">QmlJS</value>
|
||||||
|
<valuemap type="QVariantMap" key="value">
|
||||||
|
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
|
||||||
|
</valuemap>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
|
||||||
|
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
|
||||||
|
<value type="int" key="EditorConfiguration.IndentSize">4</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
|
||||||
|
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
||||||
|
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
|
||||||
|
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
|
||||||
|
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
|
||||||
|
<value type="int" key="EditorConfiguration.TabSize">8</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
|
||||||
|
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
|
||||||
|
</valuemap>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.PluginSettings</variable>
|
||||||
|
<valuemap type="QVariantMap"/>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||||
|
<valuemap type="QVariantMap">
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debian System Qt5</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debian System Qt5</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{4cec843c-77aa-4b21-bd99-b7bf84d54e1f}</value>
|
||||||
|
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||||
|
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||||
|
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||||
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/mjg/dev/.build/build-pa-card-profile-tray-Debian_System_Qt5-Debug</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
|
||||||
|
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
|
||||||
|
<value type="QString">-w</value>
|
||||||
|
<value type="QString">-r</value>
|
||||||
|
</valuelist>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
|
||||||
|
<value type="QString">-w</value>
|
||||||
|
<value type="QString">-r</value>
|
||||||
|
</valuelist>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||||
|
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||||
|
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||||
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/mjg/dev/.build/build-pa-card-profile-tray-Debian_System_Qt5-Release</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
|
||||||
|
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
|
||||||
|
<value type="QString">-w</value>
|
||||||
|
<value type="QString">-r</value>
|
||||||
|
</valuelist>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
|
||||||
|
<value type="QString">-w</value>
|
||||||
|
<value type="QString">-r</value>
|
||||||
|
</valuelist>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||||
|
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||||
|
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
||||||
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/mjg/dev/.build/build-pa-card-profile-tray-Debian_System_Qt5-Profile</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
|
||||||
|
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
|
||||||
|
<value type="QString">-w</value>
|
||||||
|
<value type="QString">-r</value>
|
||||||
|
</valuelist>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
|
||||||
|
<value type="QString">-w</value>
|
||||||
|
<value type="QString">-r</value>
|
||||||
|
</valuelist>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||||
|
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Profile</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||||
|
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy Configuration</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||||
|
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
|
||||||
|
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
|
||||||
|
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
|
||||||
|
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
|
||||||
|
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
||||||
|
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
|
||||||
|
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
|
||||||
|
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
|
||||||
|
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
|
||||||
|
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
|
||||||
|
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
|
||||||
|
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
|
||||||
|
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
|
||||||
|
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
|
||||||
|
<value type="int">0</value>
|
||||||
|
<value type="int">1</value>
|
||||||
|
<value type="int">2</value>
|
||||||
|
<value type="int">3</value>
|
||||||
|
<value type="int">4</value>
|
||||||
|
<value type="int">5</value>
|
||||||
|
<value type="int">6</value>
|
||||||
|
<value type="int">7</value>
|
||||||
|
<value type="int">8</value>
|
||||||
|
<value type="int">9</value>
|
||||||
|
<value type="int">10</value>
|
||||||
|
<value type="int">11</value>
|
||||||
|
<value type="int">12</value>
|
||||||
|
<value type="int">13</value>
|
||||||
|
<value type="int">14</value>
|
||||||
|
</valuelist>
|
||||||
|
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||||
|
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">pa-card-profile-tray</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/mjg/dev/pa-card-profile-tray/pa-card-profile-tray.pro</value>
|
||||||
|
<value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">pa-card-profile-tray.pro</value>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default"></value>
|
||||||
|
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||||
|
</valuemap>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.TargetCount</variable>
|
||||||
|
<value type="int">1</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||||
|
<value type="int">18</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>Version</variable>
|
||||||
|
<value type="int">18</value>
|
||||||
|
</data>
|
||||||
|
</qtcreator>
|
66
qpulse.cpp
Normal file
66
qpulse.cpp
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
#include "qpulse.h"
|
||||||
|
#include "threadedmainlooplock.h"
|
||||||
|
|
||||||
|
QPulse::QPulse(QObject *parent) :
|
||||||
|
QObject(parent),
|
||||||
|
ml(pa_threaded_mainloop_new()),
|
||||||
|
c(nullptr)
|
||||||
|
{
|
||||||
|
pa_threaded_mainloop_start(ml);
|
||||||
|
|
||||||
|
c = pa_context_new( pa_threaded_mainloop_get_api(ml), "pa-card-profile-tray");
|
||||||
|
pa_context_set_state_callback(c, &QPulse::onConnectionStateChangedSt, this);
|
||||||
|
pa_context_connect(c, nullptr, PA_CONTEXT_NOFLAGS, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
QPulse::~QPulse()
|
||||||
|
{
|
||||||
|
pa_context_disconnect(c);
|
||||||
|
pa_threaded_mainloop_stop(ml);
|
||||||
|
pa_threaded_mainloop_free(ml);
|
||||||
|
}
|
||||||
|
|
||||||
|
pa_context_state_t QPulse::ConnectionState()
|
||||||
|
{
|
||||||
|
//ThreadedMainLoopLock lock(ml);
|
||||||
|
|
||||||
|
return pa_context_get_state(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QPulse::RequestServerInfo()
|
||||||
|
{
|
||||||
|
//ThreadedMainLoopLock lock(ml);
|
||||||
|
|
||||||
|
pa_context_get_server_info(c, &QPulse::onGotServerInfoSt, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QPulse::RequestCardInfo()
|
||||||
|
{
|
||||||
|
//ThreadedMainLoopLock lock(ml);
|
||||||
|
|
||||||
|
pa_context_get_card_info_list(c, &QPulse::onGotCardInfoListSt, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QPulse::onGotCardInfoListSt(pa_context*, const pa_card_info *i, int eol, void *userdata)
|
||||||
|
{
|
||||||
|
QPulse* qp = static_cast<QPulse*>(userdata);
|
||||||
|
//ThreadedMainLoopLock lock(qp->ml);
|
||||||
|
|
||||||
|
emit qp->GotCardInfoList(i, eol);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QPulse::onGotServerInfoSt(pa_context*, const pa_server_info *i, void *userdata)
|
||||||
|
{
|
||||||
|
QPulse* qp = static_cast<QPulse*>(userdata);
|
||||||
|
//ThreadedMainLoopLock lock(qp->ml);
|
||||||
|
|
||||||
|
emit qp->GotServerInfo(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QPulse::onConnectionStateChangedSt(pa_context*, void *userdata)
|
||||||
|
{
|
||||||
|
QPulse* qp = static_cast<QPulse*>(userdata);
|
||||||
|
//ThreadedMainLoopLock lock(qp->ml);
|
||||||
|
|
||||||
|
emit qp->ConnectionStateChanged();
|
||||||
|
}
|
37
qpulse.h
Normal file
37
qpulse.h
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#ifndef QPULSE_H
|
||||||
|
#define QPULSE_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <pulse/pulseaudio.h>
|
||||||
|
|
||||||
|
class QPulse : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit QPulse(QObject *parent = 0);
|
||||||
|
~QPulse();
|
||||||
|
|
||||||
|
pa_context_state_t ConnectionState();
|
||||||
|
|
||||||
|
void RequestServerInfo();
|
||||||
|
void RequestCardInfo();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void ConnectionStateChanged();
|
||||||
|
void GotServerInfo(const pa_server_info *i);
|
||||||
|
void GotCardInfoList(const pa_card_info *i, int eol);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
protected:
|
||||||
|
pa_threaded_mainloop* ml;
|
||||||
|
pa_context *c;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static void onConnectionStateChangedSt(pa_context *c, void *userdata);
|
||||||
|
static void onGotServerInfoSt(pa_context *c, const pa_server_info *i, void *userdata);
|
||||||
|
static void onGotCardInfoListSt(pa_context *c, const pa_card_info *i, int eol, void *userdata);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // QPULSE_H
|
11
threadedmainlooplock.cpp
Normal file
11
threadedmainlooplock.cpp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include "threadedmainlooplock.h"
|
||||||
|
|
||||||
|
ThreadedMainLoopLock::ThreadedMainLoopLock(pa_threaded_mainloop* ml) :
|
||||||
|
ml(ml)
|
||||||
|
{
|
||||||
|
pa_threaded_mainloop_lock(ml);
|
||||||
|
}
|
||||||
|
|
||||||
|
ThreadedMainLoopLock::~ThreadedMainLoopLock() {
|
||||||
|
pa_threaded_mainloop_unlock(ml);
|
||||||
|
}
|
19
threadedmainlooplock.h
Normal file
19
threadedmainlooplock.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#ifndef THREADEDMAINLOOPLOCK_H
|
||||||
|
#define THREADEDMAINLOOPLOCK_H
|
||||||
|
|
||||||
|
#include <pulse/pulseaudio.h>
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
class ThreadedMainLoopLock {
|
||||||
|
public:
|
||||||
|
ThreadedMainLoopLock(pa_threaded_mainloop *ml);
|
||||||
|
~ThreadedMainLoopLock();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(ThreadedMainLoopLock)
|
||||||
|
|
||||||
|
private:
|
||||||
|
pa_threaded_mainloop* ml;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // THREADEDMAINLOOPLOCK_H
|
110
trayicon.cpp
Normal file
110
trayicon.cpp
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
#include "trayicon.h"
|
||||||
|
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QAction>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include <pulse/pulseaudio.h>
|
||||||
|
|
||||||
|
TrayIcon::TrayIcon(QObject *parent) :
|
||||||
|
QSystemTrayIcon(QIcon::fromTheme("preferences-desktop-sound"), parent),
|
||||||
|
pulse(this)
|
||||||
|
{
|
||||||
|
this->menu = new QMenu(); // can only be explicitly owned by a QWidget, not any QObject, so we need to
|
||||||
|
// manually manage its lifecycle in the d'tor
|
||||||
|
|
||||||
|
this->quitAction = new QAction("Quit");
|
||||||
|
connect(this->quitAction, &QAction::triggered, this, &TrayIcon::on_quitAction_triggered);
|
||||||
|
|
||||||
|
this->refreshAction = new QAction("Refresh");
|
||||||
|
connect(this->refreshAction, &QAction::triggered, this, &TrayIcon::onRefreshAction_triggered);
|
||||||
|
|
||||||
|
// Set up basic menu only, will be wiped during refresh
|
||||||
|
this->menu->addAction(refreshAction);
|
||||||
|
this->menu->addAction(quitAction);
|
||||||
|
|
||||||
|
this->setContextMenu(this->menu); // n.b. does not take ownership
|
||||||
|
|
||||||
|
connect(&this->pulse, &QPulse::ConnectionStateChanged, [=]() {
|
||||||
|
if (pulse.ConnectionState() == PA_CONTEXT_READY) {
|
||||||
|
refreshData();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
connect(&this->pulse, &QPulse::GotCardInfoList, this, &TrayIcon::onGotPulseCardInfo);
|
||||||
|
|
||||||
|
refreshData();
|
||||||
|
}
|
||||||
|
|
||||||
|
TrayIcon::~TrayIcon()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < cardMenus.length(); ++i) {
|
||||||
|
delete cardMenus[i];
|
||||||
|
}
|
||||||
|
cardMenus.clear();
|
||||||
|
delete this->quitAction;
|
||||||
|
delete this->menu;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TrayIcon::refreshData()
|
||||||
|
{
|
||||||
|
// Delete existing card menus, but leave the final clearing for later
|
||||||
|
for (int i = 0; i < cardMenus.length(); ++i) {
|
||||||
|
delete cardMenus[i];
|
||||||
|
}
|
||||||
|
cardMenus.clear();
|
||||||
|
|
||||||
|
// Calling delete() should have removed them from the menu, leaving only the separator / refresh / quit options
|
||||||
|
|
||||||
|
pulse.RequestCardInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TrayIcon::on_quitAction_triggered()
|
||||||
|
{
|
||||||
|
QApplication::exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TrayIcon::onRefreshAction_triggered()
|
||||||
|
{
|
||||||
|
refreshData();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TrayIcon::onGotPulseCardInfo(const pa_card_info *cardInfo, int eol)
|
||||||
|
{
|
||||||
|
if (eol) {
|
||||||
|
// OK - rebuild the menu
|
||||||
|
this->menu->clear();
|
||||||
|
|
||||||
|
for (int i = 0; i < this->cardMenus.length(); ++i) {
|
||||||
|
this->menu->addMenu(this->cardMenus[i]);
|
||||||
|
}
|
||||||
|
this->menu->addSeparator();
|
||||||
|
this->menu->addAction(refreshAction);
|
||||||
|
this->menu->addAction(quitAction);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
QString name; // = pa_proplist_to_string(cardInfo->proplist);; // copy to QString from internally-managed buffers
|
||||||
|
if (true) { // 0 != pa_proplist_isempty(cardInfo->proplist) && 1 == pa_proplist_contains(cardInfo->proplist, PA_PROP_DEVICE_DESCRIPTION)) {
|
||||||
|
name = pa_proplist_gets(cardInfo->proplist, PA_PROP_DEVICE_DESCRIPTION);;
|
||||||
|
} else {
|
||||||
|
name = cardInfo->name;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
QString name(cardInfo->name);
|
||||||
|
if (name.length() == 0) {
|
||||||
|
name = tr("Default card");
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
QMenu* cardMenu = new QMenu(name);
|
||||||
|
for (size_t i = 0; i < cardInfo->n_profiles; ++i) {
|
||||||
|
auto profileAction = new QAction(cardInfo->profiles[i].description, cardMenu);
|
||||||
|
cardMenu->addAction(profileAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
this->cardMenus.push_back(cardMenu);
|
||||||
|
}
|
32
trayicon.h
Normal file
32
trayicon.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#ifndef TRAYICON_H
|
||||||
|
#define TRAYICON_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QSystemTrayIcon>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QAction>
|
||||||
|
#include <QVector>
|
||||||
|
#include "qpulse.h"
|
||||||
|
|
||||||
|
class TrayIcon : public QSystemTrayIcon
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TrayIcon(QObject *parent);
|
||||||
|
~TrayIcon();
|
||||||
|
|
||||||
|
void refreshData();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void on_quitAction_triggered();
|
||||||
|
void onRefreshAction_triggered();
|
||||||
|
void onGotPulseCardInfo(const pa_card_info *i, int eol);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QPulse pulse;
|
||||||
|
QMenu* menu;
|
||||||
|
QVector<QMenu*> cardMenus;
|
||||||
|
QAction* quitAction;
|
||||||
|
QAction* refreshAction;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TRAYICON_H
|
Loading…
Reference in New Issue
Block a user