Logo Search packages:      
Sourcecode: kmess version File versions


                          emoticoncollection.h  -  description
    begin                : Mon Apr 15 2002
    copyright            : (C) 2003 by Michael Curtis
                           (C) 2005 by Diederik van der Boor
    email                : mdcurtis@users.sourceforge.net
                           "vdboor" --at-- "codingdomain.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.                                   *
 *                                                                         *


#include <qptrlist.h>
#include <qobject.h>
#include <qregexp.h>

#include "emoticon.h"

 * @brief Data class for the list of emoticon definitions and replacements.
 * This class maintains the list of the global/standard emoticons.
 * MSN Messenger uses a fixed set of emoticon/smiley codes and replacements.
 * The parseEmoticons() method can be used to replace all emoticons in a message.
 * To implement a custom search-replace algorithm, use the getPattern() / getReplacements() methods
 * to retrieve all needed data.
 * @author Michael Curtis, Diederik van der Boor
 * @ingroup Root
00041 class EmoticonCollection : public QObject, public QPtrList<Emoticon>

    // Delete the instance of the emoticon collection
    static void                destroy();
    // Return the search pattern to find emoticons in the text
    const QRegExp&             getPattern() const;
    // Return one replacement code for the given emoticons
    const QString&             getReplacement(const QString &code, bool small = false) const;
    // Return the replacement codes for all emoticons
    const QMap<QString,QString>& getReplacements(bool small = false) const;
    // Return a singleton instance of the emoticon collection
    static EmoticonCollection* instance();
    // Replace the emoticons in the text with the urls to the emoticon pngs.
    void                       parseEmoticons( QString &text, bool small = false );

    // The constructor
    // The copy constructor
                               EmoticonCollection(const EmoticonCollection&);
    // The destructor
    // Disable the assign operator
    EmoticonCollection&        operator=(const EmoticonCollection&);
    // Build the search-replace cache
    void                       updateCache();

  private slots:
    // The emoticon theme has changed
    void                       slotChangedEmoticonSettings();

    // The instance of the singleton emoticon collection
    static EmoticonCollection *instance_;
    // The replace codes for emoticons
    QMap<QString,QString>      largeReplacements_;
    // The search pattern for emoticons
    QRegExp                    pattern_;
    // The replace codes for emoticons
    QMap<QString,QString>      smallReplacements_;


Generated by  Doxygen 1.6.0   Back to index