Finish removing Messages window.

This commit is contained in:
Joe Taylor 2022-12-04 16:58:19 -05:00
parent 8731f9e75a
commit adc04fd71e
7 changed files with 3 additions and 326 deletions

View File

@ -8,7 +8,6 @@ set (q65w_CXXSRCS
getfile.cpp
main.cpp
mainwindow.cpp
messages.cpp
meterwidget.cpp
plotter.cpp
set570.cpp
@ -29,7 +28,6 @@ set (q65w_UISRCS
bandmap.ui
devsetup.ui
mainwindow.ui
messages.ui
txtune.ui
widegraph.ui
)

View File

@ -15,7 +15,6 @@
#include "about.h"
#include "astro.h"
#include "widegraph.h"
#include "messages.h"
#include "bandmap.h"
#include "txtune.h"
#include "sleep.h"
@ -48,7 +47,6 @@ MainWindow::MainWindow(QWidget *parent) :
m_settings_filename {m_appDir + "/map65.ini"},
m_astro_window {new Astro {m_settings_filename}},
m_band_map_window {new BandMap {m_settings_filename}},
// m_messages_window {new Messages {m_settings_filename}},
m_wide_graph_window {new WideGraph {m_settings_filename}},
m_gui_timer {new QTimer {this}}
{
@ -226,9 +224,7 @@ MainWindow::MainWindow(QWidget *parent) :
on_actionAstro_Data_triggered(); //Create the other windows
on_actionWide_Waterfall_triggered();
// on_actionMessages_triggered();
on_actionBand_Map_triggered();
// if (m_messages_window) m_messages_window->setColors(m_colors);
m_band_map_window->setColors(m_colors);
if (m_astro_window) m_astro_window->setFontSize (m_astroFont);
@ -301,7 +297,6 @@ MainWindow::MainWindow(QWidget *parent) :
if(ui->actionAFMHot->isChecked()) on_actionAFMHot_triggered();
if(ui->actionBlue->isChecked()) on_actionBlue_triggered();
// connect (m_messages_window.get (), &Messages::click2OnCallsign, this, &MainWindow::doubleClickOnMessages);
connect (m_wide_graph_window.get (), &WideGraph::freezeDecode2, this, &MainWindow::freezeDecode);
connect (m_wide_graph_window.get (), &WideGraph::f11f12, this, &MainWindow::bumpDF);
@ -728,7 +723,6 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog
m_initIQplus=dlg.m_initIQplus;
m_bIQxt=dlg.m_bIQxt;
m_colors=dlg.m_colors;
// m_messages_window->setColors(m_colors);
m_band_map_window->setColors(m_colors);
m_cal570=dlg.m_cal570;
m_TxOffset=dlg.m_TxOffset;
@ -976,7 +970,6 @@ void MainWindow::closeEvent (QCloseEvent * e)
mem_m65.detach();
if (m_astro_window) m_astro_window->close ();
if (m_band_map_window) m_band_map_window->close ();
// if (m_messages_window) m_messages_window->close ();
if (m_wide_graph_window) m_wide_graph_window->close ();
QMainWindow::closeEvent (e);
}
@ -1043,11 +1036,6 @@ void MainWindow::on_actionBand_Map_triggered() //Display BandMap
m_band_map_window->show ();
}
void MainWindow::on_actionMessages_triggered() //Display Messages
{
// m_messages_window->show();
}
void MainWindow::on_actionOpen_triggered() //Open File
{
m_monitoring=false;
@ -1167,7 +1155,6 @@ void MainWindow::on_actionDelete_all_tf2_files_in_SaveDir_triggered()
void MainWindow::on_actionErase_Band_Map_and_Messages_triggered()
{
m_band_map_window->setText("");
// m_messages_window->setText("","");
m_map65RxLog |= 4;
}
@ -1415,7 +1402,6 @@ void MainWindow::readFromStdout() //readFromStdout
if((t.indexOf("<EarlyFinished>") >= 0) or (t.indexOf("<DecodeFinished>") >= 0)) {
if(m_widebandDecode) {
// m_messages_window->setText(m_messagesText,m_bandmapText);
m_band_map_window->setText(m_bandmapText);
m_widebandDecode=false;
}
@ -1443,9 +1429,7 @@ void MainWindow::readFromStdout() //readFromStdout
if(n>=30 or t.indexOf("Best-fit")>=0) ui->decodedTextBrowser->append(t.mid(1,n-m-4).trimmed());
n=ui->decodedTextBrowser->verticalScrollBar()->maximum();
ui->decodedTextBrowser->verticalScrollBar()->setValue(n);
// m_messagesText="";
m_bandmapText="";
// m_messagesText += t.mid(1);
m_widebandDecode=true;
}
@ -1474,7 +1458,6 @@ void MainWindow::on_EraseButton_clicked()
qint64 ms=QDateTime::currentMSecsSinceEpoch();
ui->decodedTextBrowser->clear();
if((ms-m_msErase)<500) {
// on_actionErase_Band_Map_and_Messages_triggered();
}
m_msErase=ms;
}
@ -1844,41 +1827,6 @@ void MainWindow::doubleClickOnCall(QString hiscall, bool ctrl)
QString rpt="";
if(ctrl or m_modeTx=="Q65") rpt=t2.mid(25,3);
genStdMsgs(rpt);
if(t2.indexOf(m_myCall)>0) {
m_ntx=2;
ui->txrb2->setChecked(true);
} else {
m_ntx=1;
ui->txrb1->setChecked(true);
}
}
//doubleClickOnMessages
void MainWindow::doubleClickOnMessages(QString hiscall, QString t2, bool ctrl)
{
if(hiscall.length()<3) return;
if(m_worked[hiscall]) {
msgBox("Possible dupe: " + hiscall + " already in log.");
}
ui->dxCallEntry->setText(hiscall);
int n = 60*t2.mid(13,2).toInt() + t2.mid(15,2).toInt();
m_txFirst = ((n%2) == 1);
ui->txFirstCheckBox->setChecked(m_txFirst);
if((t2.indexOf(":")<0) and m_modeTx!="JT65") on_pbTxMode_clicked();
if((t2.indexOf(":")>0) and m_modeTx!="Q65") on_pbTxMode_clicked();
auto const& words = t2.mid(25).split(' ', SkipEmptyParts);
QString grid=words[2];
if(isGrid4(grid) and hiscall==words[1]) {
ui->dxGridEntry->setText(grid);
} else {
lookup();
}
QString rpt="";
if(ctrl or m_modeTx=="Q65") rpt=t2.mid(20,3);
genStdMsgs(rpt);
if(t2.indexOf(m_myCall)>0) {
m_ntx=2;
ui->txrb2->setChecked(true);

View File

@ -27,7 +27,6 @@ namespace Ui {
class QTimer;
class Astro;
class BandMap;
class Messages;
class WideGraph;
class MainWindow : public QMainWindow
@ -51,7 +50,6 @@ public slots:
void editor_error();
void guiUpdate();
void doubleClickOnCall(QString hiscall, bool ctrl);
void doubleClickOnMessages(QString hiscall, QString t2, bool ctrl);
private:
virtual void keyPressEvent (QKeyEvent *) override;
@ -83,7 +81,6 @@ private slots:
void on_actionQ65_Sensitivity_in_MAP65_3_0_triggered();
void on_actionWide_Waterfall_triggered();
void on_actionBand_Map_triggered();
void on_actionMessages_triggered();
void on_actionOpen_triggered();
void on_actionOpen_next_in_directory_triggered();
void on_actionDecode_remaining_files_in_directory_triggered();
@ -152,7 +149,6 @@ private:
QString m_settings_filename;
QScopedPointer<Astro> m_astro_window;
QScopedPointer<BandMap> m_band_map_window;
QScopedPointer<Messages> m_messages_window;
QScopedPointer<WideGraph> m_wide_graph_window;
QPointer<QTimer> m_gui_timer;
qint64 m_msErase;
@ -256,7 +252,6 @@ private:
QString m_pbdecoding_style1;
QString m_pbmonitor_style;
QString m_pbAutoOn_style;
QString m_messagesText;
QString m_bandmapText;
QString m_myCall;
QString m_myGrid;

View File

@ -31,7 +31,7 @@ DEFINES = UNIX
SOURCES += main.cpp mainwindow.cpp plotter.cpp about.cpp \
soundin.cpp soundout.cpp devsetup.cpp \
widegraph.cpp getfile.cpp messages.cpp bandmap.cpp \
widegraph.cpp getfile.cpp bandmap.cpp \
astro.cpp displaytext.cpp getdev.cpp \
txtune.cpp meterwidget.cpp signalmeter.cpp
@ -40,12 +40,12 @@ SOURCES += killbyname.cpp set570.cpp
}
HEADERS += mainwindow.h plotter.h soundin.h soundout.h \
about.h devsetup.h widegraph.h getfile.h messages.h \
about.h devsetup.h widegraph.h getfile.h \
bandmap.h commons.h sleep.h astro.h displaytext.h \
txtune.h meterwidget.h signalmeter.h
FORMS += mainwindow.ui about.ui devsetup.ui widegraph.ui \
messages.ui bandmap.ui astro.ui \
bandmap.ui astro.ui \
txtune.ui
RC_FILE = map65.rc

View File

@ -1,113 +0,0 @@
#include "messages.h"
#include <QSettings>
#include "SettingsGroup.hpp"
#include "ui_messages.h"
#include "mainwindow.h"
#include "qt_helpers.hpp"
Messages::Messages (QString const& settings_filename, QWidget * parent) :
QDialog {parent},
ui {new Ui::Messages},
m_settings_filename {settings_filename}
{
ui->setupUi(this);
setWindowTitle("Messages");
setWindowFlags (Qt::Dialog | Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint);
QSettings settings {m_settings_filename, QSettings::IniFormat};
SettingsGroup g {&settings, "MainWindow"}; // MainWindow group for
// historical reasons
setGeometry (settings.value ("MessagesGeom", QRect {800, 400, 381, 400}).toRect ());
ui->messagesTextBrowser->setStyleSheet( \
"QTextBrowser { background-color : #000066; color : red; }");
ui->messagesTextBrowser->clear();
m_cqOnly=false;
m_cqStarOnly=false;
connect (ui->messagesTextBrowser, &DisplayText::selectCallsign, this, &Messages::selectCallsign2);
}
Messages::~Messages()
{
QSettings settings {m_settings_filename, QSettings::IniFormat};
SettingsGroup g {&settings, "MainWindow"};
settings.setValue ("MessagesGeom", geometry ());
delete ui;
}
void Messages::setText(QString t, QString t2)
{
QString cfreq,cfreq0;
m_t=t;
m_t2=t2;
QString s="QTextBrowser{background-color: "+m_colorBackground+"}";
ui->messagesTextBrowser->setStyleSheet(s);
ui->messagesTextBrowser->clear();
QStringList lines = t.split( "\n", SkipEmptyParts );
foreach( QString line, lines ) {
QString t1=line.mid(0,50);
int ncq=t1.indexOf(" CQ ");
if((m_cqOnly or m_cqStarOnly) and ncq< 0) continue;
if(m_cqStarOnly) {
QString caller=t1.mid(ncq+4,-1);
int nz=caller.indexOf(" ");
caller=caller.mid(0,nz);
int i=t2.indexOf(caller);
if(t2.mid(i-1,1)==" ") continue;
}
int n=line.mid(50,2).toInt();
// if(line.indexOf(":")>0) n=-1;
// if(n==-1) ui->messagesTextBrowser->setTextColor("#ffffff"); // white
if(n==0) ui->messagesTextBrowser->setTextColor(m_color0);
if(n==1) ui->messagesTextBrowser->setTextColor(m_color1);
if(n==2) ui->messagesTextBrowser->setTextColor(m_color2);
if(n>=3) ui->messagesTextBrowser->setTextColor(m_color3);
cfreq=t1.mid(0,3);
if(cfreq == cfreq0) {
t1=" " + t1.mid(3,-1);
}
cfreq0=cfreq;
ui->messagesTextBrowser->append(t1);
}
}
void Messages::selectCallsign2(bool ctrl)
{
QString t = ui->messagesTextBrowser->toPlainText(); //Full contents
int i=ui->messagesTextBrowser->textCursor().position();
int i0=t.lastIndexOf(" ",i);
int i1=t.indexOf(" ",i);
QString hiscall=t.mid(i0+1,i1-i0-1);
if(hiscall!="") {
if(hiscall.length() < 13) {
QString t1 = t.mid(0,i); //contents up to text cursor
int i1=t1.lastIndexOf("\n") + 1;
QString t2 = t.mid(i1,-1); //selected line to end
int i2=t2.indexOf("\n");
t2=t2.left(i2); //selected line
emit click2OnCallsign(hiscall,t2,ctrl);
}
}
}
void Messages::setColors(QString t)
{
m_colorBackground = "#"+t.mid(0,6);
m_color0 = "#"+t.mid(6,6);
m_color1 = "#"+t.mid(12,6);
m_color2 = "#"+t.mid(18,6);
m_color3 = "#"+t.mid(24,6);
setText(m_t,m_t2);
}
void Messages::on_cbCQ_toggled(bool checked)
{
m_cqOnly = checked;
setText(m_t,m_t2);
}
void Messages::on_cbCQstar_toggled(bool checked)
{
m_cqStarOnly = checked;
setText(m_t,m_t2);
}

View File

@ -1,44 +0,0 @@
#ifndef MESSAGES_H
#define MESSAGES_H
#include <QDialog>
namespace Ui {
class Messages;
}
class Messages : public QDialog
{
Q_OBJECT
public:
explicit Messages (QString const& settings_filename, QWidget * parent = nullptr);
void setText(QString t, QString t2);
void setColors(QString t);
~Messages();
signals:
void click2OnCallsign(QString hiscall, QString t2, bool ctrl);
private slots:
void selectCallsign2(bool ctrl);
void on_cbCQ_toggled(bool checked);
void on_cbCQstar_toggled(bool checked);
private:
Ui::Messages *ui;
QString m_settings_filename;
QString m_t;
QString m_t2;
QString m_colorBackground;
QString m_color0;
QString m_color1;
QString m_color2;
QString m_color3;
bool m_cqOnly;
bool m_cqStarOnly;
};
#endif

View File

@ -1,107 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Messages</class>
<widget class="QDialog" name="Messages">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>399</width>
<height>595</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="lab1">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string> Freq DF Pol UTC dB</string>
</property>
</widget>
</item>
<item>
<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>
<item>
<widget class="QCheckBox" name="cbCQstar">
<property name="text">
<string>CQ* Only</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbCQ">
<property name="text">
<string>CQ Only</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="DisplayText" name="messagesTextBrowser">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>340</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>Courier New</family>
<pointsize>9</pointsize>
</font>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>DisplayText</class>
<extends>QTextBrowser</extends>
<header>displaytext.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>