Adding upstream version 0.9.0+20151101.

upstream/0.9.0+20151101
Alf Gaida 9 years ago
parent 161a7316cf
commit 1a184961b6

@ -1,9 +1,8 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
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
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
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations
below.
strategy to use in any particular case, based on the explanations below.
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
@ -89,9 +87,9 @@ libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it
becomes a de-facto standard. To achieve this, non-free programs must
be allowed to use the library. A more frequent case is that a free
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
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
case, there is little to gain by limiting the free library to free
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
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control
compilation and installation of the library.
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
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
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at least
three years, to give the same user the materials specified in
Subsection 6a, above, for a charge no more than the cost of
performing this distribution.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
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
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply, and the section as a whole is intended to apply in other
circumstances.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
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
@ -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
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License
may add an explicit geographical distribution limitation excluding those
countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.

@ -53,7 +53,7 @@ AddPluginDialog::AddPluginDialog(QWidget *parent):
desktopFilesDirs << QString("%1/%2").arg(XdgDirs::dataHome(), "/lxqt/lxqt-panel");
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) {
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);
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.value("Name").toString(),
plugin.value("Comment").toString(),
@ -111,10 +111,10 @@ void AddPluginDialog::filter()
{
item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
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)")));
} 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->setData(INDEX_ROLE, i);
}

@ -35,11 +35,11 @@ ConfigPanelDialog::ConfigPanelDialog(LXQtPanel *panel, QWidget *parent):
setAttribute(Qt::WA_DeleteOnClose);
mPanelPage = new ConfigPanelWidget(panel, this);
addPage(mPanelPage, tr("Panel"), QStringLiteral("configure"));
addPage(mPanelPage, tr("Panel"), QLatin1String("configure"));
connect(this, &ConfigPanelDialog::reset, mPanelPage, &ConfigPanelWidget::reset);
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::accepted, [panel] {

@ -472,6 +472,7 @@ void LXQtPanel::updateWmStrut()
if(wid == 0 || !isVisible())
return;
const QRect wholeScreen = QApplication::desktop()->geometry();
const QRect rect = geometry();
// 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."
@ -484,7 +485,7 @@ void LXQtPanel::updateWmStrut()
KWindowSystem::setExtendedStrut(wid,
/* Left */ 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
);
break;
@ -494,13 +495,13 @@ void LXQtPanel::updateWmStrut()
/* Left */ 0, 0, 0,
/* Right */ 0, 0, 0,
/* Top */ 0, 0, 0,
/* Bottom */ getReserveDimension(), rect.left(), rect.right()
/* Bottom */ wholeScreen.bottom() - rect.bottom() + getReserveDimension(), rect.left(), rect.right()
);
break;
case LXQtPanel::PositionLeft:
KWindowSystem::setExtendedStrut(wid,
/* Left */ getReserveDimension(), rect.top(), rect.bottom(),
/* Left */ rect.left() + getReserveDimension(), rect.top(), rect.bottom(),
/* Right */ 0, 0, 0,
/* Top */ 0, 0, 0,
/* Bottom */ 0, 0, 0
@ -511,7 +512,7 @@ void LXQtPanel::updateWmStrut()
case LXQtPanel::PositionRight:
KWindowSystem::setExtendedStrut(wid,
/* Left */ 0, 0, 0,
/* Right */ getReserveDimension(), rect.top(), rect.bottom(),
/* Right */ wholeScreen.right() - rect.right() + getReserveDimension(), rect.top(), rect.bottom(),
/* Top */ 0, 0, 0,
/* Bottom */ 0, 0, 0
);
@ -932,7 +933,7 @@ void LXQtPanel::showPopupMenu(Plugin *plugin)
menu->addTitle(QIcon(), tr("Panel"));
menu->addAction(XdgIcon::fromTheme(QStringLiteral("configure")),
menu->addAction(XdgIcon::fromTheme(QLatin1String("configure")),
tr("Configure Panel"),
this, SLOT(showConfigDialog())
);
@ -950,7 +951,7 @@ void LXQtPanel::showPopupMenu(Plugin *plugin)
if (a->count() > 1)
{
menu->addAction(XdgIcon::fromTheme(QStringLiteral("list-remove")),
menu->addAction(XdgIcon::fromTheme(QLatin1String("list-remove")),
tr("Remove Panel"),
this, SLOT(userRequestForDeletion())
);

@ -39,16 +39,16 @@
LXQtPanelApplication::LXQtPanelApplication(int& argc, char** argv)
: LXQt::Application(argc, argv, true)
{
QCoreApplication::setApplicationName(QStringLiteral("lxqt-panel"));
QCoreApplication::setApplicationName(QLatin1String("lxqt-panel"));
QCoreApplication::setApplicationVersion(LXQT_VERSION);
QCommandLineParser parser;
parser.setApplicationDescription(QStringLiteral("LXQt panel"));
parser.setApplicationDescription(QLatin1String("LXQt panel"));
parser.addHelpOption();
parser.addVersionOption();
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", "Configuration file"));
parser.addOption(configFileOption);
@ -58,7 +58,7 @@ LXQtPanelApplication::LXQtPanelApplication(int& argc, char** argv)
const QString configFile = parser.value(configFileOption);
if (configFile.isEmpty())
mSettings = new LXQt::Settings(QStringLiteral("panel"), this);
mSettings = new LXQt::Settings(QLatin1String("panel"), this);
else
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.
.SH AUTOSTART
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"
Report bugs to https://github.com/LXDE/LXQt/issues
.SH "SEE ALSO"

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

@ -199,34 +199,34 @@ namespace
// to be not stripped (as unused/unreferenced) in static linking time
static plugin_tuple_t const static_plugins[] = {
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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
};
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))
{
QAction* configAction = new QAction(
XdgIcon::fromTheme(QStringLiteral("preferences-other")),
XdgIcon::fromTheme(QLatin1String("preferences-other")),
tr("Configure \"%1\"").arg(name), menu);
menu->addAction(configAction);
connect(configAction, SIGNAL(triggered()), this, SLOT(showConfigureDialog()));
@ -421,7 +421,7 @@ QMenu *Plugin::popupMenu() const
menu->addSeparator();
QAction* removeAction = new QAction(
XdgIcon::fromTheme(QStringLiteral("list-remove")),
XdgIcon::fromTheme(QLatin1String("list-remove")),
tr("Remove \"%1\"").arg(name), menu);
menu->addAction(removeAction);
connect(removeAction, SIGNAL(triggered()), this, SLOT(requestRemove()));

@ -41,7 +41,7 @@
#include "desktopswitchbutton.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) :
QObject(),
@ -84,7 +84,7 @@ void DesktopSwitch::registerShortcuts()
path = QString("/panel/%1/desktop_%2").arg(settings()->group()).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)
{
m_keys << gshortcut;

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

@ -89,11 +89,8 @@ LXQtMainMenu::LXQtMainMenu(const ILXQtPanelPluginStartupInfo &startupInfo):
connect(mShortcut, &GlobalKeyShortcut::Action::registrationFinished, [this] {
if (mShortcut->shortcut().isEmpty())
mShortcut->changeShortcut(DEFAULT_SHORTCUT);
else
mShortcutSeq = QKeySequence(mShortcut->shortcut());
});
connect(mShortcut, SIGNAL(activated()), &mDelayedPopup, SLOT(start()));
connect(mShortcut, SIGNAL(shortcutChanged(QString,QString)), this, SLOT(shortcutChanged(QString,QString)));
connect(mShortcut, &GlobalKeyShortcut::Action::activated, [this] { if (!mHideTimer.isActive()) mDelayedPopup.start(); });
}
}
@ -119,26 +116,12 @@ LXQtMainMenu::~LXQtMainMenu()
************************************************/
void LXQtMainMenu::showHideMenu()
{
if (mMenu && (mMenu->isVisible() || mHideTimer.isActive()))
if (mMenu && mMenu->isVisible())
mMenu->hide();
else
showMenu();
}
/************************************************
************************************************/
void LXQtMainMenu::shortcutChanged(const QString &/*oldShortcut*/, const QString &newShortcut)
{
if (!newShortcut.isEmpty())
{
mShortcutSeq = QKeySequence(newShortcut);
}
}
/************************************************
************************************************/
@ -322,8 +305,9 @@ bool LXQtMainMenu::eventFilter(QObject *obj, QEvent *event)
{
// if our shortcut key is pressed while the menu is open, close the menu
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
return true;
}

@ -97,7 +97,6 @@ private:
QTimer mDelayedPopup;
QTimer mHideTimer;
QKeySequence mShortcutSeq;
QString mMenuFile;
protected slots:
@ -108,7 +107,6 @@ protected slots:
private slots:
void showMenu();
void showHideMenu();
void shortcutChanged(const QString &oldShortcut, const QString &newShortcut);
};
class LXQtMainMenuPluginLibrary: public QObject, public ILXQtPanelPluginLibrary

@ -57,7 +57,7 @@ LXQtMainMenuConfiguration::LXQtMainMenuConfiguration(QSettings &settings, Global
connect(ui->chooseMenuFilePB, SIGNAL(clicked()), this, SLOT(chooseMenuFile()));
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)));
@ -110,7 +110,7 @@ void LXQtMainMenuConfiguration::chooseMenuFile()
{
QFileDialog *d = new QFileDialog(this,
tr("Choose menu file"),
QStringLiteral("/etc/xdg/menus"),
QLatin1String("/etc/xdg/menus"),
tr("Menu files (*.menu)"));
d->setWindowModality(Qt::WindowModal);
d->setAttribute(Qt::WA_DeleteOnClose);

@ -37,9 +37,9 @@ Configuration::Configuration(QSettings &settings, QWidget *parent) :
ui(new Ui::Configuration)
{
ui->setupUi(this);
ui->devAddedCombo->addItem(tr("Popup menu"), QStringLiteral(ACT_SHOW_MENU));
ui->devAddedCombo->addItem(tr("Show info"), QStringLiteral(ACT_SHOW_INFO));
ui->devAddedCombo->addItem(tr("Do nothing"), QStringLiteral(ACT_NOTHING));
ui->devAddedCombo->addItem(tr("Popup menu"), QLatin1String(ACT_SHOW_MENU));
ui->devAddedCombo->addItem(tr("Show info"), QLatin1String(ACT_SHOW_INFO));
ui->devAddedCombo->addItem(tr("Do nothing"), QLatin1String(ACT_NOTHING));
loadSettings();
connect(ui->devAddedCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
@ -54,12 +54,12 @@ Configuration::~Configuration()
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);
}
void Configuration::devAddedChanged(int index)
{
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()
{
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);
if (mDeviceAction == nullptr || mDeviceAction->Type() != actionId)

@ -49,7 +49,7 @@ public:
~LXQtMountPlugin();
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; }
Popup *popup() { return mPopup; }

@ -31,9 +31,9 @@
//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
const QStringList SpacerConfiguration::msTypes = {
QStringLiteral(QT_TR_NOOP("lined"))
, QStringLiteral(QT_TR_NOOP("dotted"))
, QStringLiteral(QT_TR_NOOP("invisible"))
QLatin1String(QT_TR_NOOP("lined"))
, QLatin1String(QT_TR_NOOP("dotted"))
, QLatin1String(QT_TR_NOOP("invisible"))
};
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)
{
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;
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::NewStatus, this, &StatusNotifierButton::newStatus);
interface->propertyGetAsync(QStringLiteral("Menu"), [this] (QDBusObjectPath path) {
interface->propertyGetAsync(QLatin1String("Menu"), [this] (QDBusObjectPath path) {
if (!path.path().isEmpty())
{
mMenu = (new DBusMenuImporter(interface->service(), path.path(), this))->menu();
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);
});
interface->propertyGetAsync(QStringLiteral("IconThemePath"), [this] (QString value) {
interface->propertyGetAsync(QLatin1String("IconThemePath"), [this] (QString value) {
mThemePath = value;
//do the logic of icons after we've got the theme path
refetchIcon(Active);
@ -99,18 +99,18 @@ void StatusNotifierButton::refetchIcon(Status status)
QString nameProperty, pixmapProperty;
if (status == Active)
{
nameProperty = QStringLiteral("OverlayIconName");
pixmapProperty = QStringLiteral("OverlayIconPixmap");
nameProperty = QLatin1String("OverlayIconName");
pixmapProperty = QLatin1String("OverlayIconPixmap");
}
else if (status == NeedsAttention)
{
nameProperty = QStringLiteral("AttentionIconName");
pixmapProperty = QStringLiteral("AttentionIconPixmap");
nameProperty = QLatin1String("AttentionIconName");
pixmapProperty = QLatin1String("AttentionIconPixmap");
}
else // status == Passive
{
nameProperty = QStringLiteral("IconName");
pixmapProperty = QStringLiteral("IconPixmap");
nameProperty = QLatin1String("IconName");
pixmapProperty = QLatin1String("IconPixmap");
}
interface->propertyGetAsync(nameProperty, [this, status, pixmapProperty] (QString iconName) {
@ -204,12 +204,12 @@ void StatusNotifierButton::refetchIcon(Status status)
void StatusNotifierButton::newToolTip()
{
interface->propertyGetAsync(QStringLiteral("ToolTip"), [this] (ToolTip tooltip) {
interface->propertyGetAsync(QLatin1String("ToolTip"), [this] (ToolTip tooltip) {
QString toolTipTitle = tooltip.title;
if (!toolTipTitle.isEmpty())
setToolTip(toolTipTitle);
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
if (!title.isEmpty())
setToolTip(title);
@ -220,9 +220,9 @@ void StatusNotifierButton::newToolTip()
void StatusNotifierButton::newStatus(QString status)
{
Status newStatus;
if (status == QStringLiteral("Passive"))
if (status == QLatin1String("Passive"))
newStatus = Passive;
else if (status == QStringLiteral("Active"))
else if (status == QLatin1String("Active"))
newStatus = Active;
else
newStatus = NeedsAttention;

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

@ -620,7 +620,7 @@ void LXQtSysStatContent::paintEvent(QPaintEvent *event)
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", mDataSource.toStdString().c_str()))
.arg(tooltip));

@ -38,9 +38,9 @@
//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
const QStringList LXQtSysStatConfiguration::msStatTypes = {
QStringLiteral(QT_TR_NOOP("CPU"))
, QStringLiteral(QT_TR_NOOP("Memory"))
, QStringLiteral(QT_TR_NOOP("Network"))
QLatin1String(QT_TR_NOOP("CPU"))
, QLatin1String(QT_TR_NOOP("Memory"))
, QLatin1String(QT_TR_NOOP("Network"))
};
namespace

@ -52,7 +52,7 @@ LXQtTaskbarConfiguration::LXQtTaskbarConfiguration(QSettings &settings, QWidget
//Note: in KWindowSystem desktops are numbered from 1..N
const int desk_cnt = KWindowSystem::numberOfDesktops();
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();

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

@ -155,17 +155,19 @@ void LXQtVolume::setAudioEngine(AudioEngine *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()
{
m_defaultSinkIndex = settings()->value(SETTINGS_DEVICE, SETTINGS_DEFAULT_DEVICE).toInt();
QString engineName = settings()->value(SETTINGS_AUDIO_ENGINE, SETTINGS_DEFAULT_AUDIO_ENGINE).toString();
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 (engineName == QLatin1String("PulseAudio"))
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->volumePopup()->setSliderStep(settings()->value(SETTINGS_STEP, SETTINGS_DEFAULT_STEP).toInt());
m_defaultSinkIndex = settings()->value(SETTINGS_DEVICE, SETTINGS_DEFAULT_DEVICE).toInt();
if (m_engine && m_engine->sinks().count() > 0) {
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());
}
if (!new_engine)
handleSinkListChanged();
}
void LXQtVolume::updateConfigurationSinkList()
void LXQtVolume::handleSinkListChanged()
{
if (m_engine && m_configDialog)
m_configDialog->setSinkList(m_engine->sinks());
if (m_engine)
{
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()

@ -62,7 +62,7 @@ public:
void setAudioEngine(AudioEngine *engine);
protected slots:
virtual void settingsChanged();
void updateConfigurationSinkList();
void handleSinkListChanged();
void handleShortcutVolumeUp();
void handleShortcutVolumeDown();
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)
{
PulseAudioEngine *pulseEngine = reinterpret_cast<PulseAudioEngine*>(userdata);
foreach (AudioDevice *dev, pulseEngine->sinks()) {
if (dev->index() == idx) {
pulseEngine->requestSinkInfoUpdate(dev);
break;
}
}
if (PA_SUBSCRIPTION_EVENT_REMOVE == t)
pulseEngine->removeSink(idx);
else
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)
{
AudioDevice *dev = 0;
@ -202,14 +212,20 @@ void PulseAudioEngine::addOrUpdateSink(const pa_sink_info *info)
dev->setVolumeNoCommit(((double)v * 100.0) / m_maximumVolume);
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();
}
}
void PulseAudioEngine::requestSinkInfoUpdate(AudioDevice *device)
void PulseAudioEngine::requestSinkInfoUpdate(uint32_t idx)
{
emit sinkInfoChanged(device);
emit sinkInfoChanged(idx);
}
void PulseAudioEngine::commitDeviceVolume(AudioDevice *device)
@ -258,7 +274,7 @@ void PulseAudioEngine::setupSubscription()
if (!m_ready)
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_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)
return;
@ -357,7 +373,7 @@ void PulseAudioEngine::retrieveSinkInfo(AudioDevice *device)
pa_threaded_mainloop_lock(m_mainLoop);
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)
pa_threaded_mainloop_wait(m_mainLoop);
pa_operation_unref(operation);

@ -56,7 +56,8 @@ public:
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);
pa_context_state_t contextState() const { return m_contextState; }
@ -65,13 +66,13 @@ public:
public slots:
void commitDeviceVolume(AudioDevice *device);
void retrieveSinkInfo(AudioDevice *device);
void retrieveSinkInfo(uint32_t idx);
void setMute(AudioDevice *device, bool state);
void setContextState(pa_context_state_t state);
void setIgnoreMaxVolume(bool ignore);
signals:
void sinkInfoChanged(AudioDevice *device);
void sinkInfoChanged(uint32_t idx);
void contextStateChanged(pa_context_state_t state);
void readyChanged(bool ready);

@ -106,7 +106,7 @@ void VolumePopup::handleSliderValueChanged(int value)
return;
// qDebug("VolumePopup::handleSliderValueChanged: %d\n", 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
QToolTip::showText(QCursor::pos(), m_volumeSlider->toolTip(), m_volumeSlider);
}
@ -128,7 +128,7 @@ void VolumePopup::handleDeviceVolumeChanged(int volume)
// signal emission.
m_volumeSlider->blockSignals(true);
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
m_volumeSlider->blockSignals(false);

Loading…
Cancel
Save