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