Skip to content

Commit 177e8d8

Browse files
committedDec 1, 2021
Feat: Instrallation of PCUAE close to completion
-Version check is made at startup of the manager -Renamed PCU Game Manager to PCUAE Manager. Changed texts in UI, The generated exe file and in build files.
1 parent b4dcae3 commit 177e8d8

23 files changed

+576
-325
lines changed
 

‎pom.xml

+12-22
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>se.lantz</groupId>
6-
<artifactId>PCUGameManager</artifactId>
7-
<version>1.11.2</version>
8-
<name>PCUGameManager</name>
6+
<artifactId>PCUAEManager</artifactId>
7+
<version>2.0.0</version>
8+
<name>PCUAEManager</name>
99
<dependencies>
1010
<dependency>
1111
<groupId>org.xerial</groupId>
@@ -42,16 +42,6 @@
4242
<artifactId>commons-io</artifactId>
4343
<version>2.8.0</version>
4444
</dependency>
45-
<!-- <dependency>
46-
<groupId>com.formdev</groupId>
47-
<artifactId>flatlaf</artifactId>
48-
<version>0.46</version>
49-
</dependency>
50-
<dependency>
51-
<groupId>com.formdev</groupId>
52-
<artifactId>flatlaf-intellij-themes</artifactId>
53-
<version>0.46</version>
54-
</dependency> -->
5545
<dependency>
5646
<groupId>com.google.code.gson</groupId>
5747
<artifactId>gson</artifactId>
@@ -107,7 +97,7 @@
10797
<archive>
10898
<manifest>
10999
<mainClass>
110-
se.lantz.PCUGameManager
100+
se.lantz.PCUAEManager
111101
</mainClass>
112102
</manifest>
113103
<manifestEntries>
@@ -136,15 +126,15 @@
136126
</goals>
137127
<configuration>
138128
<headerType>gui</headerType>
139-
<outfile>target/PcuGameManager.exe</outfile>
140-
<jar>target/PCUGameManager-${project.version}-jar-with-dependencies.jar</jar>
141-
<errTitle>PcuGameManager</errTitle>
129+
<outfile>target/PCUAEManager.exe</outfile>
130+
<jar>target/PCUAEManager-${project.version}-jar-with-dependencies.jar</jar>
131+
<errTitle>PCUAEManager</errTitle>
142132
<chdir>.</chdir>
143133
<singleInstance>
144-
<mutexName>PcuGameManager${project.version}</mutexName>
134+
<mutexName>PCUAEManager${project.version}</mutexName>
145135
</singleInstance>
146136
<classPath>
147-
<mainClass>se.lantz.PCUGameManager</mainClass>
137+
<mainClass>se.lantz.PCUAEManager</mainClass>
148138
<!-- <addDependencies>true</addDependencies> -->
149139
</classPath>
150140
<jre>
@@ -160,13 +150,13 @@
160150
<versionInfo>
161151
<fileVersion>${project.version}.1</fileVersion>
162152
<txtFileVersion>${project.version}}</txtFileVersion>
163-
<fileDescription>PCU Game Manager</fileDescription>
153+
<fileDescription>PCUAE Manager</fileDescription>
164154
<copyright>Lantzelot</copyright>
165155
<productVersion>${project.version}.1</productVersion>
166156
<txtProductVersion>${project.version}</txtProductVersion>
167-
<productName>PCU Game Manager</productName>
157+
<productName>PCUAE Manager</productName>
168158
<internalName>pcu</internalName>
169-
<originalFilename>PcuGameManager.exe</originalFilename>
159+
<originalFilename>PCUAEManager.exe</originalFilename>
170160
</versionInfo>
171161
</configuration>
172162
</execution>

‎src/main/java/se/lantz/PCUGameManager.java ‎src/main/java/se/lantz/PCUAEManager.java

+21-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111
import javax.swing.UIManager;
1212

