[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kde-workspace/amourphiousGsoc13] kcontrol/keyboard: geometry components added
From: shivam makkar <amourphious1992 () gmail ! com>
Date: 2013-06-19 21:57:45
Message-ID: E1UpQNt-0001MT-9R () scm ! kde ! org
[Download RAW message or body]
Git commit 5bdb899c75c6b9e147373ff3c08ea9039c93b241 by shivam makkar.
Committed on 19/06/2013 at 21:56.
Pushed by makkar into branch 'amourphiousGsoc13'.
geometry components added
M +1 -0 kcontrol/keyboard/CMakeLists.txt
A +182 -0 kcontrol/keyboard/preview/geometry_components.cpp [License: UNKNOWN] *
A +83 -0 kcontrol/keyboard/preview/geometry_components.h [License: UNKNOWN] *
The files marked with a * at the end have a non valid license. Please read: \
http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.
http://commits.kde.org/kde-workspace/5bdb899c75c6b9e147373ff3c08ea9039c93b241
diff --git a/kcontrol/keyboard/CMakeLists.txt b/kcontrol/keyboard/CMakeLists.txt
index 973a39d..f92c96b 100644
--- a/kcontrol/keyboard/CMakeLists.txt
+++ b/kcontrol/keyboard/CMakeLists.txt
@@ -120,6 +120,7 @@ set(kcm_keyboard_PART_SRCS
preview/keysymhelper.cpp
preview/kbpreviewframe.cpp
preview/keysym2ucs.cpp
+ preview/geometry_components.cpp
)
diff --git a/kcontrol/keyboard/preview/geometry_components.cpp \
b/kcontrol/keyboard/preview/geometry_components.cpp new file mode 100644
index 0000000..6c04078
--- /dev/null
+++ b/kcontrol/keyboard/preview/geometry_components.cpp
@@ -0,0 +1,182 @@
+#include "geometry_components.h"
+
+#include <iostream>
+
+cordinate::cordinate(){
+ x=0;
+ y=0;
+}
+
+cordinate::cordinate(int &a, int &b){
+ x=a;
+ y=b;
+}
+
+Shape::Shape(){
+ cordi_count = 0;
+}
+
+void Shape::setShape(std::string n){
+ sname = n;
+}
+
+void Shape::setCordinate(int &a, int &b){
+ cordii[cordi_count++] = cordinate(a,b);
+}
+
+void Shape::setApprox(int &a, int &b){
+ approx = cordinate(a,b);
+}
+
+void Shape::display(){
+ std::cout<<"shape: "<<sname<<"\n";
+ std::cout<<"( "<<approx.x<<", "<<approx.y<<"); ";
+ for(int i=0;i<cordi_count;i++)
+ std::cout<<"( "<<cordii[i].x<<", "<<cordii[i].y<<"); ";
+ std::cout<<"\n";
+}
+
+int Shape::size(){
+ if (approx.x == 0 && approx.y== 0)
+ return cordii[0].x;
+ else
+ return approx.x;
+}
+
+Key::Key(){
+ offset = 0;
+}
+void Key::getKey(int &o){
+ offset = o;
+}
+
+void Key::setKeyPosition(int &x, int &y){
+ position = cordinate(x,y);
+}
+
+void Key::showKey(){
+ std::cout<<"\n\tKey: "<<name<<"\tshape: "<<shapeName<<"\toffset: "<<offset;
+ std::cout<<"\tposition"<<position.x<<" , "<<position.y<<std::endl;
+}
+
+Row::Row(){
+ top = 0;
+ left = 0;
+ keyCount = 0;
+}
+
+void Row::getRow(int t,int l){
+ top = t;
+ left = l;
+}
+
+void Row::addKey(){
+ std::cout<<"keyCount: "<<keyCount;
+ keyCount++;
+}
+
+void Row::displayRow(){
+ std::cout<<"\nRow: "<<top<<","<<left<<std::endl;
+ for(int i=0;i<keyCount;i++)
+ keyList[i].showKey();
+}
+
+Section::Section(){
+ top = 0;
+ left = 0;
+ angle = 0;
+ rowCount = 0;
+}
+
+void Section::getName(std::string n){
+ name = n;
+}
+
+void Section::addRow(){
+ std::cout<<"\nrowCount: "<<rowCount;
+ rowCount++;
+}
+
+void Section::displaySection(){
+ std::cout<<"\nSection: "<<name<<"\n\tposition: ("<<left<<","<<top<<");"<<angle<<std::endl;
+ for(int i=0;i<rowCount;i++){
+ std::cout<<"\n\t";
+ rowList[i].displayRow();
+ }
+}
+
+Geometry::Geometry(){
+ sectionTop = 0;
+ sectionLeft = 0;
+ rowTop = 0;
+ rowLeft = 0;
+ keyGap = 0;
+ shape_count=-1;
+ width=0;
+ height=0;
+ sectionCount = 0;
+}
+
+void Geometry::getName(std::string n){
+ name = n;
+}
+
+void Geometry::getDescription(std::string n){
+ description = n;
+}
+
+void Geometry::getWidth(int a){
+ width = a;
+}
+
+void Geometry::getHeight(int a){
+ height = a;
+}
+
+void Geometry::getShapeName(std::string n){
+ shapes[shape_count].setShape(n);
+}
+
+void Geometry::getShapeCord(int a, int b){
+ shapes[shape_count].setCordinate(a,b);
+}
+
+void Geometry::getShapeApprox(int a, int b){
+ shapes[shape_count].setApprox(a,b);
+}
+
+void Geometry::getShape(){
+ shape_count++;
+}
+
+void Geometry::display(){
+ std::cout<<name<<"\n"<<description<<"\nwidth: "<<width<<"\nheight: "<<height<<"\n"<<"sectionTop: \
"<<sectionTop; + std::cout<<"\nsectionLeft: "<<sectionLeft<<"\nrowTop: "<<rowTop<<"\nrowLeft: \
"<<rowLeft<<"\nkeyGap: "<<keyGap<<"\nkeyShape: "<<keyShape<<std::endl; + for (int \
i=0;i<shape_count;i++){ + shapes[i].display();
+ }
+ for (int j=0;j<sectionCount;j++)
+ sectionList[j].displaySection();
+}
+
+void Geometry::addSection(){
+ std::cout<<"\nsectionCount: "<<sectionCount;
+ sectionCount++;
+}
+
+Shape Geometry::findShape(std::string name){
+ Shape l;
+ for(int i=0;i<shape_count;i++){
+ if (shapes[i].sname == name){
+ return shapes[i];
+ }
+ }
+ return l;
+}
+
+
+
+
+
+
+
diff --git a/kcontrol/keyboard/preview/geometry_components.h \
b/kcontrol/keyboard/preview/geometry_components.h new file mode 100644
index 0000000..5723b01
--- /dev/null
+++ b/kcontrol/keyboard/preview/geometry_components.h
@@ -0,0 +1,83 @@
+#ifndef GEOMETRY_COMPONENTS_H
+#define GEOMETRY_COMPONENTS_H
+
+#include <iostream>
+
+
+class cordinate{
+ public :
+ int x,y;
+ cordinate();
+ cordinate(int &a,int &b);
+
+};
+
+class Shape{
+ public:
+ std::string sname;
+ cordinate cordii[20],approx;
+ int cordi_count;
+ Shape();
+ void setShape(std::string n);
+ void setCordinate(int &a, int &b);
+ void setApprox(int &a, int &b);
+ void display();
+ int size();
+};
+
+class Key{
+public:
+ std::string name,shapeName;
+ int offset;
+ cordinate position;
+ Key();
+ void getKey(int &o);
+ void setKeyPosition(int &x,int &y);
+ void showKey();
+};
+
+class Row{
+public:
+ int top,left,keyCount;
+ Key keyList[30];
+ Row();
+ void getRow(int t,int l);
+ void addKey();
+ void displayRow();
+};
+
+class Section{
+public:
+ std::string name,shapeName;
+ int top,left,angle,rowCount;
+ Row rowList[20];
+ Section();
+ void getName(std::string n);
+ void addRow();
+ void displaySection();
+};
+
+class Geometry{
+public:
+ std::string name,description,keyShape;
+ int width,height,shape_count;
+ int sectionTop,sectionLeft,rowTop,rowLeft,keyGap,sectionCount;
+ Shape shapes[40];
+ Section sectionList[20];
+ Geometry();
+ void getName(std::string n);
+ void getDescription(std::string n);
+ void getWidth(int a);
+ void getHeight(int a);
+ void getShapeName(std::string n);
+ void getShapeCord(int a, int b);
+ void getShapeApprox(int a, int b);
+ void getShape();
+ void display();
+ void addSection();
+ Shape findShape(std::string name);
+};
+
+
+
+#endif //geometry_componets.h
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic