Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the splash screen to show on its own #4783

Merged
merged 4 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/main/java/net/rptools/maptool/client/MapTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
import net.rptools.maptool.model.TextMessage;
import net.rptools.maptool.model.Zone;
import net.rptools.maptool.model.ZoneFactory;
import net.rptools.maptool.model.library.LibraryManager;
import net.rptools.maptool.model.library.url.LibraryURLStreamHandler;
import net.rptools.maptool.model.player.LocalPlayer;
import net.rptools.maptool.model.player.Player;
Expand Down Expand Up @@ -639,6 +640,7 @@ private static void moveToMonitor(JFrame frame, int monitor, boolean maximize) {
private static void initialize() {
// First time
AppSetup.install();
LibraryManager.init();

// Clean up after ourselves
FileUtil.delete(AppUtil.getAppHome("tmp"), 2);
Expand All @@ -657,10 +659,12 @@ private static void initialize() {
assetTransferManager.addConsumerListener(new AssetTransferHandler());

setClientFrame(new MapToolFrame(menuBar));
taskbarFlasher = new TaskBarFlasher(clientFrame);

try {
playerZoneListener = new PlayerZoneListener();
zoneLoadedListener = new ZoneLoadedListener();

Campaign cmpgn = CampaignFactory.createBasicCampaign();
startPersonalServer(cmpgn);
} catch (Exception e) {
Expand Down Expand Up @@ -1279,8 +1283,6 @@ private static void postInitialize() {
// fire up autosaves
getAutoSaveManager().start();

taskbarFlasher = new TaskBarFlasher(clientFrame);

// Jamz: After preferences are loaded, Asset Tree and ImagePanel are out of sync,
// so after frame is all done loading we sync them back up.
MapTool.getFrame().getAssetPanel().getAssetTree().initialize();
Expand Down Expand Up @@ -1750,6 +1752,7 @@ public static void main(String[] args) {
EventQueue.invokeLater(
() -> {
initialize();

EventQueue.invokeLater(
() -> {
clientFrame.setVisible(true);
Expand Down
17 changes: 13 additions & 4 deletions src/main/java/net/rptools/maptool/client/ui/MapToolFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ public class MapToolFrame extends DefaultDockableHolder implements WindowListene

private final DragImageGlassPane dragImageGlassPane = new DragImageGlassPane();

private boolean dockingConfigured = false;

private final class KeyListenerDeleteDraw implements KeyListener {
private final JTree tree;

Expand Down Expand Up @@ -455,8 +457,7 @@ public MapToolFrame(JMenuBar menuBar) {
restorePreferences();
updateKeyStrokes();

// This will cause the frame to be set to visible (BAD jide, BAD! No cookie for you!)
configureDocking();
initializeFrames();

new WindowPreferences(AppConstants.APP_NAME, "mainFrame", this);
chatTyperTimers = new ChatNotificationTimers();
Expand Down Expand Up @@ -545,8 +546,6 @@ public String getPropertyName() {
}

private void configureDocking() {
initializeFrames();

getDockingManager().setProfileKey(DOCKING_PROFILE_NAME);
getDockingManager().setOutlineMode(com.jidesoft.docking.DockingManager.PARTIAL_OUTLINE_MODE);
getDockingManager().setUsePref(false);
Expand Down Expand Up @@ -619,6 +618,16 @@ private void configureDocking() {
/* /Issue #2485 */
}

@Override
public void setVisible(boolean b) {
if (!dockingConfigured) {
dockingConfigured = true;
configureDocking();
}

super.setVisible(b);
}

public DockableFrame getFrame(MTFrame frame) {
return frameMap.get(frame);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public class LibraryManager {
private static final AddOnSlashCommandManager addOnSlashCommandManager =
new AddOnSlashCommandManager();

static {
public static void init() {
libraryTokenManager.init();
builtInLibraryManager.loadBuiltIns();
new MapToolEventBus().getMainEventBus().register(addOnSlashCommandManager);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package net.rptools.maptool.model.sheet.stats;

import java.net.URL;
import java.util.Objects;
import java.util.Set;

/**
Expand All @@ -28,4 +29,36 @@
* @param namespace The namespace of the add-on that provides the spreadsheet.
*/
public record StatSheet(
String name, String description, URL entry, Set<String> propertyTypes, String namespace) {}
String name, String description, URL entry, Set<String> propertyTypes, String namespace) {
@Override
public boolean equals(Object obj) {
if (!(obj instanceof StatSheet other)) {
return false;
}
if (!Objects.equals(name, other.name)) {
return false;
}
if (!Objects.equals(description, other.description)) {
return false;
}
if (!Objects.equals(propertyTypes, other.propertyTypes)) {
return false;
}
if (!Objects.equals(namespace, other.namespace)) {
return false;
}

// Finally the URLs
var thisUrl = entry == null ? null : entry.toString();
var otherUrl = other.entry == null ? null : other.entry.toString();

return Objects.equals(thisUrl, otherUrl);
}

@Override
public int hashCode() {
// Hash the URL as a string. E.g., we don't need hostname resolution just for a hashcode.
return Objects.hash(
name, description, entry == null ? null : entry.toString(), propertyTypes, namespace);
}
}
Loading