Stable sort callsigns
This commit is contained in:
parent
e0c3592868
commit
ca537f5e9f
@ -1394,9 +1394,11 @@ void MainWindow::initializeDummyData(){
|
|||||||
|
|
||||||
auto dt = QDateTime::currentDateTimeUtc().addSecs(-300);
|
auto dt = QDateTime::currentDateTimeUtc().addSecs(-300);
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
foreach(auto call, calls){
|
foreach(auto call, calls){
|
||||||
CallDetail cd = {};
|
CallDetail cd = {};
|
||||||
cd.call = call;
|
cd.call = call;
|
||||||
|
cd.snr = i++;
|
||||||
cd.utcTimestamp = dt;
|
cd.utcTimestamp = dt;
|
||||||
logCallActivity(cd, false);
|
logCallActivity(cd, false);
|
||||||
}
|
}
|
||||||
@ -1465,7 +1467,7 @@ void MainWindow::tryBandHop(){
|
|||||||
auto stations = m_config.stations()->station_list();
|
auto stations = m_config.stations()->station_list();
|
||||||
|
|
||||||
// order stations by (switch_at, switch_until) time tuple
|
// order stations by (switch_at, switch_until) time tuple
|
||||||
qSort(stations.begin(), stations.end(), [](StationList::Station const &a, StationList::Station const &b){
|
qStableSort(stations.begin(), stations.end(), [](StationList::Station const &a, StationList::Station const &b){
|
||||||
return (a.switch_at_ < b.switch_at_) || (a.switch_at_ == b.switch_at_ && a.switch_until_ < b.switch_until_);
|
return (a.switch_at_ < b.switch_at_) || (a.switch_at_ == b.switch_at_ && a.switch_until_ < b.switch_until_);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -7627,7 +7629,7 @@ void MainWindow::buildQueryMenu(QMenu * menu, QString call){
|
|||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto alertAction = menu->addAction(QString("%1>[MESSAGE] - Please (optionally relay) and display this message in an reply dialog").arg(call).trimmed());
|
auto alertAction = menu->addAction(QString("%1>[MESSAGE] - Please (optionally) relay and display this message in an reply dialog").arg(call).trimmed());
|
||||||
alertAction->setDisabled(isAllCall);
|
alertAction->setDisabled(isAllCall);
|
||||||
connect(alertAction, &QAction::triggered, this, [this](){
|
connect(alertAction, &QAction::triggered, this, [this](){
|
||||||
|
|
||||||
@ -8947,7 +8949,7 @@ QString MainWindow::callsignSelected(){
|
|||||||
selectedOffset = selectedItems.first()->text().toInt();
|
selectedOffset = selectedItems.first()->text().toInt();
|
||||||
|
|
||||||
auto keys = m_callActivity.keys();
|
auto keys = m_callActivity.keys();
|
||||||
qSort(keys.begin(), keys.end(), [this](QString const &a, QString const &b){
|
qStableSort(keys.begin(), keys.end(), [this](QString const &a, QString const &b){
|
||||||
auto tA = m_callActivity[a].utcTimestamp;
|
auto tA = m_callActivity[a].utcTimestamp;
|
||||||
auto tB = m_callActivity[b].utcTimestamp;
|
auto tB = m_callActivity[b].utcTimestamp;
|
||||||
if(tA == tB){
|
if(tA == tB){
|
||||||
@ -9448,7 +9450,7 @@ void MainWindow::processCommandActivity() {
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
int maxStations = 4;
|
int maxStations = 4;
|
||||||
auto calls = m_callActivity.keys();
|
auto calls = m_callActivity.keys();
|
||||||
qSort(calls.begin(), calls.end(), [this](QString
|
qStableSort(calls.begin(), calls.end(), [this](QString
|
||||||
const & a, QString
|
const & a, QString
|
||||||
const & b) {
|
const & b) {
|
||||||
auto left = m_callActivity[a];
|
auto left = m_callActivity[a];
|
||||||
@ -9879,13 +9881,13 @@ void MainWindow::displayBandActivity() {
|
|||||||
reverse = true;
|
reverse = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// compare offset
|
||||||
|
qStableSort(keys.begin(), keys.end());
|
||||||
|
|
||||||
if(sortBy == "timestamp"){
|
if(sortBy == "timestamp"){
|
||||||
qSort(keys.begin(), keys.end(), compareTimestamp);
|
qStableSort(keys.begin(), keys.end(), compareTimestamp);
|
||||||
} else if(sortBy == "snr"){
|
} else if(sortBy == "snr"){
|
||||||
qSort(keys.begin(), keys.end(), compareSNR);
|
qStableSort(keys.begin(), keys.end(), compareSNR);
|
||||||
} else {
|
|
||||||
// compare offset
|
|
||||||
qSort(keys.begin(), keys.end());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(reverse){
|
if(reverse){
|
||||||
@ -10069,17 +10071,17 @@ void MainWindow::displayCallActivity() {
|
|||||||
reverse = true;
|
reverse = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// compare callsign
|
||||||
|
qStableSort(keys.begin(), keys.end());
|
||||||
|
|
||||||
if(sortBy == "offset"){
|
if(sortBy == "offset"){
|
||||||
qSort(keys.begin(), keys.end(), compareOffset);
|
qStableSort(keys.begin(), keys.end(), compareOffset);
|
||||||
} else if(sortBy == "distance"){
|
} else if(sortBy == "distance"){
|
||||||
qSort(keys.begin(), keys.end(), compareDistance);
|
qStableSort(keys.begin(), keys.end(), compareDistance);
|
||||||
} else if(sortBy == "timestamp"){
|
} else if(sortBy == "timestamp"){
|
||||||
qSort(keys.begin(), keys.end(), compareTimestamp);
|
qStableSort(keys.begin(), keys.end(), compareTimestamp);
|
||||||
} else if(sortBy == "snr"){
|
} else if(sortBy == "snr"){
|
||||||
qSort(keys.begin(), keys.end(), compareSNR);
|
qStableSort(keys.begin(), keys.end(), compareSNR);
|
||||||
} else {
|
|
||||||
// compare callsign
|
|
||||||
qSort(keys.begin(), keys.end());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(reverse){
|
if(reverse){
|
||||||
@ -11026,9 +11028,9 @@ QString MainWindow::sortHoundCalls(QString t, int isort, int max_dB)
|
|||||||
|
|
||||||
if(isort>1) {
|
if(isort>1) {
|
||||||
if(bReverse) {
|
if(bReverse) {
|
||||||
qSort(list.begin(),list.end(),qGreater<int>());
|
qStableSort(list.begin(),list.end(),qGreater<int>());
|
||||||
} else {
|
} else {
|
||||||
qSort(list.begin(),list.end());
|
qStableSort(list.begin(),list.end());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user