mirror of
				https://github.com/saitohirga/WSJT-X.git
				synced 2025-11-04 05:50:31 -05:00 
			
		
		
		
	Work in progress on the ActiveStations window.
This commit is contained in:
		
							parent
							
								
									38e65b747a
								
							
						
					
					
						commit
						e732c5ba62
					
				@ -47,11 +47,8 @@ void ActiveStations::setContentFont(QFont const& font)
 | 
				
			|||||||
  cursor.mergeCharFormat (charFormat);
 | 
					  cursor.mergeCharFormat (charFormat);
 | 
				
			||||||
  cursor.clearSelection ();
 | 
					  cursor.clearSelection ();
 | 
				
			||||||
  cursor.movePosition (QTextCursor::End);
 | 
					  cursor.movePosition (QTextCursor::End);
 | 
				
			||||||
 | 
					 | 
				
			||||||
  // position so viewport scrolled to left
 | 
					 | 
				
			||||||
  cursor.movePosition (QTextCursor::Up);
 | 
					  cursor.movePosition (QTextCursor::Up);
 | 
				
			||||||
  cursor.movePosition (QTextCursor::StartOfLine);
 | 
					  cursor.movePosition (QTextCursor::StartOfLine);
 | 
				
			||||||
 | 
					 | 
				
			||||||
  ui->ActiveStationsPlainTextEdit->setTextCursor (cursor);
 | 
					  ui->ActiveStationsPlainTextEdit->setTextCursor (cursor);
 | 
				
			||||||
  ui->ActiveStationsPlainTextEdit->ensureCursorVisible ();
 | 
					  ui->ActiveStationsPlainTextEdit->ensureCursorVisible ();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -60,15 +57,34 @@ void ActiveStations::read_settings ()
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  SettingsGroup group {settings_, "ActiveStations"};
 | 
					  SettingsGroup group {settings_, "ActiveStations"};
 | 
				
			||||||
  restoreGeometry (settings_->value ("window/geometry").toByteArray ());
 | 
					  restoreGeometry (settings_->value ("window/geometry").toByteArray ());
 | 
				
			||||||
 | 
					  ui->sbMaxRecent->setValue(settings_->value("MaxRecent",10).toInt());
 | 
				
			||||||
 | 
					  ui->sbMaxAge->setValue(settings_->value("MaxAge",10).toInt());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ActiveStations::write_settings ()
 | 
					void ActiveStations::write_settings ()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  SettingsGroup group {settings_, "ActiveStations"};
 | 
					  SettingsGroup group {settings_, "ActiveStations"};
 | 
				
			||||||
  settings_->setValue ("window/geometry", saveGeometry ());
 | 
					  settings_->setValue ("window/geometry", saveGeometry ());
 | 
				
			||||||
 | 
					  settings_->setValue("MaxRecent",ui->sbMaxRecent->value());
 | 
				
			||||||
 | 
					  settings_->setValue("MaxAge",ui->sbMaxAge->value());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ActiveStations::displayActiveStations(QString const& t)
 | 
					void ActiveStations::displayActiveStations(QString const& t)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  ui->ActiveStationsPlainTextEdit->setPlainText(t);
 | 
					  ui->ActiveStationsPlainTextEdit->setPlainText(t);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void ActiveStations::displayRecentStations(QString const& t)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  ui->RecentStationsPlainTextEdit->setPlainText(t);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int ActiveStations::maxRecent()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  return ui->sbMaxRecent->value();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int ActiveStations::maxAge()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  return ui->sbMaxAge->value();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -20,7 +20,10 @@ public:
 | 
				
			|||||||
  explicit ActiveStations(QSettings *, QFont const&, QWidget * parent = 0);
 | 
					  explicit ActiveStations(QSettings *, QFont const&, QWidget * parent = 0);
 | 
				
			||||||
  ~ActiveStations();
 | 
					  ~ActiveStations();
 | 
				
			||||||
  void displayActiveStations(QString const&);
 | 
					  void displayActiveStations(QString const&);
 | 
				
			||||||
 | 
					  void displayRecentStations(QString const&);
 | 
				
			||||||
  void changeFont (QFont const&);
 | 
					  void changeFont (QFont const&);
 | 
				
			||||||
 | 
					  int  maxRecent();
 | 
				
			||||||
 | 
					  int  maxAge();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
  void read_settings ();
 | 
					  void read_settings ();
 | 
				
			||||||
 | 
				
			|||||||
@ -18,11 +18,27 @@
 | 
				
			|||||||
    <layout class="QGridLayout" name="gridLayout">
 | 
					    <layout class="QGridLayout" name="gridLayout">
 | 
				
			||||||
     <item row="1" column="0">
 | 
					     <item row="1" column="0">
 | 
				
			||||||
      <widget class="QPlainTextEdit" name="ActiveStationsPlainTextEdit">
 | 
					      <widget class="QPlainTextEdit" name="ActiveStationsPlainTextEdit">
 | 
				
			||||||
 | 
					       <property name="sizePolicy">
 | 
				
			||||||
 | 
					        <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
 | 
				
			||||||
 | 
					         <horstretch>0</horstretch>
 | 
				
			||||||
 | 
					         <verstretch>2</verstretch>
 | 
				
			||||||
 | 
					        </sizepolicy>
 | 
				
			||||||
 | 
					       </property>
 | 
				
			||||||
       <property name="lineWrapMode">
 | 
					       <property name="lineWrapMode">
 | 
				
			||||||
        <enum>QPlainTextEdit::NoWrap</enum>
 | 
					        <enum>QPlainTextEdit::NoWrap</enum>
 | 
				
			||||||
       </property>
 | 
					       </property>
 | 
				
			||||||
      </widget>
 | 
					      </widget>
 | 
				
			||||||
     </item>
 | 
					     </item>
 | 
				
			||||||
 | 
					     <item row="2" column="0">
 | 
				
			||||||
 | 
					      <widget class="QPlainTextEdit" name="RecentStationsPlainTextEdit">
 | 
				
			||||||
 | 
					       <property name="sizePolicy">
 | 
				
			||||||
 | 
					        <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
 | 
				
			||||||
 | 
					         <horstretch>0</horstretch>
 | 
				
			||||||
 | 
					         <verstretch>1</verstretch>
 | 
				
			||||||
 | 
					        </sizepolicy>
 | 
				
			||||||
 | 
					       </property>
 | 
				
			||||||
 | 
					      </widget>
 | 
				
			||||||
 | 
					     </item>
 | 
				
			||||||
     <item row="0" column="0">
 | 
					     <item row="0" column="0">
 | 
				
			||||||
      <widget class="QLabel" name="header_label">
 | 
					      <widget class="QLabel" name="header_label">
 | 
				
			||||||
       <property name="text">
 | 
					       <property name="text">
 | 
				
			||||||
@ -33,6 +49,76 @@
 | 
				
			|||||||
       </property>
 | 
					       </property>
 | 
				
			||||||
      </widget>
 | 
					      </widget>
 | 
				
			||||||
     </item>
 | 
					     </item>
 | 
				
			||||||
 | 
					     <item row="3" column="0">
 | 
				
			||||||
 | 
					      <layout class="QGridLayout" name="gridLayout_2">
 | 
				
			||||||
 | 
					       <item row="0" column="1">
 | 
				
			||||||
 | 
					        <widget class="QSpinBox" name="sbMaxAge">
 | 
				
			||||||
 | 
					         <property name="sizePolicy">
 | 
				
			||||||
 | 
					          <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
 | 
				
			||||||
 | 
					           <horstretch>0</horstretch>
 | 
				
			||||||
 | 
					           <verstretch>0</verstretch>
 | 
				
			||||||
 | 
					          </sizepolicy>
 | 
				
			||||||
 | 
					         </property>
 | 
				
			||||||
 | 
					         <property name="minimumSize">
 | 
				
			||||||
 | 
					          <size>
 | 
				
			||||||
 | 
					           <width>100</width>
 | 
				
			||||||
 | 
					           <height>0</height>
 | 
				
			||||||
 | 
					          </size>
 | 
				
			||||||
 | 
					         </property>
 | 
				
			||||||
 | 
					         <property name="prefix">
 | 
				
			||||||
 | 
					          <string>Max Age  </string>
 | 
				
			||||||
 | 
					         </property>
 | 
				
			||||||
 | 
					         <property name="minimum">
 | 
				
			||||||
 | 
					          <number>4</number>
 | 
				
			||||||
 | 
					         </property>
 | 
				
			||||||
 | 
					         <property name="maximum">
 | 
				
			||||||
 | 
					          <number>10</number>
 | 
				
			||||||
 | 
					         </property>
 | 
				
			||||||
 | 
					         <property name="value">
 | 
				
			||||||
 | 
					          <number>4</number>
 | 
				
			||||||
 | 
					         </property>
 | 
				
			||||||
 | 
					        </widget>
 | 
				
			||||||
 | 
					       </item>
 | 
				
			||||||
 | 
					       <item row="0" column="0">
 | 
				
			||||||
 | 
					        <widget class="QSpinBox" name="sbMaxRecent">
 | 
				
			||||||
 | 
					         <property name="sizePolicy">
 | 
				
			||||||
 | 
					          <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
 | 
				
			||||||
 | 
					           <horstretch>0</horstretch>
 | 
				
			||||||
 | 
					           <verstretch>0</verstretch>
 | 
				
			||||||
 | 
					          </sizepolicy>
 | 
				
			||||||
 | 
					         </property>
 | 
				
			||||||
 | 
					         <property name="minimumSize">
 | 
				
			||||||
 | 
					          <size>
 | 
				
			||||||
 | 
					           <width>100</width>
 | 
				
			||||||
 | 
					           <height>0</height>
 | 
				
			||||||
 | 
					          </size>
 | 
				
			||||||
 | 
					         </property>
 | 
				
			||||||
 | 
					         <property name="prefix">
 | 
				
			||||||
 | 
					          <string>Max Recent  </string>
 | 
				
			||||||
 | 
					         </property>
 | 
				
			||||||
 | 
					         <property name="maximum">
 | 
				
			||||||
 | 
					          <number>20</number>
 | 
				
			||||||
 | 
					         </property>
 | 
				
			||||||
 | 
					         <property name="value">
 | 
				
			||||||
 | 
					          <number>10</number>
 | 
				
			||||||
 | 
					         </property>
 | 
				
			||||||
 | 
					        </widget>
 | 
				
			||||||
 | 
					       </item>
 | 
				
			||||||
 | 
					       <item row="0" column="2">
 | 
				
			||||||
 | 
					        <spacer name="horizontalSpacer">
 | 
				
			||||||
 | 
					         <property name="orientation">
 | 
				
			||||||
 | 
					          <enum>Qt::Horizontal</enum>
 | 
				
			||||||
 | 
					         </property>
 | 
				
			||||||
 | 
					         <property name="sizeHint" stdset="0">
 | 
				
			||||||
 | 
					          <size>
 | 
				
			||||||
 | 
					           <width>40</width>
 | 
				
			||||||
 | 
					           <height>20</height>
 | 
				
			||||||
 | 
					          </size>
 | 
				
			||||||
 | 
					         </property>
 | 
				
			||||||
 | 
					        </spacer>
 | 
				
			||||||
 | 
					       </item>
 | 
				
			||||||
 | 
					      </layout>
 | 
				
			||||||
 | 
					     </item>
 | 
				
			||||||
    </layout>
 | 
					    </layout>
 | 
				
			||||||
   </item>
 | 
					   </item>
 | 
				
			||||||
  </layout>
 | 
					  </layout>
 | 
				
			||||||
 | 
				
			|||||||