1313
import se.lantz.gui.MainWindow;
14+
import se.lantz.gui.install.VersionDownloadDialog;
1415
import se.lantz.util.ExceptionHandler;
16+
import se.lantz.util.FileManager;
17+
import se.lantz.util.ManagerVersionChecker;
1518
import se.lantz.util.TopLevelExceptionHandler;
1619

17-
public class PCUGameManager
20+
public class PCUAEManager
1821
{
1922

2023
/**
@@ -55,12 +58,28 @@ public static void main(String[] args)
5558
Files.createDirectories(Paths.get("./covers/"));
5659
Files.createDirectories(Paths.get("./games/"));
5760
Files.createDirectories(Paths.get("./saves/"));
61+
Files.createDirectories(Paths.get("./pcuae-install/"));
5862
}
5963
catch (IOException e)
6064
{
61-
// TODO Auto-generated catch block
6265
e.printStackTrace();
6366
}
67+
68+
//Check for new versions at startup, but only when running stadalone, not during development.
69+
if (!FileManager.getPcuVersionFromManifest().isEmpty())
70+
{
71+
ManagerVersionChecker.fetchLatestVersionFromGithub();
72+
if (ManagerVersionChecker.isNewVersionAvailable())
73+
{
74+
VersionDownloadDialog dialog = new VersionDownloadDialog(MainWindow.getInstance());
75+
dialog.pack();
76+
dialog.setLocationRelativeTo(MainWindow.getInstance());
77+
if (dialog.showDialog())
78+
{
79+
ManagerVersionChecker.updateVersion();
80+
}
81+
}
82+
}
6483
});
6584
}
6685

‎src/main/java/se/lantz/gui/AboutDialog.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ private JLabel getTitleLabel()
114114
{
115115
if (titleLabel == null)
116116
{
117-
titleLabel = new JLabel("Project Carousel USB Game Manager");
117+
titleLabel = new JLabel("PCUAE Manager");
118118
}
119119
return titleLabel;
120120
}

‎src/main/java/se/lantz/gui/BaseDialog.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ private JPanel getButtonPanel()
8181
GridBagConstraints gbc_okButton = new GridBagConstraints();
8282
gbc_okButton.anchor = GridBagConstraints.EAST;
8383
gbc_okButton.weightx = 0.5;
84-
gbc_okButton.insets = new Insets(5, 5, 5, 5);
84+
gbc_okButton.insets = new Insets(5, 5, 15, 5);
8585
gbc_okButton.gridx = 0;
8686
gbc_okButton.gridy = 0;
8787
buttonPanel.add(getOkButton(), gbc_okButton);
8888
GridBagConstraints gbc_cancelButton = new GridBagConstraints();
8989
gbc_cancelButton.weightx = 0.5;
90-
gbc_cancelButton.insets = new Insets(5, 5, 5, 5);
90+
gbc_cancelButton.insets = new Insets(5, 5, 15, 5);
9191
gbc_cancelButton.anchor = GridBagConstraints.WEST;
9292
gbc_cancelButton.gridx = 1;
9393
gbc_cancelButton.gridy = 0;
@@ -126,6 +126,7 @@ protected JButton getCancelButton()
126126
public boolean showDialog()
127127
{
128128
okPressed = false;
129+
getOkButton().requestFocusInWindow();
129130
this.setVisible(true);
130131
return okPressed;
131132
}

‎src/main/java/se/lantz/gui/MainWindow.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public static boolean isInitialized()
4646
private MainWindow()
4747
{
4848
this.setIconImage(new ImageIcon(getClass().getResource("/se/lantz/FrameIcon.png")).getImage());
49-
this.setTitle("PCU Game Manager");
49+
this.setTitle("PCUAE Manager");
5050
uiModel = new MainViewModel();
5151
menuManager = new MenuManager(uiModel, this);
5252
this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
@@ -66,7 +66,7 @@ public void windowClosing(java.awt.event.WindowEvent e)
6666
String versionValue = FileManager.getPcuVersionFromManifest();
6767
if (!versionValue.isEmpty())
6868
{
69-
setTitle("PCU Game Manager v." + versionValue);
69+
setTitle("PCUAE Manager v." + versionValue);
7070
}
7171
}
7272

‎src/main/java/se/lantz/gui/MenuManager.java

+11-31
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,19 @@
4242
import se.lantz.gui.imports.ImportProgressDialog;
4343
import se.lantz.gui.imports.ImportSavedStatesDialog;
4444
import se.lantz.gui.imports.ImportSavedStatesWorker;
45+
import se.lantz.gui.install.VersionDownloadDialog;
4546
import se.lantz.manager.BackupManager;
4647
import se.lantz.manager.ExportManager;
4748
import se.lantz.manager.ImportManager;
48-
import se.lantz.manager.InstallPCUAEManager;
49+
import se.lantz.manager.PCUAEInstallManager;
4950
import se.lantz.manager.RestoreManager;
5051
import se.lantz.manager.SavedStatesManager;
5152
import se.lantz.model.MainViewModel;
5253
import se.lantz.model.data.GameListData;
5354
import se.lantz.model.data.GameView;
5455
import se.lantz.util.ExceptionHandler;
5556
import se.lantz.util.FileManager;
56-
import se.lantz.util.VersionChecker;
57+
import se.lantz.util.ManagerVersionChecker;
5758

5859
public class MenuManager
5960
{
@@ -108,7 +109,6 @@ public class MenuManager
108109
private JMenuItem palNtscFixItem;
109110

110111
private JMenuItem installPCUAEItem;
111-
private JMenuItem downloadPCUAEItem;
112112

113113
private JMenuItem helpItem;
114114
private JMenuItem aboutItem;
@@ -122,7 +122,7 @@ public class MenuManager
122122
private BackupManager backupManager;
123123
private RestoreManager restoreManager;
124124
private SavedStatesManager savedStatesManager;
125-
private InstallPCUAEManager installPCUAEManager;
125+
private PCUAEInstallManager installPCUAEManager;
126126
private MainWindow mainWindow;
127127

128128
public MenuManager(final MainViewModel uiModel, MainWindow mainWindow)
@@ -135,7 +135,7 @@ public MenuManager(final MainViewModel uiModel, MainWindow mainWindow)
135135
this.backupManager = new BackupManager(uiModel);
136136
this.restoreManager = new RestoreManager(uiModel);
137137
this.savedStatesManager = new SavedStatesManager(uiModel, getPalNtscFixMenuItem());
138-
this.installPCUAEManager = new InstallPCUAEManager();
138+
this.installPCUAEManager = new PCUAEInstallManager(getExportItem());
139139
uiModel.setSavedStatesManager(savedStatesManager);
140140
setupMenues();
141141
}
@@ -208,7 +208,6 @@ private void setupMenues()
208208

209209
pcuaeMenu = new JMenu("PCUAE");
210210
pcuaeMenu.add(getInstallPCUAEItem());
211-
pcuaeMenu.add(getDownloadPCUAEItem());
212211

213212
helpMenu = new JMenu("Help");
214213
helpMenu.setMnemonic('H');
@@ -691,24 +690,13 @@ private JMenuItem getInstallPCUAEItem()
691690
{
692691
if (installPCUAEItem == null)
693692
{
694-
installPCUAEItem = new JMenuItem("Install PCUAE to a USB stick...");
693+
installPCUAEItem = new JMenuItem("Install PCUAE to a USB drive...");
695694
installPCUAEItem.setMnemonic('i');
696695
installPCUAEItem.addActionListener(e -> installPCUAE());
697696
}
698697
return installPCUAEItem;
699698
}
700699

701-
private JMenuItem getDownloadPCUAEItem()
702-
{
703-
if (downloadPCUAEItem == null)
704-
{
705-
downloadPCUAEItem = new JMenuItem("Download PCUEA");
706-
downloadPCUAEItem.setMnemonic('d');
707-
downloadPCUAEItem.addActionListener(e -> downloadPCUAE());
708-
}
709-
return downloadPCUAEItem;
710-
}
711-
712700
private JMenuItem getHelpItem()
713701
{
714702
helpItem = new JMenuItem("Help");
@@ -1014,7 +1002,7 @@ private void convertScreens()
10141002
private void fixInvalidCharsInDescriptions()
10151003
{
10161004
String message =
1017-
"Do you want to check all description texts in the database and remove all carrage return (CR) characters?\nEarlier versions of the game manager allowed for CR characters, the Carousel " +
1005+
"Do you want to check all description texts in the database and remove all carrage return (CR) characters?\nEarlier versions of the manager allowed for CR characters, the Carousel " +
10181006
"does not handle that properly.\nCR characters will be replaced by a space character.";
10191007
int option = JOptionPane.showConfirmDialog(MainWindow.getInstance()
10201008
.getMainPanel(), message, "Check description texts", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
@@ -1043,14 +1031,7 @@ private void fixPalNtscIssue()
10431031

10441032
private void installPCUAE()
10451033
{
1046-
installPCUAEManager.install(getExportItem());
1047-
}
1048-
1049-
private void downloadPCUAE()
1050-
{
1051-
JProgressBar progress = new JProgressBar();
1052-
installPCUAEManager.downloadTest(progress);
1053-
JOptionPane.showMessageDialog(MainWindow.getInstance(), progress, "Downloading PCUAE", JOptionPane.OK_OPTION);
1034+
installPCUAEManager.installPCUAE();
10541035
}
10551036

10561037
private JEditorPane getPalNtscEditorPane()
@@ -1098,16 +1079,15 @@ private void clearFavorites(int number)
10981079

10991080
private void checkForNewRelease()
11001081
{
1101-
VersionChecker.fetchLatestVersionFromGithub();
1102-
if (VersionChecker.isNewVersionAvailable())
1082+
ManagerVersionChecker.fetchLatestVersionFromGithub();
1083+
if (ManagerVersionChecker.isNewVersionAvailable())
11031084
{
11041085
VersionDownloadDialog dialog = new VersionDownloadDialog(MainWindow.getInstance());
11051086
dialog.pack();
11061087
dialog.setLocationRelativeTo(MainWindow.getInstance());
11071088
if (dialog.showDialog())
11081089
{
1109-
VersionChecker.updateVersion();
1110-
// getExitItem().doClick();
1090+
ManagerVersionChecker.updateVersion();
11111091
}
11121092
}
11131093
else

‎src/main/java/se/lantz/gui/VersionDownloadDialog.java

-26
This file was deleted.

‎src/main/java/se/lantz/gui/download/DownloadDialog.java

+8-6
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,28 @@
77

88
public class DownloadDialog extends BaseDialog
99
{
10-
DownloadPanel deletePanel;
10+
DownloadPanel downloadPanel;
1111
private boolean complete = false;
1212

13-
public DownloadDialog(String title)
13+
public DownloadDialog(String downloadLabel)
1414
{
1515
super(MainWindow.getInstance());
16-
setTitle(title);
16+
// setTitle(title);
1717
addContent(getDownloadPanel());
1818
this.setResizable(false);
1919
getCancelButton().setVisible(false);
2020
getOkButton().setVisible(false);
21+
22+
getDownloadPanel().getInfoLabel().setText(downloadLabel);
2123
}
2224

2325
private DownloadPanel getDownloadPanel()
2426
{
25-
if (deletePanel == null)
27+
if (downloadPanel == null)
2628
{
27-
deletePanel = new DownloadPanel();
29+
downloadPanel = new DownloadPanel();
2830
}
29-
return deletePanel;
31+
return downloadPanel;
3032
}
3133

3234
@Override

0 commit comments

Comments
 (0)
Please sign in to comment.