mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
filter commit messages
This commit is contained in:
@@ -90,7 +90,7 @@ public enum FControl implements KeyEventDispatcher {
|
||||
private CloseAction closeAction;
|
||||
private final List<HostedMatch> currentMatches = Lists.newArrayList();
|
||||
private String snapsVersion = "", currentVersion = "";
|
||||
private Date snapsTimestamp = null;
|
||||
private Date snapsTimestamp = null, buildTimeStamp = null;
|
||||
private boolean isSnapshot, hasSnapsUpdate;
|
||||
private Localizer localizer;
|
||||
|
||||
@@ -142,31 +142,33 @@ public enum FControl implements KeyEventDispatcher {
|
||||
@Override
|
||||
public void windowClosing(final WindowEvent e) {
|
||||
switch (closeAction) {
|
||||
case NONE: //prompt user for close action if not previously specified
|
||||
final List<String> options = ImmutableList.of(getLocalizer().getMessage("lblCloseScreen"), getLocalizer().getMessage("lblExitForge"), getLocalizer().getMessage("lblCancel"));
|
||||
final int reply = FOptionPane.showOptionDialog(
|
||||
getLocalizer().getMessage("txCloseAction1") + "\n\n" + getLocalizer().getMessage("txCloseAction2"),
|
||||
getLocalizer().getMessage("titCloseAction"),
|
||||
FOptionPane.INFORMATION_ICON,
|
||||
options,
|
||||
2);
|
||||
switch (reply) {
|
||||
case 0: //Close Screen
|
||||
setCloseAction(CloseAction.CLOSE_SCREEN);
|
||||
windowClosing(e); //call again to apply chosen close action
|
||||
return;
|
||||
case 1: //Exit Forge
|
||||
setCloseAction(CloseAction.EXIT_FORGE);
|
||||
windowClosing(e); //call again to apply chosen close action
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case CLOSE_SCREEN:
|
||||
Singletons.getView().getNavigationBar().closeSelectedTab();
|
||||
break;
|
||||
case EXIT_FORGE:
|
||||
if (exitForge()) { return; }
|
||||
break;
|
||||
case NONE: //prompt user for close action if not previously specified
|
||||
final List<String> options = ImmutableList.of(getLocalizer().getMessage("lblCloseScreen"), getLocalizer().getMessage("lblExitForge"), getLocalizer().getMessage("lblCancel"));
|
||||
final int reply = FOptionPane.showOptionDialog(
|
||||
getLocalizer().getMessage("txCloseAction1") + "\n\n" + getLocalizer().getMessage("txCloseAction2"),
|
||||
getLocalizer().getMessage("titCloseAction"),
|
||||
FOptionPane.INFORMATION_ICON,
|
||||
options,
|
||||
2);
|
||||
switch (reply) {
|
||||
case 0: //Close Screen
|
||||
setCloseAction(CloseAction.CLOSE_SCREEN);
|
||||
windowClosing(e); //call again to apply chosen close action
|
||||
return;
|
||||
case 1: //Exit Forge
|
||||
setCloseAction(CloseAction.EXIT_FORGE);
|
||||
windowClosing(e); //call again to apply chosen close action
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case CLOSE_SCREEN:
|
||||
Singletons.getView().getNavigationBar().closeSelectedTab();
|
||||
break;
|
||||
case EXIT_FORGE:
|
||||
if (exitForge()) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
//prevent closing Forge if we reached this point
|
||||
Singletons.getView().getFrame().setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
||||
@@ -174,12 +176,22 @@ public enum FControl implements KeyEventDispatcher {
|
||||
});
|
||||
}
|
||||
|
||||
public Date getBuildTimeStamp() {
|
||||
return buildTimeStamp;
|
||||
}
|
||||
|
||||
public Date getSnapsTimestamp() {
|
||||
return snapsTimestamp;
|
||||
}
|
||||
|
||||
public CloseAction getCloseAction() {
|
||||
return closeAction;
|
||||
}
|
||||
|
||||
public void setCloseAction(final CloseAction closeAction0) {
|
||||
if (closeAction == closeAction0) { return; }
|
||||
if (closeAction == closeAction0) {
|
||||
return;
|
||||
}
|
||||
closeAction = closeAction0;
|
||||
Singletons.getView().getNavigationBar().updateBtnCloseTooltip();
|
||||
|
||||
@@ -190,7 +202,7 @@ public enum FControl implements KeyEventDispatcher {
|
||||
|
||||
public boolean canExitForge(final boolean forRestart) {
|
||||
final String action = (forRestart ? getLocalizer().getMessage("lblRestart") : getLocalizer().getMessage("lblExit"));
|
||||
String userPrompt =(forRestart ? getLocalizer().getMessage("lblAreYouSureYouWishRestartForge") : getLocalizer().getMessage("lblAreYouSureYouWishExitForge"));
|
||||
String userPrompt = (forRestart ? getLocalizer().getMessage("lblAreYouSureYouWishRestartForge") : getLocalizer().getMessage("lblAreYouSureYouWishExitForge"));
|
||||
final boolean hasCurrentMatches = hasCurrentMatches();
|
||||
if (hasCurrentMatches) {
|
||||
userPrompt = getLocalizer().getMessage("lblOneOrMoreGamesActive") + ". " + userPrompt;
|
||||
@@ -222,7 +234,9 @@ public enum FControl implements KeyEventDispatcher {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** After view and model have been initialized, control can start.*/
|
||||
/**
|
||||
* After view and model have been initialized, control can start.
|
||||
*/
|
||||
public void initialize() {
|
||||
final ForgePreferences prefs = FModel.getPreferences();
|
||||
currentVersion = BuildInfo.getVersionString();
|
||||
@@ -235,10 +249,12 @@ public enum FControl implements KeyEventDispatcher {
|
||||
url = new URL("https://downloads.cardforge.org/dailysnapshots/build.txt");
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
snapsTimestamp = simpleDateFormat.parse(FileUtil.readFileToString(url));
|
||||
buildTimeStamp = BuildInfo.getTimestamp();
|
||||
hasSnapsUpdate = BuildInfo.verifyTimestamp(snapsTimestamp);
|
||||
}
|
||||
|
||||
} catch (Exception ignored) {}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
// Preloads skin components (using progress bar).
|
||||
FSkin.loadFull(true);
|
||||
|
||||
@@ -258,15 +274,16 @@ public enum FControl implements KeyEventDispatcher {
|
||||
if (data.exists()) {
|
||||
try {
|
||||
FModel.getQuest().load(QuestDataIO.loadData(data));
|
||||
} catch(IOException ex) {
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
System.err.printf("Error loading quest data (%s).. skipping for now..%n", questname);
|
||||
}
|
||||
}
|
||||
// format release notes upon loading
|
||||
try {
|
||||
TextUtil.getFormattedChangelog(new File(FileUtil.pathCombine(System.getProperty("user.dir"), ForgeConstants.CHANGES_FILE_NO_RELEASE)),"");
|
||||
} catch (Exception e){}
|
||||
TextUtil.getFormattedChangelog(new File(FileUtil.pathCombine(System.getProperty("user.dir"), ForgeConstants.CHANGES_FILE_NO_RELEASE)), "");
|
||||
} catch (Exception e) {
|
||||
}
|
||||
// Handles resizing in null layouts of layers in JLayeredPane as well as saving window layout
|
||||
final FFrame window = Singletons.getView().getFrame();
|
||||
window.addComponentListener(new ComponentAdapter() {
|
||||
@@ -291,9 +308,11 @@ public enum FControl implements KeyEventDispatcher {
|
||||
FView.SINGLETON_INSTANCE.setSplashProgessBarMessage(getLocalizer().getMessage("lblOpeningMainWindow"));
|
||||
SwingUtilities.invokeLater(() -> Singletons.getView().initialize());
|
||||
}
|
||||
|
||||
public boolean isSnapshot() {
|
||||
return isSnapshot;
|
||||
}
|
||||
|
||||
public String getSnapshotNotification() {
|
||||
if (!isSnapshot || !hasSnapsUpdate || snapsVersion.isEmpty())
|
||||
return "";
|
||||
@@ -322,6 +341,7 @@ public enum FControl implements KeyEventDispatcher {
|
||||
public boolean setCurrentScreen(final FScreen screen) {
|
||||
return setCurrentScreen(screen, false);
|
||||
}
|
||||
|
||||
public boolean setCurrentScreen(final FScreen screen, final boolean previousScreenClosed) {
|
||||
//TODO: Uncomment the line below if this function stops being used to refresh
|
||||
//the current screen in some places (such as Continue and Restart in the match screen)
|
||||
@@ -370,11 +390,11 @@ public enum FControl implements KeyEventDispatcher {
|
||||
FView.SINGLETON_INSTANCE.getPnlInsets().setForegroundImage(FSkin.getIcon(FSkinProp.BG_NIGHT), true);
|
||||
}
|
||||
} else {
|
||||
FView.SINGLETON_INSTANCE.getPnlInsets().setForegroundImage((Image)null);
|
||||
FView.SINGLETON_INSTANCE.getPnlInsets().setForegroundImage((Image) null);
|
||||
}
|
||||
//SOverlayUtils.showTargetingOverlay();
|
||||
} else {
|
||||
FView.SINGLETON_INSTANCE.getPnlInsets().setForegroundImage((Image)null);
|
||||
FView.SINGLETON_INSTANCE.getPnlInsets().setForegroundImage((Image) null);
|
||||
}
|
||||
|
||||
Singletons.getView().getNavigationBar().updateSelectedTab();
|
||||
@@ -386,12 +406,16 @@ public enum FControl implements KeyEventDispatcher {
|
||||
}
|
||||
|
||||
public boolean ensureScreenActive(final FScreen screen) {
|
||||
if (currentScreen == screen) { return true; }
|
||||
if (currentScreen == screen) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return setCurrentScreen(screen);
|
||||
}
|
||||
|
||||
/** Remove all children from a specified layer. */
|
||||
/**
|
||||
* Remove all children from a specified layer.
|
||||
*/
|
||||
private void clearChildren(final int layer0) {
|
||||
final Component[] children = FView.SINGLETON_INSTANCE.getLpnDocument().getComponentsInLayer(layer0);
|
||||
|
||||
@@ -400,16 +424,24 @@ public enum FControl implements KeyEventDispatcher {
|
||||
}
|
||||
}
|
||||
|
||||
/** Sizes children of JLayeredPane to fully fit their layers. */
|
||||
/**
|
||||
* Sizes children of JLayeredPane to fully fit their layers.
|
||||
*/
|
||||
private void sizeChildren() {
|
||||
Component[] children = display.getComponentsInLayer(JLayeredPane.DEFAULT_LAYER);
|
||||
if (children.length != 0) { children[0].setSize(display.getSize()); }
|
||||
if (children.length != 0) {
|
||||
children[0].setSize(display.getSize());
|
||||
}
|
||||
|
||||
children = display.getComponentsInLayer(FView.TARGETING_LAYER);
|
||||
if (children.length != 0) { children[0].setSize(display.getSize()); }
|
||||
if (children.length != 0) {
|
||||
children[0].setSize(display.getSize());
|
||||
}
|
||||
|
||||
children = display.getComponentsInLayer(JLayeredPane.MODAL_LAYER);
|
||||
if (children.length != 0) { children[0].setSize(display.getSize()); }
|
||||
if (children.length != 0) {
|
||||
children[0].setSize(display.getSize());
|
||||
}
|
||||
}
|
||||
|
||||
public Dimension getDisplaySize() {
|
||||
@@ -428,18 +460,15 @@ public enum FControl implements KeyEventDispatcher {
|
||||
forgeMenu.show(true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (e.getID() == KeyEvent.KEY_PRESSED && e.getModifiersEx() == InputEvent.ALT_DOWN_MASK) {
|
||||
} else if (e.getID() == KeyEvent.KEY_PRESSED && e.getModifiersEx() == InputEvent.ALT_DOWN_MASK) {
|
||||
altKeyLastDown = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
altKeyLastDown = false;
|
||||
if (e.getID() == KeyEvent.KEY_PRESSED) {
|
||||
//give Forge menu the chance to handle the key event
|
||||
return forgeMenu.handleKeyEvent(e);
|
||||
}
|
||||
else if (e.getID() == KeyEvent.KEY_RELEASED) {
|
||||
} else if (e.getID() == KeyEvent.KEY_RELEASED) {
|
||||
if (e.getKeyCode() == KeyEvent.VK_CONTEXT_MENU) {
|
||||
forgeMenu.show();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package forge.screens.home.settings;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import forge.control.FControl;
|
||||
import forge.download.AutoUpdater;
|
||||
import forge.download.GuiDownloader;
|
||||
import forge.gui.ImportDialog;
|
||||
@@ -32,7 +33,7 @@ public enum CSubmenuDownloaders implements ICDoc {
|
||||
SINGLETON_INSTANCE;
|
||||
|
||||
private final UiCommand cmdLicensing = VSubmenuDownloaders.SINGLETON_INSTANCE::showLicensing;
|
||||
private final UiCommand cmdCheckForUpdates = () -> new AutoUpdater(false).attemptToUpdate(CompletableFuture.supplyAsync(() -> RSSReader.getCommitLog(GITHUB_COMMITS_URL_ATOM, null, null)));
|
||||
private final UiCommand cmdCheckForUpdates = () -> new AutoUpdater(false).attemptToUpdate(CompletableFuture.supplyAsync(() -> RSSReader.getCommitLog(GITHUB_COMMITS_URL_ATOM, FControl.instance.getBuildTimeStamp(), FControl.instance.getSnapsTimestamp())));
|
||||
|
||||
private final UiCommand cmdPicDownload = () -> new GuiDownloader(new GuiDownloadPicturesLQ()).show();
|
||||
private final UiCommand cmdPicDownloadHQ = () -> new GuiDownloader(new GuiDownloadPicturesHQ()).show();
|
||||
|
||||
@@ -438,7 +438,7 @@ public abstract class FTitleBarBase extends SkinnedMenuBar {
|
||||
protected void onClick() {
|
||||
if (!displayText.isEmpty()) {
|
||||
try {
|
||||
new AutoUpdater(false).attemptToUpdate(CompletableFuture.supplyAsync(() -> RSSReader.getCommitLog(GITHUB_COMMITS_URL_ATOM, null, null)));
|
||||
new AutoUpdater(false).attemptToUpdate(CompletableFuture.supplyAsync(() -> RSSReader.getCommitLog(GITHUB_COMMITS_URL_ATOM, FControl.instance.getBuildTimeStamp(), FControl.instance.getSnapsTimestamp())));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user