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