Skip to content

Commit

Permalink
Break cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
RetGal committed Dec 27, 2024
1 parent 317f7e3 commit 945705f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 1 addition & 5 deletions src/main/java/mpo/dayon/assistant/gui/Assistant.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ private void initGui() {
if (frame != null) {
frame.dispose();
}
frame = new AssistantFrame(createAssistantActions(), counters, createLanguageSelection(), compatibilityModeActive.get(), this);
frame = new AssistantFrame(createAssistantActions(), counters, createLanguageSelection(), compatibilityModeActive.get(), networkEngine, isUpnpEnabled());
FatalErrorHandler.attachFrame(frame);
frame.addListener(new ControlEngine(networkEngine));
frame.setVisible(true);
Expand All @@ -171,10 +171,6 @@ private void createCounters() {
counters = new ArrayList<>(Arrays.asList(receivedBitCounter, receivedTileCounter, skippedTileCounter, mergedTileCounter, captureCompressionCounter));
}

public NetworkAssistantEngine getNetworkEngine() {
return networkEngine;
}

private AssistantActions createAssistantActions() {
AssistantActions assistantActions = new AssistantActions();
assistantActions.setIpAddressAction(createWhatIsMyIpAction());
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/mpo/dayon/assistant/gui/AssistantFrame.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package mpo.dayon.assistant.gui;

import mpo.dayon.assistant.network.NetworkAssistantEngine;
import mpo.dayon.common.event.Listeners;
import mpo.dayon.common.gui.common.BaseFrame;
import mpo.dayon.common.gui.common.FrameType;
Expand All @@ -20,6 +21,7 @@
import java.net.Socket;
import java.time.Instant;
import java.util.ArrayList;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicBoolean;

import static java.awt.event.KeyEvent.*;
Expand Down Expand Up @@ -92,11 +94,11 @@ class AssistantFrame extends BaseFrame {

private char osId;

AssistantFrame(AssistantActions actions, ArrayList<Counter<?>> counters, JComboBox<Language> languageSelection, boolean compatibilityModeActive, Assistant assistant) {
AssistantFrame(AssistantActions actions, ArrayList<Counter<?>> counters, JComboBox<Language> languageSelection, boolean compatibilityModeActive, NetworkAssistantEngine networkEngine, CompletableFuture<Boolean> isUpnpEnabled) {
RepeatingReleasedEventsFixer.install();
super.setFrameType(FrameType.ASSISTANT);
this.actions = actions;
this.actions.setNetworkConfigurationAction(createAssistantConnectionSettingsAction(assistant.isUpnpEnabled(), assistant.getNetworkEngine()));
this.actions.setNetworkConfigurationAction(createAssistantConnectionSettingsAction(isUpnpEnabled, networkEngine));
this.startButton = createButton(actions.getStartAction());
this.stopButton = createButton(actions.getStopAction(), false);
this.tokenButton = createTokenButton(actions.getTokenAction());
Expand Down

0 comments on commit 945705f

Please sign in to comment.