Changeset 860 for java/installer2/src/net/oni2/aeinstaller
- Timestamp:
- May 8, 2013, 12:25:39 PM (12 years ago)
- Location:
- java/installer2/src/net/oni2/aeinstaller
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
java/installer2/src/net/oni2/aeinstaller/backend/packages/PackageManager.java
r859 r860 35 35 private Type localType = null; 36 36 37 private HashMap<Integer, Package> newToolsOnDepot = new HashMap<Integer, Package>(); 38 private HashMap<Integer, Package> newModsOnDepot = new HashMap<Integer, Package>(); 39 37 40 /** 38 41 * @param f … … 87 90 */ 88 91 public void init() { 92 HashMap<Integer, Package> oldMods = mods; 93 HashMap<Integer, Package> oldTools = tools; 94 89 95 types = new HashMap<String, Type>(); 90 96 mods = new HashMap<Integer, Package>(); 97 tools = new HashMap<Integer, Package>(); 98 99 newModsOnDepot = new HashMap<Integer, Package>(); 100 newToolsOnDepot = new HashMap<Integer, Package>(); 91 101 92 102 localType = new Type("-Local-"); … … 100 110 if (nm.getUploads().size() == 1) { 101 111 Package m = new Package(nm); 102 if (nm.isTool()) 112 if (nm.isTool()) { 103 113 tools.put(m.getPackageNumber(), m); 104 else 114 if (!oldTools.containsKey(m.getPackageNumber())) 115 newToolsOnDepot.put(m.getPackageNumber(), m); 116 } else { 105 117 mods.put(m.getPackageNumber(), m); 118 if (!oldMods.containsKey(m.getPackageNumber())) 119 newModsOnDepot.put(m.getPackageNumber(), m); 120 } 106 121 } 107 122 } … … 247 262 } 248 263 return res; 264 } 265 266 /** 267 * @return the newToolsOnDepot 268 */ 269 public HashMap<Integer, Package> getNewToolsOnDepot() { 270 return newToolsOnDepot; 271 } 272 273 /** 274 * @return the newModsOnDepot 275 */ 276 public HashMap<Integer, Package> getNewModsOnDepot() { 277 return newModsOnDepot; 249 278 } 250 279 -
java/installer2/src/net/oni2/aeinstaller/gui/MainWin.java
r859 r860 225 225 } 226 226 227 PackageManager.loadFromCacheFile(Paths.getPacManCacheFilename()); 228 227 229 if (hasUpdated || !Paths.getPacManCacheFilename().exists()) { 228 230 PackageManager.getInstance().init(); 229 231 PackageManager.getInstance().saveToCacheFile( 230 232 Paths.getPacManCacheFilename()); 231 } else 232 PackageManager.loadFromCacheFile(Paths.getPacManCacheFilename()); 233 } 233 234 tblMods.reloadData(); 234 235 initModTypeBox(); … … 390 391 391 392 @SuppressWarnings("unused") 393 private void showNewPackages() { 394 PackageManager pm = PackageManager.getInstance(); 395 if ((pm.getNewModsOnDepot().size() >= pm.getModsValidAndNotCore() 396 .size()) 397 || (pm.getNewToolsOnDepot().size() >= pm.getTools().size())) 398 return; 399 if (SettingsManager.getInstance().get("notifynewpackages", true)) { 400 if (pm.getNewModsOnDepot().size() > 0 401 || pm.getNewToolsOnDepot().size() > 0) { 402 TreeSet<Package> mods = new TreeSet<Package>(pm 403 .getNewModsOnDepot().values()); 404 TreeSet<Package> tools = new TreeSet<Package>(pm 405 .getNewToolsOnDepot().values()); 406 StringBuffer modsString = new StringBuffer(); 407 StringBuffer toolsString = new StringBuffer(); 408 for (final Package m : mods) { 409 modsString.append("<li>" + m.getName() + "</li>"); 410 } 411 for (final Package m : tools) { 412 toolsString.append("<li>" + m.getName() + "</li>"); 413 } 414 // Build info dialog content 415 String message = "<html>" 416 + bundle.getString("newPackages.text") + "</html>"; 417 if (modsString.length() > 0) { 418 modsString.insert(0, "Mods:<ul>"); 419 modsString.append("</ul>"); 420 message = message.replaceAll("%1", modsString.toString()); 421 } else { 422 message = message.replaceAll("%1", ""); 423 } 424 if (toolsString.length() > 0) { 425 toolsString.insert(0, "Tools:<ul>"); 426 toolsString.append("</ul>"); 427 message = message.replaceAll("%2", toolsString.toString()); 428 } else { 429 message = message.replaceAll("%2", ""); 430 } 431 432 JPanel pan = new JPanel(new BorderLayout(0, 25)); 433 JLabel lblTxt = new JLabel(message); 434 pan.add(lblTxt, BorderLayout.CENTER); 435 JCheckBox checkFutureUpdates = new JCheckBox( 436 bundle.getString("checkNewPackagesOnStartup.text")); 437 checkFutureUpdates.setSelected(SettingsManager.getInstance() 438 .get("notifynewpackages", true)); 439 checkFutureUpdates.addItemListener(new ItemListener() { 440 @Override 441 public void itemStateChanged(ItemEvent evt) { 442 SettingsManager.getInstance().put("notifynewpackages", 443 evt.getStateChange() == ItemEvent.SELECTED); 444 } 445 }); 446 pan.add(checkFutureUpdates, BorderLayout.SOUTH); 447 448 JOptionPane.showMessageDialog(this, pan, 449 bundle.getString("newPackages.title"), 450 JOptionPane.INFORMATION_MESSAGE); 451 } 452 } 453 } 454 455 @SuppressWarnings("unused") 392 456 private void focus() { 393 457 SwingUtilities.invokeLater(new Runnable() { … … 507 571 }); 508 572 } 509 573 510 574 @SuppressWarnings("unused") 511 575 private void refreshLocalMods() { -
java/installer2/src/net/oni2/aeinstaller/gui/MainWin.yml
r859 r860 6 6 locationRelativeTo: null 7 7 defaultCloseOperation: doNothingOnClose 8 onWindowOpened: [execDepotUpdate,checkCorePackages,infoCorePackages,checkInitialize,initialize,checkUpdates,doUpdate,refreshToolsMenu, focus]8 onWindowOpened: [execDepotUpdate,checkCorePackages,infoCorePackages,checkInitialize,initialize,checkUpdates,doUpdate,refreshToolsMenu,showNewPackages,focus] 9 9 onWindowClosing: [saveLocalData,exit] 10 10 iconImage: img.ae -
java/installer2/src/net/oni2/aeinstaller/gui/settings/SettingsDialog.java
r856 r860 39 39 40 40 private JCheckBox chkNotifyOnStart; 41 private JCheckBox chkNotifyNewPackagesOnStart; 41 42 private JCheckBox chkNotifyDepsAfterInstall; 42 43 private JCheckBox chkCopyIntro; … … 81 82 82 83 chkNotifyOnStart.setSelected(set.get("notifyupdates", true)); 84 chkNotifyNewPackagesOnStart.setSelected(set.get("notifynewpackages", 85 true)); 83 86 chkNotifyDepsAfterInstall.setSelected(set.get("notifyDepsAfterInstall", 84 87 false)); … … 137 140 138 141 set.put("notifyupdates", chkNotifyOnStart.isSelected()); 142 set.put("notifynewpackages", chkNotifyNewPackagesOnStart.isSelected()); 139 143 set.put("notifyDepsAfterInstall", 140 144 chkNotifyDepsAfterInstall.isSelected()); -
java/installer2/src/net/oni2/aeinstaller/gui/settings/SettingsDialog.yml
r856 r860 12 12 - JPanel(name=panCommon, groupTitle=panCommon): 13 13 - JCheckBox(name=chkNotifyOnStart, horizontalTextPosition=LEADING, text=lblNotifyOnStart) 14 - JCheckBox(name=chkNotifyNewPackagesOnStart, horizontalTextPosition=LEADING, text=lblNotifyNewPackagesOnStart) 14 15 - JCheckBox(name=chkNotifyDepsAfterInstall, horizontalTextPosition=LEADING, text=lblNotifyDepsAfterInstall, toolTipText=lblNotifyDepsAfterInstall.tooltip) 15 16 - JCheckBox(name=chkCopyIntro, horizontalTextPosition=LEADING, text=lblCopyIntro) … … 17 18 - MigLayout: | 18 19 [grow] 19 >chkNotifyOnStart [pref] 20 >chkNotifyDepsAfterInstall [pref] 21 >chkCopyIntro [pref] 22 >chkCopyOutro [pref] 20 >chkNotifyOnStart [pref] 21 >chkNotifyNewPackagesOnStart [pref] 22 >chkNotifyDepsAfterInstall [pref] 23 >chkCopyIntro [pref] 24 >chkCopyOutro [pref] 23 25 - JPanel(name=panProxy, groupTitle=panProxy): 24 26 - JLabel(name=empty) -
java/installer2/src/net/oni2/aeinstaller/localization/MainWin.properties
r859 r860 77 77 checkOnStartup.text=Check for updates at startup 78 78 79 newPackages.title=New packages on Depot 80 newPackages.text=New packages were added to the Depot since last start of AEI.<br>%1%2 81 checkNewPackagesOnStartup.text=Check for new packages on startup 82 79 83 noOniSplit.title=OniSplit not available 80 84 noOniSplit.text=The Edition is not yet initialized and OniSplit is missing (offline mode?).\nCan not resume from here, exiting! -
java/installer2/src/net/oni2/aeinstaller/localization/SettingsDialog.properties
r856 r860 8 8 panCommon=Common 9 9 lblNotifyOnStart=Notify about updates on startup: 10 lblNotifyNewPackagesOnStart=Notify about new packages on startup: 10 11 lblNotifyDepsAfterInstall=Only notify about dependencies after installation: 11 12 lblNotifyDepsAfterInstall.tooltip=<html>\
Note:
See TracChangeset
for help on using the changeset viewer.