5
5
#include < QJsonDocument>
6
6
#include < QJsonObject>
7
7
8
+ #include < QEvent>
8
9
#include < QIcon>
9
10
#include < QDialogButtonBox>
10
11
#include < QVBoxLayout>
17
18
FBAboutDialog::FBAboutDialog (QWidget *parent)
18
19
: QDialog(parent)
19
20
{
21
+ retranslateUi ();
22
+
20
23
QIcon icon{QStringLiteral (" :/icons/resources/org.firebird-emus.firebird-emu.png" )};
21
24
iconLabel.setPixmap (icon.pixmap (icon.actualSize (QSize{64 , 64 })));
22
25
23
- setWindowTitle (tr (" About Firebird" ));
24
- header.setText (tr (" <h3>Firebird %1</h3>"
25
- " <a href='https://github.com/nspire-emus/firebird'>On GitHub</a>" ).arg (QStringLiteral (STRINGIFY (FB_VERSION))));
26
26
header.setTextInteractionFlags (Qt::TextBrowserInteraction);
27
27
header.setOpenExternalLinks (true );
28
28
29
- update.setText (tr (" Checking for update" ));
30
29
update.setTextInteractionFlags (Qt::TextBrowserInteraction);
31
30
update.setOpenExternalLinks (true );
32
31
33
- authors.setText (tr ( " Authors:<br>"
34
- " Fabian Vogt (<a href='https://github.com/Vogtinator'>Vogtinator</a>)<br>"
35
- " Adrien Bertrand (<a href='https://github.com/adriweb'>Adriweb</a>)<br>"
36
- " Antonio Vasquez (<a href='https://github.com/antoniovazquezblanco'>antoniovazquezblanco</a>)<br>"
37
- " Lionel Debroux (<a href='https://github.com/debrouxl'>debrouxl</a>)<br>"
38
- " Denis Avashurov (<a href='https://github.com/denisps'>denisps</a>)<br>"
39
- " Based on nspire_emu v0.70 by Goplat<br><br>"
40
- " This work is licensed under the GPLv3.<br>"
41
- " To view a copy of this license, visit <a href='https://www.gnu.org/licenses/gpl-3.0.html'>https://www.gnu.org/licenses/gpl-3.0.html</a>" ));
42
32
authors.setTextInteractionFlags (Qt::TextBrowserInteraction);
43
33
authors.setOpenExternalLinks (true );
44
34
45
- auto *okButton = new QPushButton (tr (" Ok" ));
46
- connect (okButton, SIGNAL (clicked (bool )), this , SLOT (close ()));
47
- okButton->setDefault (true );
35
+ connect (&okButton, SIGNAL (clicked (bool )), this , SLOT (close ()));
36
+ okButton.setDefault (true );
48
37
49
- updateButton.setText (tr (" Check for Update" ));
50
38
updateButton.setAutoDefault (false );
51
39
connect (&updateButton, SIGNAL (clicked (bool )), this , SLOT (checkForUpdate ()));
52
40
53
41
auto *buttonBox = new QDialogButtonBox (Qt::Horizontal);
54
- buttonBox->addButton (okButton, QDialogButtonBox::AcceptRole);
42
+ buttonBox->addButton (& okButton, QDialogButtonBox::AcceptRole);
55
43
buttonBox->addButton (&updateButton, QDialogButtonBox::ActionRole);
56
44
57
45
auto *layout = new QVBoxLayout;
@@ -65,6 +53,40 @@ FBAboutDialog::FBAboutDialog(QWidget *parent)
65
53
hlayout->addLayout (layout);
66
54
}
67
55
56
+ void FBAboutDialog::changeEvent (QEvent* event)
57
+ {
58
+ if (event->type () == QEvent::LanguageChange)
59
+ retranslateUi ();
60
+
61
+ QDialog::changeEvent (event);
62
+ }
63
+
64
+ void FBAboutDialog::retranslateUi ()
65
+ {
66
+ setWindowTitle (tr (" About Firebird" ));
67
+ header.setText (tr (" <h3>Firebird %1</h3>"
68
+ " <a href='https://github.com/nspire-emus/firebird'>On GitHub</a>" ).arg (QStringLiteral (STRINGIFY (FB_VERSION))));
69
+
70
+ authors.setText (tr ( " Authors:<br>"
71
+ " Fabian Vogt (<a href='https://github.com/Vogtinator'>Vogtinator</a>)<br>"
72
+ " Adrien Bertrand (<a href='https://github.com/adriweb'>Adriweb</a>)<br>"
73
+ " Antonio Vasquez (<a href='https://github.com/antoniovazquezblanco'>antoniovazquezblanco</a>)<br>"
74
+ " Lionel Debroux (<a href='https://github.com/debrouxl'>debrouxl</a>)<br>"
75
+ " Denis Avashurov (<a href='https://github.com/denisps'>denisps</a>)<br>"
76
+ " Based on nspire_emu v0.70 by Goplat<br><br>"
77
+ " This work is licensed under the GPLv3.<br>"
78
+ " To view a copy of this license, visit <a href='https://www.gnu.org/licenses/gpl-3.0.html'>https://www.gnu.org/licenses/gpl-3.0.html</a>" ));
79
+
80
+ update.setText (tr (" Checking for update" ));
81
+
82
+ okButton.setText (tr (" Ok" ));
83
+ updateButton.setText (tr (" Check for Update" ));
84
+
85
+ // If necessary, refresh the status text. Easiest way is to just check again.
86
+ if (isVisible () || checkSuccessful)
87
+ QTimer::singleShot (0 , this , SLOT (checkForUpdate ()));
88
+ }
89
+
68
90
void FBAboutDialog::checkForUpdate ()
69
91
{
70
92
updateButton.setDisabled (true );
0 commit comments