From afed56d008df8181fae49675a2c6fc45acd87b16 Mon Sep 17 00:00:00 2001
From: Bill Somerville <g4wjs@classdesign.com>
Date: Sat, 6 Aug 2016 13:52:14 +0000
Subject: [PATCH] Proper splash screen and release notes help menu link

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7007 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
---
 CMakeLists.txt |  1 +
 main.cpp       | 24 +++++++++++++++++++++++-
 mainwindow.cpp | 43 ++++++++++++++++++-------------------------
 mainwindow.h   |  6 +++++-
 mainwindow.ui  | 22 ++++++----------------
 5 files changed, 53 insertions(+), 43 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index dc77cebce..a0e0b1d2b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -607,6 +607,7 @@ set (TOP_LEVEL_RESOURCES
   cty.dat
   icons/Darwin/wsjtx.iconset/icon_128x128.png
   contrib/gpl-v3-logo.svg
+  artwork/splash.png
   )
 
 set (PALETTE_FILES
diff --git a/main.cpp b/main.cpp
index 6ceec5e52..3c966ea00 100644
--- a/main.cpp
+++ b/main.cpp
@@ -19,6 +19,8 @@
 #include <QStringList>
 #include <QLockFile>
 #include <QStack>
+#include <QSplashScreen>
+#include <QPixmap>
 
 #if QT_VERSION >= 0x050200
 #include <QCommandLineParser>
@@ -109,6 +111,26 @@ int main(int argc, char *argv[])
       a.setApplicationVersion (version ());
       bool multiple {false};
 
+      QPixmap splash_pic {":/splash.png"};
+      QSplashScreen splash {splash_pic, Qt::WindowStaysOnTopHint};
+      splash.showMessage ("<h2>" + QString {"Alpha Release: WSJT-X v" +
+        QCoreApplication::applicationVersion() + " " +
+        revision ()}.simplified () + "</h2>"
+        "V1.7 has many new features, most aimed at VHF/UHF/Microwave users.<br />"
+        "Some are not yet described in the User Guide and may not be thoroughly<br />"
+        "tested. The release notes have more details.<br /><br />"
+        "As a test user you have an obligation to report anomalous results<br />"
+        "to the development team.  We are particularly interested in tests<br />"
+        "of experimental modes QRA64 (intended for EME) and MSK144<br />"
+        "(intended for meteor scatter).<br /><br />"
+        "Send reports to wsjtgroup@yahoogroups.com, and be sure to save .wav<br />"
+        "files where appropriate.<br /><br />"
+        "<b>Open the Help menu and select Release Notes for more details.</b><br />"
+        "<img src=\":/icon_128x128.png\" />"
+        "<img src=\":/gpl-v3-logo.svg\" height=\"80\" />", Qt::AlignCenter);
+      splash.show ();
+      a.processEvents ();
+
 #if QT_VERSION >= 0x050200
       QCommandLineParser parser;
       parser.setApplicationDescription ("\nJT65A & JT9 Weak Signal Communications Program.");
@@ -297,7 +319,7 @@ int main(int argc, char *argv[])
           }
 
           // run the application UI
-          MainWindow w(temp_dir, multiple, &multi_settings, &mem_jt9, downSampleFactor, new QNetworkAccessManager {&a});
+          MainWindow w(temp_dir, multiple, &multi_settings, &mem_jt9, downSampleFactor, new QNetworkAccessManager {&a}, &splash);
           w.show();
           QObject::connect (&a, SIGNAL (lastWindowClosed()), &a, SLOT (quit()));
           result = a.exec();
diff --git a/mainwindow.cpp b/mainwindow.cpp
index d6d5a6503..baeeaf355 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -24,6 +24,7 @@
 #include <QToolTip>
 #include <QAction>
 #include <QActionGroup>
+#include <QSplashScreen>
 
 #include "revision_utils.hpp"
 #include "qt_helpers.hpp"
@@ -162,9 +163,10 @@ namespace
 MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
                        MultiSettings * multi_settings, QSharedMemory *shdmem,
                        unsigned downSampleFactor, QNetworkAccessManager * network_manager,
-                       QWidget *parent) :
+                       QSplashScreen * splash, QWidget *parent) :
   QMainWindow(parent),
   m_valid {true},
+  m_splash {splash},
   m_dataDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)},
   m_revision {revision ()},
   m_multiple {multiple},
@@ -859,12 +861,20 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
   connect (&minuteTimer, &QTimer::timeout, this, &MainWindow::on_the_minute);
   minuteTimer.setSingleShot (true);
   minuteTimer.start (ms_minute_error () + 60 * 1000);
-  m_bSplash=true;
+
+  connect (&splashTimer, &QTimer::timeout, this, &MainWindow::splash_done);
+  splashTimer.setSingleShot (true);
+  splashTimer.start (20 * 1000);
 
   // this must be the last statement of constructor
   if (!m_valid) throw std::runtime_error {"Fatal initialization exception"};
 }
 
+void MainWindow::splash_done ()
+{
+  m_splash->close ();
+}
+
 void MainWindow::on_the_minute ()
 {
   if (minuteTimer.isSingleShot ())
@@ -1811,6 +1821,11 @@ void MainWindow::on_stopButton_clicked()                       //stopButton
   }
 }
 
+void MainWindow::on_actionRelease_Notes_triggered ()
+{
+  QDesktopServices::openUrl (QUrl {"http://physics.princeton.edu/pulsar/k1jt/v1.7_Features.txt"});
+}
+
 void MainWindow::on_actionOnline_User_Guide_triggered()      //Display manual
 {
 #if defined (CMAKE_BUILD)
@@ -2549,29 +2564,7 @@ void MainWindow::guiUpdate()
   double txDuration;
   QString rt;
 
-//### TEMPORARY MESSAGE TO USERS ###
-  if(m_bSplash) {
-    MessageBox::information_message (this,
-        "<h2>" + QString {"Alpha Release: WSJT-X v" +
-        QCoreApplication::applicationVersion() + " " +
-        revision ()}.simplified () + "</h2>"
-        "V1.7 has many new features, most aimed at VHF/UHF/Microwave users.<br />"
-         "Some are not yet described in the User Guide and may not be thoroughly<br />"
-        "tested. Click on the link at bottom for a brief description.<br /><br />"
-        "As a test user you have an obligation to report anomalous results<br />"
-        "to the development team.  We are particularly interested in tests<br />"
-        "of experimental modes QRA64 (intended for EME) and MSK144<br />"
-        "(intended for meteor scatter).<br /><br />"
-        "Send reports to wsjtgroup@yahoogroups.com, and be sure to save .wav<br />"
-        "files where appropriate.<br /><br />"
-        "<a href=" WSJTX_STRINGIZE (PROJECT_HOMEPAGE) ">"
-        "<img src=\":/icon_128x128.png\" /></a>"
-        "<a href=\"http://physics.princeton.edu/pulsar/k1jt/v1.7_Features.txt\">"
-        "<img src=\":/gpl-v3-logo.svg\" height=\"80\" /><br />"
-        "http://physics.princeton.edu/pulsar/k1jt/v1.7_Features.txt</a>");
-    m_bSplash=false;
-  }
-//###
+  if (m_splash && m_splash->isVisible ()) m_splash->raise ();
 
   if(m_TRperiod==0) m_TRperiod=60;
   txDuration=0.0;
diff --git a/mainwindow.h b/mainwindow.h
index a46207e35..b56b6abcd 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -91,6 +91,7 @@ public:
   explicit MainWindow(QDir const& temp_directory, bool multiple, MultiSettings *,
                       QSharedMemory *shdmem, unsigned downSampleFactor,
                       QNetworkAccessManager * network_manager,
+                      QSplashScreen *,
                       QWidget *parent = nullptr);
   ~MainWindow();
 
@@ -131,6 +132,7 @@ private slots:
   void on_autoButton_clicked (bool);
   void on_stopTxButton_clicked();
   void on_stopButton_clicked();
+  void on_actionRelease_Notes_triggered ();
   void on_actionOnline_User_Guide_triggered();
   void on_actionLocal_User_Guide_triggered();
   void on_actionWide_Waterfall_triggered();
@@ -251,6 +253,7 @@ private slots:
   void on_cbCQRx_toggled(bool b);
   void on_actionMSK144_triggered();
   void on_actionQRA64_triggered();
+  void splash_done ();
 
 private:
   Q_SIGNAL void initializeAudioOutputStream (QAudioDeviceInfo,
@@ -280,6 +283,7 @@ private:
   void astroUpdate ();
 
   bool m_valid;
+  QSplashScreen * m_splash;
   QDir m_dataDir;
   QString m_revision;
   bool m_multiple;
@@ -412,7 +416,6 @@ private:
   bool    m_bDoubleClickAfterCQnnn;
   bool    m_bRefSpec;
   bool    m_bUseRef;
-  bool    m_bSplash;
   float   m_pctZap;
   int			m_ihsym;
   int			m_nzap;
@@ -461,6 +464,7 @@ private:
   QTimer TxAgainTimer;
   QTimer RxQSYTimer;
   QTimer minuteTimer;
+  QTimer splashTimer;
 
   QString m_path;
   QString m_baseCall;
diff --git a/mainwindow.ui b/mainwindow.ui
index d80bd63a7..24818cca9 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -2,14 +2,6 @@
 <ui version="4.0">
  <class>MainWindow</class>
  <widget class="QMainWindow" name="MainWindow">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>896</width>
-    <height>565</height>
-   </rect>
-  </property>
   <property name="windowTitle">
    <string>WSJT-X   by K1JT</string>
   </property>
@@ -2284,14 +2276,6 @@ QPushButton[state=&quot;ok&quot;] {
    </layout>
   </widget>
   <widget class="QMenuBar" name="menuBar">
-   <property name="geometry">
-    <rect>
-     <x>0</x>
-     <y>0</y>
-     <width>896</width>
-     <height>21</height>
-    </rect>
-   </property>
    <widget class="QMenu" name="menuFile">
     <property name="title">
      <string>File</string>
@@ -2344,6 +2328,7 @@ QPushButton[state=&quot;ok&quot;] {
     <property name="title">
      <string>Help</string>
     </property>
+    <addaction name="actionRelease_Notes"/>
     <addaction name="actionOnline_User_Guide"/>
     <addaction name="actionLocal_User_Guide"/>
     <addaction name="download_samples_action"/>
@@ -2847,6 +2832,11 @@ QPushButton[state=&quot;ok&quot;] {
     <string>QRA64</string>
    </property>
   </action>
+  <action name="actionRelease_Notes">
+   <property name="text">
+    <string>Release Notes</string>
+   </property>
+  </action>
  </widget>
  <layoutdefault spacing="6" margin="11"/>
  <customwidgets>