- introduced qrv tags for callsigns, only UI so far

This commit is contained in:
Marc Froehlich
2024-03-30 00:50:16 +01:00
parent 136cf08f08
commit 8bea4111f0
9 changed files with 254 additions and 18 deletions

View File

@@ -1171,6 +1171,13 @@ category = new ChatCategory(2);
}
public void resetQRVInfoInGuiLists() {
this.chatController.getLst_chatMemberList().forEach(
chatMember -> chatMember.resetQRVInformationAtAllBands());
}
/**
* Setting the initial parameters at the chat
*

View File

@@ -220,7 +220,7 @@ public class DBController {
} catch (SQLException e) {
System.err.println("[DBH, ERROR:] Chatmember could not been stored.");
e.printStackTrace();
connection.close();
// connection.close(); //Todo commented out due to errors
}
}

View File

@@ -625,8 +625,22 @@ public class MessageBusManagementThread extends Thread {
newMessage.getReceiver().getQra(),
client.getChatPreferences().getStn_maxQRBDefault(),
client.getChatPreferences().getStn_antennaBeamWidthDeg())) {
if (this.client.getChatPreferences().isNotify_playSimpleSounds()) {
//play only tick sound if the sender was not set directedtome before
if (!newMessage.getSender().isInAngleAndRange()) {
this.client.getPlayAudioUtils().playNoiseLauncher('-');
}
}
newMessage.getSender().setInAngleAndRange(true);
System.out.println(">>>>>>>>>> Anglewarning <<<<<<<<<< " + newMessage.getSender().getCallSign() + ", " + newMessage.getSender().getQra() + " -> " + newMessage.getReceiver().getCallSign() + ", " + newMessage.getReceiver().getQra() + " = " +
new Location(newMessage.getSender().getQra()).getBearing(new Location(newMessage.getReceiver().getQra())) +
" / sender bearing to me: " + new Location(newMessage.getSender().getQra()).getBearing(new Location(client.getChatPreferences().getLoginLocator())));
} else {
System.out.println("-notinangle- " + newMessage.getSender().getCallSign() + ", " + newMessage.getSender().getQra() + " -> " + newMessage.getReceiver().getCallSign() + ", " + newMessage.getReceiver().getQra() + " = " +
new Location(newMessage.getSender().getQra()).getBearing(new Location(newMessage.getReceiver().getQra())) +
" ; sender bearing to me: " + new Location(newMessage.getSender().getQra()).getBearing(new Location(client.getChatPreferences().getLoginLocator())));
newMessage.getSender().setInAngleAndRange(false);
}

View File

@@ -29,17 +29,34 @@ public class DirectionUtils {
//check bearing of sender to receiver
double bearingOfSekdSenderToSkedReceiver = skedSenderLocation.getBearing(skedReceiverLocation);
System.out.println("skedTX -> skedTX deg: " + bearingOfSekdSenderToSkedReceiver);
// System.out.println("skedTX -> skedTX deg: " + bearingOfSekdSenderToSkedReceiver);
double bearingOfSekdSenderToMe = skedSenderLocation.getBearing(myLocation);
System.out.println("skedTX -> me deg: " + bearingOfSekdSenderToMe);
// System.out.println("skedTX -> me deg: " + bearingOfSekdSenderToMe);
if (DirectionUtils.isAngleInRange(bearingOfSekdSenderToMe,bearingOfSekdSenderToSkedReceiver, hisAntennaBeamWidth)) {
/**
* simple mech works
*/
// if (bearingOfSekdSenderToMe >= bearingOfSekdSenderToSkedReceiver) {
// if (bearingOfSekdSenderToMe-bearingOfSekdSenderToSkedReceiver <= hisAntennaBeamWidth/2){
// System.out.println(bearingOfSekdSenderToMe-bearingOfSekdSenderToSkedReceiver + " <= " + hisAntennaBeamWidth);
// return true;
// }
// } else if ((bearingOfSekdSenderToMe <= bearingOfSekdSenderToSkedReceiver)) {
// if (bearingOfSekdSenderToSkedReceiver-bearingOfSekdSenderToMe <= hisAntennaBeamWidth/2){
// return true;
// }
// } else return false;
/**
* simple mech end
*/
if (DirectionUtils.isAngleInRange(bearingOfSekdSenderToSkedReceiver, bearingOfSekdSenderToMe, hisAntennaBeamWidth)) {
//I may should get "/2" because of 50% of the 3dB opening angle if txer is directed to sender exactly
System.out.println("isinangleandrange!");
// System.out.println("------------> isinangleandrange!");
return true;
} else {
System.out.println("not in angle and reach");
// System.out.println("not in angle and reach");
return false;
}
}

