1 /** \file TocEmoticonsDialog.cpp
2 * \brief Implementation of TocEmoticonsDialog class
4 * Tieto Open Communicator - Client for the Telepathy communications framework.
5 * Copyright (c) 2010, Tieto Corporation
8 * Redistribution and use in source and binary forms, with or without modification,
9 * are permitted provided that the following conditions are met:
11 * Redistributions of source code must retain the above copyright notice,
12 * this list of conditions and the following disclaimer.
13 * Redistributions in binary form must reproduce the above copyright notice,
14 * this list of conditions and the following disclaimer in the documentation
15 * and/or other materials provided with the distribution.
16 * Neither the name of the Tieto Corporation nor the names of its contributors
17 * may be used to endorse or promote products derived from this software without
18 * specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #include "ui_TocEmoticonsDialog.h"
33 #include "TocEmoticonsDialog"
37 // Initialize static objects
38 TocEmoticonsDialog* TocEmoticonsDialog::_pSelf = 0;
40 TocEmoticonsDialog* TocEmoticonsDialog::getInstance(QWidget* parent) {
43 _pSelf = new TocEmoticonsDialog(parent);
48 TocEmoticonsDialog::TocEmoticonsDialog(QWidget *parent)
51 ui = new Ui_TocEmoticonsDialogClass();
53 setContentsMargins(-10, -10, -10, -10);
55 CONNECT(ui->backButton,SIGNAL(clicked()),this,SLOT(reject()));
56 CONNECT(ui->emoticonsListWidget,SIGNAL(itemClicked(QListWidgetItem*)),this,SLOT(onEmoticonSelected(QListWidgetItem*)));
58 ui->emoticonsListWidget->setFlow(QListView::LeftToRight);
59 ui->emoticonsListWidget->setViewMode(QListView::IconMode);
60 ui->emoticonsListWidget->setGridSize(QSize(80, 80));
61 ui->emoticonsListWidget->setIconSize(QSize(32, 32));
62 ui->emoticonsListWidget->setDragEnabled(false);
63 ui->emoticonsListWidget->setVerticalScrollMode(QAbstractItemView::ScrollPerItem);
64 ui->emoticonsListWidget->setWrapping(true);
65 ui->emoticonsListWidget->setWordWrap(true);
66 ui->emoticonsListWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
67 ui->emoticonsListWidget->setResizeMode(QListView::Adjust);
69 QFont currentFont(ui->emoticonsListWidget->font());
70 currentFont.setPixelSize(14);
71 ui->emoticonsListWidget->setFont(currentFont);
73 ui->emoticonsListWidget->addItem(new QListWidgetItem(QIcon(emotSmile_32x32),
74 tr(":)"), ui->emoticonsListWidget));
75 ui->emoticonsListWidget->addItem(new QListWidgetItem(QIcon(emotSad_32x32),
76 tr(":("), ui->emoticonsListWidget));
77 ui->emoticonsListWidget->addItem(new QListWidgetItem(QIcon(emotPlain_32x32),
78 tr(":|"), ui->emoticonsListWidget));
79 ui->emoticonsListWidget->addItem(new QListWidgetItem(QIcon(emotSurprise_32x32),
80 tr(":O"), ui->emoticonsListWidget));
81 ui->emoticonsListWidget->addItem(new QListWidgetItem(QIcon(emotGrin_32x32),
82 tr(":D"), ui->emoticonsListWidget));
83 ui->emoticonsListWidget->addItem(new QListWidgetItem(QIcon(emotWink_32x32),
84 tr(";)"), ui->emoticonsListWidget));
85 ui->emoticonsListWidget->addItem(new QListWidgetItem(QIcon(emotKiss_32x32),
86 tr(":*"), ui->emoticonsListWidget));
87 ui->emoticonsListWidget->addItem(new QListWidgetItem(QIcon(emotAngel_32x32),
88 tr("<angel>"), ui->emoticonsListWidget));
89 ui->emoticonsListWidget->addItem(new QListWidgetItem(QIcon(emotDevil_32x32),
90 tr("<devil>"), ui->emoticonsListWidget));
91 ui->emoticonsListWidget->addItem(new QListWidgetItem(QIcon(emotMonkey_32x32),
92 tr("<monkey>"), ui->emoticonsListWidget));
93 ui->emoticonsListWidget->addItem(new QListWidgetItem(QIcon(emotCrying_32x32),
94 tr("<crying>"), ui->emoticonsListWidget));
95 ui->emoticonsListWidget->addItem(new QListWidgetItem(QIcon(emotGlasses_32x32),
96 tr("<glasses>"), ui->emoticonsListWidget));
97 ui->emoticonsListWidget->addItem(new QListWidgetItem(QIcon(emotSmileBig_32x32),
98 tr("<bigsmile>"), ui->emoticonsListWidget));
101 TocEmoticonsDialog::~TocEmoticonsDialog()
106 void TocEmoticonsDialog::onEmoticonSelected(QListWidgetItem* pItem) {
108 _selectedEmoticonAlias = pItem->text();
112 QString TocEmoticonsDialog::getSelectedEmoticonAlias() {
113 return _selectedEmoticonAlias;