summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar jeff2014-08-31 17:53:05 -0400
committerGravatar jeff2014-08-31 17:53:05 -0400
commit5ba0b71cae99d99a4ef359ebccbb97ceda9c5083 (patch)
treed92d7a0af658fc609988692c58e048134b3ffba8
parentfixed mapping conversion bug with class rename order (diff)
downloadenigma-5ba0b71cae99d99a4ef359ebccbb97ceda9c5083.tar.gz
enigma-5ba0b71cae99d99a4ef359ebccbb97ceda9c5083.tar.xz
enigma-5ba0b71cae99d99a4ef359ebccbb97ceda9c5083.zip
added simple loading screen for jars
-rw-r--r--src/cuchaz/enigma/gui/Gui.java53
-rw-r--r--src/cuchaz/enigma/gui/GuiController.java5
2 files changed, 45 insertions, 13 deletions
diff --git a/src/cuchaz/enigma/gui/Gui.java b/src/cuchaz/enigma/gui/Gui.java
index ec0f842a..46395ac2 100644
--- a/src/cuchaz/enigma/gui/Gui.java
+++ b/src/cuchaz/enigma/gui/Gui.java
@@ -146,6 +146,8 @@ public class Gui
146 private JList<String> m_obfClasses; 146 private JList<String> m_obfClasses;
147 private JList<String> m_deobfClasses; 147 private JList<String> m_deobfClasses;
148 private JEditorPane m_editor; 148 private JEditorPane m_editor;
149 private JPanel m_classesPanel;
150 private JSplitPane m_splitClasses;
149 private JPanel m_infoPanel; 151 private JPanel m_infoPanel;
150 private ObfuscatedHighlightPainter m_obfuscatedHighlightPainter; 152 private ObfuscatedHighlightPainter m_obfuscatedHighlightPainter;
151 private DeobfuscatedHighlightPainter m_deobfuscatedHighlightPainter; 153 private DeobfuscatedHighlightPainter m_deobfuscatedHighlightPainter;
@@ -262,6 +264,12 @@ public class Gui
262 deobfPanel.add( new JLabel( "De-obfuscated Classes" ), BorderLayout.NORTH ); 264 deobfPanel.add( new JLabel( "De-obfuscated Classes" ), BorderLayout.NORTH );
263 deobfPanel.add( deobfScroller, BorderLayout.CENTER ); 265 deobfPanel.add( deobfScroller, BorderLayout.CENTER );
264 266
267 // set up classes panel (don't add the splitter yet)
268 m_splitClasses = new JSplitPane( JSplitPane.VERTICAL_SPLIT, true, obfPanel, deobfPanel );
269 m_classesPanel = new JPanel();
270 m_classesPanel.setLayout( new BorderLayout() );
271 m_classesPanel.setPreferredSize( new Dimension( 250, 0 ) );
272
265 // init info panel 273 // init info panel
266 m_infoPanel = new JPanel(); 274 m_infoPanel = new JPanel();
267 m_infoPanel.setLayout( new GridLayout( 4, 1, 0, 0 ) ); 275 m_infoPanel.setLayout( new GridLayout( 4, 1, 0, 0 ) );
@@ -563,8 +571,6 @@ public class Gui
563 callPanel.resetToPreferredSizes(); 571 callPanel.resetToPreferredSizes();
564 572
565 // layout controls 573 // layout controls
566 JSplitPane splitLeft = new JSplitPane( JSplitPane.VERTICAL_SPLIT, true, obfPanel, deobfPanel );
567 splitLeft.setPreferredSize( new Dimension( 250, 0 ) );
568 JPanel centerPanel = new JPanel(); 574 JPanel centerPanel = new JPanel();
569 centerPanel.setLayout( new BorderLayout() ); 575 centerPanel.setLayout( new BorderLayout() );
570 centerPanel.add( m_infoPanel, BorderLayout.NORTH ); 576 centerPanel.add( m_infoPanel, BorderLayout.NORTH );
@@ -577,7 +583,7 @@ public class Gui
577 JSplitPane splitRight = new JSplitPane( JSplitPane.HORIZONTAL_SPLIT, true, centerPanel, m_tabs ); 583 JSplitPane splitRight = new JSplitPane( JSplitPane.HORIZONTAL_SPLIT, true, centerPanel, m_tabs );
578 splitRight.setResizeWeight( 1 ); // let the left side take all the slack 584 splitRight.setResizeWeight( 1 ); // let the left side take all the slack
579 splitRight.resetToPreferredSizes(); 585 splitRight.resetToPreferredSizes();
580 JSplitPane splitCenter = new JSplitPane( JSplitPane.HORIZONTAL_SPLIT, true, splitLeft, splitRight ); 586 JSplitPane splitCenter = new JSplitPane( JSplitPane.HORIZONTAL_SPLIT, true, m_classesPanel, splitRight );
581 splitCenter.setResizeWeight( 0 ); // let the right side take all the slack 587 splitCenter.setResizeWeight( 0 ); // let the right side take all the slack
582 pane.add( splitCenter, BorderLayout.CENTER ); 588 pane.add( splitCenter, BorderLayout.CENTER );
583 589
@@ -597,14 +603,22 @@ public class Gui
597 { 603 {
598 if( m_jarFileChooser.showOpenDialog( m_frame ) == JFileChooser.APPROVE_OPTION ) 604 if( m_jarFileChooser.showOpenDialog( m_frame ) == JFileChooser.APPROVE_OPTION )
599 { 605 {
600 try 606 // load the jar in a separate thread
601 { 607 new Thread( )
602 m_controller.openJar( m_jarFileChooser.getSelectedFile() );
603 }
604 catch( IOException ex )
605 { 608 {
606 throw new Error( ex ); 609 @Override
607 } 610 public void run( )
611 {
612 try
613 {
614 m_controller.openJar( m_jarFileChooser.getSelectedFile() );
615 }
616 catch( IOException ex )
617 {
618 throw new Error( ex );
619 }
620 }
621 }.start();
608 } 622 }
609 } 623 }
610 } ); 624 } );
@@ -786,10 +800,22 @@ public class Gui
786 return m_controller; 800 return m_controller;
787 } 801 }
788 802
789 public void onOpenJar( String jarName ) 803 public void onStartOpenJar( )
804 {
805 m_classesPanel.removeAll();
806 JPanel panel = new JPanel();
807 panel.setLayout( new FlowLayout() );
808 panel.add( new JLabel( "Loading..." ) );
809 m_classesPanel.add( panel );
810 redraw();
811 }
812
813 public void onFinishOpenJar( String jarName )
790 { 814 {
791 // update gui 815 // update gui
792 m_frame.setTitle( Constants.Name + " - " + jarName ); 816 m_frame.setTitle( Constants.Name + " - " + jarName );
817 m_classesPanel.removeAll();
818 m_classesPanel.add( m_splitClasses );
793 setSource( null ); 819 setSource( null );
794 820
795 // update menu 821 // update menu
@@ -798,6 +824,8 @@ public class Gui
798 m_saveMappingsMenu.setEnabled( false ); 824 m_saveMappingsMenu.setEnabled( false );
799 m_saveMappingsAsMenu.setEnabled( true ); 825 m_saveMappingsAsMenu.setEnabled( true );
800 m_closeMappingsMenu.setEnabled( true ); 826 m_closeMappingsMenu.setEnabled( true );
827
828 redraw();
801 } 829 }
802 830
803 public void onCloseJar( ) 831 public void onCloseJar( )
@@ -807,6 +835,7 @@ public class Gui
807 setObfClasses( null ); 835 setObfClasses( null );
808 setDeobfClasses( null ); 836 setDeobfClasses( null );
809 setSource( null ); 837 setSource( null );
838 m_classesPanel.removeAll();
810 839
811 // update menu 840 // update menu
812 m_closeJarMenu.setEnabled( false ); 841 m_closeJarMenu.setEnabled( false );
@@ -814,6 +843,8 @@ public class Gui
814 m_saveMappingsMenu.setEnabled( false ); 843 m_saveMappingsMenu.setEnabled( false );
815 m_saveMappingsAsMenu.setEnabled( false ); 844 m_saveMappingsAsMenu.setEnabled( false );
816 m_closeMappingsMenu.setEnabled( false ); 845 m_closeMappingsMenu.setEnabled( false );
846
847 redraw();
817 } 848 }
818 849
819 public void setObfClasses( List<String> obfClasses ) 850 public void setObfClasses( List<String> obfClasses )
diff --git a/src/cuchaz/enigma/gui/GuiController.java b/src/cuchaz/enigma/gui/GuiController.java
index bd79e480..28794836 100644
--- a/src/cuchaz/enigma/gui/GuiController.java
+++ b/src/cuchaz/enigma/gui/GuiController.java
@@ -66,11 +66,12 @@ public class GuiController
66 return m_isDirty; 66 return m_isDirty;
67 } 67 }
68 68
69 public void openJar( File file ) 69 public void openJar( final File file )
70 throws IOException 70 throws IOException
71 { 71 {
72 m_gui.onStartOpenJar();
72 m_deobfuscator = new Deobfuscator( file ); 73 m_deobfuscator = new Deobfuscator( file );
73 m_gui.onOpenJar( m_deobfuscator.getJarName() ); 74 m_gui.onFinishOpenJar( m_deobfuscator.getJarName() );
74 refreshClasses(); 75 refreshClasses();
75 } 76 }
76 77