Add help button in main menu (opens Hedgewars Wiki in browser)
authorWuzzy <Wuzzy2@mail.ru>
Sun, 30 Sep 2018 03:18:16 +0200
changeset 13818 a8fd5490932f
parent 13817 419de2dea82b
child 13819 db1b680bd8d3
Add help button in main menu (opens Hedgewars Wiki in browser) Might be replaced with an offline help in later versions (see bug #660).
ChangeLog.txt
QTfrontend/hedgewars.qrc
QTfrontend/hwform.cpp
QTfrontend/hwform.h
QTfrontend/res/Help.png
QTfrontend/ui/page/pagemain.cpp
QTfrontend/ui/page/pagemain.h
--- a/ChangeLog.txt	Sun Sep 30 01:41:12 2018 +0200
+++ b/ChangeLog.txt	Sun Sep 30 03:18:16 2018 +0200
@@ -41,6 +41,7 @@
  + Add setting to disable audio dampening when losing window focus
  + Rework player rankings: Losing clans are now ranked in the reverse order they died
  + Add-ons now support preview images for campaign missions
+ + Add help button in main menu (link to Hedgewars Wiki)
  * Fix player rankings on round draw: Clans that died in the same turn now have the same rank
  * Fix rare crash when aborting video encoding in progress
  * Fix critical failure to cleanup teams list after rejoining game under certain conditions
--- a/QTfrontend/hedgewars.qrc	Sun Sep 30 01:41:12 2018 +0200
+++ b/QTfrontend/hedgewars.qrc	Sun Sep 30 03:18:16 2018 +0200
@@ -57,6 +57,7 @@
         <file>res/audio.png</file>
         <file>res/camera.png</file>
         <file>res/Settings.png</file>
+        <file>res/Help.png</file>
         <file>res/dropdown.png</file>
         <file>res/dropdown_disabled.png</file>
         <file>res/dropdown_selected.png</file>
--- a/QTfrontend/hwform.cpp	Sun Sep 30 01:41:12 2018 +0200
+++ b/QTfrontend/hwform.cpp	Sun Sep 30 03:18:16 2018 +0200
@@ -246,6 +246,7 @@
     connect(ui.pageMain->BtnDataDownload, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
     pageSwitchMapper->setMapping(ui.pageMain->BtnDataDownload, ID_PAGE_DATADOWNLOAD);
 
+    connect(ui.pageMain->BtnHelp, SIGNAL(clicked()), this, SLOT(GoToHelp()));
 
 #ifdef VIDEOREC
     connect(ui.pageMain->BtnVideos, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
@@ -641,6 +642,13 @@
     GoToPage(ID_PAGE_SCHEME);
 }
 
+void HWForm::GoToHelp()
+{
+    // For now just opens the Hedgewars Wiki in external browser.
+    // TODO: Replace this with an offline help someday (bug 660).
+    QDesktopServices::openUrl(QUrl("https://hedgewars.org/wiki"));
+}
+
 void HWForm::GoToVideos()
 {
     GoToPage(ID_PAGE_VIDEOS);
--- a/QTfrontend/hwform.h	Sun Sep 30 01:41:12 2018 +0200
+++ b/QTfrontend/hwform.h	Sun Sep 30 03:18:16 2018 +0200
@@ -75,6 +75,7 @@
         void GoToSaves();
         void GoToDemos();
         void GoToNet();
+        void GoToHelp();
         void GoToEditWeapons();
         void GoToNewWeapons();
         void GoToWeapons(int index);
Binary file QTfrontend/res/Help.png has changed
--- a/QTfrontend/ui/page/pagemain.cpp	Sun Sep 30 01:41:12 2018 +0200
+++ b/QTfrontend/ui/page/pagemain.cpp	Sun Sep 30 03:18:16 2018 +0200
@@ -113,7 +113,10 @@
     BtnVideos->setWhatsThis(tr("Manage videos recorded from game"));
 #endif
 
-    BtnSetup = addButton(":/res/Settings.png", bottomLayout, 2, true, Qt::AlignBottom);
+    BtnHelp = addButton(":/res/Help.png", bottomLayout, 2, true, Qt::AlignBottom);
+    BtnHelp->setWhatsThis(tr("Open the Hedgewars online game manual in your web browser"));
+
+    BtnSetup = addButton(":/res/Settings.png", bottomLayout, 3, true, Qt::AlignBottom);
     BtnSetup->setWhatsThis(tr("Edit game preferences"));
 
     return bottomLayout;
--- a/QTfrontend/ui/page/pagemain.h	Sun Sep 30 01:41:12 2018 +0200
+++ b/QTfrontend/ui/page/pagemain.h	Sun Sep 30 03:18:16 2018 +0200
@@ -40,6 +40,7 @@
         QPushButton * BtnInfo;
         QPushButton * BtnDataDownload;
         QPushButton * BtnVideos;
+        QPushButton * BtnHelp;
         QLabel * mainNote;
 
     private: