From f27eccbf8ec2fbb46d8c80199187beb401f75f3c Mon Sep 17 00:00:00 2001
From: Joe Taylor <k1jt@arrl.org>
Date: Tue, 1 May 2018 18:27:59 +0000
Subject: [PATCH] Don't allow Fox mode in any of the default FT8 sub-bands.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8647 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
---
 mainwindow.cpp | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/mainwindow.cpp b/mainwindow.cpp
index 74345a233..24b8deb3c 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -3266,7 +3266,6 @@ void MainWindow::guiUpdate()
     if ((onAirFreq > 10139900 and onAirFreq < 10140320) and
         !m_mode.startsWith ("WSPR")) {
       m_bTxTime=false;
-//      if (m_tune) stop_tuning ();
       if (m_auto) auto_tx_mode (false);
       if(onAirFreq!=m_onAirFreq0) {
         m_onAirFreq0=onAirFreq;
@@ -3283,6 +3282,29 @@ void MainWindow::guiUpdate()
       }
     }
 
+    if(m_mode=="FT8" and m_config.bFox()) {
+// Don't allow Fox mode in any of the default FT8 sub-bands.
+      qint32 ft8Freq[]={1840,3573,7074,10136,14074,18100,21074,24915,28074,50313,70100};
+      for(int i=0; i<11; i++) {
+        int kHzdiff=m_freqNominal/1000 - ft8Freq[i];
+        if(qAbs(kHzdiff) < 4) {
+          m_bTxTime=false;
+          if (m_auto) auto_tx_mode (false);
+          auto const& message = tr ("Please choose another dial frequency."
+                                    " WSJT-X will not operate in Fox mode"
+                                    " in the standard FT8 sub-bands.");
+#if QT_VERSION >= 0x050400
+          QTimer::singleShot (0, [=] {               // don't block guiUpdate
+            MessageBox::warning_message (this, tr ("Fox Mode warning"), message);
+          });
+#else
+          MessageBox::warning_message (this, tr ("Fox Mode warning"), message);
+#endif
+          break;
+        }
+      }
+    }
+
     if (m_config.watchdog() && !m_mode.startsWith ("WSPR")
         && m_idleMinutes >= m_config.watchdog ()) {
       tx_watchdog (true);       // disable transmit