2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Katri Kaikkonen - katri.kaikkonen@ixonos.com
6 Jussi Laitinen - jussi.laitinen@ixonos.com
8 Situare is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 version 2 as published by the Free Software Foundation.
12 Situare is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Situare; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
23 #ifndef TEXTMODIFIER_H
24 #define TEXTMODIFIER_H
31 * @brief Contains helper methods to modify text.
33 class TextModifier : public QObject
38 * @brief Shortens text to fit.
40 * Text shortening is defined by text maximum width.
42 * @param fontMetrics font metrics to use
43 * @param text text to shorten
44 * @param textMaxWidth maximum width for text
46 static QString shortenText(const QFontMetrics fontMetrics, const QString &text,
50 * @brief Splits too long word.
52 * Splits long word to several by adding extra spaces
54 * @param fontMetrics font metrics to use
55 * @param word long word to be splitted
56 * @param textMaxWidth maximum width for word
57 * @returns splitted word
59 static QString splitWord(const QFontMetrics fontMetrics, const QString &word, int textMaxWidth);
62 * @brief Splits long words from text.
64 * Splits long words to several by adding extra spaces
66 * @param fontMetrics font metrics to use
67 * @param text text to be splitted
68 * @param textMaxWidth maximum width for word
69 * @returns text with long words splitted
71 static QString splitLongWords(const QFontMetrics fontMetrics, const QString &text,
75 #endif // TEXTMODIFIER_H