1 /*******************************************************************************
3 This file is part of mDictionary.
5 mDictionary is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 mDictionary is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with mDictionary. If not, see <http://www.gnu.org/licenses/>.
18 Copyright 2010 Comarch S.A.
20 *******************************************************************************/
22 //Created by Mateusz Półrola
24 #include "TranslationWidget.h"
25 #include "TranslationWidgetAutoResizer.h"
28 TranslationWidget::TranslationWidget(QWidget *parent):
32 setAttribute(Qt::WA_Maemo5StackedWindow);
34 setWindowFlags(windowFlags() | Qt::Window);
38 setWindowTitle(tr("Translation"));
42 void TranslationWidget::show() {
46 void TranslationWidget::show(QStringList translations) {
53 foreach(t, translations) {
57 textEdit->setPlainText(trans);
59 textEdit->repaint(this->rect());
66 void TranslationWidget::initializeUI() {
68 zoomInToolButton = new QToolButton;
69 zoomInToolButton->setIcon(QIcon::fromTheme("pdf_zoomin"));
71 zoomOutToolButton = new QToolButton;
72 zoomOutToolButton->setIcon(QIcon::fromTheme("pdf_zoomout"));
74 // horizontalLayout = new QHBoxLayout;
75 //horizontalLayout->addWidget(zoomInToolButton);
76 // horizontalLayout->addWidget(zoomOutToolButton);
78 textEdit = new QTextEdit;
79 textEdit->setReadOnly(true);
81 resizer = new TranslationWidgetAutoResizer(textEdit);
82 connect(this, SIGNAL(updateSize()),
83 resizer, SLOT(textEditChanged()));
85 QWidget*w = new QWidget;
86 verticalLayout = new QVBoxLayout(w);
87 //verticalLayout->addLayout(horizontalLayout);
88 verticalLayout->addWidget(textEdit);
91 this->setWidgetResizable(true);
93 connect(zoomInToolButton, SIGNAL(clicked()),
94 textEdit, SLOT(zoomIn()));
96 connect(zoomInToolButton, SIGNAL(clicked()),
97 this, SIGNAL(updateSize()));
99 connect(zoomOutToolButton, SIGNAL(clicked()),
100 textEdit, SLOT(zoomOut()));
102 connect(zoomInToolButton, SIGNAL(clicked()),
103 this, SIGNAL(updateSize()));