Cherry-picked upstream version 0.9.0+20151101.

Install manpage for lxqt-panel
Deleted debian/lintian-overrides
Added minimum version for liblxqt and libqtxdg
ubuntu/bionic
Alf Gaida 9 years ago
parent 5e62c03710
commit 117e853247

@ -1,9 +1,8 @@
GNU LESSER GENERAL PUBLIC LICENSE GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999 Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc. Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed. of this license document, but changing it is not allowed.
@ -23,8 +22,7 @@ specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations strategy to use in any particular case, based on the explanations below.
below.
When we speak of free software, we are referring to freedom of use, When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that not price. Our General Public Licenses are designed to make sure that
@ -89,9 +87,9 @@ libraries. However, the Lesser license provides advantages in certain
special circumstances. special circumstances.
For example, on rare occasions, there may be a special need to For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it encourage the widest possible use of a certain library, so that it becomes
becomes a de-facto standard. To achieve this, non-free programs must a de-facto standard. To achieve this, non-free programs must be
be allowed to use the library. A more frequent case is that a free allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License. software only, so we use the Lesser General Public License.
@ -138,8 +136,8 @@ included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for "Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control interface definition files, plus the scripts used to control compilation
compilation and installation of the library. and installation of the library.
Activities other than copying, distribution and modification are not Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of covered by this License; they are outside its scope. The act of
@ -305,10 +303,10 @@ of these things:
the user installs one, as long as the modified version is the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with. interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at least c) Accompany the work with a written offer, valid for at
three years, to give the same user the materials specified in least three years, to give the same user the materials
Subsection 6a, above, for a charge no more than the cost of specified in Subsection 6a, above, for a charge no more
performing this distribution. than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above from a designated place, offer equivalent access to copy the above
@ -386,10 +384,9 @@ all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library. refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under If any portion of this section is held invalid or unenforceable under any
any particular circumstance, the balance of the section is intended to particular circumstance, the balance of the section is intended to apply,
apply, and the section as a whole is intended to apply in other and the section as a whole is intended to apply in other circumstances.
circumstances.
It is not the purpose of this section to induce you to infringe any It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any patents or other property right claims or to contest validity of any
@ -407,11 +404,11 @@ be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in 12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License original copyright holder who places the Library under this License may add
may add an explicit geographical distribution limitation excluding those an explicit geographical distribution limitation excluding those countries,
countries, so that distribution is permitted only in or among so that distribution is permitted only in or among countries not thus
countries not thus excluded. In such case, this License incorporates excluded. In such case, this License incorporates the limitation as if
the limitation as if written in the body of this License. written in the body of this License.
13. The Free Software Foundation may publish revised and/or new 13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time. versions of the Lesser General Public License from time to time.

8
debian/changelog vendored

@ -1,10 +1,12 @@
lxqt-panel (0.9.0+20151024-1) experimental; urgency=medium lxqt-panel (0.9.0+20151101-1) unstable; urgency=medium
[ Alf Gaida ] [ Alf Gaida ]
* Cherry-picked upstream version 0.9.0+20151024. * Cherry-picked upstream version 0.9.0+20151101.
* Install manpage for lxqt-panel
* Deleted debian/lintian-overrides
* Cleaned up debian/.gitignore * Cleaned up debian/.gitignore
* Switched to experimental because of LXQt namespace change * Switched to experimental because of LXQt namespace change
* Added minimum version for liblxqt0-dev (>= 0.9.0+20150911) * Added minimum version for liblxqt and libqtxdg
* Added upstream signing key and use it in watch file * Added upstream signing key and use it in watch file
* drop transitional packages * drop transitional packages
* drop breaks/replaces * drop breaks/replaces

4
debian/control vendored

@ -11,7 +11,7 @@ Build-Depends: cmake (>= 3.0.2),
libdbusmenu-qt5-dev, libdbusmenu-qt5-dev,
libglib2.0-dev, libglib2.0-dev,
libicu-dev, libicu-dev,
liblxqt0-dev (>= 0.9.0-20150911), liblxqt0-dev (>= 0.9.0-20151026),
liblxqt-globalkeys0-dev, liblxqt-globalkeys0-dev,
liblxqt-globalkeys-ui0-dev, liblxqt-globalkeys-ui0-dev,
libkf5windowsystem-dev, libkf5windowsystem-dev,
@ -19,7 +19,7 @@ Build-Depends: cmake (>= 3.0.2),
libmenu-cache-dev, libmenu-cache-dev,
libpulse-dev, libpulse-dev,
libqt5x11extras5-dev, libqt5x11extras5-dev,
libqt5xdg-dev, libqt5xdg-dev (>= 1.3.0),
libsensors4-dev, libsensors4-dev,
libstatgrab-dev, libstatgrab-dev,
libsysstat-qt5-0-dev (>= 0.3.0), libsysstat-qt5-0-dev (>= 0.3.0),

@ -1,3 +0,0 @@
# there will now manpage in a foreseable future
lxqt-panel: binary-without-manpage usr/bin/lxqt-panel

2
debian/manpages vendored

@ -0,0 +1,2 @@
panel/man/lxqt-panel.1

@ -53,7 +53,7 @@ AddPluginDialog::AddPluginDialog(QWidget *parent):
desktopFilesDirs << QString("%1/%2").arg(XdgDirs::dataHome(), "/lxqt/lxqt-panel"); desktopFilesDirs << QString("%1/%2").arg(XdgDirs::dataHome(), "/lxqt/lxqt-panel");
desktopFilesDirs << PLUGIN_DESKTOPS_DIR; desktopFilesDirs << PLUGIN_DESKTOPS_DIR;
mPlugins = LXQt::PluginInfo::search(desktopFilesDirs, QStringLiteral("LXQtPanel/Plugin"), QStringLiteral("*")); mPlugins = LXQt::PluginInfo::search(desktopFilesDirs, QLatin1String("LXQtPanel/Plugin"), QLatin1String("*"));
std::sort(mPlugins.begin(), mPlugins.end(), [](const LXQt::PluginInfo &p1, const LXQt::PluginInfo &p2) { std::sort(mPlugins.begin(), mPlugins.end(), [](const LXQt::PluginInfo &p1, const LXQt::PluginInfo &p2) {
return p1.name() < p2.name() || (p1.name() == p2.name() && p1.comment() < p2.comment()); return p1.name() < p2.name() || (p1.name() == p2.name() && p1.comment() < p2.comment());
}); });
@ -97,7 +97,7 @@ void AddPluginDialog::filter()
{ {
const LXQt::PluginInfo &plugin = mPlugins.at(i); const LXQt::PluginInfo &plugin = mPlugins.at(i);
QString s = QStringLiteral("%1 %2 %3 %4 %5").arg(plugin.name(), QString s = QString("%1 %2 %3 %4 %5").arg(plugin.name(),
plugin.comment(), plugin.comment(),
plugin.value("Name").toString(), plugin.value("Name").toString(),
plugin.value("Comment").toString(), plugin.value("Comment").toString(),
@ -111,10 +111,10 @@ void AddPluginDialog::filter()
{ {
item->setFlags(item->flags() & ~Qt::ItemIsEnabled); item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
item->setBackground(palette().brush(QPalette::Disabled, QPalette::Text)); item->setBackground(palette().brush(QPalette::Disabled, QPalette::Text));
item->setText(QStringLiteral("<b>%1</b> (%2)<br>%3<br><small>%4</small>") item->setText(QString("<b>%1</b> (%2)<br>%3<br><small>%4</small>")
.arg(plugin.name(), plugin.id(), plugin.comment(), tr("(only one instance can run at a time)"))); .arg(plugin.name(), plugin.id(), plugin.comment(), tr("(only one instance can run at a time)")));
} else } else
item->setText(QStringLiteral("<b>%1</b> (%2)<br>%3").arg(plugin.name(), plugin.id(), plugin.comment())); item->setText(QString("<b>%1</b> (%2)<br>%3").arg(plugin.name(), plugin.id(), plugin.comment()));
item->setIcon(plugin.icon(fallIco)); item->setIcon(plugin.icon(fallIco));
item->setData(INDEX_ROLE, i); item->setData(INDEX_ROLE, i);
} }

@ -35,11 +35,11 @@ ConfigPanelDialog::ConfigPanelDialog(LXQtPanel *panel, QWidget *parent):
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
mPanelPage = new ConfigPanelWidget(panel, this); mPanelPage = new ConfigPanelWidget(panel, this);
addPage(mPanelPage, tr("Panel"), QStringLiteral("configure")); addPage(mPanelPage, tr("Panel"), QLatin1String("configure"));
connect(this, &ConfigPanelDialog::reset, mPanelPage, &ConfigPanelWidget::reset); connect(this, &ConfigPanelDialog::reset, mPanelPage, &ConfigPanelWidget::reset);
mPluginsPage = new ConfigPluginsWidget(panel, this); mPluginsPage = new ConfigPluginsWidget(panel, this);
addPage(mPluginsPage, tr("Widgets"), QStringLiteral("preferences-plugin")); addPage(mPluginsPage, tr("Widgets"), QLatin1String("preferences-plugin"));
connect(this, &ConfigPanelDialog::reset, mPluginsPage, &ConfigPluginsWidget::reset); connect(this, &ConfigPanelDialog::reset, mPluginsPage, &ConfigPluginsWidget::reset);
connect(this, &ConfigPanelDialog::accepted, [panel] { connect(this, &ConfigPanelDialog::accepted, [panel] {

@ -472,6 +472,7 @@ void LXQtPanel::updateWmStrut()
if(wid == 0 || !isVisible()) if(wid == 0 || !isVisible())
return; return;
const QRect wholeScreen = QApplication::desktop()->geometry();
const QRect rect = geometry(); const QRect rect = geometry();
// NOTE: http://standards.freedesktop.org/wm-spec/wm-spec-latest.html // NOTE: http://standards.freedesktop.org/wm-spec/wm-spec-latest.html
// Quote from the EWMH spec: " Note that the strut is relative to the screen edge, and not the edge of the xinerama monitor." // Quote from the EWMH spec: " Note that the strut is relative to the screen edge, and not the edge of the xinerama monitor."
@ -484,7 +485,7 @@ void LXQtPanel::updateWmStrut()
KWindowSystem::setExtendedStrut(wid, KWindowSystem::setExtendedStrut(wid,
/* Left */ 0, 0, 0, /* Left */ 0, 0, 0,
/* Right */ 0, 0, 0, /* Right */ 0, 0, 0,
/* Top */ getReserveDimension(), rect.left(), rect.right(), /* Top */ rect.top() + getReserveDimension(), rect.left(), rect.right(),
/* Bottom */ 0, 0, 0 /* Bottom */ 0, 0, 0
); );
break; break;
@ -494,13 +495,13 @@ void LXQtPanel::updateWmStrut()
/* Left */ 0, 0, 0, /* Left */ 0, 0, 0,
/* Right */ 0, 0, 0, /* Right */ 0, 0, 0,
/* Top */ 0, 0, 0, /* Top */ 0, 0, 0,
/* Bottom */ getReserveDimension(), rect.left(), rect.right() /* Bottom */ wholeScreen.bottom() - rect.bottom() + getReserveDimension(), rect.left(), rect.right()
); );
break; break;
case LXQtPanel::PositionLeft: case LXQtPanel::PositionLeft:
KWindowSystem::setExtendedStrut(wid, KWindowSystem::setExtendedStrut(wid,
/* Left */ getReserveDimension(), rect.top(), rect.bottom(), /* Left */ rect.left() + getReserveDimension(), rect.top(), rect.bottom(),
/* Right */ 0, 0, 0, /* Right */ 0, 0, 0,
/* Top */ 0, 0, 0, /* Top */ 0, 0, 0,
/* Bottom */ 0, 0, 0 /* Bottom */ 0, 0, 0
@ -511,7 +512,7 @@ void LXQtPanel::updateWmStrut()
case LXQtPanel::PositionRight: case LXQtPanel::PositionRight:
KWindowSystem::setExtendedStrut(wid, KWindowSystem::setExtendedStrut(wid,
/* Left */ 0, 0, 0, /* Left */ 0, 0, 0,
/* Right */ getReserveDimension(), rect.top(), rect.bottom(), /* Right */ wholeScreen.right() - rect.right() + getReserveDimension(), rect.top(), rect.bottom(),
/* Top */ 0, 0, 0, /* Top */ 0, 0, 0,
/* Bottom */ 0, 0, 0 /* Bottom */ 0, 0, 0
); );
@ -932,7 +933,7 @@ void LXQtPanel::showPopupMenu(Plugin *plugin)
menu->addTitle(QIcon(), tr("Panel")); menu->addTitle(QIcon(), tr("Panel"));
menu->addAction(XdgIcon::fromTheme(QStringLiteral("configure")), menu->addAction(XdgIcon::fromTheme(QLatin1String("configure")),
tr("Configure Panel"), tr("Configure Panel"),
this, SLOT(showConfigDialog()) this, SLOT(showConfigDialog())
); );
@ -950,7 +951,7 @@ void LXQtPanel::showPopupMenu(Plugin *plugin)
if (a->count() > 1) if (a->count() > 1)
{ {
menu->addAction(XdgIcon::fromTheme(QStringLiteral("list-remove")), menu->addAction(XdgIcon::fromTheme(QLatin1String("list-remove")),
tr("Remove Panel"), tr("Remove Panel"),
this, SLOT(userRequestForDeletion()) this, SLOT(userRequestForDeletion())
); );

@ -39,16 +39,16 @@
LXQtPanelApplication::LXQtPanelApplication(int& argc, char** argv) LXQtPanelApplication::LXQtPanelApplication(int& argc, char** argv)
: LXQt::Application(argc, argv, true) : LXQt::Application(argc, argv, true)
{ {
QCoreApplication::setApplicationName(QStringLiteral("lxqt-panel")); QCoreApplication::setApplicationName(QLatin1String("lxqt-panel"));
QCoreApplication::setApplicationVersion(LXQT_VERSION); QCoreApplication::setApplicationVersion(LXQT_VERSION);
QCommandLineParser parser; QCommandLineParser parser;
parser.setApplicationDescription(QStringLiteral("LXQt panel")); parser.setApplicationDescription(QLatin1String("LXQt panel"));
parser.addHelpOption(); parser.addHelpOption();
parser.addVersionOption(); parser.addVersionOption();
QCommandLineOption configFileOption(QStringList() QCommandLineOption configFileOption(QStringList()
<< QStringLiteral("c") << QStringLiteral("config") << QStringLiteral("configfile"), << QLatin1String("c") << QLatin1String("config") << QLatin1String("configfile"),
QCoreApplication::translate("main", "Use alternate configuration file."), QCoreApplication::translate("main", "Use alternate configuration file."),
QCoreApplication::translate("main", "Configuration file")); QCoreApplication::translate("main", "Configuration file"));
parser.addOption(configFileOption); parser.addOption(configFileOption);
@ -58,7 +58,7 @@ LXQtPanelApplication::LXQtPanelApplication(int& argc, char** argv)
const QString configFile = parser.value(configFileOption); const QString configFile = parser.value(configFileOption);
if (configFile.isEmpty()) if (configFile.isEmpty())
mSettings = new LXQt::Settings(QStringLiteral("panel"), this); mSettings = new LXQt::Settings(QLatin1String("panel"), this);
else else
mSettings = new LXQt::Settings(configFile, QSettings::IniFormat, this); mSettings = new LXQt::Settings(configFile, QSettings::IniFormat, this);

@ -38,7 +38,7 @@ Several plugins are loaded by default, the desktop menu and windows workspaces c
By right clickin over there show config setting options for each plugins and also panel itsefl. By right clickin over there show config setting options for each plugins and also panel itsefl.
.SH AUTOSTART .SH AUTOSTART
The module only are showed on \fBLXQt\fR desktop environment, but you can create an autostart action The module only are showed on \fBLXQt\fR desktop environment, but you can create an autostart action
for you prefered desktop environment. for you preferred desktop environment.
.SH "REPORTING BUGS" .SH "REPORTING BUGS"
Report bugs to https://github.com/LXDE/LXQt/issues Report bugs to https://github.com/LXDE/LXQt/issues
.SH "SEE ALSO" .SH "SEE ALSO"

@ -69,9 +69,9 @@ QVariant PanelPluginsModel::data(const QModelIndex & index, int role/* = Qt::Dis
{ {
case Qt::DisplayRole: case Qt::DisplayRole:
if (plugin.second.isNull()) if (plugin.second.isNull())
ret = QStringLiteral("<b>Unknown</b> (%1)").arg(plugin.first); ret = QString("<b>Unknown</b> (%1)").arg(plugin.first);
else else
ret = QStringLiteral("<b>%1</b> (%2)").arg(plugin.second->name(), plugin.first); ret = QString("<b>%1</b> (%2)").arg(plugin.second->name(), plugin.first);
break; break;
case Qt::DecorationRole: case Qt::DecorationRole:
if (plugin.second.isNull()) if (plugin.second.isNull())
@ -246,7 +246,7 @@ QString PanelPluginsModel::findNewPluginSettingsGroup(const QString &pluginType)
groups.sort(); groups.sort();
// Generate new section name // Generate new section name
QString pluginName = QStringLiteral("%1").arg(pluginType); QString pluginName = QString("%1").arg(pluginType);
if (!groups.contains(pluginName)) if (!groups.contains(pluginName))
return pluginName; return pluginName;
@ -254,7 +254,7 @@ QString PanelPluginsModel::findNewPluginSettingsGroup(const QString &pluginType)
{ {
for (int i = 2; true; ++i) for (int i = 2; true; ++i)
{ {
pluginName = QStringLiteral("%1%2").arg(pluginType).arg(i); pluginName = QString("%1%2").arg(pluginType).arg(i);
if (!groups.contains(pluginName)) if (!groups.contains(pluginName))
return pluginName; return pluginName;
} }

@ -199,34 +199,34 @@ namespace
// to be not stripped (as unused/unreferenced) in static linking time // to be not stripped (as unused/unreferenced) in static linking time
static plugin_tuple_t const static_plugins[] = { static plugin_tuple_t const static_plugins[] = {
#if defined(WITH_CLOCK_PLUGIN) #if defined(WITH_CLOCK_PLUGIN)
std::make_tuple(QStringLiteral("clock"), plugin_ptr_t{new LXQtClockPluginLibrary}, loadPluginTranslation_clock_helper),// clock std::make_tuple(QLatin1String("clock"), plugin_ptr_t{new LXQtClockPluginLibrary}, loadPluginTranslation_clock_helper),// clock
#endif #endif
#if defined(WITH_DESKTOPSWITCH_PLUGIN) #if defined(WITH_DESKTOPSWITCH_PLUGIN)
std::make_tuple(QStringLiteral("desktopswitch"), plugin_ptr_t{new DesktopSwitchPluginLibrary}, loadPluginTranslation_desktopswitch_helper),// desktopswitch std::make_tuple(QLatin1String("desktopswitch"), plugin_ptr_t{new DesktopSwitchPluginLibrary}, loadPluginTranslation_desktopswitch_helper),// desktopswitch
#endif #endif
#if defined(WITH_MAINMENU_PLUGIN) #if defined(WITH_MAINMENU_PLUGIN)
std::make_tuple(QStringLiteral("mainmenu"), plugin_ptr_t{new LXQtMainMenuPluginLibrary}, loadPluginTranslation_mainmenu_helper),// mainmenu std::make_tuple(QLatin1String("mainmenu"), plugin_ptr_t{new LXQtMainMenuPluginLibrary}, loadPluginTranslation_mainmenu_helper),// mainmenu
#endif #endif
#if defined(WITH_QUICKLAUNCH_PLUGIN) #if defined(WITH_QUICKLAUNCH_PLUGIN)
std::make_tuple(QStringLiteral("quicklaunch"), plugin_ptr_t{new LXQtQuickLaunchPluginLibrary}, loadPluginTranslation_quicklaunch_helper),// quicklaunch std::make_tuple(QLatin1String("quicklaunch"), plugin_ptr_t{new LXQtQuickLaunchPluginLibrary}, loadPluginTranslation_quicklaunch_helper),// quicklaunch
#endif #endif
#if defined(WITH_SHOWDESKTOP_PLUGIN) #if defined(WITH_SHOWDESKTOP_PLUGIN)
std::make_tuple(QStringLiteral("showdesktop"), plugin_ptr_t{new ShowDesktopLibrary}, loadPluginTranslation_showdesktop_helper),// showdesktop std::make_tuple(QLatin1String("showdesktop"), plugin_ptr_t{new ShowDesktopLibrary}, loadPluginTranslation_showdesktop_helper),// showdesktop
#endif #endif
#if defined(WITH_SPACER_PLUGIN) #if defined(WITH_SPACER_PLUGIN)
std::make_tuple(QStringLiteral("spacer"), plugin_ptr_t{new SpacerPluginLibrary}, loadPluginTranslation_spacer_helper),// spacer std::make_tuple(QLatin1String("spacer"), plugin_ptr_t{new SpacerPluginLibrary}, loadPluginTranslation_spacer_helper),// spacer
#endif #endif
#if defined(WITH_STATUSNOTIFIER_PLUGIN) #if defined(WITH_STATUSNOTIFIER_PLUGIN)
std::make_tuple(QStringLiteral("statusnotifier"), plugin_ptr_t{new StatusNotifierLibrary}, loadPluginTranslation_statusnotifier_helper),// statusnotifier std::make_tuple(QLatin1String("statusnotifier"), plugin_ptr_t{new StatusNotifierLibrary}, loadPluginTranslation_statusnotifier_helper),// statusnotifier
#endif #endif
#if defined(WITH_TASKBAR_PLUGIN) #if defined(WITH_TASKBAR_PLUGIN)
std::make_tuple(QStringLiteral("taskbar"), plugin_ptr_t{new LXQtTaskBarPluginLibrary}, loadPluginTranslation_taskbar_helper),// taskbar std::make_tuple(QLatin1String("taskbar"), plugin_ptr_t{new LXQtTaskBarPluginLibrary}, loadPluginTranslation_taskbar_helper),// taskbar
#endif #endif
#if defined(WITH_TRAY_PLUGIN) #if defined(WITH_TRAY_PLUGIN)
std::make_tuple(QStringLiteral("tray"), plugin_ptr_t{new LXQtTrayPluginLibrary}, loadPluginTranslation_tray_helper),// tray std::make_tuple(QLatin1String("tray"), plugin_ptr_t{new LXQtTrayPluginLibrary}, loadPluginTranslation_tray_helper),// tray
#endif #endif
#if defined(WITH_WORLDCLOCK_PLUGIN) #if defined(WITH_WORLDCLOCK_PLUGIN)
std::make_tuple(QStringLiteral("worldclock"), plugin_ptr_t{new LXQtWorldClockLibrary}, loadPluginTranslation_worldclock_helper),// worldclock std::make_tuple(QLatin1String("worldclock"), plugin_ptr_t{new LXQtWorldClockLibrary}, loadPluginTranslation_worldclock_helper),// worldclock
#endif #endif
}; };
static constexpr plugin_tuple_t const * const plugins_begin = static_plugins; static constexpr plugin_tuple_t const * const plugins_begin = static_plugins;
@ -408,7 +408,7 @@ QMenu *Plugin::popupMenu() const
if (mPlugin->flags().testFlag(ILXQtPanelPlugin::HaveConfigDialog)) if (mPlugin->flags().testFlag(ILXQtPanelPlugin::HaveConfigDialog))
{ {
QAction* configAction = new QAction( QAction* configAction = new QAction(
XdgIcon::fromTheme(QStringLiteral("preferences-other")), XdgIcon::fromTheme(QLatin1String("preferences-other")),
tr("Configure \"%1\"").arg(name), menu); tr("Configure \"%1\"").arg(name), menu);
menu->addAction(configAction); menu->addAction(configAction);
connect(configAction, SIGNAL(triggered()), this, SLOT(showConfigureDialog())); connect(configAction, SIGNAL(triggered()), this, SLOT(showConfigureDialog()));
@ -421,7 +421,7 @@ QMenu *Plugin::popupMenu() const
menu->addSeparator(); menu->addSeparator();
QAction* removeAction = new QAction( QAction* removeAction = new QAction(
XdgIcon::fromTheme(QStringLiteral("list-remove")), XdgIcon::fromTheme(QLatin1String("list-remove")),
tr("Remove \"%1\"").arg(name), menu); tr("Remove \"%1\"").arg(name), menu);
menu->addAction(removeAction); menu->addAction(removeAction);
connect(removeAction, SIGNAL(triggered()), this, SLOT(requestRemove())); connect(removeAction, SIGNAL(triggered()), this, SLOT(requestRemove()));

@ -41,7 +41,7 @@
#include "desktopswitchbutton.h" #include "desktopswitchbutton.h"
#include "desktopswitchconfiguration.h" #include "desktopswitchconfiguration.h"
#define DEFAULT_SHORTCUT_TEMPLATE QStringLiteral("Control+F%1") static const QString DEFAULT_SHORTCUT_TEMPLATE("Control+F%1");
DesktopSwitch::DesktopSwitch(const ILXQtPanelPluginStartupInfo &startupInfo) : DesktopSwitch::DesktopSwitch(const ILXQtPanelPluginStartupInfo &startupInfo) :
QObject(), QObject(),
@ -84,7 +84,7 @@ void DesktopSwitch::registerShortcuts()
path = QString("/panel/%1/desktop_%2").arg(settings()->group()).arg(i + 1); path = QString("/panel/%1/desktop_%2").arg(settings()->group()).arg(i + 1);
description = tr("Switch to desktop %1").arg(i + 1); description = tr("Switch to desktop %1").arg(i + 1);
gshortcut = GlobalKeyShortcut::Client::instance()->addAction(QStringLiteral(), path, description, this); gshortcut = GlobalKeyShortcut::Client::instance()->addAction(QString(), path, description, this);
if (nullptr != gshortcut) if (nullptr != gshortcut)
{ {
m_keys << gshortcut; m_keys << gshortcut;

@ -106,5 +106,5 @@ void KbdStateConfig::save()
void KbdStateConfig::configureLayouts() void KbdStateConfig::configureLayouts()
{ {
QProcess::startDetached(QStringLiteral("lxqt-config-input")); QProcess::startDetached(QLatin1String("lxqt-config-input"));
} }

@ -63,8 +63,7 @@ LXQtMainMenu::LXQtMainMenu(const ILXQtPanelPluginStartupInfo &startupInfo):
QObject(), QObject(),
ILXQtPanelPlugin(startupInfo), ILXQtPanelPlugin(startupInfo),
mMenu(0), mMenu(0),
mShortcut(0), mShortcut(0)
mLockCascadeChanges(false)
{ {
#ifdef HAVE_MENU_CACHE #ifdef HAVE_MENU_CACHE
mMenuCache = NULL; mMenuCache = NULL;
@ -84,8 +83,15 @@ LXQtMainMenu::LXQtMainMenu(const ILXQtPanelPluginStartupInfo &startupInfo):
settingsChanged(); settingsChanged();
connect(mShortcut, SIGNAL(activated()), &mDelayedPopup, SLOT(start())); mShortcut = GlobalKeyShortcut::Client::instance()->addAction(QString{}, QString("/panel/%1/show_hide").arg(settings()->group()), tr("Show/hide main menu"), this);
connect(mShortcut, SIGNAL(shortcutChanged(QString,QString)), this, SLOT(shortcutChanged(QString,QString))); if (mShortcut)
{
connect(mShortcut, &GlobalKeyShortcut::Action::registrationFinished, [this] {
if (mShortcut->shortcut().isEmpty())
mShortcut->changeShortcut(DEFAULT_SHORTCUT);
});
connect(mShortcut, &GlobalKeyShortcut::Action::activated, [this] { if (!mHideTimer.isActive()) mDelayedPopup.start(); });
}
} }
@ -110,31 +116,12 @@ LXQtMainMenu::~LXQtMainMenu()
************************************************/ ************************************************/
void LXQtMainMenu::showHideMenu() void LXQtMainMenu::showHideMenu()
{ {
if (mMenu && mMenu->isVisible())
if (mMenu && (mMenu->isVisible() || mHideTimer.isActive()))
mMenu->hide(); mMenu->hide();
else else
showMenu(); showMenu();
} }
/************************************************
************************************************/
void LXQtMainMenu::shortcutChanged(const QString &/*oldShortcut*/, const QString &newShortcut)
{
if (!newShortcut.isEmpty())
{
mLockCascadeChanges = true;
settings()->setValue("dialog/shortcut", newShortcut);
settings()->sync();
mShortcutSeq = QKeySequence(newShortcut);
mLockCascadeChanges = false;
}
}
/************************************************ /************************************************
************************************************/ ************************************************/
@ -161,9 +148,6 @@ void LXQtMainMenu::menuCacheReloadNotify(MenuCache* cache, gpointer user_data)
************************************************/ ************************************************/
void LXQtMainMenu::settingsChanged() void LXQtMainMenu::settingsChanged()
{ {
if (mLockCascadeChanges)
return;
if (settings()->value("showText", false).toBool()) if (settings()->value("showText", false).toBool())
{ {
mButton.setText(settings()->value("text", "Start").toString()); mButton.setText(settings()->value("text", "Start").toString());
@ -213,18 +197,6 @@ void LXQtMainMenu::settingsChanged()
#endif #endif
} }
QString shortcut = settings()->value("shortcut", DEFAULT_SHORTCUT).toString();
if (shortcut.isEmpty())
shortcut = DEFAULT_SHORTCUT;
if (!mShortcut)
mShortcut = GlobalKeyShortcut::Client::instance()->addAction(shortcut, QString("/panel/%1/show_hide").arg(settings()->group()), tr("Show/hide main menu"), this);
else if (mShortcut->shortcut() != shortcut)
{
mShortcut->changeShortcut(shortcut);
}
mShortcutSeq = QKeySequence(shortcut);
setMenuFontSize(); setMenuFontSize();
realign(); realign();
@ -301,7 +273,7 @@ void LXQtMainMenu::setMenuFontSize()
************************************************/ ************************************************/
QDialog *LXQtMainMenu::configureDialog() QDialog *LXQtMainMenu::configureDialog()
{ {
return new LXQtMainMenuConfiguration(*settings(), DEFAULT_SHORTCUT); return new LXQtMainMenuConfiguration(*settings(), mShortcut, DEFAULT_SHORTCUT);
} }
/************************************************ /************************************************
@ -333,8 +305,9 @@ bool LXQtMainMenu::eventFilter(QObject *obj, QEvent *event)
{ {
// if our shortcut key is pressed while the menu is open, close the menu // if our shortcut key is pressed while the menu is open, close the menu
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event); QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
if(mShortcutSeq == QKeySequence(keyEvent->modifiers() + keyEvent->key())) if (keyEvent->modifiers() & ~Qt::ShiftModifier)
{ {
mHideTimer.start();
mMenu->hide(); // close the app menu mMenu->hide(); // close the app menu
return true; return true;
} }

@ -95,10 +95,8 @@ private:
XdgMenu mXdgMenu; XdgMenu mXdgMenu;
#endif #endif
bool mLockCascadeChanges;
QTimer mDelayedPopup; QTimer mDelayedPopup;
QTimer mHideTimer; QTimer mHideTimer;
QKeySequence mShortcutSeq;
QString mMenuFile; QString mMenuFile;
protected slots: protected slots:
@ -109,7 +107,6 @@ protected slots:
private slots: private slots:
void showMenu(); void showMenu();
void showHideMenu(); void showHideMenu();
void shortcutChanged(const QString &oldShortcut, const QString &newShortcut);
}; };
class LXQtMainMenuPluginLibrary: public QObject, public ILXQtPanelPluginLibrary class LXQtMainMenuPluginLibrary: public QObject, public ILXQtPanelPluginLibrary

@ -30,15 +30,17 @@
#include "ui_lxqtmainmenuconfiguration.h" #include "ui_lxqtmainmenuconfiguration.h"
#include <XdgMenu> #include <XdgMenu>
#include <XdgIcon> #include <XdgIcon>
#include <lxqt-globalkeys.h>
#include <QFileDialog> #include <QFileDialog>
LXQtMainMenuConfiguration::LXQtMainMenuConfiguration(QSettings &settings, const QString &defaultShortcut, QWidget *parent) : LXQtMainMenuConfiguration::LXQtMainMenuConfiguration(QSettings &settings, GlobalKeyShortcut::Action * shortcut, const QString &defaultShortcut, QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::LXQtMainMenuConfiguration), ui(new Ui::LXQtMainMenuConfiguration),
mSettings(settings), mSettings(settings),
mOldSettings(settings), mOldSettings(settings),
mDefaultShortcut(defaultShortcut) mDefaultShortcut(defaultShortcut),
mShortcut(shortcut)
{ {
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
setObjectName("MainMenuConfigurationWindow"); setObjectName("MainMenuConfigurationWindow");
@ -55,7 +57,7 @@ LXQtMainMenuConfiguration::LXQtMainMenuConfiguration(QSettings &settings, const
connect(ui->chooseMenuFilePB, SIGNAL(clicked()), this, SLOT(chooseMenuFile())); connect(ui->chooseMenuFilePB, SIGNAL(clicked()), this, SLOT(chooseMenuFile()));
connect(ui->menuFilePathLE, &QLineEdit::textChanged, [this] (QString const & file) connect(ui->menuFilePathLE, &QLineEdit::textChanged, [this] (QString const & file)
{ {
mSettings.setValue(QStringLiteral("menu_file"), file); mSettings.setValue(QLatin1String("menu_file"), file);
}); });
connect(ui->shortcutEd, SIGNAL(shortcutGrabbed(QString)), this, SLOT(shortcutChanged(QString))); connect(ui->shortcutEd, SIGNAL(shortcutGrabbed(QString)), this, SLOT(shortcutChanged(QString)));
@ -63,6 +65,8 @@ LXQtMainMenuConfiguration::LXQtMainMenuConfiguration(QSettings &settings, const
connect(ui->customFontCB, SIGNAL(toggled(bool)), this, SLOT(customFontChanged(bool))); connect(ui->customFontCB, SIGNAL(toggled(bool)), this, SLOT(customFontChanged(bool)));
connect(ui->customFontSizeSB, SIGNAL(valueChanged(int)), this, SLOT(customFontSizeChanged(int))); connect(ui->customFontSizeSB, SIGNAL(valueChanged(int)), this, SLOT(customFontSizeChanged(int)));
connect(mShortcut, &GlobalKeyShortcut::Action::shortcutChanged, this, &LXQtMainMenuConfiguration::globalShortcutChanged);
} }
LXQtMainMenuConfiguration::~LXQtMainMenuConfiguration() LXQtMainMenuConfiguration::~LXQtMainMenuConfiguration()
@ -81,7 +85,7 @@ void LXQtMainMenuConfiguration::loadSettings()
menuFile = XdgMenu::getMenuFileName(); menuFile = XdgMenu::getMenuFileName();
} }
ui->menuFilePathLE->setText(menuFile); ui->menuFilePathLE->setText(menuFile);
ui->shortcutEd->setText(mSettings.value("shortcut", "Alt+F1").toString()); ui->shortcutEd->setText(nullptr != mShortcut ? mShortcut->shortcut() : mDefaultShortcut);
ui->customFontCB->setChecked(mSettings.value("customFont", false).toBool()); ui->customFontCB->setChecked(mSettings.value("customFont", false).toBool());
LXQt::Settings lxqtSettings("lxqt"); //load system font size as init value LXQt::Settings lxqtSettings("lxqt"); //load system font size as init value
@ -106,7 +110,7 @@ void LXQtMainMenuConfiguration::chooseMenuFile()
{ {
QFileDialog *d = new QFileDialog(this, QFileDialog *d = new QFileDialog(this,
tr("Choose menu file"), tr("Choose menu file"),
QStringLiteral("/etc/xdg/menus"), QLatin1String("/etc/xdg/menus"),
tr("Menu files (*.menu)")); tr("Menu files (*.menu)"));
d->setWindowModality(Qt::WindowModal); d->setWindowModality(Qt::WindowModal);
d->setAttribute(Qt::WA_DeleteOnClose); d->setAttribute(Qt::WA_DeleteOnClose);
@ -116,10 +120,15 @@ void LXQtMainMenuConfiguration::chooseMenuFile()
d->show(); d->show();
} }
void LXQtMainMenuConfiguration::globalShortcutChanged(const QString &/*oldShortcut*/, const QString &newShortcut)
{
ui->shortcutEd->setText(newShortcut);
}
void LXQtMainMenuConfiguration::shortcutChanged(const QString &value) void LXQtMainMenuConfiguration::shortcutChanged(const QString &value)
{ {
ui->shortcutEd->setText(value); if (mShortcut)
mSettings.setValue("shortcut", value); mShortcut->changeShortcut(value);
} }
void LXQtMainMenuConfiguration::shortcutReset() void LXQtMainMenuConfiguration::shortcutReset()

@ -40,12 +40,16 @@ namespace Ui {
class LXQtMainMenuConfiguration; class LXQtMainMenuConfiguration;
} }
namespace GlobalKeyShortcut {
class Action;
}
class LXQtMainMenuConfiguration : public QDialog class LXQtMainMenuConfiguration : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit LXQtMainMenuConfiguration(QSettings &settings, const QString &defaultShortcut, QWidget *parent = 0); explicit LXQtMainMenuConfiguration(QSettings &settings, GlobalKeyShortcut::Action * shortcut, const QString &defaultShortcut, QWidget *parent = 0);
~LXQtMainMenuConfiguration(); ~LXQtMainMenuConfiguration();
private: private:
@ -53,8 +57,11 @@ private:
QSettings &mSettings; QSettings &mSettings;
LXQt::SettingsCache mOldSettings; LXQt::SettingsCache mOldSettings;
QString mDefaultShortcut; QString mDefaultShortcut;
GlobalKeyShortcut::Action * mShortcut;
private slots: private slots:
void globalShortcutChanged(const QString &oldShortcut, const QString &newShortcut);
void shortcutChanged(const QString &value);
/* /*
Saves settings in conf file. Saves settings in conf file.
*/ */
@ -63,7 +70,6 @@ private slots:
void textButtonChanged(const QString &value); void textButtonChanged(const QString &value);
void showTextChanged(bool value); void showTextChanged(bool value);
void chooseMenuFile(); void chooseMenuFile();
void shortcutChanged(const QString &value);
void shortcutReset(); void shortcutReset();
void customFontChanged(bool value); void customFontChanged(bool value);
void customFontSizeChanged(int value); void customFontSizeChanged(int value);

@ -32,7 +32,9 @@
Button::Button(QWidget * parent) : Button::Button(QWidget * parent) :
QToolButton(parent) QToolButton(parent)
{ {
setIcon(XdgIcon::fromTheme(QStringLiteral("drive-removable-media"))); //Note: don't use the QStringLiteral here as it is causing a SEGFAULT in static finalization time
//(the string is released upon our *.so removal, but the reference is still in held in libqtxdg...)
setIcon(XdgIcon::fromTheme(QLatin1String("drive-removable-media")));
setToolTip(tr("Removable media/devices manager")); setToolTip(tr("Removable media/devices manager"));
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
} }

@ -37,9 +37,9 @@ Configuration::Configuration(QSettings &settings, QWidget *parent) :
ui(new Ui::Configuration) ui(new Ui::Configuration)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->devAddedCombo->addItem(tr("Popup menu"), QStringLiteral(ACT_SHOW_MENU)); ui->devAddedCombo->addItem(tr("Popup menu"), QLatin1String(ACT_SHOW_MENU));
ui->devAddedCombo->addItem(tr("Show info"), QStringLiteral(ACT_SHOW_INFO)); ui->devAddedCombo->addItem(tr("Show info"), QLatin1String(ACT_SHOW_INFO));
ui->devAddedCombo->addItem(tr("Do nothing"), QStringLiteral(ACT_NOTHING)); ui->devAddedCombo->addItem(tr("Do nothing"), QLatin1String(ACT_NOTHING));
loadSettings(); loadSettings();
connect(ui->devAddedCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(ui->devAddedCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
@ -54,12 +54,12 @@ Configuration::~Configuration()
void Configuration::loadSettings() void Configuration::loadSettings()
{ {
QVariant value = settings().value(QStringLiteral(CFG_KEY_ACTION), QStringLiteral(ACT_SHOW_INFO)); QVariant value = settings().value(QLatin1String(CFG_KEY_ACTION), QLatin1String(ACT_SHOW_INFO));
setComboboxIndexByData(ui->devAddedCombo, value, 1); setComboboxIndexByData(ui->devAddedCombo, value, 1);
} }
void Configuration::devAddedChanged(int index) void Configuration::devAddedChanged(int index)
{ {
QString s = ui->devAddedCombo->itemData(index).toString(); QString s = ui->devAddedCombo->itemData(index).toString();
settings().setValue(QStringLiteral(CFG_KEY_ACTION), s); settings().setValue(QLatin1String(CFG_KEY_ACTION), s);
} }

@ -66,7 +66,7 @@ void LXQtMountPlugin::realign()
void LXQtMountPlugin::settingsChanged() void LXQtMountPlugin::settingsChanged()
{ {
QString s = settings()->value(QStringLiteral(CFG_KEY_ACTION)).toString(); QString s = settings()->value(QLatin1String(CFG_KEY_ACTION)).toString();
DeviceAction::ActionId actionId = DeviceAction::stringToActionId(s, DeviceAction::ActionMenu); DeviceAction::ActionId actionId = DeviceAction::stringToActionId(s, DeviceAction::ActionMenu);
if (mDeviceAction == nullptr || mDeviceAction->Type() != actionId) if (mDeviceAction == nullptr || mDeviceAction->Type() != actionId)

@ -49,7 +49,7 @@ public:
~LXQtMountPlugin(); ~LXQtMountPlugin();
virtual QWidget *widget() { return mButton; } virtual QWidget *widget() { return mButton; }
virtual QString themeId() const { return QStringLiteral("LXQtMount"); } virtual QString themeId() const { return QLatin1String("LXQtMount"); }
virtual ILXQtPanelPlugin::Flags flags() const { return PreferRightAlignment | HaveConfigDialog; } virtual ILXQtPanelPlugin::Flags flags() const { return PreferRightAlignment | HaveConfigDialog; }
Popup *popup() { return mPopup; } Popup *popup() { return mPopup; }

@ -89,7 +89,9 @@ void MenuDiskItem::setMountStatus(bool mounted)
void MenuDiskItem::updateMountStatus() void MenuDiskItem::updateMountStatus()
{ {
static const QIcon icon = XdgIcon::fromTheme(mDevice.icon(), QStringLiteral("drive-removable-media")); //Note: don't use the QStringLiteral here as it is causing a SEGFAULT in static finalization time
//(the string is released upon our *.so removal, but the reference is still in held in libqtxdg...)
static const QIcon icon = XdgIcon::fromTheme(mDevice.icon(), QLatin1String("drive-removable-media"));
if (mDevice.isValid()) if (mDevice.isValid())
{ {

@ -31,9 +31,9 @@
//Note: strings can't actually be translated here (in static initialization time) //Note: strings can't actually be translated here (in static initialization time)
// the QT_TR_NOOP here is just for qt translate tools to get the strings for translation // the QT_TR_NOOP here is just for qt translate tools to get the strings for translation
const QStringList SpacerConfiguration::msTypes = { const QStringList SpacerConfiguration::msTypes = {
QStringLiteral(QT_TR_NOOP("lined")) QLatin1String(QT_TR_NOOP("lined"))
, QStringLiteral(QT_TR_NOOP("dotted")) , QLatin1String(QT_TR_NOOP("dotted"))
, QStringLiteral(QT_TR_NOOP("invisible")) , QLatin1String(QT_TR_NOOP("invisible"))
}; };
SpacerConfiguration::SpacerConfiguration(QSettings *settings, QWidget *parent) SpacerConfiguration::SpacerConfiguration(QSettings *settings, QWidget *parent)

@ -42,7 +42,7 @@ SniAsync::SniAsync(const QString &service, const QString &path, const QDBusConne
QDBusPendingReply<QDBusVariant> SniAsync::asyncPropGet(QString const & property) QDBusPendingReply<QDBusVariant> SniAsync::asyncPropGet(QString const & property)
{ {
QDBusMessage msg = QDBusMessage::createMethodCall(mSni.service(), mSni.path(), QStringLiteral("org.freedesktop.DBus.Properties"), QStringLiteral("Get")); QDBusMessage msg = QDBusMessage::createMethodCall(mSni.service(), mSni.path(), QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("Get"));
msg << mSni.interface() << property; msg << mSni.interface() << property;
return mSni.connection().asyncCall(msg); return mSni.connection().asyncCall(msg);
} }

@ -50,20 +50,20 @@ StatusNotifierButton::StatusNotifierButton(QString service, QString objectPath,
connect(interface, &SniAsync::NewToolTip, this, &StatusNotifierButton::newToolTip); connect(interface, &SniAsync::NewToolTip, this, &StatusNotifierButton::newToolTip);
connect(interface, &SniAsync::NewStatus, this, &StatusNotifierButton::newStatus); connect(interface, &SniAsync::NewStatus, this, &StatusNotifierButton::newStatus);
interface->propertyGetAsync(QStringLiteral("Menu"), [this] (QDBusObjectPath path) { interface->propertyGetAsync(QLatin1String("Menu"), [this] (QDBusObjectPath path) {
if (!path.path().isEmpty()) if (!path.path().isEmpty())
{ {
mMenu = (new DBusMenuImporter(interface->service(), path.path(), this))->menu(); mMenu = (new DBusMenuImporter(interface->service(), path.path(), this))->menu();
dynamic_cast<QObject &>(*mMenu).setParent(this); dynamic_cast<QObject &>(*mMenu).setParent(this);
mMenu->setObjectName(QStringLiteral("StatusNotifierMenu")); mMenu->setObjectName(QLatin1String("StatusNotifierMenu"));
} }
}); });
interface->propertyGetAsync(QStringLiteral("Status"), [this] (QString status) { interface->propertyGetAsync(QLatin1String("Status"), [this] (QString status) {
newStatus(status); newStatus(status);
}); });
interface->propertyGetAsync(QStringLiteral("IconThemePath"), [this] (QString value) { interface->propertyGetAsync(QLatin1String("IconThemePath"), [this] (QString value) {
mThemePath = value; mThemePath = value;
//do the logic of icons after we've got the theme path //do the logic of icons after we've got the theme path
refetchIcon(Active); refetchIcon(Active);
@ -99,18 +99,18 @@ void StatusNotifierButton::refetchIcon(Status status)
QString nameProperty, pixmapProperty; QString nameProperty, pixmapProperty;
if (status == Active) if (status == Active)
{ {
nameProperty = QStringLiteral("OverlayIconName"); nameProperty = QLatin1String("OverlayIconName");
pixmapProperty = QStringLiteral("OverlayIconPixmap"); pixmapProperty = QLatin1String("OverlayIconPixmap");
} }
else if (status == NeedsAttention) else if (status == NeedsAttention)
{ {
nameProperty = QStringLiteral("AttentionIconName"); nameProperty = QLatin1String("AttentionIconName");
pixmapProperty = QStringLiteral("AttentionIconPixmap"); pixmapProperty = QLatin1String("AttentionIconPixmap");
} }
else // status == Passive else // status == Passive
{ {
nameProperty = QStringLiteral("IconName"); nameProperty = QLatin1String("IconName");
pixmapProperty = QStringLiteral("IconPixmap"); pixmapProperty = QLatin1String("IconPixmap");
} }
interface->propertyGetAsync(nameProperty, [this, status, pixmapProperty] (QString iconName) { interface->propertyGetAsync(nameProperty, [this, status, pixmapProperty] (QString iconName) {
@ -204,12 +204,12 @@ void StatusNotifierButton::refetchIcon(Status status)
void StatusNotifierButton::newToolTip() void StatusNotifierButton::newToolTip()
{ {
interface->propertyGetAsync(QStringLiteral("ToolTip"), [this] (ToolTip tooltip) { interface->propertyGetAsync(QLatin1String("ToolTip"), [this] (ToolTip tooltip) {
QString toolTipTitle = tooltip.title; QString toolTipTitle = tooltip.title;
if (!toolTipTitle.isEmpty()) if (!toolTipTitle.isEmpty())
setToolTip(toolTipTitle); setToolTip(toolTipTitle);
else else
interface->propertyGetAsync(QStringLiteral("Title"), [this] (QString title) { interface->propertyGetAsync(QLatin1String("Title"), [this] (QString title) {
// we should get here only in case the ToolTip.title was empty // we should get here only in case the ToolTip.title was empty
if (!title.isEmpty()) if (!title.isEmpty())
setToolTip(title); setToolTip(title);
@ -220,9 +220,9 @@ void StatusNotifierButton::newToolTip()
void StatusNotifierButton::newStatus(QString status) void StatusNotifierButton::newStatus(QString status)
{ {
Status newStatus; Status newStatus;
if (status == QStringLiteral("Passive")) if (status == QLatin1String("Passive"))
newStatus = Passive; newStatus = Passive;
else if (status == QStringLiteral("Active")) else if (status == QLatin1String("Active"))
newStatus = Active; newStatus = Active;
else else
newStatus = NeedsAttention; newStatus = NeedsAttention;

@ -133,28 +133,28 @@ public Q_SLOTS: // METHODS
{ {
QList<QVariant> argumentList; QList<QVariant> argumentList;
argumentList << QVariant::fromValue(x) << QVariant::fromValue(y); argumentList << QVariant::fromValue(x) << QVariant::fromValue(y);
return asyncCallWithArgumentList(QStringLiteral("Activate"), argumentList); return asyncCallWithArgumentList(QLatin1String("Activate"), argumentList);
} }
inline QDBusPendingReply<> ContextMenu(int x, int y) inline QDBusPendingReply<> ContextMenu(int x, int y)
{ {
QList<QVariant> argumentList; QList<QVariant> argumentList;
argumentList << QVariant::fromValue(x) << QVariant::fromValue(y); argumentList << QVariant::fromValue(x) << QVariant::fromValue(y);
return asyncCallWithArgumentList(QStringLiteral("ContextMenu"), argumentList); return asyncCallWithArgumentList(QLatin1String("ContextMenu"), argumentList);
} }
inline QDBusPendingReply<> Scroll(int delta, const QString &orientation) inline QDBusPendingReply<> Scroll(int delta, const QString &orientation)
{ {
QList<QVariant> argumentList; QList<QVariant> argumentList;
argumentList << QVariant::fromValue(delta) << QVariant::fromValue(orientation); argumentList << QVariant::fromValue(delta) << QVariant::fromValue(orientation);
return asyncCallWithArgumentList(QStringLiteral("Scroll"), argumentList); return asyncCallWithArgumentList(QLatin1String("Scroll"), argumentList);
} }
inline QDBusPendingReply<> SecondaryActivate(int x, int y) inline QDBusPendingReply<> SecondaryActivate(int x, int y)
{ {
QList<QVariant> argumentList; QList<QVariant> argumentList;
argumentList << QVariant::fromValue(x) << QVariant::fromValue(y); argumentList << QVariant::fromValue(x) << QVariant::fromValue(y);
return asyncCallWithArgumentList(QStringLiteral("SecondaryActivate"), argumentList); return asyncCallWithArgumentList(QLatin1String("SecondaryActivate"), argumentList);
} }
Q_SIGNALS: // SIGNALS Q_SIGNALS: // SIGNALS

@ -620,7 +620,7 @@ void LXQtSysStatContent::paintEvent(QPaintEvent *event)
void LXQtSysStatContent::toolTipInfo(QString const & tooltip) void LXQtSysStatContent::toolTipInfo(QString const & tooltip)
{ {
setToolTip(QStringLiteral("<b>%1(%2)</b><br>%3") setToolTip(QString("<b>%1(%2)</b><br>%3")
.arg(QCoreApplication::translate("LXQtSysStatConfiguration", mDataType.toStdString().c_str())) .arg(QCoreApplication::translate("LXQtSysStatConfiguration", mDataType.toStdString().c_str()))
.arg(QCoreApplication::translate("LXQtSysStatConfiguration", mDataSource.toStdString().c_str())) .arg(QCoreApplication::translate("LXQtSysStatConfiguration", mDataSource.toStdString().c_str()))
.arg(tooltip)); .arg(tooltip));

@ -38,9 +38,9 @@
//Note: strings can't actually be translated here (in static initialization time) //Note: strings can't actually be translated here (in static initialization time)
// the QT_TR_NOOP here is just for qt translate tools to get the strings for translation // the QT_TR_NOOP here is just for qt translate tools to get the strings for translation
const QStringList LXQtSysStatConfiguration::msStatTypes = { const QStringList LXQtSysStatConfiguration::msStatTypes = {
QStringLiteral(QT_TR_NOOP("CPU")) QLatin1String(QT_TR_NOOP("CPU"))
, QStringLiteral(QT_TR_NOOP("Memory")) , QLatin1String(QT_TR_NOOP("Memory"))
, QStringLiteral(QT_TR_NOOP("Network")) , QLatin1String(QT_TR_NOOP("Network"))
}; };
namespace namespace

@ -142,7 +142,7 @@ void LXQtTaskBar::dragEnterEvent(QDragEnterEvent* event)
if (event->mimeData()->hasFormat(LXQtTaskGroup::mimeDataFormat())) if (event->mimeData()->hasFormat(LXQtTaskGroup::mimeDataFormat()))
{ {
event->acceptProposedAction(); event->acceptProposedAction();
buttonMove(nullptr, LXQtTaskGroup::mimeDataData(event->mimeData()), event->pos()); buttonMove(nullptr, qobject_cast<LXQtTaskGroup *>(event->source()), event->pos());
} else } else
event->ignore(); event->ignore();
QWidget::dragEnterEvent(event); QWidget::dragEnterEvent(event);
@ -154,23 +154,22 @@ void LXQtTaskBar::dragEnterEvent(QDragEnterEvent* event)
void LXQtTaskBar::dragMoveEvent(QDragMoveEvent * event) void LXQtTaskBar::dragMoveEvent(QDragMoveEvent * event)
{ {
//we don't get any dragMoveEvents if dragEnter wasn't accepted //we don't get any dragMoveEvents if dragEnter wasn't accepted
buttonMove(nullptr, LXQtTaskGroup::mimeDataData(event->mimeData()), event->pos()); buttonMove(nullptr, qobject_cast<LXQtTaskGroup *>(event->source()), event->pos());
QWidget::dragMoveEvent(event); QWidget::dragMoveEvent(event);
} }
/************************************************ /************************************************
************************************************/ ************************************************/
void LXQtTaskBar::buttonMove(LXQtTaskGroup * dst, QString const & srcWindow, QPoint const & pos) void LXQtTaskBar::buttonMove(LXQtTaskGroup * dst, LXQtTaskGroup * src, QPoint const & pos)
{ {
LXQtTaskGroup *src_group = mGroupsHash.value(srcWindow, nullptr); int src_index;
if (!src_group) if (!src || -1 == (src_index = mLayout->indexOf(src)))
{ {
qDebug() << "Dropped invalid"; qDebug() << "Dropped invalid";
return; return;
} }
const int src_index = mLayout->indexOf(src_group);
const int size = mLayout->count(); const int size = mLayout->count();
Q_ASSERT(0 < size); Q_ASSERT(0 < size);
//dst is nullptr in case the drop occured on empty space in taskbar //dst is nullptr in case the drop occured on empty space in taskbar
@ -245,8 +244,8 @@ void LXQtTaskBar::addWindow(WId window, QString const & groupId)
connect(group, SIGNAL(visibilityChanged(bool)), this, SLOT(refreshPlaceholderVisibility())); connect(group, SIGNAL(visibilityChanged(bool)), this, SLOT(refreshPlaceholderVisibility()));
connect(group, &LXQtTaskGroup::popupShown, this, &LXQtTaskBar::groupPopupShown); connect(group, &LXQtTaskGroup::popupShown, this, &LXQtTaskBar::groupPopupShown);
connect(group, SIGNAL(windowDisowned(WId)), this, SLOT(refreshTaskList())); connect(group, SIGNAL(windowDisowned(WId)), this, SLOT(refreshTaskList()));
connect(group, &LXQtTaskButton::dragging, this, [this] (QString const & mimeWindow, QPoint const & pos) { connect(group, &LXQtTaskButton::dragging, this, [this] (QObject * dragSource, QPoint const & pos) {
buttonMove(qobject_cast<LXQtTaskGroup *>(sender()), mimeWindow, pos); buttonMove(qobject_cast<LXQtTaskGroup *>(sender()), qobject_cast<LXQtTaskGroup *>(dragSource), pos);
}); });
mLayout->addWidget(group); mLayout->addWidget(group);

@ -95,7 +95,7 @@ private slots:
private: private:
void addWindow(WId window, QString const & groupId); void addWindow(WId window, QString const & groupId);
void buttonMove(LXQtTaskGroup * dst, QString const & srcWindow, QPoint const & pos); void buttonMove(LXQtTaskGroup * dst, LXQtTaskGroup * src, QPoint const & pos);
private: private:
QHash<QString, LXQtTaskGroup*> mGroupsHash; QHash<QString, LXQtTaskGroup*> mGroupsHash;

@ -52,7 +52,7 @@ LXQtTaskbarConfiguration::LXQtTaskbarConfiguration(QSettings &settings, QWidget
//Note: in KWindowSystem desktops are numbered from 1..N //Note: in KWindowSystem desktops are numbered from 1..N
const int desk_cnt = KWindowSystem::numberOfDesktops(); const int desk_cnt = KWindowSystem::numberOfDesktops();
for (int i = 1; desk_cnt >= i; ++i) for (int i = 1; desk_cnt >= i; ++i)
ui->showDesktopNumCB->addItem(QStringLiteral("%1 - %2").arg(i).arg(KWindowSystem::desktopName(i)), i); ui->showDesktopNumCB->addItem(QString("%1 - %2").arg(i).arg(KWindowSystem::desktopName(i)), i);
loadSettings(); loadSettings();

@ -70,17 +70,6 @@ void LeftAlignedTextStyle::drawItemText(QPainter * painter, const QRect & rect,
} }
/************************************************
************************************************/
QString LXQtTaskButton::mimeDataData(QMimeData const * mime)
{
QString data;
QDataStream stream(mime->data(mimeDataFormat()));
stream >> data;
return data;
}
/************************************************ /************************************************
************************************************/ ************************************************/
@ -173,7 +162,7 @@ void LXQtTaskButton::dragEnterEvent(QDragEnterEvent *event)
event->acceptProposedAction(); event->acceptProposedAction();
if (event->mimeData()->hasFormat(mimeDataFormat())) if (event->mimeData()->hasFormat(mimeDataFormat()))
{ {
emit dragging(mimeDataData(event->mimeData()), event->pos()); emit dragging(event->source(), event->pos());
setAttribute(Qt::WA_UnderMouse, false); setAttribute(Qt::WA_UnderMouse, false);
} else } else
{ {
@ -187,7 +176,7 @@ void LXQtTaskButton::dragMoveEvent(QDragMoveEvent * event)
{ {
if (event->mimeData()->hasFormat(mimeDataFormat())) if (event->mimeData()->hasFormat(mimeDataFormat()))
{ {
emit dragging(mimeDataData(event->mimeData()), event->pos()); emit dragging(event->source(), event->pos());
setAttribute(Qt::WA_UnderMouse, false); setAttribute(Qt::WA_UnderMouse, false);
} }
} }
@ -203,7 +192,7 @@ void LXQtTaskButton::dropEvent(QDropEvent *event)
mDNDTimer->stop(); mDNDTimer->stop();
if (event->mimeData()->hasFormat(mimeDataFormat())) if (event->mimeData()->hasFormat(mimeDataFormat()))
{ {
emit dropped(mimeDataData(event->mimeData()), event->pos()); emit dropped(event->source(), event->pos());
setAttribute(Qt::WA_UnderMouse, false); setAttribute(Qt::WA_UnderMouse, false);
} }
QToolButton::dropEvent(event); QToolButton::dropEvent(event);
@ -266,7 +255,20 @@ void LXQtTaskButton::mouseMoveEvent(QMouseEvent* event)
QDrag *drag = new QDrag(this); QDrag *drag = new QDrag(this);
drag->setMimeData(mimeData()); drag->setMimeData(mimeData());
QIcon ico = icon(); QIcon ico = icon();
drag->setPixmap(ico.pixmap(ico.actualSize({32, 32}))); QPixmap img = ico.pixmap(ico.actualSize({32, 32}));
drag->setPixmap(img);
switch (parentTaskBar()->panel()->position())
{
case ILXQtPanel::PositionLeft:
case ILXQtPanel::PositionTop:
drag->setHotSpot({0, 0});
break;
case ILXQtPanel::PositionRight:
case ILXQtPanel::PositionBottom:
drag->setHotSpot(img.rect().bottomRight());
break;
}
sDraggging = true; sDraggging = true;
drag->exec(); drag->exec();

@ -85,7 +85,6 @@ public:
void refreshIconGeometry(QRect const & geom); void refreshIconGeometry(QRect const & geom);
static QString mimeDataFormat() { return QLatin1String("lxqt/lxqttaskbutton"); } static QString mimeDataFormat() { return QLatin1String("lxqt/lxqttaskbutton"); }
static QString mimeDataData(QMimeData const * mime);
/*! \return true if this buttom received DragEnter event (and no DragLeave event yet) /*! \return true if this buttom received DragEnter event (and no DragLeave event yet)
* */ * */
bool hasDragAndDropHover() const; bool hasDragAndDropHover() const;
@ -136,8 +135,8 @@ private slots:
void activateWithDraggable(); void activateWithDraggable();
signals: signals:
void dropped(QString const & mimeWindow, QPoint const & pos); void dropped(QObject * dragSource, QPoint const & pos);
void dragging(QString const & mimeWindow, QPoint const & pos); void dragging(QObject * dragSource, QPoint const & pos);
}; };
typedef QHash<WId,LXQtTaskButton*> LXQtTaskButtonHash; typedef QHash<WId,LXQtTaskButton*> LXQtTaskButtonHash;

@ -329,7 +329,7 @@ void LXQtTaskGroup::regroup()
{ {
QString t = QString("%1 - %2 windows").arg(mGroupName).arg(cont); QString t = QString("%1 - %2 windows").arg(mGroupName).arg(cont);
setText(t); setText(t);
setToolTip(parentTaskBar()->isShowGroupOnHover() ? QStringLiteral() : t); setToolTip(parentTaskBar()->isShowGroupOnHover() ? QString() : t);
setWindowId(0); setWindowId(0);
} }
} }

@ -155,17 +155,19 @@ void LXQtVolume::setAudioEngine(AudioEngine *engine)
} }
m_engine = engine; m_engine = engine;
connect(m_engine, SIGNAL(sinkListChanged()), this, SLOT(updateConfigurationSinkList())); connect(m_engine, &AudioEngine::sinkListChanged, this, &LXQtVolume::handleSinkListChanged);
updateConfigurationSinkList(); handleSinkListChanged();
} }
void LXQtVolume::settingsChanged() void LXQtVolume::settingsChanged()
{ {
m_defaultSinkIndex = settings()->value(SETTINGS_DEVICE, SETTINGS_DEFAULT_DEVICE).toInt();
QString engineName = settings()->value(SETTINGS_AUDIO_ENGINE, SETTINGS_DEFAULT_AUDIO_ENGINE).toString(); QString engineName = settings()->value(SETTINGS_AUDIO_ENGINE, SETTINGS_DEFAULT_AUDIO_ENGINE).toString();
qDebug() << "settingsChanged" << engineName; qDebug() << "settingsChanged" << engineName;
if (!m_engine || m_engine->backendName() != engineName) { const bool new_engine = !m_engine || m_engine->backendName() != engineName;
if (new_engine) {
#if defined(USE_PULSEAUDIO) && defined(USE_ALSA) #if defined(USE_PULSEAUDIO) && defined(USE_ALSA)
if (engineName == QLatin1String("PulseAudio")) if (engineName == QLatin1String("PulseAudio"))
setAudioEngine(new PulseAudioEngine(this)); setAudioEngine(new PulseAudioEngine(this));
@ -194,21 +196,25 @@ void LXQtVolume::settingsChanged()
m_volumeButton->setMixerCommand(settings()->value(SETTINGS_MIXER_COMMAND, SETTINGS_DEFAULT_MIXER_COMMAND).toString()); m_volumeButton->setMixerCommand(settings()->value(SETTINGS_MIXER_COMMAND, SETTINGS_DEFAULT_MIXER_COMMAND).toString());
m_volumeButton->volumePopup()->setSliderStep(settings()->value(SETTINGS_STEP, SETTINGS_DEFAULT_STEP).toInt()); m_volumeButton->volumePopup()->setSliderStep(settings()->value(SETTINGS_STEP, SETTINGS_DEFAULT_STEP).toInt());
m_defaultSinkIndex = settings()->value(SETTINGS_DEVICE, SETTINGS_DEFAULT_DEVICE).toInt(); if (!new_engine)
if (m_engine && m_engine->sinks().count() > 0) { handleSinkListChanged();
m_defaultSinkIndex = qBound(0, m_defaultSinkIndex, m_engine->sinks().count()-1);
m_defaultSink = m_engine->sinks().at(m_defaultSinkIndex);
m_volumeButton->volumePopup()->setDevice(m_defaultSink);
m_engine->setIgnoreMaxVolume(settings()->value(SETTINGS_IGNORE_MAX_VOLUME, SETTINGS_DEFAULT_IGNORE_MAX_VOLUME).toBool());
}
} }
void LXQtVolume::updateConfigurationSinkList() void LXQtVolume::handleSinkListChanged()
{ {
if (m_engine && m_configDialog) if (m_engine)
m_configDialog->setSinkList(m_engine->sinks()); {
if (m_engine->sinks().count() > 0)
{
m_defaultSink = m_engine->sinks().at(qBound(0, m_defaultSinkIndex, m_engine->sinks().count()-1));
m_volumeButton->volumePopup()->setDevice(m_defaultSink);
m_engine->setIgnoreMaxVolume(settings()->value(SETTINGS_IGNORE_MAX_VOLUME, SETTINGS_DEFAULT_IGNORE_MAX_VOLUME).toBool());
}
if (m_configDialog)
m_configDialog->setSinkList(m_engine->sinks());
}
} }
void LXQtVolume::handleShortcutVolumeUp() void LXQtVolume::handleShortcutVolumeUp()

@ -62,7 +62,7 @@ public:
void setAudioEngine(AudioEngine *engine); void setAudioEngine(AudioEngine *engine);
protected slots: protected slots:
virtual void settingsChanged(); virtual void settingsChanged();
void updateConfigurationSinkList(); void handleSinkListChanged();
void handleShortcutVolumeUp(); void handleShortcutVolumeUp();
void handleShortcutVolumeDown(); void handleShortcutVolumeDown();
void handleShortcutVolumeMute(); void handleShortcutVolumeMute();

@ -116,12 +116,10 @@ static void contextSuccessCallback(pa_context *context, int success, void *userd
static void contextSubscriptionCallback(pa_context *context, pa_subscription_event_type_t t, uint32_t idx, void *userdata) static void contextSubscriptionCallback(pa_context *context, pa_subscription_event_type_t t, uint32_t idx, void *userdata)
{ {
PulseAudioEngine *pulseEngine = reinterpret_cast<PulseAudioEngine*>(userdata); PulseAudioEngine *pulseEngine = reinterpret_cast<PulseAudioEngine*>(userdata);
foreach (AudioDevice *dev, pulseEngine->sinks()) { if (PA_SUBSCRIPTION_EVENT_REMOVE == t)
if (dev->index() == idx) { pulseEngine->removeSink(idx);
pulseEngine->requestSinkInfoUpdate(dev); else
break; pulseEngine->requestSinkInfoUpdate(idx);
}
}
} }
@ -171,6 +169,18 @@ PulseAudioEngine::~PulseAudioEngine()
} }
} }
void PulseAudioEngine::removeSink(uint32_t idx)
{
auto dev_i = std::find_if(m_sinks.begin(), m_sinks.end(), [idx] (AudioDevice * dev) { return dev->index() == idx; });
if (m_sinks.end() == dev_i)
return;
QScopedPointer<AudioDevice> dev{*dev_i};
m_cVolumeMap.remove(dev.data());
m_sinks.erase(dev_i);
emit sinkListChanged();
}
void PulseAudioEngine::addOrUpdateSink(const pa_sink_info *info) void PulseAudioEngine::addOrUpdateSink(const pa_sink_info *info)
{ {
AudioDevice *dev = 0; AudioDevice *dev = 0;
@ -202,14 +212,20 @@ void PulseAudioEngine::addOrUpdateSink(const pa_sink_info *info)
dev->setVolumeNoCommit(((double)v * 100.0) / m_maximumVolume); dev->setVolumeNoCommit(((double)v * 100.0) / m_maximumVolume);
if (newSink) { if (newSink) {
m_sinks.append(dev); //keep the sinks sorted by index()
m_sinks.insert(
std::lower_bound(m_sinks.begin(), m_sinks.end(), dev, [] (AudioDevice const * const a, AudioDevice const * const b) {
return a->name() < b->name();
})
, dev
);
emit sinkListChanged(); emit sinkListChanged();
} }
} }
void PulseAudioEngine::requestSinkInfoUpdate(AudioDevice *device) void PulseAudioEngine::requestSinkInfoUpdate(uint32_t idx)
{ {
emit sinkInfoChanged(device); emit sinkInfoChanged(idx);
} }
void PulseAudioEngine::commitDeviceVolume(AudioDevice *device) void PulseAudioEngine::commitDeviceVolume(AudioDevice *device)
@ -258,7 +274,7 @@ void PulseAudioEngine::setupSubscription()
if (!m_ready) if (!m_ready)
return; return;
connect(this, SIGNAL(sinkInfoChanged(AudioDevice*)), this, SLOT(retrieveSinkInfo(AudioDevice*)), Qt::QueuedConnection); connect(this, &PulseAudioEngine::sinkInfoChanged, this, &PulseAudioEngine::retrieveSinkInfo, Qt::QueuedConnection);
pa_context_set_subscribe_callback(m_context, contextSubscriptionCallback, this); pa_context_set_subscribe_callback(m_context, contextSubscriptionCallback, this);
pa_threaded_mainloop_lock(m_mainLoop); pa_threaded_mainloop_lock(m_mainLoop);
@ -349,7 +365,7 @@ void PulseAudioEngine::connectContext()
} }
} }
void PulseAudioEngine::retrieveSinkInfo(AudioDevice *device) void PulseAudioEngine::retrieveSinkInfo(uint32_t idx)
{ {
if (!m_ready) if (!m_ready)
return; return;
@ -357,7 +373,7 @@ void PulseAudioEngine::retrieveSinkInfo(AudioDevice *device)
pa_threaded_mainloop_lock(m_mainLoop); pa_threaded_mainloop_lock(m_mainLoop);
pa_operation *operation; pa_operation *operation;
operation = pa_context_get_sink_info_by_index(m_context, device->index(), sinkInfoCallback, this); operation = pa_context_get_sink_info_by_index(m_context, idx, sinkInfoCallback, this);
while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING) while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING)
pa_threaded_mainloop_wait(m_mainLoop); pa_threaded_mainloop_wait(m_mainLoop);
pa_operation_unref(operation); pa_operation_unref(operation);

@ -56,7 +56,8 @@ public:
int volumeMax(AudioDevice */*device*/) const { return m_maximumVolume; } int volumeMax(AudioDevice */*device*/) const { return m_maximumVolume; }
void requestSinkInfoUpdate(AudioDevice *device); void requestSinkInfoUpdate(uint32_t idx);
void removeSink(uint32_t idx);
void addOrUpdateSink(const pa_sink_info *info); void addOrUpdateSink(const pa_sink_info *info);
pa_context_state_t contextState() const { return m_contextState; } pa_context_state_t contextState() const { return m_contextState; }
@ -65,13 +66,13 @@ public:
public slots: public slots:
void commitDeviceVolume(AudioDevice *device); void commitDeviceVolume(AudioDevice *device);
void retrieveSinkInfo(AudioDevice *device); void retrieveSinkInfo(uint32_t idx);
void setMute(AudioDevice *device, bool state); void setMute(AudioDevice *device, bool state);
void setContextState(pa_context_state_t state); void setContextState(pa_context_state_t state);
void setIgnoreMaxVolume(bool ignore); void setIgnoreMaxVolume(bool ignore);
signals: signals:
void sinkInfoChanged(AudioDevice *device); void sinkInfoChanged(uint32_t idx);
void contextStateChanged(pa_context_state_t state); void contextStateChanged(pa_context_state_t state);
void readyChanged(bool ready); void readyChanged(bool ready);

@ -106,7 +106,7 @@ void VolumePopup::handleSliderValueChanged(int value)
return; return;
// qDebug("VolumePopup::handleSliderValueChanged: %d\n", value); // qDebug("VolumePopup::handleSliderValueChanged: %d\n", value);
m_device->setVolume(value); m_device->setVolume(value);
m_volumeSlider->setToolTip(QStringLiteral("%1%").arg(value)); m_volumeSlider->setToolTip(QString("%1%").arg(value));
dynamic_cast<QWidget&>(*parent()).setToolTip(m_volumeSlider->toolTip()); //parent is the button on panel dynamic_cast<QWidget&>(*parent()).setToolTip(m_volumeSlider->toolTip()); //parent is the button on panel
QToolTip::showText(QCursor::pos(), m_volumeSlider->toolTip(), m_volumeSlider); QToolTip::showText(QCursor::pos(), m_volumeSlider->toolTip(), m_volumeSlider);
} }
@ -128,7 +128,7 @@ void VolumePopup::handleDeviceVolumeChanged(int volume)
// signal emission. // signal emission.
m_volumeSlider->blockSignals(true); m_volumeSlider->blockSignals(true);
m_volumeSlider->setValue(volume); m_volumeSlider->setValue(volume);
m_volumeSlider->setToolTip(QStringLiteral("%1%").arg(volume)); m_volumeSlider->setToolTip(QString("%1%").arg(volume));
dynamic_cast<QWidget&>(*parent()).setToolTip(m_volumeSlider->toolTip()); //parent is the button on panel dynamic_cast<QWidget&>(*parent()).setToolTip(m_volumeSlider->toolTip()); //parent is the button on panel
m_volumeSlider->blockSignals(false); m_volumeSlider->blockSignals(false);

Loading…
Cancel
Save