ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/java/installer2/src/net/oni2/aeinstaller/gui/MainWin.java
(Generate patch)

Comparing AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.java (file contents):
Revision 645 by alloc, Tue Jan 22 21:24:47 2013 UTC vs.
Revision 646 by alloc, Wed Jan 23 11:43:13 2013 UTC

# Line 53 | Line 53 | import net.oni2.aeinstaller.backend.oni.
53   import net.oni2.aeinstaller.backend.oni.OniSplit;
54   import net.oni2.aeinstaller.gui.about.AboutDialog;
55   import net.oni2.aeinstaller.gui.downloadwindow.Downloader;
56 + import net.oni2.aeinstaller.gui.mandatorypackages.MandatoryPackagesDialog;
57   import net.oni2.aeinstaller.gui.modtable.DownloadSizeListener;
58   import net.oni2.aeinstaller.gui.modtable.ModSelectionListener;
59   import net.oni2.aeinstaller.gui.modtable.ModTable;
# Line 116 | Line 117 | public class MainWin extends JFrame impl
117  
118          private EInstallState installState = EInstallState.DONE;
119          private TreeSet<Mod> installMods = null;
120 +        private TreeSet<Mod> installDeps = null;
121  
122          /**
123           * Constructor of main window.
# Line 274 | Line 276 | public class MainWin extends JFrame impl
276          @SuppressWarnings("unused")
277          private void doUpdate() {
278                  if (execUpdates != null && execUpdates.size() > 0) {
279 <                        Downloader dl = new Downloader(execUpdates);
279 >                        Downloader dl = new Downloader(execUpdates, null);
280                          try {
281                                  dl.setVisible(true);
282                                  if (dl.isFinished()) {
# Line 307 | Line 309 | public class MainWin extends JFrame impl
309                  });
310  
311          }
312 <        
312 >
313          @SuppressWarnings("unused")
314          private void showMandatoryPackagesDialog() {
315 <                // TODO: open mand-pack-dialog
315 >                new MandatoryPackagesDialog().setVisible(true);
316          }
317  
318          private void showSettings() {
# Line 453 | Line 455 | public class MainWin extends JFrame impl
455                                                  new ModDownloaderListener() {
456                                                          @Override
457                                                          public void updateStatus(ModDownloader source,
458 <                                                                        State state, int filesDown, int filesTotal,
458 >                                                                        Mod currentDownload, State state,
459 >                                                                        int filesDown, int filesTotal,
460                                                                          int bytesDown, int bytesTotal,
461                                                                          int duration, int remaining, int speed) {
462                                                                  evt.setProgressEnd(filesTotal);
# Line 496 | Line 499 | public class MainWin extends JFrame impl
499                  mods.addAll(ModManager.getInstance().getMandatoryMods());
500                  mods.addAll(tblMods.getSelectedMods());
501  
502 +                installDeps = new TreeSet<Mod>();
503 +
504                  installState = EInstallState.CHECKING;
505  
506                  while (installState == EInstallState.CHECKING) {
# Line 509 | Line 514 | public class MainWin extends JFrame impl
514                                  break;
515                          }
516                          if (toDownload.size() > 0) {
517 <                                Downloader dl = new Downloader(toDownload);
517 >                                Downloader dl = new Downloader(toDownload, installDeps);
518                                  try {
519                                          dl.setVisible(true);
520                                          if (!dl.isFinished()) {
# Line 523 | Line 528 | public class MainWin extends JFrame impl
528                          HashMap<Mod, HashSet<Mod>> dependencies = ModManager.getInstance()
529                                          .checkDependencies(mods);
530                          if (dependencies.size() > 0) {
531 <                                int size = 0;
532 <                                String depsLocalString = "";
533 <                                String depsDownloadString = "";
534 <                                for (Mod m : dependencies.keySet()) {
530 <                                        for (Mod mDep : dependencies.get(m)) {
531 <                                                if (!mods.contains(mDep)) {
531 >                                for (HashSet<Mod> hm : dependencies.values()) {
532 >                                        installDeps.addAll(hm);
533 >                                        for (Mod mDep : hm) {
534 >                                                if (!mods.contains(mDep))
535                                                          mods.add(mDep);
536 <                                                        if (!mDep.isLocalAvailable()) {
537 <                                                                size += mDep.getZipSize();
538 <                                                                if (depsDownloadString.length() > 0)
539 <                                                                        depsDownloadString += "\n";
540 <                                                                depsDownloadString += " - " + mDep.getName();
541 <                                                        } else {
542 <                                                                if (depsLocalString.length() > 0)
543 <                                                                        depsLocalString += "\n";
544 <                                                                depsLocalString += " - " + mDep.getName();
536 >                                        }
537 >                                }
538 >                                
539 >                                if (!Settings.getInstance()
540 >                                                .get("notifyDepsAfterInstall", false)) {
541 >                                        int size = 0;
542 >                                        String depsLocalString = "";
543 >                                        String depsDownloadString = "";
544 >                                        for (Mod m : dependencies.keySet()) {
545 >                                                for (Mod mDep : dependencies.get(m)) {
546 >                                                        if (!mods.contains(mDep)) {
547 >                                                                mods.add(mDep);
548 >                                                                if (!mDep.isLocalAvailable()) {
549 >                                                                        size += mDep.getZipSize();
550 >                                                                        if (depsDownloadString.length() > 0)
551 >                                                                                depsDownloadString += "\n";
552 >                                                                        depsDownloadString += " - "
553 >                                                                                        + mDep.getName();
554 >                                                                } else {
555 >                                                                        if (depsLocalString.length() > 0)
556 >                                                                                depsLocalString += "\n";
557 >                                                                        depsLocalString += " - " + mDep.getName();
558 >                                                                }
559                                                          }
560                                                  }
561                                          }
562 <                                }
563 <                                if (depsLocalString.length() == 0)
564 <                                        depsLocalString = bundle
565 <                                                        .getString("installDependencies.none");
566 <                                if (depsDownloadString.length() == 0)
567 <                                        depsDownloadString = bundle
568 <                                                        .getString("installDependencies.none");
569 <
570 <                                int res = JOptionPane.showConfirmDialog(this, String.format(
571 <                                                bundle.getString("installDependencies.text"),
572 <                                                depsLocalString, depsDownloadString,
573 <                                                SizeFormatter.format(size, 3)), bundle
574 <                                                .getString("installDependencies.title"),
575 <                                                JOptionPane.YES_NO_OPTION,
576 <                                                JOptionPane.INFORMATION_MESSAGE);
577 <                                if (res == JOptionPane.NO_OPTION) {
578 <                                        installState = EInstallState.ABORTED;
579 <                                        break;
562 >                                        if (depsLocalString.length() == 0)
563 >                                                depsLocalString = bundle
564 >                                                                .getString("installDependencies.none");
565 >                                        if (depsDownloadString.length() == 0)
566 >                                                depsDownloadString = bundle
567 >                                                                .getString("installDependencies.none");
568 >
569 >                                        int res = JOptionPane.showConfirmDialog(this, String
570 >                                                        .format(bundle
571 >                                                                        .getString("installDependencies.text"),
572 >                                                                        depsLocalString, depsDownloadString,
573 >                                                                        SizeFormatter.format(size, 3)), bundle
574 >                                                        .getString("installDependencies.title"),
575 >                                                        JOptionPane.YES_NO_OPTION,
576 >                                                        JOptionPane.INFORMATION_MESSAGE);
577 >                                        if (res == JOptionPane.NO_OPTION) {
578 >                                                installState = EInstallState.ABORTED;
579 >                                                break;
580 >                                        }
581                                  }
582                          } else {
583                                  HashMap<Mod, HashSet<Mod>> incompatibilities = ModManager
# Line 634 | Line 652 | public class MainWin extends JFrame impl
652                  switch (installState) {
653                          case DONE:
654                                  revertSelection();
655 <                                JOptionPane.showMessageDialog(this,
656 <                                                bundle.getString("installDone.text"),
657 <                                                bundle.getString("installDone.title"),
658 <                                                JOptionPane.INFORMATION_MESSAGE);
655 >                                if (installDeps.size() > 0
656 >                                                && Settings.getInstance().get("notifyDepsAfterInstall",
657 >                                                                false)) {
658 >                                        String installedDeps = "";
659 >                                        for (Mod m : installDeps) {
660 >                                                if (installedDeps.length() > 0)
661 >                                                        installedDeps += "\n";
662 >                                                installedDeps += " - " + m.getName();
663 >                                        }
664 >                                        JOptionPane.showMessageDialog(this, String.format(
665 >                                                        bundle.getString("installDoneDeps.text"),
666 >                                                        installedDeps), bundle
667 >                                                        .getString("installDone.title"),
668 >                                                        JOptionPane.INFORMATION_MESSAGE);
669 >                                } else {
670 >                                        JOptionPane.showMessageDialog(this,
671 >                                                        bundle.getString("installDone.text"),
672 >                                                        bundle.getString("installDone.title"),
673 >                                                        JOptionPane.INFORMATION_MESSAGE);
674 >                                }
675                                  break;
676                          case OFFLINE:
677                                  JOptionPane.showMessageDialog(this,
# Line 648 | Line 682 | public class MainWin extends JFrame impl
682                          default:
683                                  break;
684                  }
685 +                installDeps = null;
686          }
687  
688          @Override

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)