forked from alphaonex86/Ultracopier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHelpDialog.cpp
151 lines (136 loc) · 4.57 KB
/
HelpDialog.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
/** \file HelpDialog.cpp
\brief Define the help dialog
\author alpha_one_x86
\version 0.3
\date 2010
\licence GPL3, see the file COPYING */
#include "HelpDialog.h"
#include <QTreeWidgetItem>
#include <QApplication>
/// \brief Construct the object
HelpDialog::HelpDialog() :
ui(new Ui::HelpDialog)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
ui->setupUi(this);
reloadTextValue();
#ifdef ULTRACOPIER_DEBUG
ui->debugView->setModel(DebugModel::debugModel);
connect(ui->pushButtonSaveBugReport,&QPushButton::clicked,DebugEngine::debugEngine,&DebugEngine::saveBugReport);
#else // ULTRACOPIER_DEBUG
ui->lineEditInsertDebug->hide();
ui->debugView->hide();
ui->pushButtonSaveBugReport->hide();
ui->pushButtonCrash->hide();
this->setMaximumSize(QSize(500,128));
/*timeToSetText.setInterval(250);
timeToSetText.setSingleShot(true);
connect(&timeToSetText,QTimer::timeout,this,&DebugEngine::showDebugText);*/
ui->pushButtonClose->hide();
#endif // ULTRACOPIER_DEBUG
//connect the about Qt
connect(ui->pushButtonAboutQt,&QPushButton::toggled,&QApplication::aboutQt);
#ifdef ULTRACOPIER_MODE_SUPERCOPIER
setWindowTitle(tr("About Supercopier"));
#else
setWindowTitle(tr("About Ultracopier"));
#endif
}
/// \brief Destruct the object
HelpDialog::~HelpDialog()
{
delete ui;
}
/// \brief To re-translate the ui
void HelpDialog::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
ui->retranslateUi(this);
reloadTextValue();
break;
default:
break;
}
}
/// \brief To reload the text value
void HelpDialog::reloadTextValue()
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
QString text=ui->label_ultracopier->text();
#ifdef ULTRACOPIER_VERSION_ULTIMATE
text=text.replace(QStringLiteral("%1"),QStringLiteral("Ultimate %1").arg(ULTRACOPIER_VERSION));
#else
text=text.replace(QStringLiteral("%1"),ULTRACOPIER_VERSION);
#endif
#ifdef ULTRACOPIER_MODE_SUPERCOPIER
text=text.replace(QStringLiteral("Ultracopier"),QStringLiteral("Supercopier"),Qt::CaseInsensitive);
#endif
ui->label_ultracopier->setText(text);
text=ui->label_description->text();
#ifdef ULTRACOPIER_VERSION_PORTABLE
#ifdef ULTRACOPIER_VERSION_PORTABLEAPPS
text=text.replace(QStringLiteral("%1"),tr("For http://portableapps.com/"));
#else
#ifdef ULTRACOPIER_PLUGIN_ALL_IN_ONE
text=text.replace(QStringLiteral("%1"),tr("Portable and all in one version"));
#else
text=text.replace(QStringLiteral("%1"),tr("Portable version"));
#endif
#endif
#else
#ifdef ULTRACOPIER_PLUGIN_ALL_IN_ONE
text=text.replace(QStringLiteral("%1"),tr("All in one version"));
#else
text=text.replace(QStringLiteral("%1"),tr("Normal version"));
#endif
#endif
ui->label_description->setText(text);
text=ui->label_site->text();
//: This site need be the official site of ultracopier, into the right languages, english if not exists
text=text.replace(QStringLiteral("%1"),getWebSite());
ui->label_site->setText(text);
text=ui->label_platform->text();
text=text.replace(QStringLiteral("%1"),ULTRACOPIER_PLATFORM_NAME);
ui->label_platform->setText(text);
}
QString HelpDialog::getWebSite()
{
#ifdef ULTRACOPIER_MODE_SUPERCOPIER
return tr("http://ultracopier.first-world.info/")+QStringLiteral("supercopier.html");
#else
return tr("http://ultracopier.first-world.info/");
#endif
}
QString HelpDialog::getUpdateUrl()
{
#if defined(ULTRACOPIER_VERSION_ULTIMATE)
return tr("http://ultracopier.first-world.info/shop.html");
#else
#ifdef ULTRACOPIER_MODE_SUPERCOPIER
return tr("http://ultracopier.first-world.info/")+QStringLiteral("supercopier.html");
#else
return tr("http://ultracopier.first-world.info/download.html");
#endif
#endif
}
#ifdef ULTRACOPIER_DEBUG
void HelpDialog::on_lineEditInsertDebug_returnPressed()
{
DebugEngine::addDebugNote(ui->lineEditInsertDebug->text());
ui->lineEditInsertDebug->clear();
ui->debugView->scrollToBottom();
}
#endif // ULTRACOPIER_DEBUG
void HelpDialog::on_pushButtonAboutQt_clicked()
{
QApplication::aboutQt();
}
void HelpDialog::on_pushButtonCrash_clicked()
{
int a=0;
int *b=NULL;
*b=3/a;
}