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
37 TextModifier(QObject *parent = 0);
40 * @brief Shortens text to fit.
42 * Text shortening is defined by text maximum width.
44 * @param fontMetrics font metrics to use
45 * @param text text to shorten
46 * @param textMaxWidth maximum width for text
48 static QString shortenText(const QFontMetrics fontMetrics, const QString &text,
52 * @brief Splits too long word.
54 * Splits long word to several by adding extra spaces
56 * @param fontMetrics font metrics to use
57 * @param word long word to be splitted
58 * @param textMaxWidth maximum width for word
59 * @returns splitted word
61 static QString splitWord(const QFontMetrics fontMetrics, const QString &word, int textMaxWidth);
64 * @brief Splits long words from text.
66 * Splits long words to several by adding extra spaces
68 * @param fontMetrics font metrics to use
69 * @param text text to be splitted
70 * @param textMaxWidth maximum width for word
71 * @returns text with long words splitted
73 static QString splitLongWords(const QFontMetrics fontMetrics, const QString &text,
77 #endif // TEXTMODIFIER_H