From: Holger Z. <hz...@us...> - 2004-09-26 21:12:49
|
Update of /cvsroot/jake2/jake2/src/jake2/qcommon In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8501/src/jake2/qcommon Modified Files: Q2DataDialog.java Log Message: show Kbytes in progress bar Index: Q2DataDialog.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/qcommon/Q2DataDialog.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Q2DataDialog.java 26 Sep 2004 19:58:56 -0000 1.11 --- Q2DataDialog.java 26 Sep 2004 21:12:40 -0000 1.12 *************** *** 11,16 **** import java.awt.*; ! import java.awt.event.ActionEvent; ! import java.awt.event.ActionListener; import java.io.*; import java.net.URL; --- 11,15 ---- import java.awt.*; ! import java.awt.event.*; import java.io.*; import java.net.URL; *************** *** 189,193 **** FS.setCDDir(); } ! synchronized(this) { notifyAll(); --- 188,192 ---- FS.setCDDir(); } ! synchronized(this) { notifyAll(); *************** *** 355,363 **** constraints.insets = new Insets(0, 2, 0, 5); constraints.anchor = GridBagConstraints.WEST; ! add(new JLabel("select baseq2 directory from existing Quake2 installation"), constraints); constraints.gridx = 1; constraints.gridy = 2; ! add(new JLabel("download and install Quake2 demo data (38MB)"), constraints); selection = new ButtonGroup(); --- 354,374 ---- constraints.insets = new Insets(0, 2, 0, 5); constraints.anchor = GridBagConstraints.WEST; ! JLabel label = new JLabel("select baseq2 directory from existing Quake2 installation"); ! label.addMouseListener(new MouseAdapter() { ! public void mouseClicked(MouseEvent e) { ! dir.setSelected(true); ! } ! }); ! add(label, constraints); constraints.gridx = 1; constraints.gridy = 2; ! label = new JLabel("download and install Quake2 demo data (38MB)"); ! label.addMouseListener(new MouseAdapter() { ! public void mouseClicked(MouseEvent e) { ! install.setSelected(true); ! } ! }); ! add(label, constraints); selection = new ButtonGroup(); *************** *** 662,671 **** try { if (!dir.isDirectory() || !dir.canWrite()) { ! endInstall(); return; } } catch (Exception e) { ! endInstall(); return; } --- 673,682 ---- try { if (!dir.isDirectory() || !dir.canWrite()) { ! endInstall("can't write to " + destDir); return; } } catch (Exception e) { ! endInstall(e.getMessage()); return; } *************** *** 676,680 **** int length = conn.getContentLength(); progress.setMaximum(length / 1024); ! in = conn.getInputStream(); --- 687,692 ---- int length = conn.getContentLength(); progress.setMaximum(length / 1024); ! progress.setMinimum(0); ! in = conn.getInputStream(); *************** *** 685,689 **** copyStream(in, out); } catch (Exception e) { ! endInstall(); return; } finally { --- 697,701 ---- copyStream(in, out); } catch (Exception e) { ! endInstall(e.getMessage()); return; } finally { *************** *** 699,703 **** installData(outFile.getCanonicalPath()); } catch (Exception e) { ! endInstall(); return; } --- 711,715 ---- installData(outFile.getCanonicalPath()); } catch (Exception e) { ! endInstall(e.getMessage()); return; } *************** *** 708,714 **** } catch (Exception e) {} ! parent.dir = destDir + "/baseq2"; ! parent.showChooseDialog(); ! parent.okButtonActionPerformed(null); } --- 720,724 ---- } catch (Exception e) {} ! endInstall("installation successful"); } *************** *** 741,745 **** } } catch (Exception e) { ! throw new Exception(); } finally { try {in.close();} catch (Exception e1) {} --- 751,755 ---- } } catch (Exception e) { ! throw e; } finally { try {in.close();} catch (Exception e1) {} *************** *** 748,752 **** } ! void endInstall() { parent.dir = destDir + "/baseq2"; parent.showChooseDialog(); --- 758,763 ---- } ! void endInstall(String message) { ! parent.notFoundPanel.message.setText(message); parent.dir = destDir + "/baseq2"; parent.showChooseDialog(); *************** *** 762,769 **** out.write(buf, 0, l); c += l; ! progress.setValue(c / 1024); } } catch (Exception e) { ! throw new Exception(); } finally { try { --- 773,782 ---- out.write(buf, 0, l); c += l; ! int k = c / 1024; ! progress.setValue(k); ! progress.setString(k + "/" + progress.getMaximum() + " KB"); } } catch (Exception e) { ! throw e; } finally { try { |