PageRenderTime 179ms CodeModel.GetById 32ms RepoModel.GetById 1ms app.codeStats 0ms

/hedgewars-src-0.9.17/QTfrontend/ui/widget/about.cpp

#
C++ | 174 lines | 139 code | 16 blank | 19 comment | 4 complexity | bffe36af8b6f129f1f4a90521fbf68d2 MD5 | raw file
Possible License(s): GPL-2.0, BSD-3-Clause
  1. /*
  2. * Hedgewars, a free turn based strategy game
  3. * Copyright (c) 2006-2011 Andrey Korotaev <unC0Rr@gmail.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; version 2 of the License
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  17. */
  18. #include <QGridLayout>
  19. #include <QLabel>
  20. #include <QList>
  21. #include <QUrl>
  22. #include <QRegExp>
  23. #include "hwconsts.h"
  24. #include "SDLInteraction.h"
  25. #include "about.h"
  26. About::About(QWidget * parent) :
  27. QWidget(parent)
  28. {
  29. QGridLayout *mainLayout = new QGridLayout(this);
  30. QLabel *imageLabel = new QLabel;
  31. QImage image(":/res/Hedgehog.png");
  32. imageLabel->setPixmap(QPixmap::fromImage(image));
  33. imageLabel->setScaledContents(true);
  34. imageLabel->setMinimumWidth(2.8);
  35. imageLabel->setMaximumWidth(280);
  36. imageLabel->setMinimumHeight(30);
  37. imageLabel->setMaximumHeight(300);
  38. mainLayout->addWidget(imageLabel, 0, 0, 2, 1);
  39. QLabel *lbl1 = new QLabel(this);
  40. lbl1->setOpenExternalLinks(true);
  41. lbl1->setText(
  42. "<style type=\"text/css\">"
  43. "a { color: #ffcc00; }"
  44. // "a:hover { color: yellow; }"
  45. "</style>"
  46. "<div align=\"center\"><h1>Hedgewars</h1>"
  47. "<h3>" + QLabel::tr("Version") + " " + *cVersionString + "</h3>"
  48. "<p><a href=\"http://www.hedgewars.org/\">http://www.hedgewars.org/</a></p><br>" +
  49. QLabel::tr("This program is distributed under the GNU General Public License v2") +
  50. "</div>"
  51. );
  52. lbl1->setWordWrap(true);
  53. mainLayout->addWidget(lbl1, 0, 1);
  54. lbl2 = new QTextBrowser(this);
  55. lbl2->setOpenExternalLinks(true);
  56. lbl2->setText(
  57. "<style type=\"text/css\">"
  58. "a { color: #ffcc00; }"
  59. // "a:hover { color: yellow; }"
  60. "</style>" +
  61. QString("<h2>") +
  62. QLabel::tr("Developers:") +
  63. "</h2><p>"
  64. "Engine, frontend, net server: Andrey Korotaev &lt;<a href=\"mailto:unC0Rr@gmail.com\">unC0Rr@gmail.com</a>&gt;<br>"
  65. "Many frontend improvements: Igor Ulyanov &lt;<a href=\"mailto:disinbox@gmail.com\">disinbox@gmail.com</a>&gt;<br>"
  66. "Many engine and frontend improvements: Derek Pomery &lt;<a href=\"mailto:nemo@m8y.org\">nemo@m8y.org</a>&gt;<br>"
  67. "Drill rocket, Ballgun, RC Plane weapons: Martin Boze &lt;<a href=\"mailto:afffect@gmail.com\">afffect@gmail.com</a>&gt;<br>"
  68. "Mine number and time game settings: David A. Cuadrado &lt;<a href=\"mailto:krawek@gmail.com\">krawek@gmail.com</a>&gt;<br>"
  69. "Frontend improvements: Martin Minarik &lt;<a href=\"mailto:ttsmj@pokec.sk\">ttsmj@pokec.sk</a>&gt;<br>"
  70. "Frontend improvements: Kristian Lehmann &lt;<a href=\"mailto:email@thexception.net\">email@thexception.net</a>&gt;<br>"
  71. "Mac OS X/iPhone port, OpenGL-ES conversion: Vittorio Giovara &lt;<a href=\"mailto:vittorio.giovara@gmail.com\">vittorio.giovara@gmail.com</a>&gt;<br>"
  72. "Many engine and frontend improvements (and bugs): Richard Karolyi &lt;<a href=\"mailto:sheepluva@" "ercatec.net\">sheepluva@" "ercatec.net</a>&gt;<br>"
  73. "Gamepad and Lua integration: Mario Liebisch &lt;<a href=\"mailto:mario.liebisch@gmail.com\">mario.liebisch@gmail.com</a>&gt;<br>"
  74. "Many engine improvements and graphics: Carlos Vives &lt;<a href=\"mailto:mail@carlosvives.es\">mail@carlosvives.es</a>&gt;<br>"
  75. "Maze maps: Henning K&uuml;hn &lt;<a href=\"mailto:prg@cooco.de\">prg@cooco.de</a>&gt;<br>"
  76. "Engine and frontend improvements: Henrik Rostedt &lt;<a href=\"mailto:henrik.rostedt@gmail.com\">henrik.rostedt@gmail.com</a>&gt;<br>"
  77. "Lua game modes and missions: John Lambert &lt;<a href=\"mailto:redgrinner@gmail.com\">redgrinner@gmail.com</a>&gt;<br>"
  78. "Frontend improvements: Mayur Pawashe &lt;<a href=\"mailto:zorgiepoo@gmail.com\">zorgiepoo@gmail.com</a>&gt;<br>"
  79. "Android port: Richard Deurwaarder &lt;<a href=\"mailto:xeli@xelification.com\">xeli@xelification.com</a>&gt;<br>"
  80. "</p><h2>" +
  81. QLabel::tr("Art:") + "</h2>"
  82. + QString::fromUtf8(
  83. "<p>John Dum &lt;<a href=\"mailto:fizzy@gmail.com\">fizzy@gmail.com</a>&gt;"
  84. "<br>"
  85. "Joshua Frese &lt;<a href=\"mailto:joshfrese@gmail.com\">joshfrese@gmail.com</a>&gt;"
  86. "<br>"
  87. "Stanko Tadi? &lt;<a href=\"mailto:stanko@mfhinc.net\">stanko@mfhinc.net</a>&gt;"
  88. "<br>"
  89. "Julien Koesten &lt;<a href=\"mailto:julienkoesten@aol.com\">julienkoesten@aol.com</a>&gt;"
  90. "<br>"
  91. "Joshua O'Sullivan &lt;<a href=\"mailto:coheedftw@hotmail.co.uk\">coheedftw@hotmail.co.uk</a>&gt;"
  92. "<br>"
  93. "Nils Lück &lt;<a href=\"mailto:nils.luck.design@gmail.com\">nils.luck.design@gmail.com</a>&gt;"
  94. "<br>"
  95. "Guillaume Englert &lt;<a href=\"mailto:genglert@hybird.org\">genglert@hybird.org</a>&gt;"
  96. "<br>"
  97. "Hats: Trey Perry &lt;<a href=\"mailto:tx.perry.j@gmail.com\">tx.perry.j@gmail.com</a>&gt;"
  98. "</p><h2>") +
  99. QLabel::tr("Sounds:") + "</h2>"
  100. "Hedgehogs voice: Stephen Alexander &lt;<a href=\"mailto:ArmagonNo1@gmail.com\">ArmagonNo1@gmail.com</a>&gt;"
  101. "<br>"
  102. "John Dum &lt;<a href=\"mailto:fizzy@gmail.com\">fizzy@gmail.com</a>&gt;"
  103. "<br>"
  104. "Jonatan Nilsson &lt;<a href=\"mailto:jonatanfan@gmail.com\">jonatanfan@gmail.com</a>&gt;"
  105. "<br>"
  106. "Daniel Martin &lt;<a href=\"mailto:elhombresinremedio@gmail.com\">elhombresinremedio@gmail.com</a>&gt;"
  107. "</p><h2>" +
  108. QLabel::tr("Translations:") + "</h2><p>"
  109. + QString::fromUtf8(
  110. "Brazilian Portuguese: Romulo Fernandes Machado &lt;<a href=\"mailto:abra185@gmail.com\">abra185@gmail.com</a>&gt;<br>"
  111. "Bulgarian: Svetoslav Stefanov<br>"
  112. "Czech: Petr ?ezá?ek &lt;<a href=\"mailto:rezacek@gmail.com\">rezacek@gmail.com</a>&gt;<br>"
  113. "Chinese: Jie Luo &lt;<a href=\"mailto:lililjlj@gmail.com\">lililjlj@gmail.com</a>&gt;<br>"
  114. "English: Andrey Korotaev &lt;<a href=\"mailto:unC0Rr@gmail.com\">unC0Rr@gmail.com</a>&gt;<br>"
  115. "Finnish: Nina Kuisma &lt;<a href=\"mailto:ninnnu@gmail.com\">ninnnu@gmail.com</a>&gt;<br>"
  116. "French: Antoine Turmel &lt;<a href=\"mailto:geekshadow@gmail.com\">geekshadow@gmail.com</a>&gt;<br>"
  117. "German: Peter Hüwe &lt;<a href=\"mailto:PeterHuewe@gmx.de\">PeterHuewe@gmx.de</a>&gt;, Mario Liebisch &lt;<a href=\"mailto:mario.liebisch@gmail.com\">mario.liebisch@gmail.com</a>&gt;, Richard Karolyi &lt;<a href=\"mailto:sheepluva@" "ercatec.net\">sheepluva@" "ercatec.net</a>&gt;<br>"
  118. "Greek: &lt;<a href=\"mailto:talos_kriti@yahoo.gr\">talos_kriti@yahoo.gr</a>&gt;<br>"
  119. "Italian: Luca Bonora &lt;<a href=\"mailto:bonora.luca@gmail.com\">bonora.luca@gmail.com</a>&gt;, Marco Bresciani<br>"
  120. "Japanese: ADAM Etienne &lt;<a href=\"mailto:etienne.adam@gmail.com\">etienne.adam@gmail.com</a>&gt;<br>"
  121. "Korean: Anthony Bellew &lt;<a href=\"mailto:webmaster@anthonybellew.com\">webmaster@anthonybellew.com</a>&gt;<br>"
  122. "Lithuanian: Lukas Urbonas &lt;<a href=\"mailto:lukasu08@gmail.com\">lukasu08@gmail.com</a>&gt;<br>"
  123. "Polish: Maciej Mrozi?ski &lt;<a href=\"mailto:mynick2@o2.pl\">mynick2@o2.pl</a>&gt;, Wojciech Latkowski &lt;<a href=\"mailto:magik17l@gmail.com\">magik17l@gmail.com</a>&gt;, Piotr Mitana, Maciej Górny<br>"
  124. "Portuguese: Fábio Canário &lt;<a href=\"mailto:inufabie@gmail.com\">inufabie@gmail.com</a>&gt;<br>"
  125. "Russian: Andrey Korotaev &lt;<a href=\"mailto:unC0Rr@gmail.com\">unC0Rr@gmail.com</a>&gt;<br>"
  126. "Slovak: Jose Riha<br>"
  127. "Spanish: Carlos Vives &lt;<a href=\"mailto:mail@carlosvives.es\">mail@carlosvives.es</a>&gt;<br>"
  128. "Swedish: Niklas Grahn &lt;<a href=\"mailto:raewolusjoon@yaoo.com\">raewolusjoon@yaoo.com</a>&gt;, Henrik Rostedt &lt;<a href=\"mailto:henrik.rostedt@gmail.com\">henrik.rostedt@gmail.com</a>&gt;<br>"
  129. "Ukrainian: Eugene V. Lyubimkin &lt;<a href=\"mailto:jackyf.devel@gmail.com\">jackyf.devel@gmail.com</a>&gt;, Igor Paliychuk &lt;<a href=\"mailto:mansonigor@gmail.com\">mansonigor@gmail.com</a>&gt;, Eugene Sakara &lt;<a href=\"mailto:eresid@gmail.com\">eresid@gmail.com</a>&gt;"
  130. "</p><h2>") +
  131. QLabel::tr("Special thanks:") + "</h2><p>"
  132. "Aleksey Andreev &lt;<a href=\"mailto:blaknayabr@gmail.com\">blaknayabr@gmail.com</a>&gt;<br>"
  133. "Aleksander Rudalev &lt;<a href=\"mailto:alexv@pomorsu.ru\">alexv@pomorsu.ru</a>&gt;<br>"
  134. "Natasha Korotaeva &lt;<a href=\"mailto:layout@pisem.net\">layout@pisem.net</a>&gt;<br>"
  135. "Adam Higerd (aka ahigerd at FreeNode)"
  136. "</p>"
  137. );
  138. mainLayout->addWidget(lbl2, 1, 1);
  139. setAcceptDrops(true);
  140. }
  141. void About::dragEnterEvent(QDragEnterEvent * event)
  142. {
  143. if (event->mimeData()->hasUrls())
  144. {
  145. QList<QUrl> urls = event->mimeData()->urls();
  146. QString url = urls[0].toString();
  147. if (urls.count() == 1)
  148. if (url.contains(QRegExp("^file://.*\\.ogg$")))
  149. event->acceptProposedAction();
  150. }
  151. }
  152. void About::dropEvent(QDropEvent * event)
  153. {
  154. QString file =
  155. event->mimeData()->urls()[0].toString().remove(QRegExp("^file://"));
  156. SDLInteraction::instance().setMusicTrack(file);
  157. event->acceptProposedAction();
  158. }