mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-11 06:32:13 +00:00
Fixed Unresponsive status bar and its icon
This commit is contained in:
@@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
|
||||
- [#1970] AS2 Renaming invalid identifiers for direct strings (no constant indices)
|
||||
- [#1970] AS2 Renaming invalid identifiers IndexOutOfBounds on invalid constant index (obfuscated code, etc.)
|
||||
- [#1972] AS3 Renaming invalid identifiers - '#' character
|
||||
- Unresponsive status bar and its icon
|
||||
|
||||
## [18.3.5] - 2023-02-12
|
||||
### Added
|
||||
|
||||
@@ -113,7 +113,7 @@ public class LoadingPanel extends JPanel {
|
||||
rot2 += Math.PI * 2;
|
||||
}
|
||||
setRotation(rot2);
|
||||
repaint();
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
}, idelay, idelay);
|
||||
@@ -146,8 +146,9 @@ public class LoadingPanel extends JPanel {
|
||||
drawTimer.cancel();
|
||||
drawTimer = null;
|
||||
}
|
||||
lastImage = null;
|
||||
}
|
||||
|
||||
super.setVisible(visible);
|
||||
super.setVisible(visible);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,6 +125,8 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.logging.ConsoleHandler;
|
||||
@@ -817,11 +819,37 @@ public class Main {
|
||||
startWork(name, percent, mainFrame.getPanel().getCurrentWorker());
|
||||
}
|
||||
|
||||
|
||||
private static long lastTimeStartWork = 0L;
|
||||
|
||||
|
||||
private static final Timer statusTimer = new Timer("status", true);
|
||||
|
||||
static {
|
||||
statusTimer.schedule(new TimerTask(){
|
||||
@Override
|
||||
public void run() {
|
||||
if (mainFrame != null && mainFrame.getPanel().getStatusPanel().isStatusHidden()) {
|
||||
long nowTime = System.currentTimeMillis();
|
||||
if(nowTime > lastTimeStartWork + 5000) {
|
||||
mainFrame.getPanel().showOldStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 5000, 5000);
|
||||
}
|
||||
|
||||
public static void startWork(final String name, final int percent, final CancellableWorker worker) {
|
||||
working = true;
|
||||
View.execInEventDispatchLater(() -> {
|
||||
long nowTime = System.currentTimeMillis();
|
||||
if (mainFrame != null && nowTime < lastTimeStartWork + 1000) {
|
||||
mainFrame.getPanel().setWorkStatusHidden(name, worker);
|
||||
return;
|
||||
}
|
||||
lastTimeStartWork = nowTime;
|
||||
View.execInEventDispatch(() -> {
|
||||
if (mainFrame != null) {
|
||||
mainFrame.getPanel().setWorkStatus(name, worker);
|
||||
mainFrame.getPanel().setWorkStatus(name, worker);
|
||||
if (percent == -1) {
|
||||
mainFrame.getPanel().hidePercent();
|
||||
} else {
|
||||
|
||||
@@ -54,6 +54,16 @@ public class MainFrameStatusPanel extends JPanel {
|
||||
private int blinkPos;
|
||||
|
||||
private CancellableWorker currentWorker;
|
||||
|
||||
private String oldStatus = "";
|
||||
|
||||
private boolean statusHidden = false;
|
||||
|
||||
public boolean isStatusHidden() {
|
||||
return statusHidden;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public MainFrameStatusPanel(MainPanel mainPanel) {
|
||||
this.mainPanel = mainPanel;
|
||||
@@ -107,12 +117,30 @@ public class MainFrameStatusPanel extends JPanel {
|
||||
|
||||
public void setStatus(String s) {
|
||||
statusLabel.setText(s);
|
||||
oldStatus = s;
|
||||
statusHidden = false;
|
||||
}
|
||||
|
||||
public CancellableWorker getCurrentWorker() {
|
||||
return currentWorker;
|
||||
}
|
||||
|
||||
public void setWorkStatusHidden(String s, CancellableWorker worker) {
|
||||
currentWorker = worker;
|
||||
cancelButton.setVisible(worker != null);
|
||||
oldStatus = s;
|
||||
statusHidden = true;
|
||||
}
|
||||
|
||||
public void showOldStatus() {
|
||||
if (oldStatus.isEmpty()) {
|
||||
loadingPanel.setVisible(false);
|
||||
} else {
|
||||
loadingPanel.setVisible(true);
|
||||
}
|
||||
statusLabel.setText(oldStatus);
|
||||
}
|
||||
|
||||
public void setWorkStatus(String s, CancellableWorker worker) {
|
||||
if (s.isEmpty()) {
|
||||
loadingPanel.setVisible(false);
|
||||
@@ -122,6 +150,8 @@ public class MainFrameStatusPanel extends JPanel {
|
||||
statusLabel.setText(s);
|
||||
currentWorker = worker;
|
||||
cancelButton.setVisible(worker != null);
|
||||
oldStatus = s;
|
||||
statusHidden = false;
|
||||
}
|
||||
|
||||
public void setErrorState(ErrorState errorState) {
|
||||
|
||||
@@ -921,6 +921,15 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
statusPanel.setWorkStatus(s, worker);
|
||||
mainMenu.updateComponents();
|
||||
}
|
||||
|
||||
public void setWorkStatusHidden(String s, CancellableWorker worker) {
|
||||
statusPanel.setWorkStatusHidden(s, worker);
|
||||
}
|
||||
|
||||
public void showOldStatus() {
|
||||
statusPanel.showOldStatus();
|
||||
mainMenu.updateComponents();
|
||||
}
|
||||
|
||||
public CancellableWorker getCurrentWorker() {
|
||||
return statusPanel.getCurrentWorker();
|
||||
@@ -5853,4 +5862,9 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public MainFrameStatusPanel getStatusPanel() {
|
||||
return statusPanel;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user