mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
@@ -53,7 +53,7 @@ public class PreferenceEditorFactory
|
||||
return new DirectoryPreferenceEditor(userPreferences);
|
||||
case JMBE_LIBRARY:
|
||||
return new JmbeLibraryPreferenceEditor(userPreferences);
|
||||
case SOURCE_TUNER_CHANNELIZER:
|
||||
case SOURCE_TUNERS:
|
||||
return new TunerPreferenceEditor(userPreferences);
|
||||
case TALKGROUP_FORMAT:
|
||||
return new TalkgroupFormatPreferenceEditor(userPreferences);
|
||||
|
||||
@@ -31,7 +31,7 @@ public enum PreferenceEditorType
|
||||
AUDIO_RECORD("Record"),
|
||||
AUDIO_OUTPUT("Output/Tones"),
|
||||
AUDIO_DUPLICATE_CALL_DETECTION("Duplicate Calls"),
|
||||
SOURCE_TUNER_CHANNELIZER("Tuner Channelizer"),
|
||||
SOURCE_TUNERS("Tuners"),
|
||||
TALKGROUP_FORMAT("Talkgroup & Radio ID"),
|
||||
VECTOR_CALIBRATION("Vector Calibration"),
|
||||
DEFAULT("Default");
|
||||
|
||||
@@ -22,6 +22,8 @@ package io.github.dsheirer.gui.preference;
|
||||
import io.github.dsheirer.eventbus.MyEventBus;
|
||||
import io.github.dsheirer.gui.playlist.ViewPlaylistRequest;
|
||||
import io.github.dsheirer.preference.UserPreferences;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.geometry.Insets;
|
||||
@@ -44,9 +46,6 @@ import javafx.stage.Stage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Preferences editor dialog
|
||||
*/
|
||||
@@ -196,7 +195,7 @@ public class UserPreferencesEditor extends BorderPane
|
||||
storageItem.setExpanded(true);
|
||||
|
||||
TreeItem<String> sourceItem = new TreeItem<>("Source");
|
||||
sourceItem.getChildren().add(new TreeItem(PreferenceEditorType.SOURCE_TUNER_CHANNELIZER));
|
||||
sourceItem.getChildren().add(new TreeItem(PreferenceEditorType.SOURCE_TUNERS));
|
||||
treeRoot.getChildren().add(sourceItem);
|
||||
sourceItem.setExpanded(true);
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
* Copyright (C) 2014-2022 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
* ****************************************************************************
|
||||
*/
|
||||
|
||||
package io.github.dsheirer.gui.preference.tuner;
|
||||
|
||||
/**
|
||||
* RSPduo tuner select mode preferences.
|
||||
*/
|
||||
public enum RspDuoSelectionMode
|
||||
{
|
||||
DUAL("Dual Tuner"),
|
||||
SINGLE_1("Single Tuner 1"),
|
||||
SINGLE_2("Single Tuner 2");
|
||||
|
||||
private String mLabel;
|
||||
|
||||
RspDuoSelectionMode(String label)
|
||||
{
|
||||
mLabel = label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return mLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup the enum entry from the value.
|
||||
* @param value to match
|
||||
* @return matched value or (default) DUAL if the value couldn't be matched.
|
||||
*/
|
||||
public static RspDuoSelectionMode fromValue(String value)
|
||||
{
|
||||
try
|
||||
{
|
||||
return RspDuoSelectionMode.valueOf(value);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
//Do nothing
|
||||
}
|
||||
|
||||
return DUAL;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,20 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
* Copyright (C) 2014-2022 Dennis Sheirer
|
||||
*
|
||||
* * ******************************************************************************
|
||||
* * Copyright (C) 2014-2020 Dennis Sheirer
|
||||
* *
|
||||
* * This program is free software: you can redistribute it and/or modify
|
||||
* * it under the terms of the GNU General Public License as published by
|
||||
* * the Free Software Foundation, either version 3 of the License, or
|
||||
* * (at your option) any later version.
|
||||
* *
|
||||
* * This program is distributed in the hope that it will be useful,
|
||||
* * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* * GNU General Public License for more details.
|
||||
* *
|
||||
* * You should have received a copy of the GNU General Public License
|
||||
* * along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
* * *****************************************************************************
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
* ****************************************************************************
|
||||
*/
|
||||
|
||||
package io.github.dsheirer.gui.preference.tuner;
|
||||
@@ -55,6 +52,8 @@ public class TunerPreferenceEditor extends HBox
|
||||
private Label mHelpTextPolyphaseLabel;
|
||||
private Label mHeterodyneLabel;
|
||||
private Label mHelpTextHeterodyneLabel;
|
||||
private ChoiceBox<RspDuoSelectionMode> mRspDuoTunerModeChoiceBox;
|
||||
private Label mRspDuoModeLabel;
|
||||
|
||||
public TunerPreferenceEditor(UserPreferences userPreferences)
|
||||
{
|
||||
@@ -66,19 +65,24 @@ public class TunerPreferenceEditor extends HBox
|
||||
{
|
||||
if(mEditorPane == null)
|
||||
{
|
||||
int row = 0;
|
||||
mEditorPane = new GridPane();
|
||||
mEditorPane.setVgap(10);
|
||||
mEditorPane.setHgap(10);
|
||||
mEditorPane.setPadding(new Insets(10, 10, 10, 10));
|
||||
GridPane.setHalignment(getChannelizerLabel(), HPos.LEFT);
|
||||
mEditorPane.add(getChannelizerLabel(), 0, 0);
|
||||
mEditorPane.add(getChannelizerTypeChoiceBox(), 1, 0);
|
||||
mEditorPane.add(new Separator(Orientation.HORIZONTAL), 0, 1, 2, 1);
|
||||
mEditorPane.add(getPolyphaseLabel(), 0, 2, 2, 1);
|
||||
mEditorPane.add(getHelpTextPolyphaseLabel(), 0, 3, 2, 3);
|
||||
mEditorPane.add(new Label(" "), 0, 6);
|
||||
mEditorPane.add(getHeterodyneLabel(), 0, 7, 2, 1);
|
||||
mEditorPane.add(getHelpTextHeterodyneLabel(), 0, 8, 2, 3);
|
||||
GridPane.setHalignment(getChannelizerLabel(), HPos.RIGHT);
|
||||
mEditorPane.add(getChannelizerLabel(), 0, row);
|
||||
mEditorPane.add(getChannelizerTypeChoiceBox(), 1, row);
|
||||
mEditorPane.add(getPolyphaseLabel(), 0, ++row, 2, 1);
|
||||
mEditorPane.add(getHelpTextPolyphaseLabel(), 0, ++row, 2, 3);
|
||||
row += 3;
|
||||
mEditorPane.add(new Label(" "), 0, row);
|
||||
mEditorPane.add(getHeterodyneLabel(), 0, ++row, 2, 1);
|
||||
mEditorPane.add(getHelpTextHeterodyneLabel(), 0, ++row, 2, 3);
|
||||
row += 3;
|
||||
mEditorPane.add(new Separator(Orientation.HORIZONTAL), 0, row, 2, 1);
|
||||
mEditorPane.add(getRspDuoModeLabel(), 0, ++row);
|
||||
mEditorPane.add(getRspDuoTunerModeChoiceBox(), 1, row);
|
||||
}
|
||||
|
||||
return mEditorPane;
|
||||
@@ -161,4 +165,40 @@ public class TunerPreferenceEditor extends HBox
|
||||
|
||||
return mHelpTextHeterodyneLabel;
|
||||
}
|
||||
|
||||
private ChoiceBox<RspDuoSelectionMode> getRspDuoTunerModeChoiceBox()
|
||||
{
|
||||
if(mRspDuoTunerModeChoiceBox == null)
|
||||
{
|
||||
mRspDuoTunerModeChoiceBox = new ChoiceBox<>();
|
||||
mRspDuoTunerModeChoiceBox.getItems().addAll(RspDuoSelectionMode.values());
|
||||
|
||||
RspDuoSelectionMode current = mTunerPreference.getRspDuoTunerMode();
|
||||
mRspDuoTunerModeChoiceBox.getSelectionModel().select(current);
|
||||
|
||||
mRspDuoTunerModeChoiceBox.setOnAction(event -> {
|
||||
RspDuoSelectionMode selected = mRspDuoTunerModeChoiceBox.getSelectionModel().getSelectedItem();
|
||||
mTunerPreference.setRspDuoTunerMode(selected);
|
||||
|
||||
Label label = new Label("Please restart the application for this change to take effect");
|
||||
label.setWrapText(true);
|
||||
Alert alert = new Alert(Alert.AlertType.WARNING);
|
||||
alert.getDialogPane().setContent(label);
|
||||
alert.initOwner(((Node)getRspDuoTunerModeChoiceBox()).getScene().getWindow());
|
||||
alert.show();
|
||||
});
|
||||
}
|
||||
|
||||
return mRspDuoTunerModeChoiceBox;
|
||||
}
|
||||
|
||||
private Label getRspDuoModeLabel()
|
||||
{
|
||||
if(mRspDuoModeLabel == null)
|
||||
{
|
||||
mRspDuoModeLabel = new Label("SDRPlay RSPduo Selection Mode");
|
||||
}
|
||||
|
||||
return mRspDuoModeLabel;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user