help.cpp
1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <QDesktopServices>
#include <QFile>
#include <QMessageBox>
#include <QString>
#include <QUrl>
#include <openbr.h>
#include "help.h"
/**** HELP ****/
/*** PUBLIC ***/
br::Help::Help(QWidget *parent)
: QMenu(parent)
{
actions.append(QSharedPointer<QAction>(addAction("About")));
connect(actions.last().data(), SIGNAL(triggered()), this, SLOT(showAbout()));
actions.append(QSharedPointer<QAction>(addAction("Documentation")));
connect(actions.last().data(), SIGNAL(triggered()), this, SLOT(showDocumentation()));
actions.append(QSharedPointer<QAction>(addAction("License")));
connect(actions.last().data(), SIGNAL(triggered()), this, SLOT(showLicense()));
}
/*** PUBLIC SLOTS ***/
void br::Help::showAbout()
{
QMessageBox::about(this, "About", br_about());
}
void br::Help::showDocumentation()
{
QDesktopServices::openUrl(QUrl(QString("file:///%1/doc/html/index.html").arg(br_sdk_path())));
}
void br::Help::showLicense()
{
QFile file(QString("%1/LICENSE.txt").arg(br_sdk_path()));
file.open(QFile::ReadOnly);
QString license = file.readAll();
file.close();
QMessageBox::about(this, "License", license);
}
#include "moc_help.cpp"