Further documentation corrections
[mdictionary] / src / mdictionary / gui / AboutWidget.cpp
1 /*******************************************************************************
2
3     This file is part of mDictionary.
4
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.
9
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.
14
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/>.
17
18     Copyright 2010 Comarch S.A.
19
20 *******************************************************************************/
21 //! \file AboutWidget.cpp
22 //! \brief Simple "about" widget - product, company, license info
23 //! \author Bartosz Szatkowski <bulislaw@linux.com>
24
25 #include "AboutWidget.h"
26
27 AboutWidget::AboutWidget(GUIInterface *parent): QDialog(parent)
28 {
29     QString infoNote, licenseNote, comarchNote;
30     infoNote = "<center><h2><u>mDictionary</u></h2></center>";
31     comarchNote = "<center>Maemo/Meego Multilingual Dictionary</center>";
32     comarchNote += "<center>Copyright 2006-2010, Comarch S.A. <br>";
33     comarchNote += "<a href=\"http://mdictionary.garage.maemo.org\">"
34                    "http://mdictionary.garage.maemo.org</a>";
35     comarchNote += "<br/><font size=\"small\"><a href=\"https://garage.maemo.org/tracker/?func=add&group_id=58&atid=305\">"
36                    "Report bug</a></font></center>";
37     licenseNote = QString("<br><p><font size=\"small\">This program is free"
38                   " software: you can redistribute it and/or modify\n"
39                   "it under the terms of the GNU General Public License as"
40                   " published by\n"
41                   "the Free Software Foundation, either version 3 of the License,"
42                   " or\n"
43                   "(at your option) any later version.<br>"
44                   "This program is distributed in the hope that it will be"
45                   " useful,\n"
46                   "but WITHOUT ANY WARRANTY; without even the implied warranty"
47                   " of\n"
48                   "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. "
49                   "See the\n"
50                   "GNU General Public License for more details.<br>"
51                   "You should have received a copy of the GNU General Public "
52                   "License<br>"
53                   "along with this program.  If not, see"
54                   "&lt;<a href=\"http://www.gnu.org/licenses/\">"
55                   "http://www.gnu.org/licenses/</a>&gt;."
56                   "</p></font>");
57
58     setWindowTitle(tr("About"));
59     mainLayout = new QVBoxLayout;
60
61     /*on desktop we place all content in scroll area, on maemo by default all
62     widgets that are in menu are placed in scroll area created by menu, so we
63     don't have to do it here*/
64     #ifndef Q_WS_MAEMO_5
65         scrollLayout = new QVBoxLayout;
66         scroll = new QScrollArea;
67         w = new QWidget(this);
68     #endif
69
70
71     imageLabel = new QLabel;
72     mainLabel = new QLabel;
73     licenseLabel = new QLabel;
74
75
76     QImage img(":/icons/logo/mdictionary.png");
77     imageLabel->setPixmap(QPixmap::fromImage(img));
78     imageLabel->setMinimumSize(imageLabel->pixmap()->size());
79
80     mainLabel->setText(infoNote + comarchNote);
81     mainLabel->setOpenExternalLinks(true);
82     mainLabel->setMinimumSize(mainLabel->sizeHint());
83
84
85     licenseLabel->setWordWrap(true);
86     licenseLabel->setText(licenseNote);
87     licenseLabel->setOpenExternalLinks(true);
88     licenseLabel->setMinimumSize(licenseLabel->sizeHint());
89
90
91     mainLayout->addWidget(imageLabel, 0, Qt::AlignHCenter);
92     mainLayout->addWidget(mainLabel, 0, Qt::AlignHCenter);
93     mainLayout->addWidget(licenseLabel, 0, Qt::AlignHCenter);
94
95     //add content to scroll area, and remove fram from it
96     #ifndef Q_WS_MAEMO_5
97         w->setLayout(mainLayout);
98         scroll->setWidget(w);
99         scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
100         scrollLayout->addWidget(scroll, 0, Qt::AlignHCenter);
101         this->setLayout(scrollLayout);
102         w->setMinimumSize(img.width()*1.6, img.height()*2.45);
103         scroll->setLineWidth(0);
104         scroll->setMidLineWidth(0);
105         scroll->setFrameStyle(QFrame::NoFrame);;
106     #else
107         setLayout(mainLayout);
108     #endif
109 }