Skip to content

Commit

Permalink
Merge pull request #644 from barjac/bcj-reporter-left-justify
Browse files Browse the repository at this point in the history
Left justify data and labels, remove '--' and align data start with label start for easier readability and cleaner looks
  • Loading branch information
tmiw authored Jan 7, 2024
2 parents ff9a426 + 95d5aec commit bd57914
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 36 deletions.
1 change: 1 addition & 0 deletions USER_MANUAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,7 @@ LDPC | Low Density Parity Check Codes - a family of powerful FEC codes
2. Enhancements:
* Allow user to refresh status message even if it hasn't been changed. (PR #632)
* Increase priority of status message highlight. (PR #632)
* Adjust FreeDV Reporter data display to better match accepted UX standards. (PR #644)
3. Build system:
* Include PDB debugging file for FreeDV. (PR #633)
4. Documentation:
Expand Down
66 changes: 30 additions & 36 deletions src/freedv_reporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

extern FreeDVInterface freedvInterface;

#define UNKNOWN_STR "--"
#define UNKNOWN_STR ""
#if defined(WIN32)
#define NUM_COLS (14) /* Note: need empty column 0 to work around callsign truncation issue. */
#else
Expand Down Expand Up @@ -71,26 +71,26 @@ FreeDVReporterDialog::FreeDVReporterDialog(wxWindow* parent, wxWindowID id, cons
// Create "hidden" column at the beginning. The column logic in wxWidgets
// seems to want to add an image to column 0, which affects
// autosizing.
m_listSpots->InsertColumn(col++, wxT(""), wxLIST_FORMAT_CENTER, 1);
m_listSpots->InsertColumn(col++, wxT(""), wxLIST_FORMAT_LEFT, 1);
#endif // defined(WIN32)

m_listSpots->InsertColumn(col++, wxT("Callsign"), wxLIST_FORMAT_CENTER, 80);
m_listSpots->InsertColumn(col++, wxT("Locator"), wxLIST_FORMAT_CENTER, 80);
m_listSpots->InsertColumn(col++, wxT("km"), wxLIST_FORMAT_CENTER, 80);
m_listSpots->InsertColumn(col++, wxT("Version"), wxLIST_FORMAT_CENTER, 80);
m_listSpots->InsertColumn(col++, wxGetApp().appConfiguration.reportingConfiguration.reportingFrequencyAsKhz ? wxT("kHz") : wxT("MHz"), wxLIST_FORMAT_CENTER, 80);
m_listSpots->InsertColumn(col++, wxT("Status"), wxLIST_FORMAT_CENTER, 80);
m_listSpots->InsertColumn(col++, wxT("Msg"), wxLIST_FORMAT_CENTER, 20);
m_listSpots->InsertColumn(col++, wxT("Last TX"), wxLIST_FORMAT_CENTER, 80);
m_listSpots->InsertColumn(col++, wxT("Mode"), wxLIST_FORMAT_CENTER, 80);
m_listSpots->InsertColumn(col++, wxT("RX Call"), wxLIST_FORMAT_CENTER, 120);
m_listSpots->InsertColumn(col++, wxT("Mode"), wxLIST_FORMAT_CENTER, 120);
m_listSpots->InsertColumn(col++, wxT("SNR"), wxLIST_FORMAT_CENTER, 40);
m_listSpots->InsertColumn(col++, wxT("Last Update"), wxLIST_FORMAT_CENTER, 120);
m_listSpots->InsertColumn(col++, wxT("Callsign"), wxLIST_FORMAT_LEFT, 80);
m_listSpots->InsertColumn(col++, wxT("Locator"), wxLIST_FORMAT_LEFT, 80);
m_listSpots->InsertColumn(col++, wxT("km"), wxLIST_FORMAT_RIGHT, 80);
m_listSpots->InsertColumn(col++, wxT("Version"), wxLIST_FORMAT_LEFT, 80);
m_listSpots->InsertColumn(col++, wxGetApp().appConfiguration.reportingConfiguration.reportingFrequencyAsKhz ? wxT("kHz") : wxT("MHz"), wxLIST_FORMAT_RIGHT, 80);
m_listSpots->InsertColumn(col++, wxT("Status"), wxLIST_FORMAT_LEFT, 80);
m_listSpots->InsertColumn(col++, wxT("Msg"), wxLIST_FORMAT_LEFT, 20);
m_listSpots->InsertColumn(col++, wxT("Last TX"), wxLIST_FORMAT_LEFT, 80);
m_listSpots->InsertColumn(col++, wxT("Mode"), wxLIST_FORMAT_LEFT, 80);
m_listSpots->InsertColumn(col++, wxT("RX Call"), wxLIST_FORMAT_LEFT, 120);
m_listSpots->InsertColumn(col++, wxT("Mode"), wxLIST_FORMAT_LEFT, 120);
m_listSpots->InsertColumn(col++, wxT("SNR"), wxLIST_FORMAT_RIGHT, 40);
m_listSpots->InsertColumn(col++, wxT("Last Update"), wxLIST_FORMAT_LEFT, 120);

// On Windows, the last column will end up taking a lot more space than desired regardless
// of the space we actually need. Create a "dummy" column to take that space instead.
m_listSpots->InsertColumn(col++, wxT(""), wxLIST_FORMAT_CENTER, 1);
m_listSpots->InsertColumn(col++, wxT(""), wxLIST_FORMAT_LEFT, 1);

sectionSizer->Add(m_listSpots, 0, wxALL | wxEXPAND, 2);

Expand Down Expand Up @@ -301,11 +301,11 @@ void FreeDVReporterDialog::refreshLayout()

if (wxGetApp().appConfiguration.reportingConfiguration.useMetricDistances)
{
item.SetText("km");
item.SetText("km ");
}
else
{
item.SetText("mi");
item.SetText("Miles");
}

m_listSpots->SetColumn(2 + colOffset, item);
Expand Down Expand Up @@ -1061,14 +1061,8 @@ void FreeDVReporterDialog::onUserConnectFn_(std::string sid, std::string lastUpd
temp->distanceVal *= 0.621371;
}

if (temp->distanceVal < 10.0)
{
temp->distance = wxString::Format("%.01f", temp->distanceVal);
}
else
{
temp->distance = wxString::Format("%.0f", temp->distanceVal);
}
temp->distance = wxString::Format("%.0f", temp->distanceVal);

}

temp->version = version;
Expand Down Expand Up @@ -1438,43 +1432,43 @@ void FreeDVReporterDialog::addOrUpdateListIfNotFiltered_(ReporterData* data, std
col = 1;
#endif // defined(WIN32)

bool changed = setColumnForRow_(itemIndex, col++, data->callsign, colResizeList);
bool changed = setColumnForRow_(itemIndex, col++, " "+data->callsign, colResizeList);
needResort |= changed && currentSortColumn_ == (col - 1);

changed = setColumnForRow_(itemIndex, col++, data->gridSquare, colResizeList);
changed = setColumnForRow_(itemIndex, col++, " "+data->gridSquare, colResizeList);
needResort |= changed && currentSortColumn_ == (col - 1);

changed = setColumnForRow_(itemIndex, col++, data->distance, colResizeList);
needResort |= changed && currentSortColumn_ == (col - 1);

changed = setColumnForRow_(itemIndex, col++, data->version, colResizeList);
changed = setColumnForRow_(itemIndex, col++, " "+data->version, colResizeList);
needResort |= changed && currentSortColumn_ == (col - 1);

changed = setColumnForRow_(itemIndex, col++, data->freqString, colResizeList);
needResort |= changed && currentSortColumn_ == (col - 1);

changed = setColumnForRow_(itemIndex, col++, data->status, colResizeList);
changed = setColumnForRow_(itemIndex, col++, " "+data->status, colResizeList);
needResort |= changed && currentSortColumn_ == (col - 1);

changed = setColumnForRow_(itemIndex, col++, data->userMessage, colResizeList);
changed = setColumnForRow_(itemIndex, col++, " "+data->userMessage, colResizeList);
needResort |= changed && currentSortColumn_ == (col - 1);

changed = setColumnForRow_(itemIndex, col++, data->lastTx, colResizeList);
changed = setColumnForRow_(itemIndex, col++, " "+data->lastTx, colResizeList);
needResort |= changed && currentSortColumn_ == (col - 1);

changed = setColumnForRow_(itemIndex, col++, data->txMode, colResizeList);
changed = setColumnForRow_(itemIndex, col++, " "+data->txMode, colResizeList);
needResort |= changed && currentSortColumn_ == (col - 1);

changed = setColumnForRow_(itemIndex, col++, data->lastRxCallsign, colResizeList);
changed = setColumnForRow_(itemIndex, col++, " "+data->lastRxCallsign, colResizeList);
needResort |= changed && currentSortColumn_ == (col - 1);

changed = setColumnForRow_(itemIndex, col++, data->lastRxMode, colResizeList);
changed = setColumnForRow_(itemIndex, col++, " "+data->lastRxMode, colResizeList);
needResort |= changed && currentSortColumn_ == (col - 1);

changed = setColumnForRow_(itemIndex, col++, data->snr, colResizeList);
needResort |= changed && currentSortColumn_ == (col - 1);

changed = setColumnForRow_(itemIndex, col++, data->lastUpdate, colResizeList);
changed = setColumnForRow_(itemIndex, col++, " "+data->lastUpdate, colResizeList);
needResort |= changed && currentSortColumn_ == (col - 1);

// Messaging updates take highest priority.
Expand Down

0 comments on commit bd57914

Please sign in to comment.