fixed play is enabled when updating or file checking
This commit is contained in:
parent
21b86d6808
commit
0b2f64fc9a
@ -371,7 +371,7 @@ public class LauncherGUI implements Observer {
|
||||
Object elementAt = model1.getElementAt(presetList.getSelectedIndex());
|
||||
Modset selectedModset = (Modset) elementAt;
|
||||
|
||||
if(selectedModset.getType() == Modset.Type.PLACEHOLDER) return;
|
||||
if (selectedModset.getType() == Modset.Type.PLACEHOLDER) return;
|
||||
|
||||
ArmaUtils.start(selectedModset);
|
||||
}
|
||||
@ -416,6 +416,8 @@ public class LauncherGUI implements Observer {
|
||||
syncIntensiveCheckButton.setEnabled(false);
|
||||
syncFastCheckButton.setEnabled(false);
|
||||
refreshRepoButton.setEnabled(false);
|
||||
playButton.setEnabled(false);
|
||||
playPresetButton.setEnabled(false);
|
||||
new Thread(() -> syncer.sync(lastSynclist.clone())).start();
|
||||
});
|
||||
|
||||
@ -672,7 +674,7 @@ public class LauncherGUI implements Observer {
|
||||
syncFastCheckButton.setToolTipText(LangUtils.getInstance().getString("arma_running"));
|
||||
} else {
|
||||
if (SteamTimer.steam_running) {
|
||||
if (pathSet) {
|
||||
if (pathSet && !syncer.isRunning() && !fileChecker.isRunning()) {
|
||||
if (serverTable.getSelectedRow() != -1) {
|
||||
playButton.setEnabled(true);
|
||||
playButton.setToolTipText(null);
|
||||
@ -1161,11 +1163,11 @@ public class LauncherGUI implements Observer {
|
||||
syncDownloadButton.setEnabled(true);
|
||||
syncPauseButton.setEnabled(false);
|
||||
|
||||
refreshRepoButton.setEnabled(true);
|
||||
|
||||
syncChangedFileSizeLabel.setText(Humanize.binaryPrefix(fileChecker.getSize()));
|
||||
|
||||
lastSynclist = null;
|
||||
|
||||
techCheck();
|
||||
} else if (s.equals("fileCheckerStopped")) {
|
||||
syncIntensiveCheckButton.setEnabled(true);
|
||||
syncFastCheckButton.setEnabled(true);
|
||||
@ -1179,7 +1181,6 @@ public class LauncherGUI implements Observer {
|
||||
syncPauseButton.setEnabled(false);
|
||||
|
||||
repoTree.setCheckboxesChecked(false);
|
||||
refreshRepoButton.setEnabled(true);
|
||||
|
||||
syncAddedFilesLabel.setText("" + 0);
|
||||
syncChangedFilesLabel.setText("" + 0);
|
||||
@ -1188,6 +1189,7 @@ public class LauncherGUI implements Observer {
|
||||
syncChangedFileSizeLabel.setText("0.0 B");
|
||||
|
||||
lastSynclist = null;
|
||||
techCheck();
|
||||
} else if (s.equals("syncStopped")) {
|
||||
final Parameter workshopParameter = Parameters.USE_WORKSHOP.toParameter();
|
||||
fileCheck(!(workshopParameter.getValue() != null && (boolean) workshopParameter.getValue()));
|
||||
@ -1200,6 +1202,7 @@ public class LauncherGUI implements Observer {
|
||||
TaskBarUtils.getInstance().setValue(0);
|
||||
TaskBarUtils.getInstance().off();
|
||||
});
|
||||
techCheck();
|
||||
} else if (s.equals("syncComplete")) {
|
||||
final Parameter workshopParameter = Parameters.USE_WORKSHOP.toParameter();
|
||||
fileCheck(!(workshopParameter.getValue() != null && (boolean) workshopParameter.getValue()));
|
||||
@ -1214,6 +1217,7 @@ public class LauncherGUI implements Observer {
|
||||
TaskBarUtils.getInstance().attention();
|
||||
TaskBarUtils.getInstance().notification("Sync complete", "", TrayIcon.MessageType.INFO);
|
||||
});
|
||||
techCheck();
|
||||
} else if (s.equals("syncContinue")) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
syncDownloadAbortButton.setEnabled(true);
|
||||
@ -1266,6 +1270,9 @@ public class LauncherGUI implements Observer {
|
||||
|
||||
repoTree.setCheckboxesEnabled(false);
|
||||
repoTree.setCheckboxesChecked(false);
|
||||
|
||||
playButton.setEnabled(false);
|
||||
playPresetButton.setEnabled(false);
|
||||
}
|
||||
|
||||
public void exit() {
|
||||
|
@ -29,12 +29,13 @@ public class FileChecker implements Observable {
|
||||
private boolean stop = false;
|
||||
|
||||
private boolean checked = false;
|
||||
private boolean running = false;
|
||||
|
||||
private ArrayList<Path> deleted = new ArrayList<>();
|
||||
private HashMap<String, ArrayList<ModFile>> changed = new HashMap<>();
|
||||
int changedCount = 0;
|
||||
private int changedCount = 0;
|
||||
private HashMap<String, ArrayList<ModFile>> added = new HashMap<>();
|
||||
int addedCount = 0;
|
||||
private int addedCount = 0;
|
||||
|
||||
long size = 0;
|
||||
|
||||
@ -47,6 +48,7 @@ public class FileChecker implements Observable {
|
||||
}
|
||||
|
||||
public void check(boolean fastscan) {
|
||||
running = true;
|
||||
deleted.clear();
|
||||
changed.clear();
|
||||
changedCount = 0;
|
||||
@ -63,6 +65,7 @@ public class FileChecker implements Observable {
|
||||
for (AbstractMod abstractMod : RepositoryManger.MOD_LIST) {
|
||||
if (stop) {
|
||||
stop = false;
|
||||
running = false;
|
||||
notifyObservers("fileCheckerStopped");
|
||||
return;
|
||||
}
|
||||
@ -80,6 +83,7 @@ public class FileChecker implements Observable {
|
||||
|
||||
if (stop) {
|
||||
stop = false;
|
||||
running = false;
|
||||
notifyObservers("fileCheckerStopped");
|
||||
return;
|
||||
}
|
||||
@ -98,6 +102,7 @@ public class FileChecker implements Observable {
|
||||
checkDeleted();
|
||||
notifyObservers("fileChecker");
|
||||
checked = true;
|
||||
running = false;
|
||||
}
|
||||
|
||||
public boolean isChecked() {
|
||||
@ -108,6 +113,10 @@ public class FileChecker implements Observable {
|
||||
stop = true;
|
||||
}
|
||||
|
||||
public boolean isRunning() {
|
||||
return running;
|
||||
}
|
||||
|
||||
private void checkFile(String mod, ModFile mf, boolean fastscan) {
|
||||
ArrayList<ModFile> temp = new ArrayList<>();
|
||||
|
||||
|
@ -145,14 +145,16 @@ public class Syncer implements Observable, SyncListener {
|
||||
|
||||
if (mf != null) {
|
||||
final Path mfPath = mf.getLocaleFile().toPath();
|
||||
final String mfModPath = mf.getModPath();
|
||||
if(!workshopFiles.isEmpty()) {
|
||||
try {
|
||||
final String modfilePatj = mf.getModfileString().replace("/", File.separator).toLowerCase();
|
||||
Map.Entry<Path, Long> workshopFile = workshopFiles.entrySet()
|
||||
.stream().filter(e -> e.getKey().toAbsolutePath().toString().toLowerCase().endsWith(modfilePatj)).findFirst().get();
|
||||
if(workshopFile.getValue() == mf.getSize()) {
|
||||
SwingUtilities.invokeLater(() -> gui.syncStatusLabel.setText(mfModPath + ": Found in Steam-Workshop. Copy."));
|
||||
Files.copy(workshopFile.getKey(), mfPath, StandardCopyOption.REPLACE_EXISTING);
|
||||
Logger.getLogger(getClass().getName()).log(Level.INFO, "Found workshop file and copied: " + mfPath);
|
||||
SwingUtilities.invokeLater(() -> gui.syncStatusLabel.setText(mfModPath + ": Copied"));
|
||||
success++;
|
||||
finnishCurrent();
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user