BuildmLearn Toolkit  2.0.4
BuildmLearn Toolkit is an easy-to-use program that helps users make mobile apps without any knowledge of application development.
 All Classes Functions Enumerations Groups Pages
formabout.cpp
1 /*
2  Copyright (c) 2012, BuildmLearn Contributors listed at http://buildmlearn.org/people/
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without
6  modification, are permitted provided that the following conditions are met:
7 
8  * Redistributions of source code must retain the above copyright notice, this
9  list of conditions and the following disclaimer.
10 
11  * Redistributions in binary form must reproduce the above copyright notice,
12  this list of conditions and the following disclaimer in the documentation
13  and/or other materials provided with the distribution.
14 
15  * Neither the name of the BuildmLearn nor the names of its
16  contributors may be used to endorse or promote products derived from
17  this software without specific prior written permission.
18 
19  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30 
31 #include "gui/formabout.h"
32 
33 #include "miscellaneous/iconfactory.h"
34 #include "miscellaneous/textfactory.h"
35 
36 #include <QFile>
37 #include <QTextStream>
38 
39 
40 FormAbout::FormAbout(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormAbout) {
41  m_ui->setupUi(this);
42 
43  // Set flags and attributes.
44  setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
45  setWindowIcon(IconFactory::instance()->fromTheme("application-about"));
46 
47  //: About toolkit dialog title.
48  setWindowTitle(tr("About %1").arg(APP_NAME));
49 
50  m_ui->m_lblIcon->setPixmap(QPixmap(APP_ICON_PATH));
51 
52  // Load information from embedded text files.
53  QTextStream text_stream;
54  QFile file;
55  text_stream.setDevice(&file);
56 
57  file.setFileName(APP_INFO_PATH + "/CHANGELOG");
58  if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
59  m_ui->m_txtChangelog->setText(text_stream.readAll());
60  file.close();
61  }
62  else {
63  m_ui->m_txtChangelog->setText(tr("Changelog not found."));
64  }
65 
66  file.setFileName(APP_INFO_PATH + "/LICENSE");
67  if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
68  m_ui->m_txtLicense->setText(text_stream.readAll());
69  file.close();
70  }
71  else {
72  m_ui->m_txtLicense->setText(tr("License not found."));
73  }
74 
75  // Set other informative texts.
76  m_ui->m_lblDesc->setText(tr("<b>%8</b><br>"
77  "<b>Version:</b> %1 (build on %2 with CMake %3)<br>"
78  "<b>Revision:</b> %4<br>"
79  "<b>Build date:</b> %5<br>"
80  "<b>Qt:</b> %6 (compiled against %7)<br>").arg(qApp->applicationVersion(),
81  CMAKE_SYSTEM,
82  CMAKE_VERSION,
83  APP_REVISION,
84  TextFactory::parseDateTime(QString("%1 %2").arg(__DATE__,
85  __TIME__)).toString(Qt::DefaultLocaleShortDate),
86  qVersion(),
87  QT_VERSION_STR,
88  APP_NAME));
89 
90  m_ui->m_txtInfo->setText(tr("<body>%4 is an easy-to-use program that helps users make mobile apps without any knowledge of application development."
91  "<br><br>Visit us at <a href=\"%2\">%2</a>."
92  "<br><br>Any feedback or suggestions related to %4 are always welcome. Please write to us at <a href=\"mailto:%1\">%1</a>."
93  "<br><br>Copyright (C) 2012 %3</body>").arg(APP_EMAIL,
94  APP_URL,
95  APP_AUTHOR,
96  APP_NAME));
97 }
98 
99 FormAbout::~FormAbout() {
100  qDebug("Destroying FormAbout instance.");
101  delete m_ui;
102 }
FormAbout(QWidget *parent)
Constructor.
Definition: formabout.cpp:40
static QDateTime parseDateTime(const QString &date_time)
Tries to parse input textual date/time representation.
Definition: textfactory.cpp:43
Form for displaying "about" information.
Definition: formabout.h:46
static IconFactory * instance()
Singleton getter.
Definition: iconfactory.cpp:48