View File

@@ -40,6 +40,17 @@ public class ChatMember {
boolean worked5600;
boolean worked10G;
boolean qrv144;
boolean qrv432;
boolean qrv1240;
boolean qrv2300;
boolean qrv3400;
boolean qrv5600;
boolean qrv10G;
boolean qrvAny;
public boolean isInAngleAndRange() {
return isInAngleAndRange;
}
@@ -128,6 +139,70 @@ public class ChatMember {
worked10G = worked10g;
}
public boolean isQrv144() {
return qrv144;
}
public void setQrv144(boolean qrv144) {
this.qrv144 = qrv144;
}
public boolean isQrv432() {
return qrv432;
}
public void setQrv432(boolean qrv432) {
this.qrv432 = qrv432;
}
public boolean isQrv1240() {
return qrv1240;
}
public void setQrv1240(boolean qrv1240) {
this.qrv1240 = qrv1240;
}
public boolean isQrv2300() {
return qrv2300;
}
public void setQrv2300(boolean qrv2300) {
this.qrv2300 = qrv2300;
}
public boolean isQrv3400() {
return qrv3400;
}
public void setQrv3400(boolean qrv3400) {
this.qrv3400 = qrv3400;
}
public boolean isQrv5600() {
return qrv5600;
}
public void setQrv5600(boolean qrv5600) {
this.qrv5600 = qrv5600;
}
public boolean isQrv10G() {
return qrv10G;
}
public void setQrv10G(boolean qrv10G) {
this.qrv10G = qrv10G;
}
public boolean isQrvAny() {
return qrvAny;
}
public void setQrvAny(boolean qrvAny) {
this.qrvAny = qrvAny;
}
public int[] getWorkedCategories() {
return workedCategories;
}
@@ -180,12 +255,6 @@ public class ChatMember {
QTFdirection = qTFdirection;
}
// public int getWorkedCategory() {
// return workedCategory;
// }
// public void setWorkedCategory(int workedCategory) {
// this.workedCategory = workedCategory;
// }
public String getCallSign() {
return callSign;
}
@@ -253,6 +322,22 @@ public class ChatMember {
this.setWorked10G(false);
}
/**
* Sets all worked information of this object to false. Scope: GUI, Reset Button
* for worked info, called by appcontroller
*/
public void resetQRVInformationAtAllBands() {
this.setQrvAny(true);
this.setQrv144(true);
this.setQrv432(true);
this.setQrv1240(true);
this.setQrv2300(true);
this.setQrv3400(true);
this.setQrv5600(true);
this.setQrv10G(true);
}
@Override
public String toString() {
String chatMemberSerialization = "";

View File

@@ -20,11 +20,13 @@ public class PlayAudioUtils {
*/
public PlayAudioUtils() {
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/NOISESTARTUP.mp3", "NOISESTARTUP.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/NOISECQWINDOW.mp3", "NOISECQWINDOW.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/NOISEPMWINDOW.mp3", "NOISEPMWINDOW.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/NOISEERROR.mp3", "NOISEERROR.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/NOISENOTIFY.mp3", "NOISENOTIFY.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/tick.mp3", "tick.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRA.mp3", "LTTRA.mp3");
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME, "/LTTRB.mp3", "LTTRB.mp3");
@@ -119,6 +121,7 @@ public class PlayAudioUtils {
*<br/>
*
* case '!': Startup<br/>
* case '-': tick<br/>
* case 'C': CQ Window new entry<br/>
* case 'P': PM Window new entry<br/>
* case 'E': Error occured<br/>
@@ -134,6 +137,9 @@ public class PlayAudioUtils {
switch (actionChar){
case '-':
musicList.add(new Media(new File (ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/tick.mp3")).toURI().toString()));
break;
case '!':
musicList.add(new Media(new File (ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/NOISESTARTUP.mp3")).toURI().toString()));
break;

View File

@@ -4,6 +4,8 @@ import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.*;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import javafx.beans.binding.Bindings;
@@ -97,6 +99,36 @@ public class Kst4ContestApplication extends Application {
selectedCallSignDownerSiteGridPane.add(new Label("Last activity: " + new Utils4KST().time_convertEpochToReadable(selectedCallSignInfoStageChatMember.getActivityTimeLastInEpoch()+"")), 0,2,1,1);
selectedCallSignDownerSiteGridPane.add(new Label(("(" + Utils4KST.time_getSecondsBetweenEpochAndNow(selectedCallSignInfoStageChatMember.getActivityTimeLastInEpoch()+"") /60%60) +" min ago)"), 0,3,1,1);
/**
* users qrv info setting will follow here
*/
CheckBox chkbx_tagMemberNotQRVFurtherInfoPane = new CheckBox("tag NOT QRV ALL");
chkbx_tagMemberNotQRVFurtherInfoPane.setSelected(selectedCallSignInfoStageChatMember.isQrvAny());
chkbx_tagMemberNotQRVFurtherInfoPane.selectedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
//if selected: NOT QRV; if NOT selected: is qrv!
if (!newValue) {
chkbx_tagMemberNotQRVFurtherInfoPane.selectedProperty().setValue(true);
} else {
chkbx_tagMemberNotQRVFurtherInfoPane.selectedProperty().setValue(false);
}
}
});
selectedCallSignDownerSiteGridPane.add(new CheckBox("tag not qrv 144"), 2,0,1,1);
selectedCallSignDownerSiteGridPane.add(new CheckBox("tag not qrv 432"), 2,1,1,1);
selectedCallSignDownerSiteGridPane.add(new CheckBox("tag not qrv 23cm"), 2,2,1,1);
selectedCallSignDownerSiteGridPane.add(new CheckBox("tag not qrv 13cm"), 2,3,1,1);
selectedCallSignDownerSiteGridPane.add(new CheckBox("tag not qrv 9cm"), 3,0,1,1);
selectedCallSignDownerSiteGridPane.add(new CheckBox("tag not qrv 6cm"), 3,1,1,1);
selectedCallSignDownerSiteGridPane.add(new CheckBox("tag not qrv 3cm"), 3,2,1,1);
selectedCallSignDownerSiteGridPane.add(new CheckBox("tag not qrv all"), 3,3,1,1);
/**
* users qrv info setting ending
*/
Button selectedCallSignShowAsPathBtn = new Button("Show path in AS");
selectedCallSignShowAsPathBtn.setOnAction(new EventHandler<ActionEvent>() {
@Override
@@ -105,7 +137,7 @@ public class Kst4ContestApplication extends Application {
}
});
selectedCallSignDownerSiteGridPane.add(selectedCallSignShowAsPathBtn, 1,0,1,3);
selectedCallSignDownerSiteGridPane.add(selectedCallSignShowAsPathBtn, 1,0,1,2);
@@ -699,6 +731,10 @@ public class Kst4ContestApplication extends Application {
shf3_subcol.prefWidthProperty().bind(tbl_chatMemberTable.widthProperty().divide(32));
// TableColumn<ChatMember, Void> unworkableCol = new TableColumn<ChatMember, Void>("qrv");
// unworkableCol.setCellFactory(CheckBoxTableCell.<ChatMember, Void>forTableColumn("lalala", c ->
// System.out.println(c.getCallSign())));
// TableColumn uhfCol_subcol = new TableColumn("432"); //TODO: Worked band analysis
// TableColumn shf23_subcol = new TableColumn("23");
// TableColumn shf13_subcol = new TableColumn("13");
@@ -4299,7 +4335,7 @@ public class Kst4ContestApplication extends Application {
}
System.out.println("[Main.java, Info]: Setted the QRB: " + txtFldstn_maxQRBDefault.getText());
chatcontroller.getChatPreferences().setStn_antennaBeamWidthDeg(Double.parseDouble(txtFldstn_maxQRBDefault.getText()));
chatcontroller.getChatPreferences().setStn_maxQRBDefault(Double.parseDouble(txtFldstn_maxQRBDefault.getText()));
}
});
@@ -4709,7 +4745,7 @@ public class Kst4ContestApplication extends Application {
// "Switch bands, prefix worked by others alert, direction notifications, notification pattern matchers");
// CheckBox chkBxEnableTRXMsgbyUCX = new CheckBox();
Label lblNotifyEnableSimpleSounds = new Label("Enable audio notifications at: startup, new personal messages, other");
Label lblNotifyEnableSimpleSounds = new Label("Enable simple audio notifications at: new personal message, new sked in ur dir, other");
Label lblNotifyEnableCWSounds = new Label("Enable CW callsign spelling for new personal messages");
Label lblNotifyEnableVoiceSounds = new Label("Enable phonetic callsign spelling for new personal messages");
@@ -5119,6 +5155,9 @@ public class Kst4ContestApplication extends Application {
btnOptionspnlConnect.setDisable(false);
btnOptionspnlDisconnect.setDisable(false);
btnOptionspnlDisconnectOnly.setDisable(true);
txtFldstn_antennaBeamWidthDeg.setDisable(false);
txtFldstn_qtfDefault.setDisable(false);
txtFldstn_maxQRBDefault.setDisable(false);
menuItemOptionsSetFrequencyAsName.setDisable(true);
menuItemOptionsAwayBack.setDisable(true);
}
@@ -5405,3 +5444,71 @@ public class Kst4ContestApplication extends Application {
// }
}
/**
* This cell type is used to declare buttons which can be placed in the tableview
*
* // source: https://stackoverflow.com/questions/76248808/how-do-i-add-a-button-into-a-jfx-tableview
*/
class ActionButtonTableCell<S, T> extends TableCell<S, T> {
private final ToggleButton actionButton;
public ActionButtonTableCell(String label, Consumer<S> function) {
this.getStyleClass().add("action-button-table-cell");
this.actionButton = new ToggleButton(label);
this.actionButton.setOnAction(e -> function.accept(getCurrentItem()));
this.actionButton.setMaxWidth(Double.MAX_VALUE);
}
public S getCurrentItem() {
// No need for a cast here:
System.out.println("<<<<<<<<<<<<<<<<<<<<TV Actionbutton pressed");
return getTableView().getItems().get(getIndex());
}
public static <S, T> Callback<TableColumn<S, T>, TableCell<S, T>> forTableColumn(String label, Consumer<S> function) {
return param -> new ActionButtonTableCell<>(label, function);
}
@Override
public void updateItem(T item, boolean empty) {
super.updateItem(item, empty);
if (empty) {
setGraphic(null);
} else {
setGraphic(actionButton);
}
}
}
/**
* This cell type is used to declare buttons which can be placed in the tableview
*
* // source: https://stackoverflow.com/questions/76248808/how-do-i-add-a-button-into-a-jfx-tableview
*/
class CheckBoxTableCell<S, T> extends TableCell<S, T> {
private final CheckBox actionCheckBox;
public CheckBoxTableCell(String label, Consumer<S> function) {
this.getStyleClass().add("action-button-table-cell");
this.actionCheckBox = new CheckBox(label);
this.actionCheckBox.setOnAction(e -> function.accept(getCurrentItem()));
// this.actionCheckBox.setMaxWidth(Double.MAX_VALUE);
}
public S getCurrentItem() {
// No need for a cast here:
System.out.println("<<<<<<<<<<<<<<<<<<<<TV Actionbutton pressed");
return getTableView().getItems().get(getIndex());
}
public static <S, T> Callback<TableColumn<S, T>, TableCell<S, T>> forTableColumn(String label, Consumer<S> function) {
return param -> new CheckBoxTableCell<>(label, function);
}
@Override
public void updateItem(T item, boolean empty) {
super.updateItem(item, empty);
if (empty) {
setGraphic(null);
} else {
setGraphic(actionCheckBox);
}
}
}

View File

@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<praktiKST>
<station>
<LoginCallSign>DO5SA</LoginCallSign>
<LoginCallSign>DO5AMF</LoginCallSign>
<LoginPassword>kst4contest.test</LoginPassword>
<LoginDisplayedName>Paule</LoginDisplayedName>
<LoginLocator>JO51DI</LoginLocator>
<LoginDisplayedName>Marc</LoginDisplayedName>
<LoginLocator>JN49GL</LoginLocator>
<ChatCategory>2</ChatCategory>
<stn_antennaBeamWidthDeg>50</stn_antennaBeamWidthDeg>
<stn_maxQRBDefault>900</stn_maxQRBDefault>

BIN
src/main/resources/tick.mp3 Normal file

Binary file not shown.