@ -3406,12 +3406,14 @@ void MainWindow::ARRL_Digi_Update(DecodedText dt)
 | 
				
			|||||||
    if(bCQ or deGrid=="RR73" or deGrid=="73") rc.ready2call=true;
 | 
					    if(bCQ or deGrid=="RR73" or deGrid=="73") rc.ready2call=true;
 | 
				
			||||||
    rc.decodeTime=m_latestDecodeTime;
 | 
					    rc.decodeTime=m_latestDecodeTime;
 | 
				
			||||||
    m_recentCall[deCall]=rc;
 | 
					    m_recentCall[deCall]=rc;
 | 
				
			||||||
 | 
					    /*
 | 
				
			||||||
    ac=m_activeCall[deCall];
 | 
					    ac=m_activeCall[deCall];
 | 
				
			||||||
    if(rc.ready2call != bCQ) {
 | 
					    if(rc.ready2call != bCQ) {
 | 
				
			||||||
      qDebug() << "aa" << deCall << ac.grid4 << ac.az
 | 
					      qDebug() << "aa" << deCall << ac.grid4 << ac.az
 | 
				
			||||||
               << rc.dialFreq/1000000.0 << rc.audioFreq
 | 
					               << rc.dialFreq/1000000.0 << rc.audioFreq
 | 
				
			||||||
               << rc.snr << rc.decodeTime << ac.points << rc.ready2call << bCQ;
 | 
					               << rc.snr << rc.decodeTime << ac.points << rc.ready2call << bCQ;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -3421,7 +3423,7 @@ void MainWindow::ARRL_Digi_Display()
 | 
				
			|||||||
  QString deCall;
 | 
					  QString deCall;
 | 
				
			||||||
  int age=0;
 | 
					  int age=0;
 | 
				
			||||||
  int i=0;
 | 
					  int i=0;
 | 
				
			||||||
  int maxAge=4;
 | 
					  int maxAge=m_ActiveStationsWidget->maxAge();
 | 
				
			||||||
  int points=0;
 | 
					  int points=0;
 | 
				
			||||||
  int maxPoints=0;
 | 
					  int maxPoints=0;
 | 
				
			||||||
  int indx[1000];
 | 
					  int indx[1000];
 | 
				
			||||||
@ -3433,7 +3435,7 @@ void MainWindow::ARRL_Digi_Display()
 | 
				
			|||||||
    deCall=icall.key();
 | 
					    deCall=icall.key();
 | 
				
			||||||
    age=int((m_latestDecodeTime - icall.value().decodeTime)/m_TRperiod + 0.5);
 | 
					    age=int((m_latestDecodeTime - icall.value().decodeTime)/m_TRperiod + 0.5);
 | 
				
			||||||
    if(age>maxAge) {
 | 
					    if(age>maxAge) {
 | 
				
			||||||
      qDebug() << "bb" << i << deCall << "removed";
 | 
					//      qDebug() << "bb" << i << deCall << "removed";
 | 
				
			||||||
      icall.remove();
 | 
					      icall.remove();
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      i++;
 | 
					      i++;
 | 
				
			||||||
@ -3443,18 +3445,18 @@ void MainWindow::ARRL_Digi_Display()
 | 
				
			|||||||
      QString t1;
 | 
					      QString t1;
 | 
				
			||||||
      t1 = t1.asprintf("  %2d  %2d",age,points);
 | 
					      t1 = t1.asprintf("  %2d  %2d",age,points);
 | 
				
			||||||
      t1 = (deCall + "   ").left(6) + "  " + m_activeCall[deCall].grid4 + t1;
 | 
					      t1 = (deCall + "   ").left(6) + "  " + m_activeCall[deCall].grid4 + t1;
 | 
				
			||||||
//      qDebug() << "cc" << t1 << m_activeCall.count() << m_recentCall.count() << pts[i-1];
 | 
					 | 
				
			||||||
      list.append(t1);
 | 
					      list.append(t1);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  int nmax=i;
 | 
					  int maxRecent=qMin(i,m_ActiveStationsWidget->maxRecent());
 | 
				
			||||||
  indexx_(pts,&nmax,indx);
 | 
					  indexx_(pts,&maxRecent,indx);
 | 
				
			||||||
  QString t;
 | 
					  QString t;
 | 
				
			||||||
  for(int j=nmax-1; j>=0; j--) {
 | 
					  for(int j=maxRecent-1; j>=0; j--) {
 | 
				
			||||||
    int k=indx[j]-1;
 | 
					    int k=indx[j]-1;
 | 
				
			||||||
    t += (list[k] + "\n");
 | 
					    t += (list[k] + "\n");
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if(m_ActiveStationsWidget!=NULL) m_ActiveStationsWidget->displayActiveStations(t);
 | 
					  if(m_ActiveStationsWidget!=NULL) m_ActiveStationsWidget->displayRecentStations(t);
 | 
				
			||||||
 | 
					  qDebug() << "dd" << maxRecent << maxAge;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MainWindow::readFromStdout()                             //readFromStdout
 | 
					void MainWindow::readFromStdout()                             //readFromStdout
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user