-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcaboutdialog.cpp
226 lines (203 loc) · 7.71 KB
/
caboutdialog.cpp
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
/*********************** Information *************************\
| $HeadURL$
|
| Author: Jo2003
|
| Begin: 18.01.2010 / 16:13:41
|
| Last edited by: $Author$
|
| $Id$
\*************************************************************/
#include "caboutdialog.h"
#include "ui_caboutdialog.h"
#include "externals_inc.h"
#include <QFile>
/* -----------------------------------------------------------------\
| Method: CAboutDialog / constructor
| Begin: 18.01.2010 / 16:14:06
| Author: Jo2003
| Description: constructs about dialog class
|
| Parameters: pointer to parent window
|
| Returns: --
\----------------------------------------------------------------- */
CAboutDialog::CAboutDialog(QWidget *parent, QString sExpires, const QString &lang) :
QDialog(parent),
ui(new Ui::CAboutDialog)
{
ui->setupUi(this);
FillInfo(sExpires);
#ifdef __INFO_WINDOW_CONTENT
addOrderInfo();
#endif // __INFO_WINDOW_CONTENT
ui->textBrowser->setHtml(strAbout);
// QFile fEula(QString("%1/eula_%2.txt").arg(pFolders->getLangDir()).arg(lang));
Q_UNUSED(lang)
QFile fEula(QString("%1/eula_ru.txt").arg(pFolders->getLangDir()));
if (fEula.open(QIODevice::ReadOnly | QIODevice::Text))
{
QString sEula = QString::fromUtf8(fEula.readAll().constData());
ui->eulaText->setPlainText(sEula);
}
}
/* -----------------------------------------------------------------\
| Method: ~CAboutDialog / destructor
| Begin: 18.01.2010 / 16:14:44
| Author: Jo2003
| Description: clean at destruction
|
| Parameters: --
|
| Returns: --
\----------------------------------------------------------------- */
CAboutDialog::~CAboutDialog()
{
delete ui;
}
/* -----------------------------------------------------------------\
| Method: ConnectSettings
| Begin: 08.03.2010 / 14:14:44
| Author: Jo2003
| Description: connect settings with splash options ...
|
| Parameters: --
|
| Returns: --
\----------------------------------------------------------------- */
void CAboutDialog::ConnectSettings(CSettingsDlg *pSet)
{
ui->checkDontShowOnStartup->setChecked(pSet->DisableSplashScreen());
connect (ui->checkDontShowOnStartup, SIGNAL(clicked(bool)), pSet, SLOT(slotSplashStateChgd(bool)));
}
/* -----------------------------------------------------------------\
| Method: changeEvent
| Begin: 18.01.2010 / 16:15:15
| Author: Jo2003
| Description: catch language change event
|
| Parameters: pointer to event
|
| Returns: --
\----------------------------------------------------------------- */
void CAboutDialog::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
switch (e->type())
{
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
/* -----------------------------------------------------------------\
| Method: FillInfo
| Begin: 18.01.2010 / 16:15:50
| Author: Jo2003
| Description: fill about info into string
|
| Parameters: sExpires - string with date and time
|
| Returns: --
\----------------------------------------------------------------- */
void CAboutDialog::FillInfo(QString sExpires)
{
strAbout = "";
QString td, rows, link;
const char* linkcss = "text-decoration: underline; color: #0482FE;";
strAbout = pHtml->span(pCustomization->strVal("APP_NAME"), "font-weight: bold; font-size: 16px;") + "<br />";
// version ...
td = pHtml->tableCell(tr("Version:") , "font-weight: bold;");
td += pHtml->tableCell(__MY__VERSION__ , "padding-left: 7px;");
rows = pHtml->tableRow(td);
// libvlc version ...
link = pHtml->link("http://www.videolan.org", "VideoLAN.org", "", linkcss);
link = QString("%1 by %2").arg(libvlc_get_version()).arg(link);
td = pHtml->tableCell(tr("libVLC:") , "font-weight: bold;");
td += pHtml->tableCell(link , "padding-left: 7px;");
rows += pHtml->tableRow(td);
// author ...
link = pHtml->link("mailto:coujo@gmx.net", "Jo2003", "", linkcss);
td = pHtml->tableCell(tr("Author:") , "font-weight: bold;");
td += pHtml->tableCell(link , "padding-left: 7px;");
rows += pHtml->tableRow(td);
#ifndef _IS_OEM
// project site ...
link = pHtml->link("http://vlc-record.coujo.de", "vlc-record.coujo.de", "", linkcss);
td = pHtml->tableCell(tr("Project Site:" ) , "font-weight: bold;");
td += pHtml->tableCell(link , "padding-left: 7px;");
rows += pHtml->tableRow(td);
#endif // _IS_OEM
// inspiration ...
td = pHtml->tableCell(tr("Inspired by:") , "font-weight: bold;");
td += pHtml->tableCell("Olenka!" , "padding-left: 7px;");
rows += pHtml->tableRow(td);
// qt version ...
link = pHtml->link("http://qt-project.org", "Qt Project", "", linkcss);
link = QString("Qt %1 by %2").arg(qVersion()).arg(link);
td = pHtml->tableCell("SDK:" , "font-weight: bold;");
td += pHtml->tableCell(link , "padding-left: 7px;");
rows += pHtml->tableRow(td);
// expires ...
td = pHtml->tableCell(tr("Account expires:") , "font-weight: bold;");
td += pHtml->tableCell(sExpires , "padding-left: 7px;");
rows += pHtml->tableRow(td);
// icons ...
link = pHtml->link("http://dryicons.com", "dryicons.com", "", linkcss);
td = pHtml->tableCell("Most icons:" , "font-weight: bold;");
td += pHtml->tableCell(link , "padding-left: 7px;");
rows += pHtml->tableRow(td);
// wrap into table ...
strAbout += pHtml->htmlTag("table", rows) + "<br /> <br />";
strAbout += pHtml->htmlTag("b", tr("This program is free software!")) + " ";
strAbout += tr("Nevertheless ... if you like this software, please support me: ");
strAbout += pHtml->link("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=11286909",
tr("Donate some $ and / or € at Paypal for my work."), "", linkcss) + "<br /> <br />";
strAbout += tr("Thank you,") + "<br /> Jörg";
strAbout = pHtml->htmlPage(strAbout);
}
#ifdef __INFO_WINDOW_CONTENT
//---------------------------------------------------------------------------
//
//! \brief add order information in first tab
//
//! \author Jo2003
//! \date 27.05.2015
//
//! \return --
//---------------------------------------------------------------------------
void CAboutDialog::addOrderInfo()
{
QWidget* pOrderWidgetTab = new QWidget;
QHBoxLayout* pLayout = new QHBoxLayout;
QTextBrowser* pContent = new QTextBrowser;
QString sContent = pAppTransl->translate("infoWindowContent", __INFO_WINDOW_CONTENT);
QString sCss;
if (sContent.isEmpty())
{
sContent = __INFO_WINDOW_CONTENT;
}
// CSS
sCss = "body{background-color: rgb(255, 254, 212); color: #151515;}";
sCss += "a{text-decoration: underline; color: #0482FE;}";
// table width ...
sContent = sContent.arg("98%");
sContent = pHtml->htmlPage(sContent, tr("Order Info"), sCss);
// add order content ...
pContent->setHtml(sContent);
// make sure browser can be opened ...
pContent->setOpenExternalLinks(true);
// add widget to layout and create new tab ...
pLayout->addWidget(pContent);
pOrderWidgetTab->setLayout(pLayout);
ui->tabWidget->insertTab(0, pOrderWidgetTab, tr("Order Info"));
// set active tab
ui->tabWidget->setCurrentIndex(0);
}
#endif // __INFO_WINDOW_CONTENT
/************************* History ***************************\
| $Log$
\*************************************************************/