@@ -21,7 +21,7 @@ MODULE_IDENTIFICATION("qlog.ui.wsjtxswidget");
21
21
WsjtxWidget::WsjtxWidget (QWidget *parent) :
22
22
QWidget(parent),
23
23
ui(new Ui::WsjtxWidget),
24
- lastSelectedCallsign(QString() )
24
+ cqRE( " ^CQ (DX |TEST |[A-Z]{0,2} )?([A-Z0-9 \\ /]+) ?([A-Z]{2}[0-9]{2})?.* " )
25
25
{
26
26
FCT_IDENTIFICATION;
27
27
@@ -42,12 +42,8 @@ WsjtxWidget::WsjtxWidget(QWidget *parent) :
42
42
ui->tableView ->addAction (ui->actionFilter );
43
43
ui->tableView ->addAction (ui->actionDisplayedColumns );
44
44
45
- // set Distance Column Delegate Class
46
-
47
45
restoreTableHeaderState ();
48
46
49
- contregexp.setPatternOptions (QRegularExpression::CaseInsensitiveOption);
50
-
51
47
reloadSetting ();
52
48
}
53
49
@@ -57,8 +53,6 @@ void WsjtxWidget::decodeReceived(WsjtxDecode decode)
57
53
58
54
qCDebug (function_parameters)<<decode.message ;
59
55
60
- static QRegularExpression cqRE (" ^CQ (DX |TEST |[A-Z]{0,2} )?([A-Z0-9\\ /]+) ?([A-Z]{2}[0-9]{2})?.*" );
61
-
62
56
const StationProfile &profile = StationProfilesManager::instance ()->getCurProfile1 ();
63
57
64
58
if ( decode.message .startsWith (" CQ" ) )
@@ -73,11 +67,11 @@ void WsjtxWidget::decodeReceived(WsjtxDecode decode)
73
67
entry.callsign = match.captured (2 );
74
68
entry.grid = match.captured (3 );
75
69
entry.dxcc = Data::instance ()->lookupDxcc (entry.callsign );
76
- entry.status = Data::instance ()->dxccStatus (entry.dxcc .dxcc , band , BandPlan::MODE_GROUP_STRING_DIGITAL);
70
+ entry.status = Data::instance ()->dxccStatus (entry.dxcc .dxcc , currBand , BandPlan::MODE_GROUP_STRING_DIGITAL);
77
71
entry.receivedTime = QDateTime::currentDateTimeUtc ();
78
72
entry.freq = currFreq;
79
- entry.band = band ;
80
- entry.decodedMode = currMode ;
73
+ entry.band = currBand ;
74
+ entry.decodedMode = status. mode ;
81
75
entry.spotter = profile.callsign .toUpper ();
82
76
entry.dxcc_spotter = Data::instance ()->lookupDxcc (entry.spotter );
83
77
// fix dxcc_spotter based on station prifile setting - cont is not calculated
@@ -129,22 +123,22 @@ void WsjtxWidget::decodeReceived(WsjtxDecode decode)
129
123
}
130
124
else
131
125
{
132
- QStringList decodedElements = decode.message .split (" " );
126
+ const QStringList & decodedElements = decode.message .split (" " );
133
127
134
128
if ( decodedElements.count () > 1 )
135
129
{
136
- QString callsign = decode.message .split (" " ).at (1 );
137
130
WsjtxEntry entry;
138
- entry.callsign = callsign;
131
+ entry.callsign = decodedElements.at (1 );
132
+
139
133
if ( wsjtxTableModel->callsignExists (entry) )
140
134
{
141
135
entry.dxcc = Data::instance ()->lookupDxcc (entry.callsign );
142
- entry.status = Data::instance ()->dxccStatus (entry.dxcc .dxcc , band , BandPlan::MODE_GROUP_STRING_DIGITAL);
136
+ entry.status = Data::instance ()->dxccStatus (entry.dxcc .dxcc , currBand , BandPlan::MODE_GROUP_STRING_DIGITAL);
143
137
entry.decode = decode;
144
138
entry.receivedTime = QDateTime::currentDateTimeUtc ();
145
139
entry.freq = currFreq;
146
- entry.band = band ;
147
- entry.decodedMode = currMode ;
140
+ entry.band = currBand ;
141
+ entry.decodedMode = status. mode ;
148
142
entry.spotter = profile.callsign .toUpper ();
149
143
entry.dxcc_spotter = Data::instance ()->lookupDxcc (entry.spotter );
150
144
// fix dxcc_spotter based on station prifile setting - cont is not calculated
@@ -165,27 +159,20 @@ void WsjtxWidget::decodeReceived(WsjtxDecode decode)
165
159
wsjtxTableModel->spotAging ();
166
160
167
161
ui->tableView ->repaint ();
168
-
169
- // setSelectedCallsign(lastSelectedCallsign);
170
162
}
171
163
172
164
void WsjtxWidget::statusReceived (WsjtxStatus newStatus)
173
165
{
174
166
FCT_IDENTIFICATION;
175
167
176
- if (this ->status .dial_freq != newStatus.dial_freq ) {
168
+ if ( this ->status .dial_freq != newStatus.dial_freq )
169
+ {
177
170
currFreq = Hz2MHz (newStatus.dial_freq );
178
- band = BandPlan::freq2Band (currFreq).name ;
171
+ currBand = BandPlan::freq2Band (currFreq).name ;
179
172
ui->freqLabel ->setText (QString (" %1 MHz" ).arg (QSTRING_FREQ (currFreq)));
180
173
clearTable ();
181
174
}
182
175
183
- if ( this ->status .dx_call != newStatus.dx_call )
184
- {
185
- lastSelectedCallsign = newStatus.dx_call ;
186
- // setSelectedCallsign(lastSelectedCallsign);
187
- }
188
-
189
176
if ( this ->status .dx_call != newStatus.dx_call
190
177
|| this ->status .dx_grid != newStatus.dx_grid )
191
178
{
@@ -195,7 +182,6 @@ void WsjtxWidget::statusReceived(WsjtxStatus newStatus)
195
182
if ( this ->status .mode != newStatus.mode )
196
183
{
197
184
ui->modeLabel ->setText (newStatus.mode );
198
- currMode = newStatus.mode ;
199
185
wsjtxTableModel->setCurrentSpotPeriod (Wsjtx::modePeriodLenght (newStatus.mode )); /* currently, only Status has a correct Mode in the message */
200
186
clearTable ();
201
187
}
@@ -228,25 +214,13 @@ void WsjtxWidget::callsignClicked(QString callsign)
228
214
emit reply (entry.decode );
229
215
}
230
216
231
- void WsjtxWidget::tableViewClicked (QModelIndex index )
217
+ void WsjtxWidget::tableViewClicked (QModelIndex)
232
218
{
233
219
FCT_IDENTIFICATION;
234
220
235
- const QModelIndex &source_index = proxyModel->mapToSource (index );
221
+ // const QModelIndex &source_index = proxyModel->mapToSource(index);
236
222
237
- lastSelectedCallsign = wsjtxTableModel->getEntry (source_index).callsign ;
238
- }
239
-
240
- void WsjtxWidget::setSelectedCallsign (const QString &selectCallsign)
241
- {
242
- FCT_IDENTIFICATION;
243
-
244
- QModelIndexList nextMatches = proxyModel->match (proxyModel->index (0 ,0 ), Qt::DisplayRole, selectCallsign, 1 , Qt::MatchExactly);
245
-
246
- if ( nextMatches.size () >= 1 )
247
- {
248
- ui->tableView ->setCurrentIndex (nextMatches.at (0 ));
249
- }
223
+ // lastSelectedCallsign = wsjtxTableModel->getEntry(source_index).callsign;
250
224
}
251
225
252
226
void WsjtxWidget::displayedColumns ()
@@ -271,39 +245,39 @@ void WsjtxWidget::actionFilter()
271
245
}
272
246
}
273
247
274
- uint WsjtxWidget::dxccStatusFilterValue ()
248
+ uint WsjtxWidget::dxccStatusFilterValue () const
275
249
{
276
250
FCT_IDENTIFICATION;
277
251
278
252
QSettings settings;
279
253
return settings.value (" wsjtx/filter_dxcc_status" , DxccStatus::All).toUInt ();
280
254
}
281
255
282
- QString WsjtxWidget::contFilterRegExp ()
256
+ QString WsjtxWidget::contFilterRegExp () const
283
257
{
284
258
FCT_IDENTIFICATION;
285
259
286
260
QSettings settings;
287
261
return settings.value (" wsjtx/filter_cont_regexp" ," NOTHING|AF|AN|AS|EU|NA|OC|SA" ).toString ();
288
262
}
289
263
290
- int WsjtxWidget::getDistanceFilterValue ()
264
+ int WsjtxWidget::getDistanceFilterValue () const
291
265
{
292
266
FCT_IDENTIFICATION;
293
267
294
268
QSettings settings;
295
269
return settings.value (" wsjtx/filter_distance" , 0 ).toInt ();
296
270
}
297
271
298
- int WsjtxWidget::getSNRFilterValue ()
272
+ int WsjtxWidget::getSNRFilterValue () const
299
273
{
300
274
FCT_IDENTIFICATION;
301
275
302
276
QSettings settings;
303
277
return settings.value (" wsjtx/filter_snr" , -41 ).toInt ();
304
278
}
305
279
306
- QStringList WsjtxWidget::dxMemberList ()
280
+ QStringList WsjtxWidget::dxMemberList () const
307
281
{
308
282
FCT_IDENTIFICATION;
309
283
@@ -315,6 +289,7 @@ void WsjtxWidget::reloadSetting()
315
289
{
316
290
FCT_IDENTIFICATION;
317
291
292
+ contregexp.setPatternOptions (QRegularExpression::CaseInsensitiveOption);
318
293
contregexp.setPattern (contFilterRegExp ());
319
294
dxccStatusFilter = dxccStatusFilterValue ();
320
295
distanceFilter = getDistanceFilterValue ();
@@ -364,10 +339,3 @@ WsjtxWidget::~WsjtxWidget()
364
339
saveTableHeaderState ();
365
340
delete ui;
366
341
}
367
-
368
- WsjtxEntry WsjtxWidget::getEntry (const QString &callsign)
369
- {
370
- FCT_IDENTIFICATION;
371
-
372
- return ( !wsjtxTableModel ) ? WsjtxEntry () : wsjtxTableModel->getEntry (callsign);
373
- }
0 commit comments