daae50da08a5158537120a41e4514e3cd433c171
[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     setWindowTitle(tr("About"));
33
34 #ifndef Q_WS_MAEMO_5
35     resize(380,450);
36     mainLayout = new QVBoxLayout;
37     view= new QDeclarativeView();
38     mainLayout->addWidget(view);
39     view->setSource(QUrl("src/mdictionary/qml/AboutWidget.qml"));
40     view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
41     view->setAlignment(Qt::AlignCenter);
42     view->show();
43
44     QGraphicsObject *rootObject = view->rootObject();
45     connect(rootObject, SIGNAL(linkClicked(QString)), this, SLOT(openUrl(QString)));
46     this->setLayout(mainLayout);
47 #else
48     setModal(true);
49     QString infoNote, licenseNote, comarchNote;
50     infoNote = "<center><h2><u>mDictionary</u></h2></center>";
51     comarchNote = "<center>Maemo/Meego Multilingual Dictionary</center>";
52     comarchNote += "<center>Copyright 2006-2010, Comarch S.A. <br>";
53     comarchNote += "<a href=\"http://mdictionary.garage.maemo.org\">"
54                    "http://mdictionary.garage.maemo.org</a>";
55     comarchNote += "<br/><font size=\"small\"><a href=\"https://garage.maemo.org/tracker/?func=add&group_id=58&atid=305\">"
56                    "Report bug</a></font></center>";
57     licenseNote = QString("<br><p><font size=\"small\">This program is free"
58                   " software: you can redistribute it and/or modify\n"
59                   "it under the terms of the GNU General Public License as"
60                   " published by\n"
61                   "the Free Software Foundation, either version 3 of the License,"
62                   " or\n"
63                   "(at your option) any later version.<br>"
64                   "This program is distributed in the hope that it will be"
65                   " useful,\n"
66                   "but WITHOUT ANY WARRANTY; without even the implied warranty"
67                   " of\n"
68                   "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. "
69                   "See the\n"
70                   "GNU General Public License for more details.<br>"
71                   "You should have received a copy of the GNU General Public "
72                   "License<br>"
73                   "along with this program.  If not, see"
74                   "&lt;<a href=\"http://www.gnu.org/licenses/\">"
75                   "http://www.gnu.org/licenses/</a>&gt;."
76                   "</p></font>");
77     mainLayout = new QVBoxLayout;
78
79     imageLabel = new QLabel;
80     mainLabel = new QLabel;
81     licenseLabel = new QLabel;
82
83
84     QImage img(":/icons/logo/mdictionary.png");
85     imageLabel->setPixmap(QPixmap::fromImage(img));
86     imageLabel->setMinimumSize(imageLabel->pixmap()->size());
87
88     mainLabel->setText(infoNote + comarchNote);
89     mainLabel->setOpenExternalLinks(true);
90     mainLabel->setMinimumSize(mainLabel->sizeHint());
91
92
93     licenseLabel->setWordWrap(true);
94     licenseLabel->setText(licenseNote);
95     licenseLabel->setOpenExternalLinks(true);
96     licenseLabel->setMinimumSize(licenseLabel->sizeHint());
97
98
99     mainLayout->addWidget(imageLabel, 0, Qt::AlignHCenter);
100     mainLayout->addWidget(mainLabel, 0, Qt::AlignHCenter);
101     mainLayout->addWidget(licenseLabel, 0, Qt::AlignHCenter);
102
103     setLayout(mainLayout);
104 #endif
105 }
106
107
108 void AboutWidget::openUrl(QString url){
109     QDesktopServices::openUrl(url);
110 }