Skip to content

Commit dbc19d2

Browse files
committed
1) Icon pack support for window/tray 2) Add basic stream enumerator for PW
1 parent f6616ba commit dbc19d2

File tree

12 files changed

+102
-24
lines changed

12 files changed

+102
-24
lines changed

src/MainWindow.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ MainWindow::MainWindow(QString exepath,
150150
{
151151
Log::information("============ Initializing user interface ============");
152152

153+
this->setWindowIcon(QIcon::fromTheme("jamesdsp-tray", QIcon(":/icons/icon.png")));
154+
153155
ui->eq_widget->setBands(PresetProvider::EQ::defaultPreset(), false);
154156
ui->eq_dyn_widget->setSidebarHidden(true);
155157
ui->eq_dyn_widget->set15BandFreeMode(true);

src/MainWindow.ui

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@
2525
<property name="windowTitle">
2626
<string>JamesDSP for Linux</string>
2727
</property>
28-
<property name="windowIcon">
29-
<iconset resource="../resources/resources.qrc">
30-
<normaloff>:/icons/icon.svg</normaloff>:/icons/icon.svg</iconset>
31-
</property>
3228
<property name="tabShape">
3329
<enum>QTabWidget::Rounded</enum>
3430
</property>

src/audio/pipewire/PipewireAudioService.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ PipewireAudioService::PipewireAudioService()
2020
void PipewireAudioService::initialize()
2121
{
2222
mgr = std::make_unique<PwPipelineManager>();
23+
appMgr = std::make_unique<PwAppManager>(mgr.get());
2324
plugin = std::make_unique<PwJamesDspPlugin>(mgr.get());
2425
effects = std::make_unique<FilterContainer>(mgr.get(), plugin.get(), &AppConfig::instance());
2526

src/audio/pipewire/PipewireAudioService.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "PwPipelineManager.h"
55
#include "FilterContainer.h"
6+
#include "PwAppManager.h"
67
#include "IAudioService.h"
78
#include "config/AppConfig.h"
89

@@ -34,6 +35,7 @@ public slots:
3435
const std::string log_tag = "PipewireAudioService: ";
3536

3637
std::unique_ptr<PwPipelineManager> mgr;
38+
std::unique_ptr<PwAppManager> appMgr;
3739
std::unique_ptr<FilterContainer> effects;
3840
std::unique_ptr<PwJamesDspPlugin> plugin;
3941

src/audio/pipewire/PipewireCore.pri

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ INCLUDEPATH += $$PWD
33
HEADERS += \
44
$$PWD/FilterContainer.h \
55
$$PWD/PipewireAudioService.h \
6+
$$PWD/PwAppManager.h \
67
$$PWD/PwBasePlugin.h \
78
$$PWD/PwDevice.h \
89
$$PWD/PwJamesDspPlugin.h \
@@ -11,6 +12,7 @@ HEADERS += \
1112
SOURCES += \
1213
$$PWD/FilterContainer.cpp \
1314
$$PWD/PipewireAudioService.cpp \
15+
$$PWD/PwAppManager.cpp \
1416
$$PWD/PwBasePlugin.cpp \
1517
$$PWD/PwDevice.cpp \
1618
$$PWD/PwJamesDspPlugin.cpp \
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#include "PwAppManager.h"
2+
3+
PwAppManager::PwAppManager(PwPipelineManager* mgr) : mgr(mgr)
4+
{
5+
mgr->stream_output_added.connect(sigc::mem_fun(*this, &PwAppManager::onAppAdded));
6+
mgr->stream_output_changed.connect(sigc::mem_fun(*this, &PwAppManager::onAppChanged));
7+
mgr->stream_output_removed.connect(sigc::mem_fun(*this, &PwAppManager::onAppRemoved));
8+
}
9+
10+
void PwAppManager::onAppAdded(const uint id, const std::string name, const std::string media_class)
11+
{
12+
for (int n = 0; n < apps.length(); n++) {
13+
if (apps[n].id == id) {
14+
return;
15+
}
16+
}
17+
18+
NodeInfo node_info;
19+
20+
try {
21+
node_info = mgr->node_map.at(id);
22+
} catch (...) {
23+
return;
24+
}
25+
26+
apps.append(node_info);
27+
emit appAdded(node_info);
28+
}
29+
30+
void PwAppManager::onAppChanged(const uint id)
31+
{
32+
for (int n = 0; n < apps.length(); n++) {
33+
if (auto item = apps[n]; item.id == id) {
34+
try {
35+
item = mgr->node_map.at(id);
36+
} catch (...) {
37+
return;
38+
}
39+
40+
emit appChanged(item);
41+
break;
42+
}
43+
}
44+
}
45+
46+
void PwAppManager::onAppRemoved(const uint id)
47+
{
48+
for (int n = 0; n < apps.length(); n++)
49+
{
50+
if (apps[n].id == id)
51+
{
52+
apps.removeAt(n);
53+
emit appRemoved(id);
54+
break;
55+
}
56+
}
57+
}

src/audio/pipewire/PwAppManager.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#ifndef PWAPPMANAGER_H
2+
#define PWAPPMANAGER_H
3+
4+
#include <PwPipelineManager.h>
5+
#include <QObject>
6+
#include <memory>
7+
8+
class PwAppManager : public QObject
9+
{
10+
Q_OBJECT
11+
public:
12+
explicit PwAppManager(PwPipelineManager* mgr);
13+
14+
signals:
15+
void appAdded(const NodeInfo& node);
16+
void appChanged(const NodeInfo& node);
17+
void appRemoved(const uint id);
18+
19+
private:
20+
void onAppAdded(const uint id, const std::string name, const std::string media_class);
21+
void onAppChanged(const uint id);
22+
void onAppRemoved(const uint id);
23+
24+
QList<NodeInfo> apps;
25+
26+
PwPipelineManager* mgr;
27+
};
28+
29+
#endif // PWAPPMANAGER_H

src/audio/pulseaudio/wrapper/gstjamesdsp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ G_BEGIN_DECLS
1515
#define GST_IS_JAMESDSP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_JAMESDSP))
1616

1717
#define PACKAGE "jamesdsp-plugin"
18-
#define VERSION "3.0.5"
18+
#define VERSION "4.1.0"
1919
#define ALLOWED_CAPS \
2020
"audio/x-raw," \
2121
" format=(string){" GST_AUDIO_NE(F32) "," GST_AUDIO_NE(S32) "," GST_AUDIO_NE(S16) "}," \

src/interface/TrayIcon.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ void TrayIcon::createTrayIcon()
3838
menuOwner = new QWidget();
3939
trayIcon = new QSystemTrayIcon(this);
4040
trayIcon->setToolTip("JamesDSP for Linux");
41-
connect(trayIcon, &QSystemTrayIcon::activated, this, &TrayIcon::iconActivated);
42-
trayIcon->setIcon(QIcon(":/icons/icon.png"));
41+
trayIcon->setIcon(QIcon::fromTheme("jamesdsp-tray", QIcon(":/icons/icon.png")));
42+
43+
connect(trayIcon, &QSystemTrayIcon::activated, this, &TrayIcon::iconActivated);
4344
}
4445

4546
void TrayIcon::setTrayVisible(bool visible)

src/interface/dialog/PaletteEditor.ui

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<ui version="4.0">
33
<class>PaletteEditor</class>
4-
<widget class="QDialog" name="palette">
4+
<widget class="QDialog" name="PaletteEditor">
55
<property name="geometry">
66
<rect>
77
<x>0</x>
@@ -11,11 +11,7 @@
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
14-
<string>Palette Editor</string>
15-
</property>
16-
<property name="windowIcon">
17-
<iconset resource="../resources.qrc">
18-
<normaloff>:/icons/icon.svg</normaloff>:/icons/icon.svg</iconset>
14+
<string>Palette editor</string>
1915
</property>
2016
<widget class="QPushButton" name="base">
2117
<property name="geometry">
@@ -196,8 +192,6 @@
196192
<tabstop>reset</tabstop>
197193
<tabstop>close</tabstop>
198194
</tabstops>
199-
<resources>
200-
<include location="../resources.qrc"/>
201-
</resources>
195+
<resources/>
202196
<connections/>
203197
</ui>

0 commit comments

Comments
 (0)