Add check beta updates checkbox in preferences
This commit is contained in:
parent
40eeb99255
commit
53026d0838
@ -14,5 +14,7 @@ build.source=default
|
|||||||
|
|
||||||
|
|
||||||
# Whether checking for updates is enabled by default.
|
# Whether checking for updates is enabled by default.
|
||||||
|
|
||||||
build.checkupdates=true
|
build.checkupdates=true
|
||||||
|
|
||||||
|
# Whether checking for beta updates is enabled by default.
|
||||||
|
build.checkbetaupdates=true
|
||||||
|
@ -293,6 +293,8 @@ pref.dlg.RockSimfiles = RockSim engine files (*.rse)
|
|||||||
pref.dlg.ZIParchives = ZIP archives (*.zip)
|
pref.dlg.ZIParchives = ZIP archives (*.zip)
|
||||||
pref.dlg.checkbox.Checkupdates = Check for software updates at startup
|
pref.dlg.checkbox.Checkupdates = Check for software updates at startup
|
||||||
pref.dlg.checkbox.Checkupdates.ttip = Check for software updates every time you start up OpenRocket
|
pref.dlg.checkbox.Checkupdates.ttip = Check for software updates every time you start up OpenRocket
|
||||||
|
pref.dlg.checkbox.CheckBetaupdates = Also check for beta releases
|
||||||
|
pref.dlg.checkbox.CheckBetaupdates.ttip = If checked, beta release updates are also notified. If unchecked, only official releases are considered.
|
||||||
pref.dlg.ttip.Checkupdatesnow = Check for software updates now
|
pref.dlg.ttip.Checkupdatesnow = Check for software updates now
|
||||||
pref.dlg.lbl.Selectprefunits = Select your preferred units:
|
pref.dlg.lbl.Selectprefunits = Select your preferred units:
|
||||||
pref.dlg.lbl.Rocketinfofontsize = Size of text in rocket design panel:
|
pref.dlg.lbl.Rocketinfofontsize = Size of text in rocket design panel:
|
||||||
|
@ -117,7 +117,6 @@ public class UpdateInfoRetriever {
|
|||||||
|
|
||||||
private final String preTag = null; // Change e.g. to 'android' for Android release
|
private final String preTag = null; // Change e.g. to 'android' for Android release
|
||||||
private final String[] filterTags = null; // Change to e.g. ["beta"] to only retrieve beta releases
|
private final String[] filterTags = null; // Change to e.g. ["beta"] to only retrieve beta releases
|
||||||
private final boolean onlyOfficial = false; // Change to false for beta testing
|
|
||||||
|
|
||||||
private volatile UpdateInfo info;
|
private volatile UpdateInfo info;
|
||||||
|
|
||||||
@ -140,7 +139,7 @@ public class UpdateInfoRetriever {
|
|||||||
|
|
||||||
// Get the latest release name from the GitHub release page
|
// Get the latest release name from the GitHub release page
|
||||||
JsonArray jsonArr = retrieveAllReleaseObjects();
|
JsonArray jsonArr = retrieveAllReleaseObjects();
|
||||||
JsonObject latestObj = getLatestReleaseJSON(jsonArr, preTag, filterTags, onlyOfficial);
|
JsonObject latestObj = getLatestReleaseJSON(jsonArr, preTag, filterTags, !Application.getPreferences().getCheckBetaUpdates());
|
||||||
ReleaseInfo release = new ReleaseInfo(latestObj);
|
ReleaseInfo release = new ReleaseInfo(latestObj);
|
||||||
String latestName = release.getReleaseName();
|
String latestName = release.getReleaseName();
|
||||||
|
|
||||||
|
@ -56,6 +56,8 @@ public abstract class Preferences implements ChangeSource {
|
|||||||
|
|
||||||
private static final String CHECK_UPDATES = "CheckUpdates";
|
private static final String CHECK_UPDATES = "CheckUpdates";
|
||||||
|
|
||||||
|
private static final String CHECK_BETA_UPDATES = "CheckBetaUpdates";
|
||||||
|
|
||||||
public static final String MOTOR_DIAMETER_FILTER = "MotorDiameterMatch";
|
public static final String MOTOR_DIAMETER_FILTER = "MotorDiameterMatch";
|
||||||
public static final String MOTOR_HIDE_SIMILAR = "MotorHideSimilar";
|
public static final String MOTOR_HIDE_SIMILAR = "MotorHideSimilar";
|
||||||
public static final String MOTOR_HIDE_UNAVAILABLE = "MotorHideUnavailable";
|
public static final String MOTOR_HIDE_UNAVAILABLE = "MotorHideUnavailable";
|
||||||
@ -141,6 +143,14 @@ public abstract class Preferences implements ChangeSource {
|
|||||||
this.putBoolean(CHECK_UPDATES, check);
|
this.putBoolean(CHECK_UPDATES, check);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final boolean getCheckBetaUpdates() {
|
||||||
|
return this.getBoolean(CHECK_BETA_UPDATES, BuildProperties.getDefaultCheckBetaUpdates());
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void setCheckBetaUpdates(boolean check) {
|
||||||
|
this.putBoolean(CHECK_BETA_UPDATES, check);
|
||||||
|
}
|
||||||
|
|
||||||
public final boolean getConfirmSimDeletion() {
|
public final boolean getConfirmSimDeletion() {
|
||||||
return this.getBoolean(CONFIRM_DELETE_SIMULATION, true);
|
return this.getBoolean(CONFIRM_DELETE_SIMULATION, true);
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ public class BuildProperties {
|
|||||||
private static final String BUILD_COPYRIGHT;
|
private static final String BUILD_COPYRIGHT;
|
||||||
private static final String BUILD_SOURCE;
|
private static final String BUILD_SOURCE;
|
||||||
private static final boolean DEFAULT_CHECK_UPDATES;
|
private static final boolean DEFAULT_CHECK_UPDATES;
|
||||||
|
private static final boolean DEFAULT_CHECK_BETA_UPDATES;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the OpenRocket version number.
|
* Return the OpenRocket version number.
|
||||||
@ -31,6 +32,10 @@ public class BuildProperties {
|
|||||||
return DEFAULT_CHECK_UPDATES;
|
return DEFAULT_CHECK_UPDATES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean getDefaultCheckBetaUpdates() {
|
||||||
|
return DEFAULT_CHECK_BETA_UPDATES;
|
||||||
|
}
|
||||||
|
|
||||||
public static String getCopyrightYear() {
|
public static String getCopyrightYear() {
|
||||||
return BUILD_COPYRIGHT;
|
return BUILD_COPYRIGHT;
|
||||||
}
|
}
|
||||||
@ -70,6 +75,12 @@ public class BuildProperties {
|
|||||||
else
|
else
|
||||||
DEFAULT_CHECK_UPDATES = true;
|
DEFAULT_CHECK_UPDATES = true;
|
||||||
|
|
||||||
|
value = PROPERTIES.getProperty("build.checkbetaupdates");
|
||||||
|
if (value != null)
|
||||||
|
DEFAULT_CHECK_BETA_UPDATES = Boolean.parseBoolean(value);
|
||||||
|
else
|
||||||
|
DEFAULT_CHECK_BETA_UPDATES = true;
|
||||||
|
|
||||||
BUILD_COPYRIGHT = PROPERTIES.getProperty("build.copyright", "2021");
|
BUILD_COPYRIGHT = PROPERTIES.getProperty("build.copyright", "2021");
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -213,6 +213,18 @@ public class GeneralPreferencesPanel extends PreferencesPanel {
|
|||||||
});
|
});
|
||||||
this.add(button, "right, wrap");
|
this.add(button, "right, wrap");
|
||||||
|
|
||||||
|
//// Check for beta releases
|
||||||
|
final JCheckBox betaUpdateBox = new JCheckBox(trans.get("pref.dlg.checkbox.CheckBetaupdates"));
|
||||||
|
betaUpdateBox.setToolTipText(trans.get("pref.dlg.checkbox.CheckBetaupdates.ttip"));
|
||||||
|
betaUpdateBox.setSelected(preferences.getCheckBetaUpdates());
|
||||||
|
betaUpdateBox.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
preferences.setCheckBetaUpdates(betaUpdateBox.isSelected());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.add(betaUpdateBox, "gapleft para, wrap");
|
||||||
|
|
||||||
//// Open most recent file on startup
|
//// Open most recent file on startup
|
||||||
final JCheckBox openRecentOnStartupBox = new JCheckBox(trans.get("pref.dlg.but.openlast"));
|
final JCheckBox openRecentOnStartupBox = new JCheckBox(trans.get("pref.dlg.but.openlast"));
|
||||||
openRecentOnStartupBox.setSelected(preferences.isAutoOpenLastDesignOnStartupEnabled());
|
openRecentOnStartupBox.setSelected(preferences.isAutoOpenLastDesignOnStartupEnabled());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user