Commit 18838380 authored by Alf Gaida's avatar Alf Gaida

initial commit

parents
ABOUT-NLS
ChangeLog
*~
config.guess
config.rpath
config.sub
intltool-extract.in
intltool-merge.in
intltool-update.in
aclocal.m4
*.cache
compile
config.h
config.h.in
config.log
config.status
configure
depcomp
README
README.html
install-sh
missing
*.o
stamp*
Makefile
Makefile.in
.deps
*.tar.gz
*.swp
This is the Qt port of pavucontrol <https://freedesktop.org/software/pulseaudio/pavucontrol/>.
The original authors of the gtk+ version of pavucontrol are:
* Copyright 2006-2009 Lennart Poettering
* Copyright 2009-2011 Colin Guthrie <mzcnihpbageby (at) 0pointer (dot) de>
The Qt port pavucontrol-qt is derived from the gtk+ version.
It's done by LXQt developers:
* Copyright 2016 Hong Jen-Yee (PCMan) <pcman.tw@gmail.com>
This diff is collapsed.
cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
project(pavucontrol-qt)
option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
include(GNUInstallDirs)
find_package(Qt5Widgets REQUIRED QUIET)
find_package(Qt5LinguistTools REQUIRED QUIET)
find_package(lxqt REQUIRED QUIET)
find_package(XdgUserDirs REQUIRED QUIET)
include(LXQtCompilerSettings NO_POLICY_SCOPE)
include(LXQtTranslate)
find_package(PkgConfig REQUIRED QUIET)
pkg_check_modules(
PULSE REQUIRED
libpulse>=5.0
libpulse-mainloop-glib>=0.9.16
)
pkg_check_modules(
GLIB REQUIRED
glib-2.0
)
add_subdirectory(src)
This diff is collapsed.
# pavucontrol-qt
## Overview
pavucontrol-qt is the Qt port of volume control [pavucontrol](https://freedesktop.org/software/pulseaudio/pavucontrol/) of sound server [PulseAudio](https://www.freedesktop.org/wiki/Software/PulseAudio/).
As such it can be used to adjust all controls provided by PulseAudio as well as some additional settings.
The software belongs to the LXQt project but its usage isn't limited to this desktop environment.
## Installation
### Compiling source code
Runtime dependencies are qtbase and PulseAudio client library libpulse.
Additional build dependencies are CMake, xdg-user-dirs and [liblxqt](https://github.com/lxde/liblxqt) as well as optionally Git to pull latest VCS checkouts. The localization files were outsourced to repository [lxqt-l10n](https://github.com/lxde/lxqt-l10n) so the corresponding dependencies are needed, too. Please refer to this repository's `README.md` for further information.
Code configuration is handled by CMake. CMake variable `CMAKE_INSTALL_PREFIX` has to be set to `/usr` on most operating systems.
To build run `make`, to install `make install` which accepts variable `DESTDIR` as usual.
### Binary packages
This project was launched in August 2016 and binary packages are rare so far. On Arch Linux an [AUR](https://aur.archlinux.org/) package [pavucontrol-qt-git](https://aur.archlinux.org/packages/pavucontrol-qt-git/) can be used to build current checkouts of branch `master`.
## Usage
In LXQt sessions the binary is placed in sub-menu "Sound & Video" of the panel's main menu.
The usage itself should be self-explanatory.
/*.debhelper
/*.log
/*.substvars
/debhelper-build-stamp
/files
/pavucontrol-qt/
pavucontrol-qt (0.1.0-2) UNRELEASED; urgency=medium
* Fixed signing-key, thanks Rohan Garg <rohan@kde.org>
-- Alf Gaida <agaida@siduction.org> Thu, 13 Oct 2016 01:46:40 +0200
pavucontrol-qt (0.1.0-1) experimental; urgency=medium
* Initial release (Closes: #838724)
-- Alf Gaida <agaida@siduction.org> Sat, 24 Sep 2016 16:18:14 +0200
Source: pavucontrol-qt
Maintainer: LXQt Packaging Team <pkg-lxqt-devel@lists.alioth.debian.org>
Uploaders: Alf Gaida <agaida@siduction.org>,
ChangZhuo Chen (陳昌倬) <czchen@debian.org>,
Section: utils
Priority: optional
Build-Depends: debhelper (>= 10),
cmake (>= 3.0.2),
libkf5windowsystem-dev,
liblxqt0-dev (>= 0.11.0),
libpulse-dev,
libqt5svg5-dev,
libqt5x11extras5-dev,
libqt5xdg-dev (>= 2.0.0),
libqt5xdgiconloader-dev (>= 2.0.0),
pkg-config,
qttools5-dev,
qttools5-dev-tools,
xdg-user-dirs
Standards-Version: 3.9.8
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-lxqt/pavucontrol-qt.git/?h=debian/experimental
Vcs-Git: https://anonscm.debian.org/git/pkg-lxqt/pavucontrol-qt.git -b debian/experimental
Homepage: https://github.com/lxde/pavucontrol-qt
Package: pavucontrol-qt
Architecture: any
Depends: ${misc:Depends},
${shlibs:Depends}
Recommends: obconf-qt-l10n
Description: Qt port of volume control pavucontrol
Qt port of volume control pavucontrol of sound server PulseAudio. As such it
can be used to adjust all controls provided by PulseAudio as well as some
additional settings.
.
The software belongs to the LXQt project but its usage isn't limited to this
desktop environment.
.
This package contain the application files.
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: pavucontrol-qt
Source: https://github.com/lxde/pavucontrol-qt
Files: *
Copyright: 2016 LXQt team
2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
2016 Palo Kisa <palo.kisa@gmail.com>
License: GPL-2.0+
Files: src/cardwidget.cc
src/cardwidget.h
src/channel.cc
src/channel.h
src/devicewidget.cc
src/devicewidget.h
src/mainwindow.cc
src/mainwindow.h
src/minimalstreamwidget.cc
src/minimalstreamwidget.h
src/rolewidget.cc
src/rolewidget.h
src/sinkinputwidget.cc
src/sinkinputwidget.h
src/sinkwidget.cc
src/sinkwidget.h
src/sourceoutputwidget.cc
src/sourceoutputwidget.h
src/sourcewidget.cc
src/sourcewidget.h
src/streamwidget.cc
src/streamwidget.h
Copyright: 2006-2008 Lennart Poettering
2009 Colin Guthrie
License: GPL-2.0+
Files: src/Makefile.am
Copyright: 2006-2008 Lennart Poettering
License: GPL-2.0+
Files: src/pavucontrol.cc
src/pavucontrol.h
Copyright: 2006-2008 Lennart Poettering
2008 Sjoerd Simons <sjoerd@luon.net>
License: GPL-2.0+
Files: debian/*
Copyright: 2016 Alf Gaida <agaida@siduction.org>
License: GPL-2.0+
License: GPL-2.0+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
On Debian systems, the complete text of the GNU General Public License
version 2 can be found in "/usr/share/common-licenses/GPL-2".
AUTHORS
README.md
[DEFAULT]
debian-branch = debian/experimental
upstream-branch = upstream/latest
pristine-tar = True
[import-orig]
# Use git cherrypick -n upstream instead.
merge = False
#!/usr/bin/make -f
# export DH_VERBOSE=1
export LC_ALL=C.UTF-8
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
%:
dh ${@} --buildsystem cmake
override_dh_auto_configure:
dh_auto_configure -- \
-DPULL_TRANSLATIONS=OFF\
-DUPDATE_TRANSLATIONS=OFF\
-DCMAKE_BUILD_TYPE=RelWithDebInfo
tar-ignore=.gitignore
tar-ignore=obconf-qt.kdev4
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFXQeMMBEACif4+9pTrC6uNmRng0ZbzLh7p3cazmbnp2YFgDQDJZ7ZNmebxy
ngRuRhjGuDcFAL/37BwJnrBpfZFK9ljoH4Fo5Jm9cOELaTy7AIcEiV9dKMyrKF1E
C76d8jHVuzuPbI92DkFdLZAdk+qjrrAy0x43PvUd+aaBGLcFs1ZMk7gOvElc2d95
zWWSp5anjukmGbp+EsStnWJkF6VHj56qmklfYy5ioiVBOSpXo/RsACAcIlz8C8A1
d4tNMiB2uF2OrUfrL8DD6m3nBqep+AYbIQrxMl9kUQH3I33e9kH/L+SHQyE6phS8
Czq06WjV4TcJ9VWxm7hQCNLYSxhZYYr1AW45lS5+xmfBOq2qeLgvjbFxa8PPrsp6
Bqgt8MjwUkXjU5IB7YulUBvFU2l0MJZWDBuNy0oNtCe1cU3JyIqLKjvzQQQ9eD5L
o3Ul704TLHz0z+67Rxh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EBGJS5nkrYjsLTduZIjJHYHYH7f
3/ydVjQ3z12iqHKElgaRI7RUmpNiNxVIr+TtuxzeC6G+CF++XNkUtJODvCmRaoJS
waYsitz8+LSv3tawZJ0iQkKc9nerQMuBD+AzIr3i4NgXiEIN513esUtnKzeyIIsL
ntUcBjXKuLCj8OZrZtexjq7edWWbN57/3ikyS2Z7y0i3O30qk5jmccSaS6kA7xTY
WCDFzbN2v2y+vGu9KYn+2HtrP2BtNa8JTh3waNeLUTpn4GV4mMrsZjOy6vhhHb91
1TKfI1gvjk7lE9xaWmcDjdI55dw3jIq8kK9SdgORGq9/S3g7KJNRjme+6GjqQfk=
=h7ww
-----END PGP PUBLIC KEY BLOCK-----
version=3
opts="pgpsigurlmangle=s/$/.asc/" \
https://github.com/lxde/pavucontrol-qt/releases .*/pavucontrol-qt-([\d\.]+).tar.xz
pavucontrol
pavucontrol.desktop
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
include_directories(
${PULSE_INCLUDE_DIRS}
${GLIB_INCLUDE_DIRS}
)
set(pavucontrol-qt_HDRS
pavucontrol.h
mainwindow.h
cardwidget.h
channel.h
devicewidget.h
minimalstreamwidget.h
rolewidget.h
sinkinputwidget.h
sinkwidget.h
sourceoutputwidget.h
sourcewidget.h
streamwidget.h
)
set(pavucontrol-qt_SRCS
pavucontrol.cc
mainwindow.cc
cardwidget.cc
channel.cc
devicewidget.cc
minimalstreamwidget.cc
rolewidget.cc
sinkinputwidget.cc
sinkwidget.cc
sourceoutputwidget.cc
sourcewidget.cc
streamwidget.cc
)
set(pavucontrol-qt_UI
cardwidget.ui
devicewidget.ui
mainwindow.ui
streamwidget.ui
)
# Translations
lxqt_translate_ts(pavucontrol-qt_QM_FILES
UPDATE_TRANSLATIONS
${UPDATE_TRANSLATIONS}
SOURCES
${pavucontrol-qt_HDRS}
${pavucontrol-qt_SRCS}
${pavucontrol-qt_UI}
INSTALL_DIR
"${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/translations"
PULL_TRANSLATIONS
${PULL_TRANSLATIONS}
CLEAN_TRANSLATIONS
${CLEAN_TRANSLATIONS}
TRANSLATIONS_REPO
${TRANSLATIONS_REPO}
TRANSLATIONS_REFSPEC
${TRANSLATIONS_REFSPEC}
)
lxqt_translate_desktop(DESKTOP_FILES
SOURCES
pavucontrol-qt.desktop.in
)
add_executable(pavucontrol-qt
${pavucontrol-qt_SRCS}
${pavucontrol-qt_QM_FILES}
${pavucontrol-qt_QM_LOADER}
${DESKTOP_FILES}
)
set_property(
TARGET pavucontrol-qt APPEND
PROPERTY COMPILE_DEFINITIONS
PAVUCONTROL_QT_DATA_DIR="${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}"
)
target_link_libraries(pavucontrol-qt
Qt5::Widgets
Qt5::DBus
${PULSE_LIBRARIES}
${GLIB_LIBRARIES}
)
install(TARGETS
pavucontrol-qt
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
COMPONENT Runtime
)
install(FILES
${DESKTOP_FILES}
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications"
COMPONENT Runtime
)
# This file is part of pavucontrol.
#
# Copyright 2006-2008 Lennart Poettering
#
# pavucontrol is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# pavucontrol is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pavucontrol. If not, see <http://www.gnu.org/licenses/>.
desktopdir = $(datadir)/applications
gladedir = $(pkgdatadir)
localedir = $(datadir)/locale
bin_PROGRAMS=pavucontrol
glade_DATA=pavucontrol.glade
desktop_in_files=pavucontrol.desktop.in
desktop_DATA=$(desktop_in_files:.desktop.in=.desktop)
pavucontrol_SOURCES= \
minimalstreamwidget.h minimalstreamwidget.cc \
channelwidget.h channelwidget.cc \
streamwidget.h streamwidget.cc \
devicewidget.h devicewidget.cc \
cardwidget.h cardwidget.cc \
sinkwidget.h sinkwidget.cc \
sourcewidget.h sourcewidget.cc \
sinkinputwidget.h sinkinputwidget.cc \
sourceoutputwidget.h sourceoutputwidget.cc \
rolewidget.h rolewidget.cc \
mainwindow.h mainwindow.cc \
pavucontrol.h pavucontrol.cc \
i18n.h
pavucontrol_LDADD=$(AM_LDADD) $(GUILIBS_LIBS) $(PULSE_LIBS)
pavucontrol_CXXFLAGS=$(AM_CXXFLAGS) $(GUILIBS_CFLAGS) $(PULSE_CFLAGS) -DLOCALEDIR=\"$(localedir)\"
pavucontrol_CXXFLAGS+=-DGLADE_FILE=\"$(gladedir)/pavucontrol.glade\"
#pavucontrol_CXXFLAGS+=-DGLADE_FILE=\"pavucontrol.glade\"
EXTRA_DIST = $(glade_DATA) $(desktop_in_files)
CLEANFILES = $(desktop_DATA)
@INTLTOOL_DESKTOP_RULE@
/***
This file is part of pavucontrol.
Copyright 2006-2008 Lennart Poettering
Copyright 2009 Colin Guthrie
pavucontrol is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
pavucontrol is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with pavucontrol. If not, see <http://www.gnu.org/licenses/>.
***/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "cardwidget.h"
/*** CardWidget ***/
CardWidget::CardWidget(QWidget* parent) :
QWidget(parent) {
setupUi(this);
connect(profileList, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &CardWidget::onProfileChange);
}
void CardWidget::prepareMenu() {
int idx = 0;
int active_idx = -1;
profileList->clear();
/* Fill the ComboBox */
for (uint32_t i = 0; i < profiles.size(); ++i) {
const auto& profile = profiles[i];
QByteArray name = profile.first;
QString desc = QString::fromUtf8(profile.second);
profileList->addItem(desc, name);
if (profile.first == activeProfile)
active_idx = idx;
idx++;
}
if (active_idx >= 0)
profileList->setCurrentIndex(active_idx);
}
void CardWidget::onProfileChange(int active) {
if (updating)
return;
if (active != -1) {
QString desc = profileList->itemText(active);
QByteArray name = profileList->itemData(active).toByteArray();
pa_operation* o;
if (!(o = pa_context_set_card_profile_by_index(get_context(), index, name.constData(), NULL, NULL))) {
show_error(tr("pa_context_set_card_profile_by_index() failed").toUtf8().constData());
return;
}
pa_operation_unref(o);
}
}
/***
This file is part of pavucontrol.
Copyright 2006-2008 Lennart Poettering
Copyright 2009 Colin Guthrie
pavucontrol is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
pavucontrol is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with pavucontrol. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef cardwidget_h
#define cardwidget_h
#include "pavucontrol.h"
#include "ui_cardwidget.h"
#include <QWidget>
class PortInfo {
public:
QByteArray name;
QByteArray description;
uint32_t priority;
int available;
int direction;
int64_t latency_offset;
std::vector<QByteArray> profiles;
};
class CardWidget : public QWidget, public Ui::CardWidget {
Q_OBJECT
public:
CardWidget(QWidget *parent = nullptr);
QByteArray name;
uint32_t index;
bool updating;
std::vector< std::pair<QByteArray,QByteArray> > profiles;
std::map<QByteArray, PortInfo> ports;
QByteArray activeProfile;
bool hasSinks;
bool hasSources;
void prepareMenu();
protected:
virtual void onProfileChange(int active);
};
#endif
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CardWidget</class>
<widget class="QWidget" name="CardWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>368</width>
<height>79</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
<item>
<widget class="QLabel" name="iconImage">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="nameLabel">
<property name="text">
<string>Card Name</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Profile:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="profileList"/>
</item>
<item row="2" column="0" colspan="2">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
/***
This file is part of pavucontrol.
Copyright 2006-2008 Lennart Poettering
Copyright 2009 Colin Guthrie
pavucontrol is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
pavucontrol is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with pavucontrol. If not, see <http://www.gnu.org/licenses/>.
***/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <QGridLayout>
#include <QLabel>
#include <QSlider>
#include "channel.h"
#include "minimalstreamwidget.h"
/*** ChannelWidget ***/
Channel::Channel(QGridLayout* parent) :
QObject(parent),
can_decibel(false),
volumeScaleEnabled(true),
last(false)
{
channelLabel = new QLabel(nullptr);
volumeScale = new QSlider(Qt::Horizontal, nullptr);
volumeLabel = new QLabel(nullptr);
const int row = parent->rowCount();
parent->addWidget(channelLabel, row, 0);
parent->addWidget(volumeScale, row, 1);
parent->addWidget(volumeLabel, row, 2);
volumeScale->setMinimum(PA_VOLUME_MUTED);
volumeScale->setMaximum(PA_VOLUME_UI_MAX);
volumeScale->setValue(PA_VOLUME_NORM);
volumeScale->setSingleStep(qRound((double)PA_VOLUME_NORM)/100.0);
volumeScale->setPageStep(qRound((double)PA_VOLUME_NORM)/20.0);
setBaseVolume(PA_VOLUME_NORM);
connect(volumeScale, &QSlider::valueChanged, this, &Channel::onVolumeScaleValueChanged);
}
void Channel::setVolume(pa_volume_t volume) {
double v;
char txt[64];
v = ((gdouble) volume * 100) / PA_VOLUME_NORM;
if (can_decibel) {
double dB = pa_sw_volume_to_dB(volume);
if (dB > PA_DECIBEL_MININFTY)
snprintf(txt, sizeof(txt), "<small>%0.0f%% (%0.2fdB)</small>", v, dB);
else
snprintf(txt, sizeof(txt), "<small>%0.0f%% (-&#8734;dB)</small>", v);
}
else
snprintf(txt, sizeof(txt), "%0.0f%%", v);
volumeLabel->setText(QString::fromUtf8(txt));
volumeScaleEnabled = false;
volumeScale->setValue(volume > PA_VOLUME_UI_MAX ? PA_VOLUME_UI_MAX : volume);