From b5a045c63b61ce9f747ea261d3442b3aa7d453a6 Mon Sep 17 00:00:00 2001
From: Joe Taylor <joe@princeton.edu>
Date: Fri, 27 Jan 2023 10:55:04 -0500
Subject: [PATCH] Implement an option for temporary manual rig control. Useful
 for CW EME ??

---
 widgets/mainwindow.cpp | 13 ++++++++++++-
 widgets/mainwindow.ui  | 11 ++++++++---
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp
index 6e4c84597..d4ad1b6f5 100644
--- a/widgets/mainwindow.cpp
+++ b/widgets/mainwindow.cpp
@@ -1075,6 +1075,8 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
   ui->labDXped->setVisible(SpecOp::NONE != m_specOp);
   ui->labDXped->setStyleSheet("QLabel {background-color: red; color: white;}");
   ui->pbBestSP->setVisible(m_mode=="FT4");
+  ui->readFreq->setEnabled(true);            //To enable manual rig-control option
+
 
 // this must be the last statement of constructor
   if (!m_valid) throw std::runtime_error {"Fatal initialization exception"};
@@ -7795,6 +7797,15 @@ void MainWindow::on_readFreq_clicked()
 {
   if (m_transmitting) return;
 
+// CTRL+click on the rig-mode button to allow temporary manual rig control.
+  bool b=QApplication::keyboardModifiers().testFlag(Qt::ControlModifier);
+  if(b and m_config.is_transceiver_online()) {
+      m_config.transceiver_offline();
+      update_dynamic_property (ui->readFreq, "state", "manual");
+      ui->readFreq->setText("M");
+      return;
+  }
+
   if (m_config.transceiver_online ())
     {
       m_config.sync_transceiver (true, true);
@@ -7934,7 +7945,7 @@ void MainWindow::handle_transceiver_update (Transceiver::TransceiverState const&
 
   displayDialFrequency ();
   update_dynamic_property (ui->readFreq, "state", "ok");
-  ui->readFreq->setEnabled (false);
+//  ui->readFreq->setEnabled (false);    //Leave it enabled to allow Manual rig control option
   ui->readFreq->setText (s.split () ? "S" : "");
 }
 
diff --git a/widgets/mainwindow.ui b/widgets/mainwindow.ui
index e5ed6cefe..e1a250cb6 100644
--- a/widgets/mainwindow.ui
+++ b/widgets/mainwindow.ui
@@ -42,6 +42,7 @@
           <property name="font">
            <font>
             <pointsize>10</pointsize>
+            <weight>50</weight>
             <bold>false</bold>
            </font>
           </property>
@@ -185,6 +186,7 @@
           <property name="font">
            <font>
             <pointsize>10</pointsize>
+            <weight>50</weight>
             <bold>false</bold>
            </font>
           </property>
@@ -3100,10 +3102,10 @@ QLabel[oob=&quot;true&quot;] {
               <bool>false</bool>
              </property>
              <property name="toolTip">
-              <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If orange or red there has been a rig control failure, click to reset and read the dial frequency.  S implies split mode.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+              <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If orange or red there has been a rig control failure, click to reset and read the dial frequency. S implies split mode.  CTRL-click for temporary manual rig control, signified by yellow.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
              </property>
              <property name="accessibleDescription">
-              <string>If orange or red there has been a rig control failure, click to reset and read the dial frequency. S implies split mode.</string>
+              <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If orange or red there has been a rig control failure, click to reset and read the dial frequency. S implies split mode. CTRL-click for temporary manual rig control, signified by yellow.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
              </property>
              <property name="styleSheet">
               <string notr="true">QPushButton {
@@ -3127,6 +3129,9 @@ QPushButton[state=&quot;error&quot;] {
 QPushButton[state=&quot;warning&quot;] {
  background-color: orange;
 }
+QPushButton[state=&quot;manual&quot;] {
+ background-color: yellow;
+}
 QPushButton[state=&quot;ok&quot;] {
  background-color: #00ff00;
 }</string>
@@ -3151,7 +3156,7 @@ QPushButton[state=&quot;ok&quot;] {
      <x>0</x>
      <y>0</y>
      <width>880</width>
-     <height>22</height>
+     <height>21</height>
     </rect>
    </property>
    <widget class="QMenu" name="menuFile">