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