Commit 74cb67e5 authored by Alf Gaida's avatar Alf Gaida

Adding upstream version 0.3.0.

Signed-off-by: Alf Gaida's avatarAlf Gaida <agaida@siduction.org>
parent c7c802bb
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
pavucontrol-qt-0.2.0 / 2016-12-11
pavucontrol-qt-0.3.0 / 2017-09-24
=================================
* Bump version to 0.3.0
* correct spelling mistake
* Added Lithuanian .desktop file
* liblxqt make no sense here
* Copied issue template
* set Qt::AA_UseHighDpiPixmaps to true
* Added version to cli options
* Added default CMAKE_BUILD_TYPE and versioning
* added pl.desktop
* ui: Use "changes-prevent-symbolic" icon
* MainWindow: Remove old GTK remnants
* Add Catalan translation
* Channel: Add slider snapping to 100%
* Channel: Address compiler warnings
* Channel: Align slider controls correclty
* Channel: Add ticks to volume slider
* Channel: Use percentage for volume scale
* devicewidgte: Re-add device renaming
* MainWindow: Force using the size from previous run
* MainWindow: Add quit shortcut
* Added pavucontrol-qt_da.desktop
0.2.0 / 2016-12-11
==================
* Release 0.2.0: Update changelog
* Release 0.2.0: Update changelog
* Use QSettings for storing configuration
* Create pavucontrol-qt_pt.desktop
......
......@@ -3,7 +3,7 @@ project(pavucontrol-qt)
option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF)
set(LXQTBT_MINIMUM_VERSION "0.1.0")
set(LXQTBT_MINIMUM_VERSION "0.4.0")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
......@@ -13,16 +13,26 @@ set(CMAKE_AUTOUIC ON)
include(GNUInstallDirs)
find_package(Qt5Widgets REQUIRED QUIET)
find_package(Qt5LinguistTools REQUIRED QUIET)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5LinguistTools REQUIRED)
find_package(Qt5DBus REQUIRED)
find_package(lxqt-build-tools ${LXQTBT_MINIMUM_VERSION} REQUIRED)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(PAVUCONTROLQT_MAJOR_VERSION 0)
set(PAVUCONTROLQT_MINOR_VERSION 3)
set(PAVUCONTROLQT_PATCH_VERSION 0)
set(PAVUCONTROLQT_VERSION ${PAVUCONTROLQT_MAJOR_VERSION}.${PAVUCONTROLQT_MINOR_VERSION}.${PAVUCONTROLQT_PATCH_VERSION})
add_definitions("-DPAVUCONTROLQT_VERSION=\"${PAVUCONTROLQT_VERSION}\"")
include(LXQtCompilerSettings NO_POLICY_SCOPE)
include(LXQtTranslate)
find_package(PkgConfig REQUIRED QUIET)
find_package(PkgConfig REQUIRED)
pkg_check_modules(
PULSE REQUIRED
libpulse>=5.0
......
pavucontrol
pavucontrol.desktop
......@@ -25,9 +25,23 @@
#include <QGridLayout>
#include <QLabel>
#include <QSlider>
#include <QFontMetrics>
#include "channel.h"
#include "minimalstreamwidget.h"
constexpr int SLIDER_SNAP = 2;
static inline int paVolume2Percent(pa_volume_t vol)
{
if (vol > PA_VOLUME_UI_MAX)
vol = PA_VOLUME_UI_MAX;
return qRound(static_cast<double>(vol - PA_VOLUME_MUTED) / PA_VOLUME_NORM * 100);
}
static inline pa_volume_t percent2PaVolume(int percent)
{
return PA_VOLUME_MUTED + qRound(static_cast<double>(percent) / 100 * PA_VOLUME_NORM);
}
/*** ChannelWidget ***/
Channel::Channel(QGridLayout* parent) :
......@@ -45,34 +59,41 @@ Channel::Channel(QGridLayout* parent) :
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);
// make the info font smaller
QFont label_font = volumeLabel->font();
if (label_font.pixelSize() == -1)
label_font.setPointSizeF(label_font.pointSizeF() * 0.8);
else
label_font.setPixelSize(qRound(static_cast<double>(label_font.pixelSize()) * 0.8));
volumeLabel->setFont(label_font);
volumeLabel->setFixedWidth(QFontMetrics{volumeLabel->font()}.size(Qt::TextSingleLine, QStringLiteral("100%(-99.99dB)")).width());
volumeLabel->setAlignment(Qt::AlignHCenter);
volumeLabel->setTextFormat(Qt::RichText);
volumeScale->setRange(paVolume2Percent(PA_VOLUME_MUTED), paVolume2Percent(PA_VOLUME_UI_MAX));
volumeScale->setValue(paVolume2Percent(PA_VOLUME_NORM));
volumeScale->setPageStep(5);
volumeScale->setTickInterval(paVolume2Percent(PA_VOLUME_NORM));
volumeScale->setTickPosition(QSlider::TicksBelow);
volumeScale->setTracking(false);
setBaseVolume(PA_VOLUME_NORM);
connect(volumeScale, &QSlider::valueChanged, this, &Channel::onVolumeScaleValueChanged);
connect(volumeScale, &QSlider::sliderMoved, this, &Channel::onVolumeScaleSliderMoved);
}
void Channel::setVolume(pa_volume_t volume) {
double v;
char txt[64];
v = ((gdouble) volume * 100) / PA_VOLUME_NORM;
const int v = paVolume2Percent(volume);
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);
const double dB = pa_sw_volume_to_dB(volume);
volumeLabel->setText(tr("%1% (%2dB)", "volume slider label [X% (YdB)]").arg(v)
.arg(dB > PA_DECIBEL_MININFTY ? QString::asprintf("%0.2f", dB) : QStringLiteral("-&#8734;")));
}
else
snprintf(txt, sizeof(txt), "%0.0f%%", v);
volumeLabel->setText(QString::fromUtf8(txt));
volumeLabel->setText(tr("%1%", "volume slider label [X%]").arg(v));
volumeScaleEnabled = false;
volumeScale->setValue(volume > PA_VOLUME_UI_MAX ? PA_VOLUME_UI_MAX : volume);
volumeScale->setValue(v);
volumeScaleEnabled = true;
}
......@@ -98,8 +119,27 @@ void Channel::onVolumeScaleValueChanged(int value) {
if (minimalStreamWidget->updating)
return;
pa_volume_t volume = (pa_volume_t) volumeScale->value();
minimalStreamWidget->updateChannelVolume(channel, volume);
minimalStreamWidget->updateChannelVolume(channel, percent2PaVolume(value));
}
void Channel::onVolumeScaleSliderMoved(int value)
{
if (!volumeScaleEnabled)
return;
if (minimalStreamWidget->updating)
return;
const int current_value = volumeScale->value();
if (current_value == 100 && qAbs(value - current_value) <= SLIDER_SNAP)
{
volumeScale->blockSignals(true);
volumeScale->setSliderPosition(current_value);
volumeScale->blockSignals(false);
return;
}
volumeScale->setValue(value);
}
/*
......@@ -112,7 +152,7 @@ void Channel::set_sensitive(bool enabled) {
}
*/
void Channel::setBaseVolume(pa_volume_t v) {
void Channel::setBaseVolume(pa_volume_t /*v*/) {
#if 0 // FIXME: Qt does not support this functionality
gtk_scale_clear_marks(GTK_SCALE(volumeScale->gobj()));
......
......@@ -43,6 +43,7 @@ public:
protected Q_SLOTS:
void onVolumeScaleValueChanged(int value);
void onVolumeScaleSliderMoved(int value);
public:
bool can_decibel;
......
......@@ -29,12 +29,15 @@
#include "channel.h"
#include <sstream>
#include <QLabel>
#include <QMessageBox>
#include <QInputDialog>
/*** DeviceWidget ***/
DeviceWidget::DeviceWidget(MainWindow* parent, QByteArray deviceType) :
MinimalStreamWidget(parent),
offsetButtonEnabled(false),
mpMainWindow(parent),
rename{new QAction{tr("Rename device..."), this}},
mDeviceType(deviceType) {
setupUi(this);
......@@ -45,18 +48,13 @@ DeviceWidget::DeviceWidget(MainWindow* parent, QByteArray deviceType) :
timeout.setInterval(100);
connect(&timeout, &QTimer::timeout, this, &DeviceWidget::timeoutEvent);
// FIXME: this->signal_button_press_event().connect(sigc::mem_fun(*this, &DeviceWidget::onContextTriggerEvent));
connect(muteToggleButton, &QToolButton::toggled, this, &DeviceWidget::onMuteToggleButton);
connect(lockToggleButton, &QToolButton::toggled, this, &DeviceWidget::onLockToggleButton);
connect(defaultToggleButton, &QToolButton::toggled, this, &DeviceWidget::onDefaultToggleButton);
#if 0
rename.set_label(tr("Rename Device...").toUtf8().constData());
rename.signal_activate().connect(sigc::mem_fun(*this, &DeviceWidget::renamePopup));
contextMenu.append(rename);
contextMenu.show_all();
#endif
connect(rename, &QAction::triggered, this, &DeviceWidget::renamePopup);
addAction(rename);
setContextMenuPolicy(Qt::ActionsContextMenu);
connect(portList, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &DeviceWidget::onPortChange);
connect(offsetButton, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &DeviceWidget::onOffsetChange);
......@@ -220,56 +218,27 @@ void DeviceWidget::prepareMenu() {
}
}
#if 0
bool DeviceWidget::onContextTriggerEvent(GdkEventButton* event) {
if (GDK_BUTTON_PRESS == event->type && 3 == event->button) {
contextMenu.popup(event->button, event->time);
return true;
}
return false;
}
#endif
void DeviceWidget::renamePopup() {
if (updating)
return;
#if 0
if (!mpMainWindow->canRenameDevices) {
Gtk::MessageDialog dialog(
*mpMainWindow,
tr("Sorry, but device renaming is not supported.").toUtf8().constData(),
false,
Gtk::MESSAGE_WARNING,
Gtk::BUTTONS_OK,
true);
dialog.set_secondary_text(tr("You need to load module-device-manager in the PulseAudio server in order to rename devices").toUtf8().constData());
dialog.run();
QMessageBox::warning(this, tr("Sorry, but device renaming is not supported.")
, tr("You need to load module-device-manager in the PulseAudio server in order to rename devices"));
return;
}
Gtk::Dialog* dialog;
Gtk::Entry* renameText;
Glib::RefPtr<Gtk::Builder> x = Gtk::Builder::create_from_file(GLADE_FILE, "renameDialog");
x->get_widget("renameDialog", dialog);
x->get_widget("renameText", renameText);
renameText->set_text(description);
dialog->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
dialog->add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
dialog->set_default_response(Gtk::RESPONSE_OK);
if (Gtk::RESPONSE_OK == dialog->run()) {
const QString old_name = description.constData();
bool ok;
const QString new_name = QInputDialog::getText(this, QCoreApplication::organizationName(), tr("Rename device %1 to:").arg(old_name)
, QLineEdit::Normal, old_name, &ok);
if (ok && new_name != old_name) {
pa_operation* o;
gchar *key = g_markup_printf_escaped("%s:%s", mDeviceType, name);
gchar *key = g_markup_printf_escaped("%s:%s", mDeviceType.constData(), name.constData());
if (!(o = pa_ext_device_manager_set_device_description(get_context(), key, renameText->get_text(), NULL, NULL))) {
show_error(tr("pa_ext_device_manager_write() failed").toUtf8().constData());
return;
}
if (!(o = pa_ext_device_manager_set_device_description(get_context(), key, new_name.toUtf8().constData(), NULL, NULL)))
show_error(tr("pa_ext_device_manager_set_device_description() failed").toUtf8().constData());
else
pa_operation_unref(o);
g_free(key);
}
delete dialog;
#endif
}
......@@ -81,8 +81,7 @@ protected:
virtual void onPortChange() = 0;
// Gtk::Menu contextMenu;
// Gtk::MenuItem rename;
QAction * rename;
private:
QByteArray mDeviceType;
......
......@@ -69,7 +69,7 @@
<string>Lock channels together</string>
</property>
<property name="icon">
<iconset theme="changes-prevent"/>
<iconset theme="changes-prevent-symbolic"/>
</property>
<property name="checkable">
<bool>true</bool>
......@@ -111,7 +111,11 @@
</widget>
</item>
<item>
<layout class="QGridLayout" name="channelsGrid"/>
<layout class="QGridLayout" name="channelsGrid">
<property name="horizontalSpacing">
<number>0</number>
</property>
</layout>
</item>
<item>
<widget class="QCheckBox" name="advancedOptions">
......
......@@ -90,13 +90,17 @@ MainWindow::MainWindow():
connect(sourceTypeComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &MainWindow::onSourceTypeComboBoxChanged);
connect(showVolumeMetersCheckButton, &QCheckBox::toggled, this, &MainWindow::onShowVolumeMetersCheckButtonToggled);
QAction * quit = new QAction{this};
connect(quit, &QAction::triggered, this, &QWidget::close);
quit->setShortcut(QKeySequence::Quit);
addAction(quit);
const QSettings config;
showVolumeMetersCheckButton->setChecked(config.value("window/showVolumeMeters", true).toBool());
const QSize last_size = config.value("window/size").toSize();
const QSize default_size = size(); // widget is resized in setupUi based on values in *.ui
if (last_size.width() >= default_size.width() && last_size.height() >= default_size.height())
if (last_size.isValid())
resize(last_size);
const QVariant sinkInputTypeSelection = config.value("window/sinkInputType");
......@@ -120,50 +124,6 @@ MainWindow::MainWindow():
connectingLabel->show();
}
void MainWindow::on_realize() {
#if 0
Gtk::Window::on_realize();
get_window()->set_cursor(Gdk::Cursor::create(Gdk::WATCH));
#endif
}
#if 0
bool MainWindow::on_key_press_event(GdkEventKey* event) {
if (GDK_KEY_Escape == event->keyval) {
Gtk::Main::quit();
return true;
}
if (event->state & GDK_CONTROL_MASK) {
switch (event->keyval) {
case GDK_KEY_KP_1:
case GDK_KEY_KP_2:
case GDK_KEY_KP_3:
case GDK_KEY_KP_4:
case GDK_KEY_KP_5:
notebook->set_current_page(event->keyval - GDK_KEY_KP_1);
return true;
case GDK_KEY_1:
case GDK_KEY_2:
case GDK_KEY_3:
case GDK_KEY_4:
case GDK_KEY_5:
notebook->set_current_page(event->keyval - GDK_KEY_1);
return true;
case GDK_KEY_W:
case GDK_KEY_Q:
case GDK_KEY_w:
case GDK_KEY_q:
Gtk::Main::quit();
return true;
}
}
return Gtk::Window::on_key_press_event(event);
}
#endif
MainWindow::~MainWindow() {
QSettings config;
config.setValue("window/size", size());
......
......@@ -104,10 +104,6 @@ public:
bool canRenameDevices;
protected:
virtual void on_realize();
// virtual bool on_key_press_event(GdkEventKey* event);
private:
gboolean m_connected;
gchar* m_config_filename;
......
......@@ -653,7 +653,7 @@ int main(int argc, char *argv[]) {
return 0;
app.setOrganizationName(QStringLiteral("pavucontrol-qt"));
app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
QString locale = QLocale::system().name();
QTranslator qtTranslator;
......@@ -668,6 +668,11 @@ int main(int argc, char *argv[]) {
parser.setApplicationDescription(QObject::tr("PulseAudio Volume Control"));
parser.addHelpOption();
const QString VERINFO = QStringLiteral(PAVUCONTROLQT_VERSION
"\nQt " QT_VERSION_STR);
app.setApplicationVersion(VERINFO);
parser.addVersionOption();
QCommandLineOption tabOption(QStringList() << "tab" << "t", QObject::tr("Select a specific tab on load."), "tab");
parser.addOption(tabOption);
......@@ -677,9 +682,6 @@ int main(int argc, char *argv[]) {
QCommandLineOption maximizeOption(QStringList() << "maximize" << "m", QObject::tr("Maximize the window."));
parser.addOption(maximizeOption);
// QCommandLineOption versionOption("version", QObject::tr("Show version"));
// parser.addOption(versionOption);
parser.process(app);
default_tab = parser.value(tabOption).toInt();
retry = parser.isSet(retryOption);
......
......@@ -79,7 +79,7 @@
<string>Lock channels together</string>
</property>
<property name="icon">
<iconset theme="changes-prevent"/>
<iconset theme="changes-prevent-symbolic"/>
</property>
<property name="checkable">
<bool>true</bool>
......
Name[ca]=Control del volum de PulseAudio
GenericName[ca]=Control del volum
Comment[ca]=Ajusteu el nivell del volum
Name[da]=PulseAudio-lydstyrkekontrol
GenericName[da]=Lydstyrkekontrol
Comment[da]=Justér lydstyrkeniveauet
Name[lt]=PulseAudio garsio reguliavimas
GenericName[lt]=Garsio reguliavimas
Comment[lt]=Reguliuoti garsio lygį
Name[pl]=Kontrola PulseAudio
GenericName[pl]=Kontrola głośności
Comment[pl]=Dostosuj głośność i ustawienia dźwięku
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment