# HG changeset patch
# User Wuzzy <Wuzzy2@mail.ru>
# Date 1538270296 -7200
# Node ID a8fd5490932fdd43a9decd667d1f288037dcad98
# Parent  419de2dea82b586d604b4b2e9d6cfb60ce697b92
Add help button in main menu (opens Hedgewars Wiki in browser)

Might be replaced with an offline help in later versions (see bug 660).

diff -r 419de2dea82b -r a8fd5490932f ChangeLog.txt
--- 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
diff -r 419de2dea82b -r a8fd5490932f QTfrontend/hedgewars.qrc
--- 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>
diff -r 419de2dea82b -r a8fd5490932f QTfrontend/hwform.cpp
--- 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);
diff -r 419de2dea82b -r a8fd5490932f QTfrontend/hwform.h
--- 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);
diff -r 419de2dea82b -r a8fd5490932f QTfrontend/res/Help.png
Binary file QTfrontend/res/Help.png has changed
diff -r 419de2dea82b -r a8fd5490932f QTfrontend/ui/page/pagemain.cpp
--- 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;
diff -r 419de2dea82b -r a8fd5490932f QTfrontend/ui/page/pagemain.h
--- 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: