[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kde-workspace/vpolevoy/keyboard-layout-cursor-indicator] kcontrol/keyboard: Moved cursor layout ind
From: Victor Polevoy <vityatheboss () gmail ! com>
Date: 2013-08-31 18:30:12
Message-ID: E1VFpw4-0007Hc-AP () scm ! kde ! org
[Download RAW message or body]
Git commit 2adc87102b05aea5dc000b4b206d3daccf22c1e5 by Victor Polevoy.
Committed on 31/08/2013 at 18:29.
Pushed by vpolevoy into branch 'vpolevoy/keyboard-layout-cursor-indicator'.
Moved cursor layout indicator files into /cursorlayoutindicator subdirectory.
Deleted empty .cpp files for template classes.
Minor fixes in kdelibs style.
M +5 -8 kcontrol/keyboard/CMakeLists.txt
M +0 -23 kcontrol/keyboard/cursorlayoutindicator.cpp
M +0 -100 kcontrol/keyboard/cursorlayoutindicator.h
C +1 -1 kcontrol/keyboard/cursorlayoutindicator/cursorlayoutindicator.h [from: \
kcontrol/keyboard/cursorlayoutindicator.h - 098% similarity] C +0 -0 \
kcontrol/keyboard/cursorlayoutindicator/cursorlayoutindicatorfactory.cpp [from: \
kcontrol/keyboard/cursorlayoutindicatorfactory.cpp - 100% similarity] C +1 -1 \
kcontrol/keyboard/cursorlayoutindicator/cursorlayoutindicatorfactory.h [from: \
kcontrol/keyboard/cursorlayoutindicatorfactory.h - 097% similarity] C +0 -0 \
kcontrol/keyboard/cursorlayoutindicator/icursorlayoutindicator.h [from: \
kcontrol/keyboard/icursorlayoutindicator.h - 100% similarity] C +0 -0 \
kcontrol/keyboard/cursorlayoutindicator/imagecombiner.h [from: \
kcontrol/keyboard/imagecombiner.h - 100% similarity] C +2 -2 \
kcontrol/keyboard/cursorlayoutindicator/x11cursorimagecombiner.cpp [from: \
kcontrol/keyboard/x11cursorimagecombiner.cpp - 096% similarity] C +0 -0 \
kcontrol/keyboard/cursorlayoutindicator/x11cursorimagecombiner.h [from: \
kcontrol/keyboard/x11cursorimagecombiner.h - 100% similarity] C +2 -2 \
kcontrol/keyboard/cursorlayoutindicator/x11cursorlayoutindicator.cpp [from: \
kcontrol/keyboard/x11cursorlayoutindicator.cpp - 099% similarity] C +1 -1 \
kcontrol/keyboard/cursorlayoutindicator/x11cursorlayoutindicator.h [from: \
kcontrol/keyboard/x11cursorlayoutindicator.h - 098% similarity] M +0 -32 \
kcontrol/keyboard/cursorlayoutindicatorfactory.cpp M +0 -39 \
kcontrol/keyboard/cursorlayoutindicatorfactory.h M +0 -23 \
kcontrol/keyboard/icursorlayoutindicator.cpp M +0 -50 \
kcontrol/keyboard/icursorlayoutindicator.h M +0 -21 \
kcontrol/keyboard/imagecombiner.cpp M +0 -90 kcontrol/keyboard/imagecombiner.h
M +3 -3 kcontrol/keyboard/keyboard_daemon.cpp
M +0 -71 kcontrol/keyboard/x11cursorimagecombiner.cpp
M +0 -38 kcontrol/keyboard/x11cursorimagecombiner.h
M +0 -142 kcontrol/keyboard/x11cursorlayoutindicator.cpp
M +0 -56 kcontrol/keyboard/x11cursorlayoutindicator.h
http://commits.kde.org/kde-workspace/2adc87102b05aea5dc000b4b206d3daccf22c1e5
diff --git a/kcontrol/keyboard/CMakeLists.txt b/kcontrol/keyboard/CMakeLists.txt
index e82e3fa..cd127dd 100644
--- a/kcontrol/keyboard/CMakeLists.txt
+++ b/kcontrol/keyboard/CMakeLists.txt
@@ -30,7 +30,7 @@ set( kded_keyboard_SRCS
layouts_menu.cpp
flags.cpp
xkb_rules.cpp
-# next are temporary for Victor Polevoy GSOC 2013 project
+# next are temporary for cursor layout indicator
../input/xcursor/cursortheme.cpp
../input/xcursor/itemdelegate.cpp
../input/xcursor/previewwidget.cpp
@@ -39,13 +39,10 @@ set( kded_keyboard_SRCS
../input/xcursor/themepage.cpp
../input/xcursor/xcursortheme.cpp
../krdb/krdb.cpp
-# next are Victor Polevoy GSOC 2013 files
- imagecombiner.cpp
- x11cursorimagecombiner.cpp
- icursorlayoutindicator.cpp
- cursorlayoutindicator.cpp
- x11cursorlayoutindicator.cpp
- cursorlayoutindicatorfactory.cpp
+# cursor layout indicator realization
+ cursorlayoutindicator/x11cursorimagecombiner.cpp
+ cursorlayoutindicator/x11cursorlayoutindicator.cpp
+ cursorlayoutindicator/cursorlayoutindicatorfactory.cpp
)
kde4_add_ui_files( kded_keyboard_SRCS ../input/xcursor/themepage.ui )
diff --git a/kcontrol/keyboard/cursorlayoutindicator.cpp \
b/kcontrol/keyboard/cursorlayoutindicator.cpp index f59cf5b..e69de29 100644
--- a/kcontrol/keyboard/cursorlayoutindicator.cpp
+++ b/kcontrol/keyboard/cursorlayoutindicator.cpp
@@ -1,23 +0,0 @@
-/*
- * Abstract class which provides API to change cursor layout indicator.
- * Copyright 2013 Victor Polevoy <vityatheboss@gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "cursorlayoutindicator.h"
diff --git a/kcontrol/keyboard/cursorlayoutindicator.h \
b/kcontrol/keyboard/cursorlayoutindicator.h index 1057ed6..e69de29 100644
--- a/kcontrol/keyboard/cursorlayoutindicator.h
+++ b/kcontrol/keyboard/cursorlayoutindicator.h
@@ -1,100 +0,0 @@
-/*
- * Abstract class which provides API to change cursor layout indicator.
- * Copyright 2013 Victor Polevoy <vityatheboss@gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef CURSORLAYOUTINDICATOR_H
-#define CURSORLAYOUTINDICATOR_H
-
-#include <icursorlayoutindicator.h>
-
-#include <KConfig>
-#include <KConfigGroup>
-
-#include <QtCore/QHash>
-#include <QtCore/QPair>
-#include <QtCore/QString>
-
-class CursorTheme;
-
-template <class ImageCombinerType, class CursorImageType> class \
CursorLayoutIndicator
-{
-private:
- QHash<CursorInfo::CursorType, QString>* cursorNames;
- QHash<QPair<CursorInfo::CursorType, QString>, CursorImageType>* \
cachedImages;
-
-protected:
- KConfig* kcmInputKdeConfig;
- KConfigGroup* mouseConfigGroup;
-
- ImageCombinerType* imageCombiner;
-
- QString getCursorName(CursorInfo::CursorType cursorType) const
- {
- return this->cursorNames->value(cursorType);
- }
-
- bool cachedImageExists(CursorInfo::CursorType cursorType, QString & layout) \
const
- {
- return this->cachedImages->contains(QPair<CursorInfo::CursorType, \
QString>(cursorType, layout));
- }
-
- CursorImageType getCachedImage(CursorInfo::CursorType cursorType, QString & \
layout) const
- {
- return this->cachedImages->value(QPair<CursorInfo::CursorType, \
QString>(cursorType, layout));
- }
-
- void addCachedImage(CursorInfo::CursorType cursorType, QString & layout, \
CursorImageType cursorImage) const
- {
- this->cachedImages->insert(QPair<CursorInfo::CursorType, \
QString>(cursorType, layout), cursorImage);
- }
-
- virtual const CursorTheme* getCurrentCursorTheme() const = 0;
- virtual CursorImageType getCursorImage(CursorInfo::CursorType) const = 0;
- virtual void setCursorImage(CursorInfo::CursorType, CursorImageType) const = 0;
-
-public:
- CursorLayoutIndicator()
- {
- this->kcmInputKdeConfig = new KConfig("kcminputrc");
- this->mouseConfigGroup = new KConfigGroup(this->kcmInputKdeConfig, \
"Mouse");
-
- this->imageCombiner = new ImageCombinerType();
-
- this->cachedImages = new QHash<QPair<CursorInfo::CursorType, QString>, \
CursorImageType>();
-
- this->cursorNames = new QHash<CursorInfo::CursorType, QString>();
-
- this->cursorNames->insert(CursorInfo::IBEAM, "ibeam");
- }
-
- virtual ~CursorLayoutIndicator()
- {
- delete this->kcmInputKdeConfig;
- delete this->mouseConfigGroup;
- delete this->imageCombiner;
- delete this->cursorNames;
- delete this->cachedImages;
- }
-};
-
-#endif // CURSORLAYOUTINDICATOR_H
-
-
diff --git a/kcontrol/keyboard/cursorlayoutindicator.h \
b/kcontrol/keyboard/cursorlayoutindicator/cursorlayoutindicator.h similarity index \
98% copy from kcontrol/keyboard/cursorlayoutindicator.h
copy to kcontrol/keyboard/cursorlayoutindicator/cursorlayoutindicator.h
index 1057ed6..f2ab312 100644
--- a/kcontrol/keyboard/cursorlayoutindicator.h
+++ b/kcontrol/keyboard/cursorlayoutindicator/cursorlayoutindicator.h
@@ -23,7 +23,7 @@
#ifndef CURSORLAYOUTINDICATOR_H
#define CURSORLAYOUTINDICATOR_H
-#include <icursorlayoutindicator.h>
+#include "icursorlayoutindicator.h"
#include <KConfig>
#include <KConfigGroup>
diff --git a/kcontrol/keyboard/cursorlayoutindicatorfactory.cpp \
b/kcontrol/keyboard/cursorlayoutindicator/cursorlayoutindicatorfactory.cpp similarity \
index 100% copy from kcontrol/keyboard/cursorlayoutindicatorfactory.cpp
copy to kcontrol/keyboard/cursorlayoutindicator/cursorlayoutindicatorfactory.cpp
diff --git a/kcontrol/keyboard/cursorlayoutindicatorfactory.h \
b/kcontrol/keyboard/cursorlayoutindicator/cursorlayoutindicatorfactory.h similarity \
index 97% copy from kcontrol/keyboard/cursorlayoutindicatorfactory.h
copy to kcontrol/keyboard/cursorlayoutindicator/cursorlayoutindicatorfactory.h
index 16f1330..501529b 100644
--- a/kcontrol/keyboard/cursorlayoutindicatorfactory.h
+++ b/kcontrol/keyboard/cursorlayoutindicator/cursorlayoutindicatorfactory.h
@@ -23,7 +23,7 @@
#ifndef CURSORLAYOUTINDICATORFACTORY_H
#define CURSORLAYOUTINDICATORFACTORY_H
-#include <x11cursorlayoutindicator.h>
+#include "x11cursorlayoutindicator.h"
#include <QtCore/QString>
diff --git a/kcontrol/keyboard/icursorlayoutindicator.h \
b/kcontrol/keyboard/cursorlayoutindicator/icursorlayoutindicator.h similarity index \
100% copy from kcontrol/keyboard/icursorlayoutindicator.h
copy to kcontrol/keyboard/cursorlayoutindicator/icursorlayoutindicator.h
diff --git a/kcontrol/keyboard/imagecombiner.h \
b/kcontrol/keyboard/cursorlayoutindicator/imagecombiner.h similarity index 100%
copy from kcontrol/keyboard/imagecombiner.h
copy to kcontrol/keyboard/cursorlayoutindicator/imagecombiner.h
diff --git a/kcontrol/keyboard/x11cursorimagecombiner.cpp \
b/kcontrol/keyboard/cursorlayoutindicator/x11cursorimagecombiner.cpp similarity index \
96% copy from kcontrol/keyboard/x11cursorimagecombiner.cpp
copy to kcontrol/keyboard/cursorlayoutindicator/x11cursorimagecombiner.cpp
index b843410..f904727 100644
--- a/kcontrol/keyboard/x11cursorimagecombiner.cpp
+++ b/kcontrol/keyboard/cursorlayoutindicator/x11cursorimagecombiner.cpp
@@ -32,7 +32,7 @@ bool X11CursorImageCombiner::imagesBeenSet()
QImage *imageBelow = this->getImageBelow();
QImage *imageAbove = this->getImageAbove();
- if(imageAbove == NULL || imageBelow == NULL
+ if (imageAbove == NULL || imageBelow == NULL
|| imageAbove->isNull() || imageBelow->isNull()) {
return false;
}
@@ -43,7 +43,7 @@ bool X11CursorImageCombiner::imagesBeenSet()
/* Image below is cursor image, image above is country flag */
void X11CursorImageCombiner::combineImages()
{
- if(this->imagesBeenSet()) {
+ if (this->imagesBeenSet()) {
kDebug() << "Images been set, combining";
QImage *imageBelow = this->getImageBelow();
diff --git a/kcontrol/keyboard/x11cursorimagecombiner.h \
b/kcontrol/keyboard/cursorlayoutindicator/x11cursorimagecombiner.h similarity index \
100% copy from kcontrol/keyboard/x11cursorimagecombiner.h
copy to kcontrol/keyboard/cursorlayoutindicator/x11cursorimagecombiner.h
diff --git a/kcontrol/keyboard/x11cursorlayoutindicator.cpp \
b/kcontrol/keyboard/cursorlayoutindicator/x11cursorlayoutindicator.cpp similarity \
index 99% copy from kcontrol/keyboard/x11cursorlayoutindicator.cpp
copy to kcontrol/keyboard/cursorlayoutindicator/x11cursorlayoutindicator.cpp
index b34bb87..6943800 100644
--- a/kcontrol/keyboard/x11cursorlayoutindicator.cpp
+++ b/kcontrol/keyboard/cursorlayoutindicator/x11cursorlayoutindicator.cpp
@@ -23,8 +23,8 @@
#include <kdebug.h>
#include "x11cursorlayoutindicator.h"
-
#include "x11cursorimagecombiner.h"
+
#include "x11_helper.h"
#include <QtGui/QPixmap>
@@ -120,7 +120,7 @@ void \
X11CursorLayoutIndicator::setCursorImage(CursorInfo::CursorType cursorType,
void X11CursorLayoutIndicator::setLayoutIndicator(CursorInfo::CursorType cursorType, \
LayoutUnit& layoutUnit, KeyboardConfig& keyboardConfig) const {
- if(!layoutUnit.layout.isEmpty()) {
+ if (!layoutUnit.layout.isEmpty()) {
if (!this->cachedImageExists(cursorType, layoutUnit.layout)) {
QImage mouseCursorImage = this->getCursorImage(cursorType);
QImage flagImage = this->getFlagImage(layoutUnit, \
keyboardConfig);
diff --git a/kcontrol/keyboard/x11cursorlayoutindicator.h \
b/kcontrol/keyboard/cursorlayoutindicator/x11cursorlayoutindicator.h similarity index \
98% copy from kcontrol/keyboard/x11cursorlayoutindicator.h
copy to kcontrol/keyboard/cursorlayoutindicator/x11cursorlayoutindicator.h
index 574ec03..2592b14 100644
--- a/kcontrol/keyboard/x11cursorlayoutindicator.h
+++ b/kcontrol/keyboard/cursorlayoutindicator/x11cursorlayoutindicator.h
@@ -23,7 +23,7 @@
#ifndef X11CURSORLAYOUTINDICATOR_H
#define X11CURSORLAYOUTINDICATOR_H
-#include <cursorlayoutindicator.h>
+#include "cursorlayoutindicator.h"
class X11CursorImageCombiner;
class QImage;
diff --git a/kcontrol/keyboard/cursorlayoutindicatorfactory.cpp \
b/kcontrol/keyboard/cursorlayoutindicatorfactory.cpp index 837be87..e69de29 100644
--- a/kcontrol/keyboard/cursorlayoutindicatorfactory.cpp
+++ b/kcontrol/keyboard/cursorlayoutindicatorfactory.cpp
@@ -1,32 +0,0 @@
-/*
- * Facatory class which provides API to create cursor layout indicator objects.
- * Copyright 2013 Victor Polevoy <vityatheboss@gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "cursorlayoutindicatorfactory.h"
-
-ICursorLayoutIndicator* CursorLayoutIndicatorFactory::CreateCursorLayoutIndicator()
-{
- //#ifdef HAVE_XFIXES // Need to find proper definition, not HAVE_XFIXES, it \
should be like X11_FOUND
- return new X11CursorLayoutIndicator();
- //#else #ifdef WAYLAND_FOUND
- // Create cursor layout indicator here
- //#endif
-}
diff --git a/kcontrol/keyboard/cursorlayoutindicatorfactory.h \
b/kcontrol/keyboard/cursorlayoutindicatorfactory.h index 16f1330..e69de29 100644
--- a/kcontrol/keyboard/cursorlayoutindicatorfactory.h
+++ b/kcontrol/keyboard/cursorlayoutindicatorfactory.h
@@ -1,39 +0,0 @@
-/*
- * Facatory class which provides API to create cursor layout indicator objects.
- * Copyright 2013 Victor Polevoy <vityatheboss@gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef CURSORLAYOUTINDICATORFACTORY_H
-#define CURSORLAYOUTINDICATORFACTORY_H
-
-#include <x11cursorlayoutindicator.h>
-
-#include <QtCore/QString>
-
-class CursorLayoutIndicatorFactory
-{
-private:
- CursorLayoutIndicatorFactory();
-
-public:
- static ICursorLayoutIndicator* CreateCursorLayoutIndicator();
-};
-
-#endif // CURSORLAYOUTINDICATORFACTORY_H
diff --git a/kcontrol/keyboard/icursorlayoutindicator.cpp \
b/kcontrol/keyboard/icursorlayoutindicator.cpp index a5a018a..e69de29 100644
--- a/kcontrol/keyboard/icursorlayoutindicator.cpp
+++ b/kcontrol/keyboard/icursorlayoutindicator.cpp
@@ -1,23 +0,0 @@
-/*
- * <one line to give the library's name and an idea of what it does.>
- * Copyright 2013 Victor Polevoy <thewaveeffect@rocketmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "icursorlayoutindicator.h"
\ No newline at end of file
diff --git a/kcontrol/keyboard/icursorlayoutindicator.h \
b/kcontrol/keyboard/icursorlayoutindicator.h index 896cb36..e69de29 100644
--- a/kcontrol/keyboard/icursorlayoutindicator.h
+++ b/kcontrol/keyboard/icursorlayoutindicator.h
@@ -1,50 +0,0 @@
-/*
- * Interface that provides API to change cursor layout indicator.
- * Copyright 2013 Victor Polevoy <vityatheboss@gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ICURSORLAYOUTINDICATOR_H
-#define ICURSORLAYOUTINDICATOR_H
-
-class LayoutUnit;
-class KeyboardConfig;
-
-namespace CursorInfo
-{
- enum CursorType
- {
- IBEAM
-
- };
-}
-
-
-class ICursorLayoutIndicator
-{
-public:
-
- virtual void setLayoutIndicator(CursorInfo::CursorType, LayoutUnit &, \
KeyboardConfig &) const = 0;
-
- virtual ~ICursorLayoutIndicator()
- {
- }
-};
-
-#endif // ICURSORLAYOUTINDICATOR_H
diff --git a/kcontrol/keyboard/imagecombiner.cpp \
b/kcontrol/keyboard/imagecombiner.cpp index 7abdebc..e69de29 100644
--- a/kcontrol/keyboard/imagecombiner.cpp
+++ b/kcontrol/keyboard/imagecombiner.cpp
@@ -1,21 +0,0 @@
-/*
- * ImageCombiner takes 2 images and combine them by setting first image above/near \
the second.
- * Copyright (C) 2013 Victor Polevoy <vityatheboss@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-
-#include "imagecombiner.h"
\ No newline at end of file
diff --git a/kcontrol/keyboard/imagecombiner.h b/kcontrol/keyboard/imagecombiner.h
index 338d4e7..e69de29 100644
--- a/kcontrol/keyboard/imagecombiner.h
+++ b/kcontrol/keyboard/imagecombiner.h
@@ -1,90 +0,0 @@
-/*
- * ImageCombiner takes 2 images and combine them by setting first image above/near \
the second.
- * Copyright (C) 2013 Victor Polevoy <vityatheboss@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-
-#ifndef IMAGECOMBINER_H
-#define IMAGECOMBINER_H
-
-#include <cstddef>
-
-template <class BelowImageType, class AboveImageType, class CombinedImageType> class \
ImageCombiner
-{
-private:
- BelowImageType* imageBelow;
- AboveImageType* imageAbove;
-
- CombinedImageType* combinedImage;
-
-protected:
- virtual void combineImages() = 0;
-
- void setResultImage(CombinedImageType *combinedImage)
- {
- this->combinedImage = new CombinedImageType();
-
- *this->combinedImage = *combinedImage;
- }
-
-public:
- ImageCombiner()
- {
- this->imageBelow = new BelowImageType();
- this->imageAbove = new AboveImageType();
- }
-
- virtual ~ImageCombiner()
- {
- delete this->imageBelow;
- delete this->imageAbove;
-
- delete this->combinedImage;
- }
-
- virtual bool imagesBeenSet() = 0;
-
- virtual CombinedImageType getCombinedImage()
- {
- this->combineImages();
-
- if (this->combinedImage != NULL) {
- return *(this->combinedImage);
- }
-
- return CombinedImageType();
- }
-
- BelowImageType* getImageBelow()
- {
- return this->imageBelow;
- }
-
- AboveImageType* getImageAbove()
- {
- return this->imageAbove;
- }
-
- void setSourceImages(BelowImageType imageBelow, AboveImageType imageAbove)
- {
- this->imageBelow = &imageBelow;
- this->imageAbove = &imageAbove;
- }
-};
-
-#endif // IMAGECOMBINER_H
-
diff --git a/kcontrol/keyboard/keyboard_daemon.cpp \
b/kcontrol/keyboard/keyboard_daemon.cpp index ba4173a..36dbe8c 100644
--- a/kcontrol/keyboard/keyboard_daemon.cpp
+++ b/kcontrol/keyboard/keyboard_daemon.cpp
@@ -42,7 +42,7 @@
#include "layouts_menu.h"
-#include <cursorlayoutindicatorfactory.h>
+#include "cursorlayoutindicator/cursorlayoutindicatorfactory.h"
K_PLUGIN_FACTORY(KeyboardFactory, registerPlugin<KeyboardDaemon>();)
K_EXPORT_PLUGIN(KeyboardFactory("keyboard", "kxkb"))
@@ -134,14 +134,14 @@ void KeyboardDaemon::setupTrayIcon()
void KeyboardDaemon::setupCursorLayoutIndicator()
{
- if(keyboardConfig.showCursorLayoutIndicator == true) {
+ if (keyboardConfig.showCursorLayoutIndicator == true) {
cursorLayoutIndicator = \
CursorLayoutIndicatorFactory::CreateCursorLayoutIndicator(); }
}
void KeyboardDaemon::updateCursorLayoutIndicator()
{
- if(keyboardConfig.showCursorLayoutIndicator == true && cursorLayoutIndicator != \
NULL) { + if (keyboardConfig.showCursorLayoutIndicator == true && \
cursorLayoutIndicator != NULL) {
cursorLayoutIndicator->setLayoutIndicator(CursorInfo::IBEAM, currentLayout, \
keyboardConfig); }
}
diff --git a/kcontrol/keyboard/x11cursorimagecombiner.cpp \
b/kcontrol/keyboard/x11cursorimagecombiner.cpp index b843410..e69de29 100644
--- a/kcontrol/keyboard/x11cursorimagecombiner.cpp
+++ b/kcontrol/keyboard/x11cursorimagecombiner.cpp
@@ -1,71 +0,0 @@
-/*
- * X11CursorImageCombiner combines flag and cursor icons.
- * Copyright (C) 2013 Victor Polevoy <vityatheboss@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-
-#include "x11cursorimagecombiner.h"
-
-#include <QtGui/QImage>
-#include <QtGui/QPainter>
-#include <QtGui/QCursor>
-
-#include <kdebug.h>
-
-
-bool X11CursorImageCombiner::imagesBeenSet()
-{
- QImage *imageBelow = this->getImageBelow();
- QImage *imageAbove = this->getImageAbove();
-
- if(imageAbove == NULL || imageBelow == NULL
- || imageAbove->isNull() || imageBelow->isNull()) {
- return false;
- }
-
- return true;
-}
-
-/* Image below is cursor image, image above is country flag */
-void X11CursorImageCombiner::combineImages()
-{
- if(this->imagesBeenSet()) {
- kDebug() << "Images been set, combining";
-
- QImage *imageBelow = this->getImageBelow();
- QImage *imageAbove = this->getImageAbove();
-
- /* Cursor ibeam-image needs to be in the middle of the result icon to avoid \
visual issues */
- /* 4 is the margins before and after (2 || image || 2) */
- int resultImageWidth = 2 * imageAbove->width() + 4 + imageBelow->width();
- int resultImageHeight = imageBelow->height();
-
- QImage cursorImage(resultImageWidth, resultImageHeight, \
QImage::Format_ARGB32);
-
- cursorImage.fill(Qt::transparent);
-
- QPainter painter;
- painter.begin(&cursorImage);
- painter.drawImage(imageAbove->width() + 2, 0, *imageBelow);
- painter.drawImage(resultImageWidth - imageAbove->width(), 0, *imageAbove);
- painter.end();
-
- this->setResultImage(&cursorImage);
- } else {
- kError() << "Error: one or two images have not been set, can't combine.";
- }
-}
\ No newline at end of file
diff --git a/kcontrol/keyboard/x11cursorimagecombiner.h \
b/kcontrol/keyboard/x11cursorimagecombiner.h index 445ee6e..e69de29 100644
--- a/kcontrol/keyboard/x11cursorimagecombiner.h
+++ b/kcontrol/keyboard/x11cursorimagecombiner.h
@@ -1,38 +0,0 @@
-/*
- * X11CursorImageCombiner combines flag and cursor icons.
- * Copyright (C) 2013 Victor Polevoy <vityatheboss@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-
-#ifndef X11CURSORIMAGECOMBINER_H
-#define X11CURSORIMAGECOMBINER_H
-
-
-#include "imagecombiner.h"
-
-class QImage;
-
-class X11CursorImageCombiner : public ImageCombiner<QImage, QImage, QImage>
-{
-protected:
- void combineImages();
-
-public:
- bool imagesBeenSet();
-};
-
-#endif // X11CURSORIMAGECOMBINER_H
diff --git a/kcontrol/keyboard/x11cursorlayoutindicator.cpp \
b/kcontrol/keyboard/x11cursorlayoutindicator.cpp index b34bb87..e69de29 100644
--- a/kcontrol/keyboard/x11cursorlayoutindicator.cpp
+++ b/kcontrol/keyboard/x11cursorlayoutindicator.cpp
@@ -1,142 +0,0 @@
-/*
- * X Window System cursor layout indicator realization.
- * Copyright 2013 Victor Polevoy <vityatheboss@gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include <kdebug.h>
-
-#include "x11cursorlayoutindicator.h"
-
-#include "x11cursorimagecombiner.h"
-#include "x11_helper.h"
-
-#include <QtGui/QPixmap>
-#include <QtGui/QCursor>
-#include <QtGui/QImage>
-#include <QtGui/QIcon>
-#include <QtCore/QDir>
-#include <QtGui/QX11Info>
-#include <QtCore/QFile>
-
-#include <config-X11.h>
-#include <X11/Xlib.h>
-#include <X11/Xcursor/Xcursor.h>
-
-#ifdef HAVE_XFIXES
-# include <X11/extensions/Xfixes.h>
-#endif
-
-#include <keyboard_config.h>
-#include <KGlobalSettings>
-#include "flags.h"
-#include <xcursortheme.h>
-#include <thememodel.h>
-
-#include "../../krdb/krdb.h"
-
-// 24 is maximum for all flag icons; found experimentally
-const int X11CursorLayoutIndicator::flagImageSize = 24;
-
-
-X11CursorLayoutIndicator::X11CursorLayoutIndicator()
-{
- this->cursorThemeModel = new CursorThemeModel();
-}
-
-X11CursorLayoutIndicator::~X11CursorLayoutIndicator()
-{
- delete this->cursorThemeModel;
-}
-
-QImage X11CursorLayoutIndicator::getFlagImage(LayoutUnit& currentLayout, \
KeyboardConfig& keyboardConfig) const
-{
- Flags flags;
- QImage flagImage = flags.getIconWithText(currentLayout, \
keyboardConfig).pixmap(flagImageSize).toImage();
-
- if (flagImage.isNull()) {
- kError() << "Error: flag image is null";
- }
-
- return flagImage;
-}
-
-const CursorTheme* X11CursorLayoutIndicator::getCurrentCursorTheme() const
-{
- QString currentTheme = XcursorGetTheme(QX11Info().display());
-
- currentTheme = this->mouseConfigGroup->readEntry("cursorTheme", currentTheme);
-
- return this->cursorThemeModel->theme(this->cursorThemeModel->findIndex(currentTheme));
-}
-
-QImage X11CursorLayoutIndicator::getCursorImage(CursorInfo::CursorType cursorType) \
const
-{
- QString cursorName = this->getCursorName(cursorType);
- QImage cursorDefaultImage = \
this->getCurrentCursorTheme()->loadImage(cursorName, 0);
-
- if (cursorDefaultImage.isNull()) {
- kError() << "Error: cursor image is null";
- }
-
- return cursorDefaultImage;
-}
-
-void X11CursorLayoutIndicator::setCursorImage(CursorInfo::CursorType cursorType, \
QImage cursorImage) const
-{
- //TODO Make new cursor appear in new windows and change it in \
firefox/chromium/other-non-kde applications.
-
- kDebug() << "Changing cursor icon";
-
- KGlobalSettings::self()->emitChange(KGlobalSettings::CursorChanged);
- runRdb(0);
-
- QString cursorName = this->getCursorName(cursorType);
-
- QCursor cursor(QPixmap::fromImage(cursorImage));
-
- // Tagging cursor with "cursorName"
- XFixesSetCursorName(QX11Info::display(), cursor.handle(), \
QFile::encodeName(cursorName));
-
- // Changing "cursorName"-cursors on the current display in all running \
applications
- XFixesChangeCursorByName(QX11Info::display(), cursor.handle(), \
QFile::encodeName(cursorName));
-}
-
-void X11CursorLayoutIndicator::setLayoutIndicator(CursorInfo::CursorType cursorType, \
LayoutUnit& layoutUnit, KeyboardConfig& keyboardConfig) const
-{
- if(!layoutUnit.layout.isEmpty()) {
- if (!this->cachedImageExists(cursorType, layoutUnit.layout)) {
- QImage mouseCursorImage = this->getCursorImage(cursorType);
- QImage flagImage = this->getFlagImage(layoutUnit, \
keyboardConfig);
-
- if (!mouseCursorImage.isNull() && !flagImage.isNull()) {
- this->imageCombiner->setSourceImages(mouseCursorImage, flagImage);
-
- QImage combinedImage = this->imageCombiner->getCombinedImage();
-
- this->setCursorImage(cursorType, combinedImage);
-
- this->addCachedImage(cursorType, layoutUnit.layout, combinedImage);
- }
- } else {
- this->setCursorImage(cursorType, this->getCachedImage(cursorType, \
layoutUnit.layout));
- }
- }
-}
-
diff --git a/kcontrol/keyboard/x11cursorlayoutindicator.h \
b/kcontrol/keyboard/x11cursorlayoutindicator.h index 574ec03..e69de29 100644
--- a/kcontrol/keyboard/x11cursorlayoutindicator.h
+++ b/kcontrol/keyboard/x11cursorlayoutindicator.h
@@ -1,56 +0,0 @@
-/*
- * X Window System cursor layout indicator realization.
- * Copyright 2013 Victor Polevoy <vityatheboss@gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef X11CURSORLAYOUTINDICATOR_H
-#define X11CURSORLAYOUTINDICATOR_H
-
-#include <cursorlayoutindicator.h>
-
-class X11CursorImageCombiner;
-class QImage;
-class LayoutUnit;
-class KeyboardConfig;
-class CursorThemeModel;
-class CursorTheme;
-
-class X11CursorLayoutIndicator : public \
CursorLayoutIndicator<X11CursorImageCombiner, QImage>, public \
ICursorLayoutIndicator
-{
-private:
- CursorThemeModel *cursorThemeModel;
-
- static const int flagImageSize;
-
- QImage getFlagImage(LayoutUnit &, KeyboardConfig &) const;
-
-protected:
- const CursorTheme* getCurrentCursorTheme() const;
- QImage getCursorImage(CursorInfo::CursorType) const;
- void setCursorImage(CursorInfo::CursorType, QImage) const;
-
-public:
- void setLayoutIndicator(CursorInfo::CursorType, LayoutUnit &, KeyboardConfig &) \
const;
-
- X11CursorLayoutIndicator();
- ~X11CursorLayoutIndicator();
-};
-
-#endif // X11CURSORLAYOUTINDICATOR_H
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic