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