From ce599e4f9f94b4eb00c1b5edb85bce5431ab3df2 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeedu@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- ktouch/src/ktouchkeyboard.h | 67 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 ktouch/src/ktouchkeyboard.h (limited to 'ktouch/src/ktouchkeyboard.h') diff --git a/ktouch/src/ktouchkeyboard.h b/ktouch/src/ktouchkeyboard.h new file mode 100644 index 00000000..88949537 --- /dev/null +++ b/ktouch/src/ktouchkeyboard.h @@ -0,0 +1,67 @@ +/*************************************************************************** + * ktouchkeyboard.h * + * ---------------- * + * Copyright (C) 2004 by Andreas Nicolai * + * ghorwin@users.sourceforge.net * + * * + * 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. * + ***************************************************************************/ + +#ifndef KTOUCHKEYBOARD_H +#define KTOUCHKEYBOARD_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +#include "ktouchkeyconnector.h" +#include "ktouchkey.h" + +class KURL; + +/// This class stores the keyboard layout and the connectivity between characters +/// and the actual keys. +class KTouchKeyboard { + public: + /// Default constructor, sets up the standard number keyboard. + KTouchKeyboard() { createDefault(); } + /// Clears the keyboard (resets all data) + void clear(); + /// Loads a keyboard layout (old format) from file (returns true if successful). + bool load(QWidget * window, const KURL& url); + /// Loads a lecture (in XML format) from file (returns true if successful). + bool loadXML(QWidget * window, const KURL& url); + /// Saves the lecture data to file (returns true if successful). + bool saveXML(QWidget * window, const KURL& url) const; + /// Creates the default number keyboard. + void createDefault(); + /// Updates the indices in the KTouchKeyConnector objects for faster access. + void updateConnections(); + + QValueVector m_keys; ///< Vector with key definitions. + QValueVector m_connectors; ///< Vector with connectivity data. + + QString m_title; ///< Title of the keyboard (to appear in the menu). + QString m_comment; ///< Comments about the creator of the keyboard layout. + QString m_language; ///< Language ID of keyboard + QString m_fontSuggestions; ///< Suggestions of fonts to be used on the keys. + + // These variables are recalculated after the keyboard was loaded. + int m_width; ///< The width of the keyboard (maximum of the sums of all keywidths in each line). + int m_height; ///< The height of the keyboard (sum of all key row heights). + + private: + /// Loads keyboard data from file + bool read(QTextStream& in); + /// Loads keyboard data from file into an XML document + bool read(const QDomDocument& doc); + /// Saves keyboard data in the XML document + void write(QDomDocument& doc) const; +}; + +#endif // KTOUCHKEYBOARD_H -- cgit v1.2.1