Verified Commit c7c802bb authored by Alf Gaida's avatar Alf Gaida

Adding upstream version 0.2.0.

Signed-off-by: Alf Gaida's avatarAlf Gaida <agaida@siduction.org>
parent f586f249
pavucontrol-qt-0.1.0 / 2016-09-24
pavucontrol-qt-0.2.0 / 2016-12-11
=================================
* Release 0.2.0: Update changelog
* Use QSettings for storing configuration
* Create pavucontrol-qt_pt.desktop
* Use the new lxqt-build-tools package
* - Add a simple single instance controller to avoid run multiple simultaneous applications
* Use same approach as avidemux
* Simply differentiate the namnig to avoid menu duplication
* CMakeLists: Remove XdgUserDirs requirement
* mainwindow: Set icon for eventRoleWidget
0.1.0 / 2016-09-24
==================
* Release 0.1.0: Add changelog
* devicewidget: Remove debug
* Address compiler warnings
* streamwidget: Fix specific termination text
......
......@@ -3,6 +3,7 @@ project(pavucontrol-qt)
option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF)
set(LXQTBT_MINIMUM_VERSION "0.1.0")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
......@@ -14,9 +15,9 @@ include(GNUInstallDirs)
find_package(Qt5Widgets REQUIRED QUIET)
find_package(Qt5LinguistTools REQUIRED QUIET)
find_package(Qt5DBus REQUIRED)
find_package(lxqt REQUIRED QUIET)
find_package(XdgUserDirs REQUIRED QUIET)
find_package(lxqt-build-tools ${LXQTBT_MINIMUM_VERSION} REQUIRED)
include(LXQtCompilerSettings NO_POLICY_SCOPE)
include(LXQtTranslate)
......
......@@ -13,7 +13,7 @@ The software belongs to the LXQt project but its usage isn't limited to this des
### 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.
Additional build dependencies are CMake 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.
......
......@@ -35,6 +35,7 @@ set(pavucontrol-qt_SRCS
sourceoutputwidget.cc
sourcewidget.cc
streamwidget.cc
uniqueapplication.cc
)
set(pavucontrol-qt_UI
......
......@@ -33,6 +33,7 @@
#include "rolewidget.h"
#include <QIcon>
#include <QStyle>
#include <QSettings>
/* Used for profile sorting */
struct profile_prio_compare {
......@@ -89,65 +90,30 @@ MainWindow::MainWindow():
connect(sourceTypeComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &MainWindow::onSourceTypeComboBoxChanged);
connect(showVolumeMetersCheckButton, &QCheckBox::toggled, this, &MainWindow::onShowVolumeMetersCheckButtonToggled);
GKeyFile* config = g_key_file_new();
g_assert(config);
GKeyFileFlags flags = (GKeyFileFlags)( G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS);
GError *err = nullptr;
m_config_filename = g_strconcat(g_get_user_config_dir(), "/pavucontrol.ini", nullptr);
/* Load the GKeyFile from keyfile.conf or return. */
if (g_key_file_load_from_file (config, m_config_filename, flags, &err)) {
int width = g_key_file_get_integer(config, "window", "width", nullptr);
int height = g_key_file_get_integer(config, "window", "height", nullptr);
/* When upgrading from a previous version, set showVolumeMeters to TRUE
* (default from glade file), so users don't complain about missing
* volume meters. */
if (g_key_file_has_key(config, "window", "showVolumeMeters", nullptr)) {
showVolumeMetersCheckButton->setChecked(g_key_file_get_boolean(config, "window", "showVolumeMeters", nullptr));
}
const QSettings config;
const QSize default_size = size(); // widget is resized in setupUi based on values in *.ui
if (width >= default_size.width() && height >= default_size.height())
resize(width, height);
showVolumeMetersCheckButton->setChecked(config.value("window/showVolumeMeters", true).toBool());
int sinkInputTypeSelection = g_key_file_get_integer(config, "window", "sinkInputType", &err);
if (err == nullptr)
sinkInputTypeComboBox->setCurrentIndex(sinkInputTypeSelection);
else {
g_error_free(err);
err = nullptr;
}
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())
resize(last_size);
int sourceOutputTypeSelection = g_key_file_get_integer(config, "window", "sourceOutputType", &err);
if (err == nullptr)
sourceOutputTypeComboBox->setCurrentIndex(sourceOutputTypeSelection);
else {
g_error_free(err);
err = nullptr;
}
const QVariant sinkInputTypeSelection = config.value("window/sinkInputType");
if (sinkInputTypeSelection.isValid())
sinkInputTypeComboBox->setCurrentIndex(sinkInputTypeSelection.toInt());
int sinkTypeSelection = g_key_file_get_integer(config, "window", "sinkType", &err);
if (err == nullptr)
sinkTypeComboBox->setCurrentIndex(sinkTypeSelection);
else {
g_error_free(err);
err = nullptr;
}
const QVariant sourceOutputTypeSelection = config.value("window/sourceOutputType");
if (sourceOutputTypeSelection.isValid())
sourceOutputTypeComboBox->setCurrentIndex(sourceOutputTypeSelection.toInt());
int sourceTypeSelection = g_key_file_get_integer(config, "window", "sourceType", &err);
if (err == nullptr)
sourceTypeComboBox->setCurrentIndex(sourceTypeSelection);
else {
g_error_free(err);
err = nullptr;
}
} else {
g_debug(tr("Error reading config file %s: %s").toUtf8().constData(), m_config_filename, err->message);
g_error_free(err);
}
g_key_file_free(config);
const QVariant sinkTypeSelection = config.value("window/sinkType");
if (sinkTypeSelection.isValid())
sinkTypeComboBox->setCurrentIndex(sinkTypeSelection.toInt());
const QVariant sourceTypeSelection = config.value("window/sourceType");
if (sourceTypeSelection.isValid())
sourceTypeComboBox->setCurrentIndex(sourceTypeSelection.toInt());
/* Hide first and show when we're connected */
notebook->hide();
......@@ -199,40 +165,13 @@ bool MainWindow::on_key_press_event(GdkEventKey* event) {
#endif
MainWindow::~MainWindow() {
GKeyFile* config = g_key_file_new();
g_assert(config);
g_key_file_set_integer(config, "window", "width", width());
g_key_file_set_integer(config, "window", "height", height());
g_key_file_set_integer(config, "window", "sinkInputType", sinkInputTypeComboBox->currentIndex());
g_key_file_set_integer(config, "window", "sourceOutputType", sourceOutputTypeComboBox->currentIndex());
g_key_file_set_integer(config, "window", "sinkType", sinkTypeComboBox->currentIndex());
g_key_file_set_integer(config, "window", "sourceType", sourceTypeComboBox->currentIndex());
g_key_file_set_integer(config, "window", "showVolumeMeters", showVolumeMetersCheckButton->isChecked());
gsize filelen;
GError *err = nullptr;
gchar *filedata = g_key_file_to_data(config, &filelen, &err);
if (err) {
show_error(tr("Error saving preferences").toUtf8().constData());
g_error_free(err);
goto finish;
}
g_file_set_contents(m_config_filename, filedata, filelen, &err);
g_free(filedata);
if (err) {
gchar* msg = g_strconcat(tr("Error writing config file %s").toUtf8().constData(), m_config_filename, nullptr);
show_error(msg);
g_free(msg);
g_error_free(err);
goto finish;
}
finish:
g_key_file_free(config);
g_free(m_config_filename);
QSettings config;
config.setValue("window/size", size());
config.setValue("window/sinkInputType", sinkInputTypeComboBox->currentIndex());
config.setValue("window/sourceOutputType", sourceOutputTypeComboBox->currentIndex());
config.setValue("window/sinkType", sinkTypeComboBox->currentIndex());
config.setValue("window/sourceType", sourceTypeComboBox->currentIndex());
config.setValue("window/showVolumeMeters", showVolumeMetersCheckButton->isChecked());
while (!clientNames.empty()) {
std::map<uint32_t, char*>::iterator i = clientNames.begin();
......@@ -857,7 +796,7 @@ bool MainWindow::createEventRoleWidget() {
eventRoleWidget->boldNameLabel->setText("");
eventRoleWidget->nameLabel->setText(tr("System Sounds").toUtf8().constData());
// eventRoleWidget->iconImage->set_from_icon_name("multimedia-volume-control", Gtk::ICON_SIZE_SMALL_TOOLBAR);
setIconByName(eventRoleWidget->iconImage, "multimedia-volume-control");
eventRoleWidget->device = "";
......
......@@ -49,6 +49,8 @@
#include <QTranslator>
#include <QCommandLineParser>
#include <QCommandLineOption>
#include "uniqueapplication.h"
#include <QString>
static pa_context* context = NULL;
static pa_mainloop_api* api = NULL;
......@@ -645,7 +647,13 @@ int main(int argc, char *argv[]) {
signal(SIGPIPE, SIG_IGN);
QApplication app(argc, argv);
UniqueApplication app(argc, argv);
if(app.active())
return 0;
app.setOrganizationName(QStringLiteral("pavucontrol-qt"));
QString locale = QLocale::system().name();
QTranslator qtTranslator;
......
Name[pt]=Controlo de volume PulseAudio
GenericName[pt]=Controlo de volume
Comment[pt]=Ajustar o nível do volume
/***
This file is part of pavucontrol-qt.
Copyright 2006-2008 Lennart Poettering
Copyright 2008 Sjoerd Simons <sjoerd@luon.net>
Copyright 2016 Helio Chissini de Castro <helio@kde.org>
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/>.
***/
#include "uniqueapplication.h"
UniqueApplication::UniqueApplication(int &argc, char **argv)
: QApplication(argc, argv)
{
uniq = new QSharedMemory("pavucontrol-Qt", this);
}
UniqueApplication::~UniqueApplication()
{
if(uniq->isAttached())
uniq->detach();
}
bool UniqueApplication::active()
{
if(uniq->attach(QSharedMemory::ReadOnly)){
uniq->detach();
return true;
}
if(uniq->create(1)){
return false;
}
return true;
}
/***
This file is part of pavucontrol-qt.
Copyright 2006-2008 Lennart Poettering
Copyright 2008 Sjoerd Simons <sjoerd@luon.net>
Copyright 2016 Helio Chissini de Castro <helio@kde.org>
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 UNIQUEAPPLICATION_H
#define UNIQUEAPPLICATION_H
#include <QApplication>
#include <QSharedMemory>
class UniqueApplication : public QApplication
{
Q_OBJECT
public:
UniqueApplication(int &argc, char** argv);
~UniqueApplication();
bool active();
private:
QSharedMemory *uniq;
};
#endif // UNIQUEAPPLICATION_H
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