[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kde-workspace/amourphiouskb] kcontrol/keyboard: Code cleanup
From: Andriy Rysin <arysin () gmail ! com>
Date: 2012-10-03 17:09:22
Message-ID: 20121003170922.80F11A605D () git ! kde ! org
[Download RAW message or body]
Git commit 32c77777e65991214d45c550ae43cb376837ff41 by Andriy Rysin.
Committed on 01/10/2012 at 23:53.
Pushed by rysin into branch 'amourphiouskb'.
Code cleanup
M +5 -3 kcontrol/keyboard/kbpreviewframe.cpp
M +1 -1 kcontrol/keyboard/kcm_add_layout_dialog.cpp
M +1 -1 kcontrol/keyboard/kcm_add_layout_dialog.ui
M +1 -1 kcontrol/keyboard/kcm_keyboard.ui
M +1 -1 kcontrol/keyboard/kcm_keyboard_widget.cpp
M +6 -5 kcontrol/keyboard/keyaliases.cpp
M +5 -3 kcontrol/keyboard/keyaliases.h
M +12 -8 kcontrol/keyboard/keyboardlayout.cpp
M +13 -5 kcontrol/keyboard/keyboardlayout.h
M +10 -4 kcontrol/keyboard/keyboardpainter.cpp
M +10 -8 kcontrol/keyboard/keyboardpainter.h
M +1 -1 kcontrol/keyboard/x11_helper.cpp
http://commits.kde.org/kde-workspace/32c77777e65991214d45c550ae43cb376837ff41
diff --git a/kcontrol/keyboard/kbpreviewframe.cpp b/kcontrol/keyboard/kbpreviewframe.cpp
index d26b4b5..f908704 100644
--- a/kcontrol/keyboard/kbpreviewframe.cpp
+++ b/kcontrol/keyboard/kbpreviewframe.cpp
@@ -18,8 +18,10 @@
#include "kbpreviewframe.h"
-#include<QPainter>
-#include<QFont>
+
+#include <QtGui/QPainter>
+#include <QtGui/QFont>
+
#include <KApplication>
#include <KLocale>
@@ -308,7 +310,7 @@ void KbPreviewFrame::paintEvent(QPaintEvent *){
if(symbol.nill>=120){
painter.drawRect(strtx,strty,endx,endy);
const int midx=470,midy=240;
- painter.drawText(midx,midy,i18n("NO PREVIEW FOUND"));
+ painter.drawText(midx,midy,i18n("No preview found"));
}
}
diff --git a/kcontrol/keyboard/kcm_add_layout_dialog.cpp b/kcontrol/keyboard/kcm_add_layout_dialog.cpp
index fad516a..f4c1cd7 100644
--- a/kcontrol/keyboard/kcm_add_layout_dialog.cpp
+++ b/kcontrol/keyboard/kcm_add_layout_dialog.cpp
@@ -160,7 +160,7 @@ void AddLayoutDialog::preview(){
//variant=getvariant(variant);
/*a.append(selectedLayout);*/
layoutprev=new KeyboardPainter();
- layoutprev->kbframe->getKeyboardLayout(selectedLayout,variant);
+ layoutprev->getKeyboardLayout(selectedLayout,variant);
layoutprev->exec();
layoutprev->setModal(true);
}
diff --git a/kcontrol/keyboard/kcm_add_layout_dialog.ui b/kcontrol/keyboard/kcm_add_layout_dialog.ui
index 1bb3ed8..78304fb 100644
--- a/kcontrol/keyboard/kcm_add_layout_dialog.ui
+++ b/kcontrol/keyboard/kcm_add_layout_dialog.ui
@@ -98,7 +98,7 @@
<item row="7" column="0">
<widget class="QPushButton" name="prevbutton">
<property name="text">
- <string>PREVIEW</string>
+ <string>Preview</string>
</property>
</widget>
</item>
diff --git a/kcontrol/keyboard/kcm_keyboard.ui b/kcontrol/keyboard/kcm_keyboard.ui
index b3a810f..f64eeea 100644
--- a/kcontrol/keyboard/kcm_keyboard.ui
+++ b/kcontrol/keyboard/kcm_keyboard.ui
@@ -334,7 +334,7 @@
<bool>false</bool>
</property>
<property name="text">
- <string>PREVIEW</string>
+ <string>Preview</string>
</property>
</widget>
</item>
diff --git a/kcontrol/keyboard/kcm_keyboard_widget.cpp b/kcontrol/keyboard/kcm_keyboard_widget.cpp
index d398482..a5aeddc 100644
--- a/kcontrol/keyboard/kcm_keyboard_widget.cpp
+++ b/kcontrol/keyboard/kcm_keyboard_widget.cpp
@@ -377,7 +377,7 @@ void KCMKeyboardWidget::previewLayout(){
break;
}
}
- layoutprev->kbframe->getKeyboardLayout(country,variant);
+ layoutprev->getKeyboardLayout(country,variant);
layoutprev->exec();
layoutprev->setModal(true);
diff --git a/kcontrol/keyboard/keyaliases.cpp b/kcontrol/keyboard/keyaliases.cpp
index 94d6df2..a924352 100644
--- a/kcontrol/keyboard/keyaliases.cpp
+++ b/kcontrol/keyboard/keyaliases.cpp
@@ -17,19 +17,20 @@
*/
#include "keyaliases.h"
-#include<QString>
-#include<QMap>
-#include<QMessageBox>
-#include<QFile>
+#include <QtCore/QString>
+#include <QtCore/QMap>
+#include <QtGui/QMessageBox>
+#include <QtCore/QFile>
+#include <QtCore/QDir>
#include <QtGui/QX11Info>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/XKBlib.h>
#include <X11/extensions/XKBrules.h>
+
#include <fixx11h.h>
#include <config-workspace.h>
-#include<QDir>
Aliases::Aliases()
{
diff --git a/kcontrol/keyboard/keyaliases.h b/kcontrol/keyboard/keyaliases.h
index 6b67b47..e7623ca 100644
--- a/kcontrol/keyboard/keyaliases.h
+++ b/kcontrol/keyboard/keyaliases.h
@@ -17,15 +17,17 @@
*/
#ifndef ALIASES_H
#define ALIASES_H
-#include<QMap>
+
+#include <QtCore/QMap>
class Aliases
{
-public:
- Aliases();
QMap<QString,QString>qwerty;
QMap<QString,QString>azerty;
QMap<QString,QString>qwertz;
+
+public:
+ Aliases();
QString findaliasdir();
QString getAlias(QString type,QString name);
};
diff --git a/kcontrol/keyboard/keyboardlayout.cpp b/kcontrol/keyboard/keyboardlayout.cpp
index 240792a..9ce8852 100644
--- a/kcontrol/keyboard/keyboardlayout.cpp
+++ b/kcontrol/keyboard/keyboardlayout.cpp
@@ -18,24 +18,28 @@
#include "keyboardlayout.h"
-#include<QList>
-#include"keys.h"
-#include<QMessageBox>
-#include<QFile>
+#include "keys.h"
+#include <QtCore/QList>
+#include <QtCore/QFile>
+#include <QtCore/QDir>
+
+#include <QtGui/QMessageBox>
#include <QtGui/QX11Info>
+
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/XKBlib.h>
#include <X11/extensions/XKBrules.h>
+
#include <fixx11h.h>
#include <config-workspace.h>
-#include<QDir>
KeyboardLayout::KeyboardLayout()
{
}
+
void KeyboardLayout::getLayout(QString a,QString cname){
includeSymbol(a,cname);
int i=a.indexOf("name[Group1]=");
@@ -43,9 +47,9 @@ void KeyboardLayout::getLayout(QString a,QString cname){
QString n=a.mid(i);
n=n.simplified();
i=n.indexOf("\"",1);
- Layoutname=n.left(i);
- Layoutname.remove("\"");
- Layoutname.simplified();
+ layoutName=n.left(i);
+ layoutName.remove("\"");
+ layoutName.simplified();
i=n.indexOf("key");
n=n.mid(i);
QList<QString> st;
diff --git a/kcontrol/keyboard/keyboardlayout.h b/kcontrol/keyboard/keyboardlayout.h
index 8b9fd4f..029a4c2 100644
--- a/kcontrol/keyboard/keyboardlayout.h
+++ b/kcontrol/keyboard/keyboardlayout.h
@@ -18,22 +18,30 @@
#ifndef KEYBOARDLAYOUT_H
#define KEYBOARDLAYOUT_H
+
#include"keys.h"
#include"keyaliases.h"
-#include<QApplication>
+
+#include <QtGui/QApplication>
+
class KeyboardLayout
{
-public:
- KeyboardLayout();
- QString Layoutname;
+ QString layoutName;
Aliases alias;
- Keys TLDE;
+
+public:
Keys AE[12];
Keys AD[12];
Keys AC[11];
Keys AB[11];
+ Keys TLDE;
+
+ KeyboardLayout();
void getLayout(QString a,QString cname);
QString findSymbolbasedir();
void includeSymbol(QString a,QString cname);
+ QString getLayoutName() const {
+ return layoutName;
+ }
};
#endif // KEYBOARDLAYOUT_H
diff --git a/kcontrol/keyboard/keyboardpainter.cpp b/kcontrol/keyboard/keyboardpainter.cpp
index 24f24d6..22e5f01 100644
--- a/kcontrol/keyboard/keyboardpainter.cpp
+++ b/kcontrol/keyboard/keyboardpainter.cpp
@@ -18,12 +18,13 @@
#include "keyboardpainter.h"
#include "ui_keyboardpainter.h"
-#include<QHBoxLayout>
-#include<QVBoxLayout>
+
+#include <QtGui/QHBoxLayout>
+#include <QtGui/QVBoxLayout>
KeyboardPainter::KeyboardPainter() :
kbframe(new KbPreviewFrame(this)),
- exitButton(new QPushButton(tr("CLOSE"),this)),
+ exitButton(new QPushButton(tr("Close"),this)),
ui(new Ui::keyboardpainter)
{
ui->setupUi(this);
@@ -33,7 +34,7 @@ KeyboardPainter::KeyboardPainter() :
QVBoxLayout*const vLayout = new QVBoxLayout( this );
vLayout->addWidget(kbframe);
vLayout->addWidget(exitButton);
- setWindowTitle(kbframe->kblayout.Layoutname);
+ setWindowTitle(kbframe->kblayout.getLayoutName());
}
KeyboardPainter::~KeyboardPainter()
@@ -42,3 +43,8 @@ KeyboardPainter::~KeyboardPainter()
delete kbframe;
delete exitButton;
}
+
+void KeyboardPainter::getKeyboardLayout(QString country, QString variant)
+{
+ kbframe->getKeyboardLayout(country,variant);
+}
diff --git a/kcontrol/keyboard/keyboardpainter.h b/kcontrol/keyboard/keyboardpainter.h
index d9a5b74..f4a4be8 100644
--- a/kcontrol/keyboard/keyboardpainter.h
+++ b/kcontrol/keyboard/keyboardpainter.h
@@ -20,10 +20,10 @@
#ifndef KEYBOARDPAINTER_H
#define KEYBOARDPAINTER_H
-#include <QDialog>
-#include<QPushButton>
+#include <QtGui/QDialog>
+#include <QtGui/QPushButton>
-#include"kbpreviewframe.h"
+#include "kbpreviewframe.h"
namespace Ui {
class keyboardpainter;
@@ -32,15 +32,17 @@ class keyboardpainter;
class KeyboardPainter : public QDialog
{
Q_OBJECT
-
+
public:
explicit KeyboardPainter();
- KbPreviewFrame *kbframe;
- QPushButton *exitButton;
- QString getVariant(QString variant,QString selectedLayout);
~KeyboardPainter();
-
+
+ QString getVariant(QString variant,QString selectedLayout);
+ void getKeyboardLayout(QString country, QString layoutvariant);
+
private:
+ KbPreviewFrame *kbframe;
+ QPushButton *exitButton;
Ui::keyboardpainter *ui;
};
diff --git a/kcontrol/keyboard/x11_helper.cpp b/kcontrol/keyboard/x11_helper.cpp
index fdadeeb..ebd09f3 100644
--- a/kcontrol/keyboard/x11_helper.cpp
+++ b/kcontrol/keyboard/x11_helper.cpp
@@ -347,7 +347,7 @@ bool XEventNotifier::isGroupSwitchEvent(XEvent* event)
#define GROUP_CHANGE_MASK \
( XkbGroupStateMask | XkbGroupBaseMask | XkbGroupLatchMask | XkbGroupLockMask )
- return xkbEvent->any.xkb_type == XkbStateNotify && xkbEvent->state.changed & GROUP_CHANGE_MASK;
+ return xkbEvent->any.xkb_type == XkbStateNotify && (xkbEvent->state.changed & GROUP_CHANGE_MASK);
}
bool XEventNotifier::isLayoutSwitchEvent(XEvent* event)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic