[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [plasma-desktop/amourphious/keyboard] kcms/keyboard: qdebug to qcdebug and added new connect syntax
From: shivam makkar <amourphious1992 () gmail ! com>
Date: 2014-09-25 19:20:38
Message-ID: E1XXEak-0004lO-6P () scm ! kde ! org
[Download RAW message or body]
Git commit dc3f8b08de8cdf28bd4402c5e852d4018c322437 by shivam makkar.
Committed on 20/06/2014 at 21:17.
Pushed by makkar into branch 'amourphious/keyboard'.
qdebug to qcdebug and added new connect syntax
M +5 -4 kcms/keyboard/bindings.cpp
M +2 -1 kcms/keyboard/bindings.h
M +3 -2 kcms/keyboard/iso_codes.cpp
M +2 -1 kcms/keyboard/iso_codes.h
M +0 -2 kcms/keyboard/kcm_keyboard.cpp
M +2 -1 kcms/keyboard/kcm_keyboard_widget.cpp
M +3 -0 kcms/keyboard/kcm_keyboard_widget.h
M +8 -6 kcms/keyboard/kcmmisc.cpp
M +3 -0 kcms/keyboard/kcmmisc.h
M +3 -1 kcms/keyboard/keyboard_config.cpp
M +3 -0 kcms/keyboard/keyboard_config.h
M +16 -6 kcms/keyboard/keyboard_daemon.cpp
M +3 -0 kcms/keyboard/keyboard_daemon.h
M +4 -1 kcms/keyboard/keyboard_hardware.cpp
M +11 -10 kcms/keyboard/layout_memory.cpp
M +3 -0 kcms/keyboard/layout_memory.h
M +11 -10 kcms/keyboard/layout_memory_persister.cpp
M +3 -0 kcms/keyboard/layout_memory_persister.h
M +0 -1 kcms/keyboard/layout_widget.cpp
M +2 -1 kcms/keyboard/layouts_menu.cpp
M +3 -0 kcms/keyboard/layouts_menu.h
M +19 -18 kcms/keyboard/x11_helper.cpp
M +2 -1 kcms/keyboard/x11_helper.h
M +9 -6 kcms/keyboard/xinput_helper.cpp
M +8 -6 kcms/keyboard/xkb_helper.cpp
M +21 -20 kcms/keyboard/xkb_rules.cpp
M +4 -2 kcms/keyboard/xkb_rules.h
http://commits.kde.org/plasma-desktop/dc3f8b08de8cdf28bd4402c5e852d4018c322437
diff --git a/kcms/keyboard/bindings.cpp b/kcms/keyboard/bindings.cpp
index 325dd3c..5413fbb 100644
--- a/kcms/keyboard/bindings.cpp
+++ b/kcms/keyboard/bindings.cpp
@@ -31,6 +31,7 @@
#include "x11_helper.h"
#include "flags.h"
+Q_LOGGING_CATEGORY(BINDINGS, "bindings")
static const char* actionName = I18N_NOOP("Switch to Next Keyboard Layout");
static const char* COMPONENT_NAME = I18N_NOOP("KDE Keyboard Layout Switcher");
@@ -110,7 +111,7 @@ void KeyboardLayoutActionCollection::setLayoutShortcuts(QList<LayoutUnit>& layou
createLayoutShortcutActon(layoutUnit, rules, false);
}
}
- qDebug() << "Cleaning component shortcuts on save" << KGlobalAccel::cleanComponent(COMPONENT_NAME);
+ qCDebug(BINDINGS) << "Cleaning component shortcuts on save" << \
KGlobalAccel::cleanComponent(COMPONENT_NAME); }
void KeyboardLayoutActionCollection::loadLayoutShortcuts(QList<LayoutUnit>& layoutUnits, const Rules* \
rules) @@ -120,15 +121,15 @@ void KeyboardLayoutActionCollection::loadLayoutShortcuts(QList<LayoutUnit>& \
layo QAction* action = createLayoutShortcutActon(layoutUnit, rules, true);
const auto shortcut = KGlobalAccel::self()->shortcut(action);
if( ! shortcut.isEmpty() ) {
- qDebug() << "Restored shortcut for" << layoutUnit.toString() << shortcut.first();
+ qCDebug(BINDINGS) << "Restored shortcut for" << layoutUnit.toString() << shortcut.first();
layoutUnit.setShortcut(shortcut.first());
}
else {
- qDebug() << "Skipping empty shortcut for" << layoutUnit.toString();
+ qCDebug(BINDINGS) << "Skipping empty shortcut for" << layoutUnit.toString();
removeAction(action);
}
}
- qDebug() << "Cleaning component shortcuts on load" << KGlobalAccel::cleanComponent(COMPONENT_NAME);
+ qCDebug(BINDINGS) << "Cleaning component shortcuts on load" << \
KGlobalAccel::cleanComponent(COMPONENT_NAME); }
//KAction* KeyboardLayoutActionCollection::getAction(const LayoutUnit& layoutUnit)
diff --git a/kcms/keyboard/bindings.h b/kcms/keyboard/bindings.h
index c576455..29bd910 100644
--- a/kcms/keyboard/bindings.h
+++ b/kcms/keyboard/bindings.h
@@ -21,8 +21,9 @@
#define BINDINGS_H_
#include <kactioncollection.h>
+#include <QLoggingCategory>
-
+Q_DECLARE_LOGGING_CATEGORY(BINDINGS)
//class QObject;
class Rules;
class LayoutUnit;
diff --git a/kcms/keyboard/iso_codes.cpp b/kcms/keyboard/iso_codes.cpp
index 3e3b210..c08d729 100644
--- a/kcms/keyboard/iso_codes.cpp
+++ b/kcms/keyboard/iso_codes.cpp
@@ -24,6 +24,7 @@
#include <QtXml/QXmlAttributes>
+Q_LOGGING_CATEGORY(ISO_CODES, "iso.codes")
class IsoCodesPrivate {
public:
@@ -131,9 +132,9 @@ void IsoCodesPrivate::buildIsoEntryList()
QXmlInputSource xmlInputSource(&file);
if( ! reader.parse(xmlInputSource) ) {
- kError() << "Failed to parse the xml file" << file.fileName();
+ qCDebug(ISO_CODES) << "Failed to parse the xml file" << file.fileName();
return;
}
- kDebug() << "Loaded" << isoEntryList.count() << ("iso entry definitions for iso"+isoCode) << "from" << \
file.fileName(); + qCDebug(ISO_CODES) << "Loaded" << isoEntryList.count() << ("iso entry definitions \
for iso"+isoCode) << "from" << file.fileName(); }
diff --git a/kcms/keyboard/iso_codes.h b/kcms/keyboard/iso_codes.h
index 6a33739..95f370e 100644
--- a/kcms/keyboard/iso_codes.h
+++ b/kcms/keyboard/iso_codes.h
@@ -23,8 +23,9 @@
#include <QtCore/QString>
#include <QtCore/QList>
#include <QtCore/QMap>
+#include <QLoggingCategory>
-
+Q_DECLARE_LOGGING_CATEGORY(BINDINGS)
/**
* Represents an item for iso-* standards which consists of attributes and their values
*/
diff --git a/kcms/keyboard/kcm_keyboard.cpp b/kcms/keyboard/kcm_keyboard.cpp
index 699c6f4..530b4a6 100644
--- a/kcms/keyboard/kcm_keyboard.cpp
+++ b/kcms/keyboard/kcm_keyboard.cpp
@@ -41,9 +41,7 @@
//temp hack
#include "kcmmisc.h"
-
K_PLUGIN_FACTORY(KeyboardModuleFactory, registerPlugin<KCMKeyboard>();)
-K_EXPORT_PLUGIN(KeyboardModuleFactory("kcmkeyboard"))
KCMKeyboard::KCMKeyboard(QWidget *parent, const QVariantList &args)
: KCModule(parent)
diff --git a/kcms/keyboard/kcm_keyboard_widget.cpp b/kcms/keyboard/kcm_keyboard_widget.cpp
index b5a9ac0..9029ff1 100644
--- a/kcms/keyboard/kcm_keyboard_widget.cpp
+++ b/kcms/keyboard/kcm_keyboard_widget.cpp
@@ -46,6 +46,7 @@
#include "ui_kcm_add_layout_dialog.h"
+Q_LOGGING_CATEGORY(KEBOARD_WIDGET, "keyboard.widget")
static const QString GROUP_SWITCH_GROUP_NAME("grp");
static const QString LV3_SWITCH_GROUP_NAME("lv3");
@@ -607,7 +608,7 @@ void KCMKeyboardWidget::updateXkbShortcutButton(const QString& groupName, QPushB
const OptionGroupInfo* optionGroupInfo = rules->getOptionGroupInfo(groupName);
const OptionInfo* optionInfo = optionGroupInfo->getOptionInfo(option);
if( optionInfo == NULL || optionInfo->description == NULL ) {
- qDebug() << "Could not find option info for " << option;
+ qCDebug(KEBOARD_WIDGET) << "Could not find option info for " << option;
button->setText(grpOptions.first());
}
else {
diff --git a/kcms/keyboard/kcm_keyboard_widget.h b/kcms/keyboard/kcm_keyboard_widget.h
index 657ddda..110f16d 100644
--- a/kcms/keyboard/kcm_keyboard_widget.h
+++ b/kcms/keyboard/kcm_keyboard_widget.h
@@ -24,6 +24,9 @@
#include <kcomponentdata.h>
#include <QTabWidget>
+#include <QLoggingCategory>
+
+Q_DECLARE_LOGGING_CATEGORY(KCM_KEYBOARD)
class QWidget;
class KeyboardConfig;
diff --git a/kcms/keyboard/kcmmisc.cpp b/kcms/keyboard/kcmmisc.cpp
index 7fdb387..c9e6a30 100755
--- a/kcms/keyboard/kcmmisc.cpp
+++ b/kcms/keyboard/kcmmisc.cpp
@@ -39,6 +39,7 @@
#include <X11/Xlib.h>
+Q_LOGGING_CATEGORY(KCMMISC, "kcmmisc")
KCMiscKeyboardWidget::KCMiscKeyboardWidget(QWidget *parent)
: QWidget(parent),
@@ -63,17 +64,18 @@ KCMiscKeyboardWidget::KCMiscKeyboardWidget(QWidget *parent)
ui.rateSlider->setTickInterval(498);
QList <QAbstractButton*> btns = ui.kbRepButtonGroup->buttons();
- for (int i = 0; i < btns.size(); i++) {
+
+ for(int i = 0; i < btns.size(); i++){
ui.kbRepButtonGroup->setId(btns[i], i);
}
-
btns = ui.numButtonGroup->buttons();
- for (int i = 0; i < btns.size(); i++) {
+
+ for(int i = 0; i < btns.size(); i++){
ui.numButtonGroup->setId(btns[i], i);
}
- connect(ui.kbRepButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(changed()));
- connect(ui.kbRepButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(keyboardRepeatStateChanged(int)));
+ connect(ui.kbRepButtonGroup, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), \
this, static_cast<void (KCMiscKeyboardWidget::*)(void)>(&KCMiscKeyboardWidget::changed)); + \
connect(ui.kbRepButtonGroup, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), \
this, &KCMiscKeyboardWidget::keyboardRepeatStateChanged); connect(ui.delay, SIGNAL(valueChanged(int)), \
this, SLOT(delaySpinboxChanged(int))); connect(ui.delaySlider, SIGNAL(valueChanged(int)), this, \
SLOT(delaySliderChanged(int))); connect(ui.rate, SIGNAL(valueChanged(double)), this, \
SLOT(rateSpinboxChanged(double))); @@ -129,7 +131,7 @@ void TriStateHelper::setTriState(QButtonGroup* \
group, TriState state) QAbstractButton* checked = group->button(getInt(state));
if(checked){
checked->setChecked(true);
- //qDebug()<<"button: "<<checked->text();
+ //qCDebug(KCMMISC)<<"button: "<<checked->text();
}
}
diff --git a/kcms/keyboard/kcmmisc.h b/kcms/keyboard/kcmmisc.h
index 1183fb1..d4ff2ef 100755
--- a/kcms/keyboard/kcmmisc.h
+++ b/kcms/keyboard/kcmmisc.h
@@ -27,6 +27,9 @@
#include <QString>
#include <QWidget>
#include <QButtonGroup>
+#include <QLoggingCategory>
+
+Q_DECLARE_LOGGING_CATEGORY(KCM_KEYBOARD)
class Ui_KeyboardConfigWidget;
diff --git a/kcms/keyboard/keyboard_config.cpp b/kcms/keyboard/keyboard_config.cpp
index a227a34..05afba7 100644
--- a/kcms/keyboard/keyboard_config.cpp
+++ b/kcms/keyboard/keyboard_config.cpp
@@ -23,6 +23,8 @@
#include <QDebug>
+Q_LOGGING_CATEGORY(KEYBOARD_CONFIG, "keyboard_config")
+
static const char* SWITCHING_POLICIES[] = {"Global", "Desktop", "WinClass", "Window", NULL };
static const char* LIST_SEPARATOR = ",";
//static const char* DEFAULT_LAYOUT = "us";
@@ -143,7 +145,7 @@ void KeyboardConfig::load()
// }
// }
- qDebug() << "configuring layouts" << configureLayouts << "configuring options" << \
resetOldXkbOptions; + qCDebug(KEYBOARD_CONFIG) << "configuring layouts" << configureLayouts << \
"configuring options" << resetOldXkbOptions; }
void KeyboardConfig::save()
diff --git a/kcms/keyboard/keyboard_config.h b/kcms/keyboard/keyboard_config.h
index b86418d..759deb0 100644
--- a/kcms/keyboard/keyboard_config.h
+++ b/kcms/keyboard/keyboard_config.h
@@ -27,6 +27,9 @@
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QPair>
+#include <QLoggingCategory>
+
+Q_DECLARE_LOGGING_CATEGORY(KEYBOARD_CONFIG)
/**
* This class provides configuration options for keyboard module
diff --git a/kcms/keyboard/keyboard_daemon.cpp b/kcms/keyboard/keyboard_daemon.cpp
index cb84410..f3ad565 100644
--- a/kcms/keyboard/keyboard_daemon.cpp
+++ b/kcms/keyboard/keyboard_daemon.cpp
@@ -28,6 +28,8 @@
#include <kactioncollection.h>
#include <kglobalsettings.h>
+Q_LOGGING_CATEGORY(KEYBOARD_DAEMON, "keyboard_daemon")
+
#include "x11_helper.h"
#include "xinput_helper.h"
#include "xkb_helper.h"
@@ -41,7 +43,7 @@
K_PLUGIN_FACTORY(KeyboardFactory, registerPlugin<KeyboardDaemon>();)
-K_EXPORT_PLUGIN(KeyboardFactory("keyboard", "kxkb"))
+
KeyboardDaemon::KeyboardDaemon(QObject *parent, const QList<QVariant>&)
: KDEDModule(parent),
@@ -91,7 +93,7 @@ KeyboardDaemon::~KeyboardDaemon()
void KeyboardDaemon::configureKeyboard()
{
- qDebug() << "Configuring keyboard";
+ qCDebug(KEYBOARD_DAEMON) << "Configuring keyboard";
init_keyboard_hardware();
keyboardConfig.load();
@@ -196,9 +198,17 @@ void KeyboardDaemon::layoutChanged()
}
if( newLayout != currentLayout ) {
- currentLayout = newLayout;
- emit currentLayoutChanged(newLayout.toString());
- }
+ currentLayout = newLayout;
+ QDBusMessage msg = QDBusMessage::createMethodCall(
+ QLatin1Literal("org.kde.plasma_shell"),
+ QLatin1Literal("/org/kde/osdService"),
+ QLatin1Literal("org.kde.osdService"),
+ QLatin1Literal("kbdLayoutChanged"));
+ qCDebug(KEYBOARD_DAEMON) << newLayout.getDisplayName();
+ msg.setArguments(QList<QVariant>() << newLayout.getDisplayName());
+ QDBusConnection::sessionBus().asyncCall(msg);
+ emit currentLayoutChanged(newLayout.toString());
+ }
}
void KeyboardDaemon::layoutMapChanged()
@@ -213,7 +223,7 @@ void KeyboardDaemon::layoutMapChanged()
void KeyboardDaemon::switchToNextLayout()
{
- qDebug() << "Toggling layout";
+ qCDebug(KEYBOARD_DAEMON) << "Toggling layout";
X11Helper::switchToNextLayout();
LayoutUnit newLayout = X11Helper::getCurrentLayout();
diff --git a/kcms/keyboard/keyboard_daemon.h b/kcms/keyboard/keyboard_daemon.h
index 4edb968..47935e3 100644
--- a/kcms/keyboard/keyboard_daemon.h
+++ b/kcms/keyboard/keyboard_daemon.h
@@ -23,6 +23,9 @@
#include <kdedmodule.h>
#include <kdemacros.h>
#include <QtCore/QStringList>
+#include <QLoggingCategory>
+
+Q_DECLARE_LOGGING_CATEGORY(KEYBOARD_DAEMON)
#include "layout_memory.h"
#include "keyboard_dbus.h"
diff --git a/kcms/keyboard/keyboard_hardware.cpp b/kcms/keyboard/keyboard_hardware.cpp
index ba6d83d..7ab443f 100644
--- a/kcms/keyboard/keyboard_hardware.cpp
+++ b/kcms/keyboard/keyboard_hardware.cpp
@@ -22,6 +22,7 @@
#include <QX11Info>
#include <QCursor> // WTF? - otherwise compiler complains
#include <QDebug>
+#include <QLoggingCategory>
#include <math.h>
@@ -35,6 +36,8 @@ extern "C" void numlockx_change_numlock_state(Display* dpy, int state);
#include <X11/keysym.h>
#include <X11/Xlib.h>
+Q_DECLARE_LOGGING_CATEGORY(KEYBOARD_HARDWARE)
+Q_LOGGING_CATEGORY(KEYBOARD_HARDWARE, "keyboard_hardware")
// This code is taken from xset utility from XFree 4.3 (http://www.xfree86.org/)
@@ -42,7 +45,7 @@ static
void set_repeatrate(int delay, double rate)
{
if( !X11Helper::xkbSupported(NULL) ) {
- qDebug() << "Failed to set keyboard repeat rate: xkb is not supported";
+ qCDebug(KEYBOARD_HARDWARE) << "Failed to set keyboard repeat rate: xkb is not supported";
return;
}
diff --git a/kcms/keyboard/layout_memory.cpp b/kcms/keyboard/layout_memory.cpp
index d78e677..079a413 100644
--- a/kcms/keyboard/layout_memory.cpp
+++ b/kcms/keyboard/layout_memory.cpp
@@ -27,6 +27,7 @@
#include "x11_helper.h"
#include "xkb_helper.h"
+Q_LOGGING_CATEGORY(LAYOUT_MEMORY, "layout_memory")
LayoutMemory::LayoutMemory(const KeyboardConfig& keyboardConfig_):
prevLayoutList(X11Helper::getLayoutsList()),
@@ -72,7 +73,7 @@ QString LayoutMemory::getCurrentMapKey() {
WId wid = KWindowSystem::self()->activeWindow();
KWindowInfo winInfo(wid, NET::WMWindowType);
NET::WindowType windowType = winInfo.windowType( NET::NormalMask | NET::DesktopMask | NET::DialogMask \
);
- qDebug() << "window type" << windowType;
+ qCDebug(LAYOUT_MEMORY) << "window type" << windowType;
// we ignore desktop type so that our keybaord layout applet on desktop could change layout properly
if( windowType == NET::Desktop )
@@ -86,7 +87,7 @@ QString LayoutMemory::getCurrentMapKey() {
WId wid = KWindowSystem::self()->activeWindow();
KWindowInfo winInfo(wid, NET::WMWindowType, NET::WM2WindowClass);
NET::WindowType windowType = winInfo.windowType( NET::NormalMask | NET::DesktopMask | NET::DialogMask \
);
- qDebug() << "window type" << windowType;
+ qCDebug(LAYOUT_MEMORY) << "window type" << windowType;
// we ignore desktop type so that our keybaord layout applet on desktop could change layout properly
if( windowType == NET::Desktop )
@@ -96,7 +97,7 @@ QString LayoutMemory::getCurrentMapKey() {
// shall we use pid or window class ??? - class seems better (see e.g. \
https://bugs.kde.org/show_bug.cgi?id=245507) // for window class shall we use class.class or class.name? \
(seem class.class is a bit better - more app-oriented)
- qDebug() << "New active window with class.class: " << winInfo.windowClassClass();
+ qCDebug(LAYOUT_MEMORY) << "New active window with class.class: " << winInfo.windowClassClass();
return QString(winInfo.windowClassClass());
// NETWinInfo winInfoForPid( QX11Info::display(), wid, QX11Info::appRootWindow(), NET::WMPid);
// return QString::number(winInfoForPid.pid());
@@ -127,20 +128,20 @@ void LayoutMemory::layoutMapChanged()
if( prevLayoutList == newLayoutList )
return;
- qDebug() << "Layout map change: " << LayoutSet::toString(prevLayoutList) << "-->" << \
LayoutSet::toString(newLayoutList); + qCDebug(LAYOUT_MEMORY) << "Layout map change: " << \
LayoutSet::toString(prevLayoutList) << "-->" << LayoutSet::toString(newLayoutList); prevLayoutList = \
newLayoutList;
//TODO: need more thinking here on how to support external map resetting
if( keyboardConfig.configureLayouts
&& keyboardConfig.isSpareLayoutsEnabled()
&& isExtraSubset(keyboardConfig.layouts, newLayoutList) ) {
- qDebug() << "Layout map change for extra layout";
+ qCDebug(LAYOUT_MEMORY) << "Layout map change for extra layout";
layoutChanged(); // to remember new map for active "window"
}
else {
// if( newLayoutList != keyboardConfig.getDefaultLayouts() ) {
// layoutList = newLayoutList;
- qDebug() << "Layout map change from external source: clearing layout memory";
+ qCDebug(LAYOUT_MEMORY) << "Layout map change from external source: clearing layout memory";
layoutMap.clear();
// }
}
@@ -162,10 +163,10 @@ void LayoutMemory::setCurrentLayoutFromMap()
return;
if( ! layoutMap.contains(layoutMapKey) ) {
-// qDebug() << "new key for layout map" << layoutMapKey;
+// qCDebug(LAYOUT_MEMORY) << "new key for layout map" << layoutMapKey;
if( ! X11Helper::isDefaultLayout() ) {
-// qDebug() << "setting default layout for container key" << layoutMapKey;
+// qCDebug(LAYOUT_MEMORY) << "setting default layout for container key" << layoutMapKey;
if( keyboardConfig.configureLayouts && keyboardConfig.isSpareLayoutsEnabled()
&& X11Helper::getLayoutsList() != keyboardConfig.getDefaultLayouts() ) {
XkbHelper::initializeKeyboardLayouts(keyboardConfig.getDefaultLayouts());
@@ -175,7 +176,7 @@ void LayoutMemory::setCurrentLayoutFromMap()
}
else {
LayoutSet layoutFromMap = layoutMap[layoutMapKey];
- qDebug() << "Setting layout map item" << layoutFromMap.currentLayout.toString()
+ qCDebug(LAYOUT_MEMORY) << "Setting layout map item" << layoutFromMap.currentLayout.toString()
<< "for container key" << layoutMapKey;
LayoutSet currentLayouts = X11Helper::getCurrentLayouts();
@@ -200,7 +201,7 @@ void LayoutMemory::windowChanged(WId /*wId*/)
{
// KPluginInfo::List plugins = Plasma::Containment::listContainments();
// foreach(KPluginInfo info, plugins) {
-// qDebug() << "applets" << info.name();
+// qCDebug(LAYOUT_MEMORY) << "applets" << info.name();
// }
setCurrentLayoutFromMap();
}
diff --git a/kcms/keyboard/layout_memory.h b/kcms/keyboard/layout_memory.h
index df8568c..1ca49bc 100644
--- a/kcms/keyboard/layout_memory.h
+++ b/kcms/keyboard/layout_memory.h
@@ -23,6 +23,9 @@
#include <QtCore/QString>
#include <QtCore/QMap>
#include <QtGui/QWidgetList> //For WId
+#include <QLoggingCategory>
+
+Q_DECLARE_LOGGING_CATEGORY(BINDINGS)
#include "x11_helper.h"
#include "keyboard_config.h"
diff --git a/kcms/keyboard/layout_memory_persister.cpp b/kcms/keyboard/layout_memory_persister.cpp
index 1dba024..d760f24 100644
--- a/kcms/keyboard/layout_memory_persister.cpp
+++ b/kcms/keyboard/layout_memory_persister.cpp
@@ -31,6 +31,7 @@
#include "keyboard_config.h"
#include "layout_memory.h"
+Q_LOGGING_CATEGORY(LAYOUT_MEMORY_PERSISTER, "layout_memory_persister")
static const char* VERSION = "1.0";
static const char* DOC_NAME = "LayoutMap";
@@ -89,7 +90,7 @@ QString LayoutMemoryPersister::getLayoutMapAsString()
static bool isRestoreSession()
{
KConfigGroup c(KSharedConfig::openConfig("ksmserverrc", KConfig::NoGlobals), "General");
- qDebug() << "loginMode:" << c.readEntry("loginMode");
+ qCDebug(LAYOUT_MEMORY_PERSISTER) << "loginMode:" << c.readEntry("loginMode");
QString loginMode = c.readEntry("loginMode");
return loginMode != "default" && loginMode != "restoreSavedSession"; // we don't know how to restore \
saved session - only previous one }
@@ -123,7 +124,7 @@ bool LayoutMemoryPersister::saveToFile(const QFile& file_)
QFile file(file_.fileName()); // so we don't expose the file we open/close to the caller
if( ! file.open( QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text) ) {
- qDebug() << "Failed to open layout memory xml file for writing" << file.fileName();
+ qCDebug(LAYOUT_MEMORY_PERSISTER) << "Failed to open layout memory xml file for writing" << \
file.fileName(); return false;
}
@@ -132,13 +133,13 @@ bool LayoutMemoryPersister::saveToFile(const QFile& file_)
out.flush();
if( file.error() != QFile::NoError ) {
- qDebug() << "Failed to store keyboard layout memory, error" << file.error();
+ qCDebug(LAYOUT_MEMORY_PERSISTER) << "Failed to store keyboard layout memory, error" << \
file.error(); file.close();
file.remove();
return false;
}
else {
- qDebug() << "Keyboard layout memory stored into" << file.fileName() << "written" << file.pos();
+ qCDebug(LAYOUT_MEMORY_PERSISTER) << "Keyboard layout memory stored into" << file.fileName() << \
"written" << file.pos(); return true;
}
}
@@ -215,7 +216,7 @@ bool LayoutMemoryPersister::restoreFromFile(const QFile& file_)
QFile file(file_.fileName()); // so we don't expose the file we open/close to the caller
if( ! file.open( QIODevice::ReadOnly | QIODevice::Text ) ) {
- qDebug() << "Failed to open layout memory xml file for reading" << file.fileName() << "error:" \
<< file.error(); + qCDebug(LAYOUT_MEMORY_PERSISTER) << "Failed to open layout memory xml file for \
reading" << file.fileName() << "error:" << file.error(); return false;
}
@@ -226,17 +227,17 @@ bool LayoutMemoryPersister::restoreFromFile(const QFile& file_)
reader.setErrorHandler(&mapHandler);
QXmlInputSource xmlInputSource(&file);
- qDebug() << "Restoring keyboard layout map from" << file.fileName();
+ qCDebug(LAYOUT_MEMORY_PERSISTER) << "Restoring keyboard layout map from" << file.fileName();
if( ! reader.parse(xmlInputSource) ) {
- qDebug() << "Failed to parse the layout memory file" << file.fileName();
+ qCDebug(LAYOUT_MEMORY_PERSISTER) << "Failed to parse the layout memory file" << file.fileName();
return false;
}
if( layoutMemory.keyboardConfig.switchingPolicy == KeyboardConfig::SWITCH_POLICY_GLOBAL ) {
if( mapHandler.globalLayout.isValid() && \
layoutMemory.keyboardConfig.layouts.contains(mapHandler.globalLayout)) { globalLayout = \
mapHandler.globalLayout;
- qDebug() << "Restored global layout" << globalLayout.toString();
+ qCDebug(LAYOUT_MEMORY_PERSISTER) << "Restored global layout" << globalLayout.toString();
}
}
else {
@@ -246,7 +247,7 @@ bool LayoutMemoryPersister::restoreFromFile(const QFile& file_)
layoutMemory.layoutMap.insert(key, mapHandler.layoutMap[key]);
}
}
- qDebug() << "Restored layouts for" << layoutMemory.layoutMap.size() << "containers";
+ qCDebug(LAYOUT_MEMORY_PERSISTER) << "Restored layouts for" << layoutMemory.layoutMap.size() << \
"containers"; }
return true;
}
@@ -255,7 +256,7 @@ bool LayoutMemoryPersister::canPersist() {
// we can't persist per window - as we're using window id which is not preserved between sessions
bool windowMode = layoutMemory.keyboardConfig.switchingPolicy == KeyboardConfig::SWITCH_POLICY_WINDOW;
if( windowMode ) {
- qDebug() << "Not saving session for window mode";
+ qCDebug(LAYOUT_MEMORY_PERSISTER) << "Not saving session for window mode";
}
return !windowMode;
}
diff --git a/kcms/keyboard/layout_memory_persister.h b/kcms/keyboard/layout_memory_persister.h
index 8c4b3c5..825bbd9 100644
--- a/kcms/keyboard/layout_memory_persister.h
+++ b/kcms/keyboard/layout_memory_persister.h
@@ -20,6 +20,9 @@
#define LAYOUT_MEMORY_PERSISTER_H_
#include <QtCore/QString>
+#include <QLoggingCategory>
+
+Q_DECLARE_LOGGING_CATEGORY(LAYOUT_MEMORY_PERSISTER)
#include "x11_helper.h"
diff --git a/kcms/keyboard/layout_widget.cpp b/kcms/keyboard/layout_widget.cpp
index e67b2d7..2f681dd 100644
--- a/kcms/keyboard/layout_widget.cpp
+++ b/kcms/keyboard/layout_widget.cpp
@@ -31,7 +31,6 @@
K_PLUGIN_FACTORY(LayoutWidgetFactory, registerPlugin<LayoutWidget>();)
-K_EXPORT_PLUGIN(LayoutWidgetFactory("keyboard_layout_widget"))
LayoutWidget::LayoutWidget(QWidget* parent, const QList<QVariant>& /*args*/):
diff --git a/kcms/keyboard/layouts_menu.cpp b/kcms/keyboard/layouts_menu.cpp
index 7d4c4d6..0707875 100644
--- a/kcms/keyboard/layouts_menu.cpp
+++ b/kcms/keyboard/layouts_menu.cpp
@@ -30,6 +30,7 @@
#include "xkb_helper.h"
#include "flags.h"
+Q_LOGGING_CATEGORY(LAYOUTS_MENU, "layouts_menu")
LayoutsMenu::LayoutsMenu(const KeyboardConfig& keyboardConfig_, const Rules& rules_, Flags& flags_):
keyboardConfig(keyboardConfig_),
@@ -80,7 +81,7 @@ int LayoutsMenu::switchToLayout(const LayoutUnit& layoutUnit, const KeyboardConf
res = X11Helper::setLayout(layoutUnit);
}
else {
- qDebug() << "switchToLayout with unknown layout" << layoutUnit.toString();
+ qCDebug(LAYOUTS_MENU) << "switchToLayout with unknown layout" << layoutUnit.toString();
res = -1;
}
return res;
diff --git a/kcms/keyboard/layouts_menu.h b/kcms/keyboard/layouts_menu.h
index db2f3ff..5b77051 100644
--- a/kcms/keyboard/layouts_menu.h
+++ b/kcms/keyboard/layouts_menu.h
@@ -21,6 +21,9 @@
#include <QtCore/QList>
#include <QtGui/QIcon>
+#include <QLoggingCategory>
+
+Q_DECLARE_LOGGING_CATEGORY(LAYOUTS_MENU)
class QAction;
class KeyboardConfig;
diff --git a/kcms/keyboard/x11_helper.cpp b/kcms/keyboard/x11_helper.cpp
index cbb2cfc..6cab72a 100644
--- a/kcms/keyboard/x11_helper.cpp
+++ b/kcms/keyboard/x11_helper.cpp
@@ -35,6 +35,7 @@
#include <xcb/xcb.h>
#include <fixx11h.h>
+Q_LOGGING_CATEGORY(X11_HELPER, "x11_helper")
// more information about the limit https://bugs.freedesktop.org/show_bug.cgi?id=19501
int X11Helper::MAX_GROUP_COUNT = 4;
@@ -105,7 +106,7 @@ bool X11Helper::setLayout(const LayoutUnit& layout)
QList<LayoutUnit> currentLayouts = getLayoutsList();
int idx = currentLayouts.indexOf(layout);
if( idx == -1 || idx >= X11Helper::MAX_GROUP_COUNT ) {
- qWarning() << "Layout" << layout.toString() << "is not found in current layout list"
+ qCWarning(X11_HELPER) << "Layout" << layout.toString() << "is not found in current layout list"
<< getLayoutsListAsString(currentLayouts);
return false;
}
@@ -128,7 +129,7 @@ LayoutUnit X11Helper::getCurrentLayout()
if( group < (unsigned int)currentLayouts.size() )
return currentLayouts[group];
- qWarning() << "Current group number" << group << "is outside of current layout list" <<
+ qWarning() << "Current group number" << group << "is outside of current layout list" <<
getLayoutsListAsString(currentLayouts);
return LayoutUnit();
}
@@ -145,7 +146,7 @@ LayoutSet X11Helper::getCurrentLayouts()
layoutSet.currentLayout = currentLayouts[group];
}
else {
- qWarning() << "Current group number" << group << "is outside of current layout list" << \
getLayoutsListAsString(currentLayouts); + qWarning() << "Current group number" << group << "is \
outside of current layout list" << getLayoutsListAsString(currentLayouts); layoutSet.currentLayout = \
LayoutUnit(); }
@@ -180,21 +181,21 @@ QList<LayoutUnit> X11Helper::getLayoutsList()
// if( layouts[i].layout == layouts[j].layout && layouts[i].getRawDisplayName().isEmpty() ) {
// layouts[i].setDisplayName( addNum(layouts[i].layout, 1) );
// layouts[j].setDisplayName( addNum(layouts[j].layout, ++n) );
-// qDebug() << "Adding" << 1 << "to" << layouts[i].toString();
-// qDebug() << "Adding" << n << "to" << layouts[j].toString();
+// qCDebug(X11_HELPER) << "Adding" << 1 << "to" << layouts[i].toString();
+// qCDebug(X11_HELPER) << "Adding" << n << "to" << layouts[j].toString();
// }
// }
// }
}
else {
- qWarning() << "Failed to get layout groups from X server";
+ qWarning() << "Failed to get layout groups from X server";
}
return layouts;
}
bool X11Helper::setGroup(unsigned int group)
{
- qDebug() << group;
+ qCDebug(X11_HELPER) << group;
xcb_void_cookie_t cookie;
cookie = xcb_xkb_latch_lock_state(QX11Info::connection(),
XCB_XKB_ID_USE_CORE_KBD,
@@ -206,7 +207,7 @@ bool X11Helper::setGroup(unsigned int group)
xcb_generic_error_t *error = nullptr;
error = xcb_request_check(QX11Info::connection(), cookie);
if (error) {
- qDebug() << "Couldn't change the group" << error->error_code;
+ qCDebug(X11_HELPER) << "Couldn't change the group" << error->error_code;
return false;
}
@@ -234,7 +235,7 @@ bool X11Helper::getGroupNames(Display* display, XkbConfig* xkbConfig, FetchType
/* no such atom! */
if (rules_atom == None) { /* property cannot exist */
- qWarning() << "Failed to fetch layouts from server:" << "could not find the atom" << \
_XKB_RF_NAMES_PROP_ATOM; + qWarning() << "Failed to fetch layouts from server:" << "could not find \
the atom" << _XKB_RF_NAMES_PROP_ATOM; return false;
}
@@ -247,7 +248,7 @@ bool X11Helper::getGroupNames(Display* display, XkbConfig* xkbConfig, FetchType
/* property not found! */
if (ret != Success) {
- qWarning() << "Failed to fetch layouts from server:" << "Could not get the property";
+ qWarning() << "Failed to fetch layouts from server:" << "Could not get the property";
return false;
}
@@ -255,11 +256,11 @@ bool X11Helper::getGroupNames(Display* display, XkbConfig* xkbConfig, FetchType
if ((extra_bytes > 0) || (real_prop_type != XA_STRING) || (fmt != 8)) {
if (prop_data)
XFree(prop_data);
- qWarning() << "Failed to fetch layouts from server:" << "Wrong property format";
+ qWarning() << "Failed to fetch layouts from server:" << "Wrong property format";
return false;
}
-// qDebug() << "prop_data:" << nitems << prop_data;
+// qCDebug(X11_HELPER) << "prop_data:" << nitems << prop_data;
QStringList names;
for(char* p=prop_data; p-prop_data < (long)nitems && p != NULL; p += strlen(p)+1) {
names.append( p );
@@ -279,21 +280,21 @@ bool X11Helper::getGroupNames(Display* display, XkbConfig* xkbConfig, FetchType
xkbConfig->layouts << (layouts[ii] != NULL ? layouts[ii] : "");
xkbConfig->variants << (ii < variants.count() && variants[ii] != NULL ? variants[ii] : "");
}
- qDebug() << "Fetched layout groups from X server:"
+ qCDebug(X11_HELPER) << "Fetched layout groups from X server:"
<< "\tlayouts:" << xkbConfig->layouts
<< "\tvariants:" << xkbConfig->variants;
}
if( fetchType == ALL || fetchType == MODEL_ONLY ) {
xkbConfig->keyboardModel = (names[1] != NULL ? names[1] : "");
- qDebug() << "Fetched keyboard model from X server:" << xkbConfig->keyboardModel;
+ qCDebug(X11_HELPER) << "Fetched keyboard model from X server:" << xkbConfig->keyboardModel;
}
if( fetchType == ALL ) {
if( names.count() >= 5 ) {
QString options = (names[4] != NULL ? names[4] : "");
xkbConfig->options = options.split(OPTIONS_SEPARATOR);
- qDebug() << "Fetched xkbOptions from X server:" << options;
+ qCDebug(X11_HELPER) << "Fetched xkbOptions from X server:" << options;
}
}
@@ -305,7 +306,7 @@ XEventNotifier::XEventNotifier():
xkbOpcode(-1)
{
if( QCoreApplication::instance() == NULL ) {
- qWarning() << "Layout Widget won't work properly without QCoreApplication instance";
+ qWarning() << "Layout Widget won't work properly without QCoreApplication instance";
}
}
@@ -321,7 +322,7 @@ XEventNotifier::XEventNotifier(QWidget* parent):
void XEventNotifier::start()
{
- qDebug() << "qCoreApp" << QCoreApplication::instance();
+ qCDebug(X11_HELPER) << "qCoreApp" << QCoreApplication::instance();
if( QCoreApplication::instance() != NULL && X11Helper::xkbSupported(&xkbOpcode) ) {
registerForXkbEvents(QX11Info::display());
@@ -416,7 +417,7 @@ int XEventNotifier::registerForXkbEvents(Display* display)
{
int eventMask = XkbNewKeyboardNotifyMask | XkbStateNotifyMask;
if( ! XkbSelectEvents(display, XkbUseCoreKbd, eventMask, eventMask) ) {
- qWarning() << "Couldn't select desired XKB events";
+ qWarning() << "Couldn't select desired XKB events";
return false;
}
return true;
diff --git a/kcms/keyboard/x11_helper.h b/kcms/keyboard/x11_helper.h
index 385ae28..68a59fc 100644
--- a/kcms/keyboard/x11_helper.h
+++ b/kcms/keyboard/x11_helper.h
@@ -26,10 +26,11 @@
#include <QWidget>
#include <QX11Info>
#include <QAbstractNativeEventFilter>
+#include <QLoggingCategory>
#include <xcb/xcb.h>
//#include <xcb/xkb.h>
-
+Q_DECLARE_LOGGING_CATEGORY(X11_HELPER)
//union _xkb_event;
//class xcb_generic_event_t;
diff --git a/kcms/keyboard/xinput_helper.cpp b/kcms/keyboard/xinput_helper.cpp
index 9bcf442..ea616d4 100644
--- a/kcms/keyboard/xinput_helper.cpp
+++ b/kcms/keyboard/xinput_helper.cpp
@@ -21,6 +21,7 @@
#include <QCoreApplication>
#include <QX11Info>
#include <QDebug>
+#include <QLoggingCategory>
#include <X11/X.h>
#include <X11/Xlib.h>
@@ -34,6 +35,8 @@
#include <fixx11h.h>
+Q_LOGGING_CATEGORY(XINPUT_HELPER, "xinput_helper")
+
static int DEVICE_NONE = 0;
static int DEVICE_KEYBOARD = 1;
static int DEVICE_POINTER = 2;
@@ -44,7 +47,7 @@ XInputEventNotifier::XInputEventNotifier(QWidget* parent):
xinputEventType(-1)
{
XListInputDevices(QX11Info::display(), &connectedDevices);
- qDebug()<<"initializing connectedDevices to: "<<connectedDevices;
+ qCDebug(XINPUT_HELPER)<<"initializing connectedDevices to: "<<connectedDevices;
}
void XInputEventNotifier::start()
@@ -102,16 +105,16 @@ int XInputEventNotifier::getNewDeviceEventType(xcb_generic_event_t* event)
int ndevices;
XDeviceInfo *devices = XListInputDevices(QX11Info::display(), &ndevices);
if((ndevices > connectedDevices)){
- qDebug() << "id:" << devices[ndevices - 1].id << "name:" << devices[ndevices - 1].name << "used \
as:" << devices[ndevices-1].use; + qCDebug(XINPUT_HELPER) << "id:" << devices[ndevices - 1].id << \
"name:" << devices[ndevices - 1].name << "used as:" << devices[ndevices-1].use;
if( devices[ndevices - 1].use == IsXKeyboard || devices[ndevices - 1].use == \
IsXExtensionKeyboard ) { if( isRealKeyboard(devices[ndevices - 1].name) ) {
newDeviceType = DEVICE_KEYBOARD;
- qDebug() << "new keyboard device, id:" << devices[ndevices - 1].id << "name:" << \
devices[ndevices - 1].name << "used as:" << devices[ndevices - 1].use; + \
qCDebug(XINPUT_HELPER) << "new keyboard device, id:" << devices[ndevices - 1].id << "name:" << \
devices[ndevices - 1].name << "used as:" << devices[ndevices - 1].use; }
}
if( devices[ndevices - 1].use == IsXPointer || devices[ndevices - 1].use == IsXExtensionPointer \
) { newDeviceType = DEVICE_POINTER;
- qDebug() << "new pointer device, id:" << devices[ndevices - 1].id << "name:" << \
devices[ndevices - 1].name << "used as:" << devices[ndevices - 1].use; + \
qCDebug(XINPUT_HELPER) << "new pointer device, id:" << devices[ndevices - 1].id << "name:" << \
devices[ndevices - 1].name << "used as:" << devices[ndevices - 1].use; }
connectedDevices = ndevices;
}
@@ -128,7 +131,7 @@ int XInputEventNotifier::registerForNewDeviceEvent(Display* display)
DevicePresence(display, xitype, xiclass);
XSelectExtensionEvent(display, DefaultRootWindow(display), &xiclass, 1);
- qDebug() << "Registered for new device events from XInput, class" << xitype;
+ qCDebug(XINPUT_HELPER) << "Registered for new device events from XInput, class" << xitype;
xinputEventType = xitype;
return xitype;
}
@@ -141,7 +144,7 @@ int XInputEventNotifier::registerForNewDeviceEvent(Display* display)
int XInputEventNotifier::registerForNewDeviceEvent(Display* /*display*/)
{
- qWarning() << "Keyboard kded daemon is compiled without XInput, xkb configuration will be reset when \
new keyboard device is plugged in!"; + qWarning() << "Keyboard kded daemon is compiled without XInput, \
xkb configuration will be reset when new keyboard device is plugged in!"; return -1;
}
diff --git a/kcms/keyboard/xkb_helper.cpp b/kcms/keyboard/xkb_helper.cpp
index 967399e..395f5ff 100644
--- a/kcms/keyboard/xkb_helper.cpp
+++ b/kcms/keyboard/xkb_helper.cpp
@@ -26,11 +26,13 @@
#include <QX11Info>
#include <QStandardPaths>
#include <QDebug>
+#include <QLoggingCategory>
#include <kprocess.h>
#include "keyboard_config.h"
+Q_LOGGING_CATEGORY(XKB_HELPER, "xkb_helper")
static const char* SETXKBMAP_EXEC = "setxkbmap";
static const char* XMODMAP_EXEC = "xmodmap";
@@ -71,7 +73,7 @@ void executeXmodmap(const QString& configFileName)
xmodmapExe = QStandardPaths::findExecutable(XMODMAP_EXEC);
if( xmodmapExe.isEmpty() ) {
xmodmapNotFound = true;
- qCritical() << "Can't find" << XMODMAP_EXEC << "- xmodmap files won't be run";
+ qCCritical(XKB_HELPER) << "Can't find" << XMODMAP_EXEC << "- xmodmap files won't be \
run"; return;
}
}
@@ -79,9 +81,9 @@ void executeXmodmap(const QString& configFileName)
KProcess xmodmapProcess;
xmodmapProcess << xmodmapExe;
xmodmapProcess << configFileName;
- qDebug() << "Executing" << xmodmapProcess.program().join(" ");
+ qCDebug(XKB_HELPER) << "Executing" << xmodmapProcess.program().join(" ");
if( xmodmapProcess.execute() != 0 ) {
- qCritical() << "Failed to execute " << xmodmapProcess.program();
+ qCCritical(XKB_HELPER) << "Failed to execute " << xmodmapProcess.program();
}
}
}
@@ -107,13 +109,13 @@ bool XkbHelper::runConfigLayoutCommand(const QStringList& setxkbmapCommandArgume
int res = setxkbmapProcess.execute();
if( res == 0 ) { // restore Xmodmap mapping reset by setxkbmap
- qDebug() << "Executed successfully in " << timer.elapsed() << "ms" << \
setxkbmapProcess.program().join(" "); + qCDebug(XKB_HELPER) << "Executed successfully in " << \
timer.elapsed() << "ms" << setxkbmapProcess.program().join(" "); restoreXmodmap();
- qDebug() << "\t and with xmodmap" << timer.elapsed() << "ms";
+ qCDebug(XKB_HELPER) << "\t and with xmodmap" << timer.elapsed() << "ms";
return true;
}
else {
- qCritical() << "Failed to run" << setxkbmapProcess.program().join(" ") << "return code:" << res;
+ qCCritical(XKB_HELPER) << "Failed to run" << setxkbmapProcess.program().join(" ") << "return \
code:" << res; }
return false;
}
diff --git a/kcms/keyboard/xkb_rules.cpp b/kcms/keyboard/xkb_rules.cpp
index f09e675..4eb7237 100644
--- a/kcms/keyboard/xkb_rules.cpp
+++ b/kcms/keyboard/xkb_rules.cpp
@@ -27,7 +27,7 @@
#include <QTextDocument> // for Qt::escape
#include <QXmlAttributes>
#include <QtConcurrentFilter>
-#include <QtDebug>
+#include <QDebug>
//#include <libintl.h>
//#include <locale.h>
@@ -43,6 +43,7 @@
#include <fixx11h.h>
#include <config-workspace.h>
+Q_LOGGING_CATEGORY(XKB_RULES, "xkb_rules")
class RulesHandler : public QXmlDefaultHandler
{
@@ -147,7 +148,7 @@ QString Rules::getRulesName()
char *tmp = NULL;
if (XkbRF_GetNamesProp(QX11Info::display(), &tmp, &vd) && tmp != NULL ) {
- // qDebug() << "namesprop" << tmp ;
+ // qCDebug(XKB_RULES) << "namesprop" << tmp ;
const QString name(tmp);
XFree(tmp);
return name;
@@ -208,7 +209,7 @@ void mergeRules(Rules* rules, Rules* extraRules)
}
}
rules->layoutInfos.append(layoutsToAdd);
- qDebug() << "Merged from extra rules:" << extraRules->layoutInfos.size() << "layouts," << \
extraRules->modelInfos.size() << "models," << extraRules->optionGroupInfos.size() << "option groups"; + \
qCDebug(XKB_RULES) << "Merged from extra rules:" << extraRules->layoutInfos.size() << "layouts," << \
extraRules->modelInfos.size() << "models," << extraRules->optionGroupInfos.size() << "option groups";
// base rules now own the objects - remove them from extra rules so that it does not try to delete them
extraRules->layoutInfos.clear();
@@ -244,7 +245,7 @@ Rules* Rules::readRules(Rules* rules, const QString& filename, bool fromExtras)
{
QFile file(filename);
if( !file.open(QFile::ReadOnly | QFile::Text) ) {
- qCritical() << "Cannot open the rules file" << file.fileName();
+ qCritical() << "Cannot open the rules file" << file.fileName();
return NULL;
}
@@ -256,10 +257,10 @@ Rules* Rules::readRules(Rules* rules, const QString& filename, bool fromExtras)
QXmlInputSource xmlInputSource(&file);
- qDebug() << "Parsing xkb rules from" << file.fileName();
+ qCDebug(XKB_RULES) << "Parsing xkb rules from" << file.fileName();
if( ! reader.parse(xmlInputSource) ) {
- qCritical() << "Failed to parse the rules file" << file.fileName();
+ qCritical() << "Failed to parse the rules file" << file.fileName();
delete rules;
return NULL;
}
@@ -293,7 +294,7 @@ bool RulesHandler::startElement(const QString &/*namespaceURI*/, const QString &
}
else if( strPath == ("xkbConfigRegistry") && ! attributes.value("version").isEmpty() ) {
rules->version = attributes.value("version");
- qDebug() << "xkbConfigRegistry version" << rules->version;
+ qCDebug(XKB_RULES) << "xkbConfigRegistry version" << rules->version;
}
return true;
}
@@ -311,57 +312,57 @@ bool RulesHandler::characters(const QString &str)
if( strPath.endsWith("layoutList/layout/configItem/name") ) {
if( rules->layoutInfos.last() != NULL ) {
rules->layoutInfos.last()->name = str.trimmed();
-// qDebug() << "name:" << str;
+// qCDebug(XKB_RULES) << "name:" << str;
}
// skipping invalid entry
}
else if( strPath.endsWith("layoutList/layout/configItem/description") ) {
rules->layoutInfos.last()->description = str.trimmed();
-// qDebug() << "descr:" << str;
+// qCDebug(XKB_RULES) << "descr:" << str;
}
else if( strPath.endsWith("layoutList/layout/configItem/languageList/iso639Id") ) {
rules->layoutInfos.last()->languages << str.trimmed();
-// qDebug() << "\tlang:" << str;
+// qCDebug(XKB_RULES) << "\tlang:" << str;
}
else if( strPath.endsWith("layoutList/layout/variantList/variant/configItem/name") ) {
rules->layoutInfos.last()->variantInfos.last()->name = str.trimmed();
-// qDebug() << "\tvariant name:" << str;
+// qCDebug(XKB_RULES) << "\tvariant name:" << str;
}
else if( strPath.endsWith("layoutList/layout/variantList/variant/configItem/description") ) {
rules->layoutInfos.last()->variantInfos.last()->description = str.trimmed();
-// qDebug() << "\tvariant descr:" << str;
+// qCDebug(XKB_RULES) << "\tvariant descr:" << str;
}
else if( strPath.endsWith("layoutList/layout/variantList/variant/configItem/languageList/iso639Id") ) \
{ rules->layoutInfos.last()->variantInfos.last()->languages << str.trimmed();
-// qDebug() << "\tvlang:" << str;
+// qCDebug(XKB_RULES) << "\tvlang:" << str;
}
else if( strPath.endsWith("modelList/model/configItem/name") ) {
rules->modelInfos.last()->name = str.trimmed();
-// qDebug() << "name:" << str;
+// qCDebug(XKB_RULES) << "name:" << str;
}
else if( strPath.endsWith("modelList/model/configItem/description") ) {
rules->modelInfos.last()->description = str.trimmed();
-// qDebug() << "\tdescr:" << str;
+// qCDebug(XKB_RULES) << "\tdescr:" << str;
}
else if( strPath.endsWith("modelList/model/configItem/vendor") ) {
rules->modelInfos.last()->vendor = str.trimmed();
-// qDebug() << "\tvendor:" << str;
+// qCDebug(XKB_RULES) << "\tvendor:" << str;
}
else if( strPath.endsWith("optionList/group/configItem/name") ) {
rules->optionGroupInfos.last()->name = str.trimmed();
-// qDebug() << "name:" << str;
+// qCDebug(XKB_RULES) << "name:" << str;
}
else if( strPath.endsWith("optionList/group/configItem/description") ) {
rules->optionGroupInfos.last()->description = str.trimmed();
-// qDebug() << "\tdescr:" << str;
+// qCDebug(XKB_RULES) << "\tdescr:" << str;
}
else if( strPath.endsWith("optionList/group/option/configItem/name") ) {
rules->optionGroupInfos.last()->optionInfos.last()->name = str.trimmed();
-// qDebug() << "name:" << str;
+// qCDebug(XKB_RULES) << "name:" << str;
}
else if( strPath.endsWith("optionList/group/option/configItem/description") ) {
rules->optionGroupInfos.last()->optionInfos.last()->description = str.trimmed();
-// qDebug() << "\tdescr:" << str;
+// qCDebug(XKB_RULES) << "\tdescr:" << str;
}
}
return true;
diff --git a/kcms/keyboard/xkb_rules.h b/kcms/keyboard/xkb_rules.h
index 2be8562..b38fd68 100644
--- a/kcms/keyboard/xkb_rules.h
+++ b/kcms/keyboard/xkb_rules.h
@@ -21,9 +21,11 @@
#define XKB_RULES_H_
#include <QtXml/QXmlDefaultHandler>
-#include <QtCore/QList>
-#include <QtCore/QStringList>
+#include <QList>
+#include <QStringList>
+#include <QLoggingCategory>
+Q_DECLARE_LOGGING_CATEGORY(XKB_RULES)
struct ConfigItem {
QString name;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic