mirror of
https://github.com/clementine-player/Clementine
synced 2025-02-03 12:47:31 +01:00
Actually fix formatting
This commit is contained in:
parent
0b6519bad4
commit
a3531d749a
@ -43,7 +43,8 @@ GlobalShortcuts::GlobalShortcuts(QWidget* parent)
|
||||
gnome_backend_(nullptr),
|
||||
system_backend_(nullptr),
|
||||
use_gnome_(false),
|
||||
have_kglobalaccel_(KGlobalAccelShortcutBackend::isKGlobalAccelAvailable()) {
|
||||
have_kglobalaccel_(
|
||||
KGlobalAccelShortcutBackend::isKGlobalAccelAvailable()) {
|
||||
settings_.beginGroup(kSettingsGroup);
|
||||
|
||||
// Create actions
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "kglobalaccelglobalshortcutbackend.h"
|
||||
#include "core/logging.h"
|
||||
#include "kglobalaccelglobalshortcutbackend.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QGuiApplication>
|
||||
@ -47,7 +47,9 @@ bool isCorrectMediaKeyShortcut(const GlobalShortcuts::Shortcut &shortcut) {
|
||||
|
||||
KGlobalAccelShortcutBackend::KGlobalAccelShortcutBackend(
|
||||
GlobalShortcuts* parent)
|
||||
: GlobalShortcutBackend(parent), iface_(nullptr), component_(nullptr),
|
||||
: GlobalShortcutBackend(parent),
|
||||
iface_(nullptr),
|
||||
component_(nullptr),
|
||||
nameToAction_() {}
|
||||
|
||||
#else // HAVE_DBUS
|
||||
@ -69,21 +71,17 @@ bool KGlobalAccelShortcutBackend::DoRegister() {
|
||||
#ifdef HAVE_DBUS
|
||||
qLog(Debug) << "Registering shortcuts";
|
||||
|
||||
if (!acquireInterface())
|
||||
return false;
|
||||
if (!acquireInterface()) return false;
|
||||
|
||||
bool complete = true;
|
||||
for (const GlobalShortcuts::Shortcut& shortcut :
|
||||
manager_->shortcuts().values()) {
|
||||
if (shortcut.action->shortcut().isEmpty())
|
||||
continue;
|
||||
if (shortcut.action->shortcut().isEmpty()) continue;
|
||||
|
||||
if (!registerShortcut(shortcut))
|
||||
complete = false;
|
||||
if (!registerShortcut(shortcut)) complete = false;
|
||||
}
|
||||
|
||||
if (!acquireComponent())
|
||||
return false;
|
||||
if (!acquireComponent()) return false;
|
||||
|
||||
QObject::connect(component_,
|
||||
&OrgKdeKglobalaccelComponentInterface::globalShortcutPressed,
|
||||
@ -98,11 +96,9 @@ bool KGlobalAccelShortcutBackend::DoRegister() {
|
||||
|
||||
void KGlobalAccelShortcutBackend::DoUnregister() {
|
||||
#ifdef HAVE_DBUS
|
||||
if (!acquireInterface())
|
||||
return;
|
||||
if (!acquireInterface()) return;
|
||||
|
||||
if (!acquireComponent())
|
||||
return;
|
||||
if (!acquireComponent()) return;
|
||||
|
||||
for (const GlobalShortcuts::Shortcut& shortcut : manager_->shortcuts())
|
||||
unregisterAction(shortcut.id, shortcut.action);
|
||||
@ -143,16 +139,14 @@ bool KGlobalAccelShortcutBackend::acquireComponent() {
|
||||
}
|
||||
|
||||
bool KGlobalAccelShortcutBackend::acquireInterface() {
|
||||
if (iface_ && iface_->isValid())
|
||||
return true;
|
||||
if (iface_ && iface_->isValid()) return true;
|
||||
|
||||
if (isKGlobalAccelAvailable()) {
|
||||
iface_ = new OrgKdeKGlobalAccelInterface(
|
||||
Service, Path, QDBusConnection::sessionBus(), this);
|
||||
}
|
||||
|
||||
if (iface_ && iface_->isValid())
|
||||
return true;
|
||||
if (iface_ && iface_->isValid()) return true;
|
||||
|
||||
if (!iface_)
|
||||
qLog(Warning) << "KGlobalAccel daemon not registered";
|
||||
@ -170,13 +164,12 @@ QStringList KGlobalAccelShortcutBackend::id(const QString &name,
|
||||
ret << name;
|
||||
ret << compDisplayName();
|
||||
ret << action->text().replace(QLatin1Char('&'), QStringLiteral(""));
|
||||
if (ret.back().isEmpty())
|
||||
ret.back() = name;
|
||||
if (ret.back().isEmpty()) ret.back() = name;
|
||||
return ret;
|
||||
}
|
||||
|
||||
QList<int>
|
||||
KGlobalAccelShortcutBackend::intList(const QList<QKeySequence> &seq) {
|
||||
QList<int> KGlobalAccelShortcutBackend::intList(
|
||||
const QList<QKeySequence>& seq) {
|
||||
QList<int> ret;
|
||||
for (const QKeySequence& sequence : seq) {
|
||||
ret.append(sequence[0]);
|
||||
@ -209,8 +202,7 @@ bool KGlobalAccelShortcutBackend::registerAction(const QString &name,
|
||||
bool KGlobalAccelShortcutBackend::registerShortcut(
|
||||
const GlobalShortcuts::Shortcut& shortcut) {
|
||||
QStringList actionId;
|
||||
if (!registerAction(shortcut.id, shortcut.action, actionId))
|
||||
return false;
|
||||
if (!registerAction(shortcut.id, shortcut.action, actionId)) return false;
|
||||
|
||||
QList<QKeySequence> activeShortcut;
|
||||
activeShortcut << shortcut.action->shortcut();
|
||||
@ -239,8 +231,8 @@ bool KGlobalAccelShortcutBackend::registerShortcut(
|
||||
return true;
|
||||
}
|
||||
|
||||
QList<QKeySequence>
|
||||
KGlobalAccelShortcutBackend::shortcutList(const QList<int> &seq) {
|
||||
QList<QKeySequence> KGlobalAccelShortcutBackend::shortcutList(
|
||||
const QList<int>& seq) {
|
||||
QList<QKeySequence> ret;
|
||||
for (int i : seq) {
|
||||
ret.append(i);
|
||||
@ -268,8 +260,7 @@ void KGlobalAccelShortcutBackend::onShortcutPressed(
|
||||
}
|
||||
}
|
||||
|
||||
if (action && action->isEnabled())
|
||||
action->trigger();
|
||||
if (action && action->isEnabled()) action->trigger();
|
||||
}
|
||||
|
||||
#endif // HAVE_DBUS
|
||||
|
Loading…
x
Reference in New Issue
Block a user