/* * Copyright (C) 2012 Shivam Makkar (amourphious1992@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 "kbpreviewframe.h" #include #include #include #include static const QColor keyBorderColor("#d4d4d4"); static const QColor lev12color("#d4d4d4"); static const QColor lev34color("#FF3300"); static const int sz=20, kszx=70, kszy=70; static const int xOffset[] = {15, 15, 40, 40 }; static const int yOffset[] = {10, 40, 10, 40 }; static const QColor color[] = { lev12color, lev12color, lev34color, lev34color }; // TODO: parse geometry files and display keyboard according to current keyboard model KbPreviewFrame::KbPreviewFrame(QWidget *parent) : QFrame(parent) { setFrameStyle( QFrame::Box ); setFrameShadow(QFrame::Sunken); } void KbPreviewFrame::paintTLDE(QPainter &painter,int &x,int &y) { painter.setPen(keyBorderColor); painter.drawRect(x, y, kszx, kszy); const QList symbols = keyboardLayout.TLDE.symbols; for(int level=0; level symbols = keyboardLayout.AE[i].symbols; for(int level=0; level")); x+=tabszx; for(int i=0; i symbols = keyboardLayout.AD[i].symbols; painter.setPen(keyBorderColor); painter.drawRect(x, y,kszx,kszy); for(int level=0; level symbols = keyboardLayout.BKSL.symbols; for(int level=0; level symbols = keyboardLayout.AC[i].symbols; for(int level=0; level symbols = keyboardLayout.AB[i].symbols; for(int level=0; level symstr = content.split("xkb_symbols "); if( layoutVariant.isEmpty() ) { keyboardLayout.generateLayout(symstr.at(1), layout); } else { for(int i=1;i