From 7bcffdfae1e90f00c64a264460fa9d3ac6e89d65 Mon Sep 17 00:00:00 2001 From: tonikelope Date: Sun, 4 Feb 2018 23:47:30 +0100 Subject: [PATCH] 2.93 --- pom.xml | 2 +- .../megabasterd/GetMasterPasswordDialog.form | 2 +- .../megabasterd/GetMasterPasswordDialog.java | 2 +- .../megabasterd/LinkGrabberDialog.java | 80 +++++++++++-------- .../com/tonikelope/megabasterd/MainPanel.java | 2 +- .../tonikelope/megabasterd/MainPanelView.form | 12 ++- .../tonikelope/megabasterd/MainPanelView.java | 4 +- .../megabasterd/StreamerDialog.form | 2 +- .../megabasterd/StreamerDialog.java | 79 ++++++++++-------- 9 files changed, 111 insertions(+), 74 deletions(-) diff --git a/pom.xml b/pom.xml index aa1d983e0..b1448074a 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.tonikelope MegaBasterd - 2.92 + 2.93 jar diff --git a/src/main/java/com/tonikelope/megabasterd/GetMasterPasswordDialog.form b/src/main/java/com/tonikelope/megabasterd/GetMasterPasswordDialog.form index 1b6ad8646..cae74a448 100644 --- a/src/main/java/com/tonikelope/megabasterd/GetMasterPasswordDialog.form +++ b/src/main/java/com/tonikelope/megabasterd/GetMasterPasswordDialog.form @@ -46,7 +46,7 @@ - + diff --git a/src/main/java/com/tonikelope/megabasterd/GetMasterPasswordDialog.java b/src/main/java/com/tonikelope/megabasterd/GetMasterPasswordDialog.java index 64ea26300..18d736fb8 100644 --- a/src/main/java/com/tonikelope/megabasterd/GetMasterPasswordDialog.java +++ b/src/main/java/com/tonikelope/megabasterd/GetMasterPasswordDialog.java @@ -161,7 +161,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(layout.createSequentialGroup() .addComponent(remember_checkbox) .addGap(0, 0, Short.MAX_VALUE)) - .addComponent(please_label, javax.swing.GroupLayout.DEFAULT_SIZE, 584, Short.MAX_VALUE)))) + .addComponent(please_label, javax.swing.GroupLayout.DEFAULT_SIZE, 524, Short.MAX_VALUE)))) .addContainerGap()) ); layout.setVerticalGroup( diff --git a/src/main/java/com/tonikelope/megabasterd/LinkGrabberDialog.java b/src/main/java/com/tonikelope/megabasterd/LinkGrabberDialog.java index 8cc347687..cd675d931 100644 --- a/src/main/java/com/tonikelope/megabasterd/LinkGrabberDialog.java +++ b/src/main/java/com/tonikelope/megabasterd/LinkGrabberDialog.java @@ -24,7 +24,7 @@ public final class LinkGrabberDialog extends javax.swing.JDialog implements ClipboardChangeObserver { private boolean _download; - private String _download_path; + private String _download_path, _selected_item; private final ClipboardSpy _clipboardspy; private final MainPanel _main_panel; @@ -66,6 +66,8 @@ public LinkGrabberDialog(MainPanelView parent, boolean modal, String download_pa _download_path = download_path; + _selected_item = null; + _clipboardspy = clipboardspy; download_dir_label.setText(truncateText(download_path, 80)); @@ -79,7 +81,19 @@ public void run() { swingInvoke(new Runnable() { @Override public void run() { - use_mega_account_down_combobox.addItem(_main_panel.getMega_account_down()); + + String mega_default_down = _main_panel.getMega_account_down(); + + use_mega_account_down_combobox.addItem(mega_default_down); + + for (Object k : _main_panel.getMega_accounts().keySet()) { + + if (!mega_default_down.equals(k)) { + use_mega_account_down_combobox.addItem((String) k); + } + + } + use_mega_account_down_combobox.addItem(""); use_mega_account_down_combobox.setSelectedIndex(0); } @@ -366,56 +380,56 @@ public void run() { private void use_mega_account_down_comboboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_use_mega_account_down_comboboxItemStateChanged - String selected_item = (String) use_mega_account_down_combobox.getSelectedItem(); + if (_selected_item == null || !((String) use_mega_account_down_combobox.getSelectedItem()).equals(_selected_item)) { + _selected_item = (String) use_mega_account_down_combobox.getSelectedItem(); - if (_main_panel.isUse_mega_account_down() && !"".equals(selected_item)) { + if (_main_panel.isUse_mega_account_down() && !"".equals(_selected_item)) { - use_mega_account_down_combobox.setEnabled(false); + use_mega_account_down_combobox.setEnabled(false); - dance_button.setEnabled(false); + dance_button.setEnabled(false); - dance_button.setText("Checking MEGA account..."); + dance_button.setText("Checking MEGA account..."); - pack(); + pack(); - final String email = selected_item; + final LinkGrabberDialog tthis = this; - final LinkGrabberDialog tthis = this; + THREAD_POOL.execute(new Runnable() { + @Override + public void run() { - THREAD_POOL.execute(new Runnable() { - @Override - public void run() { + try { + checkMegaAccountLoginAndShowMasterPassDialog(_main_panel, tthis, _selected_item); + } catch (Exception ex) { + + swingInvoke(new Runnable() { + @Override + public void run() { + use_mega_account_down_combobox.setSelectedIndex(_main_panel.getMega_accounts().size()); - try { - checkMegaAccountLoginAndShowMasterPassDialog(_main_panel, tthis, email); - } catch (Exception ex) { + } + }); + } swingInvoke(new Runnable() { @Override public void run() { - use_mega_account_down_combobox.setSelectedIndex(1); + getUse_mega_account_down_combobox().setEnabled(true); - } - }); - } - - swingInvoke(new Runnable() { - @Override - public void run() { - getUse_mega_account_down_combobox().setEnabled(true); - - getDance_button().setText("Let's dance, baby"); + getDance_button().setText("Let's dance, baby"); - getDance_button().setEnabled(true); + getDance_button().setEnabled(true); - pack(); + pack(); - } - }); + } + }); - } - }); + } + }); + } } }//GEN-LAST:event_use_mega_account_down_comboboxItemStateChanged diff --git a/src/main/java/com/tonikelope/megabasterd/MainPanel.java b/src/main/java/com/tonikelope/megabasterd/MainPanel.java index b15e0dcc3..5981559de 100644 --- a/src/main/java/com/tonikelope/megabasterd/MainPanel.java +++ b/src/main/java/com/tonikelope/megabasterd/MainPanel.java @@ -48,7 +48,7 @@ */ public final class MainPanel { - public static final String VERSION = "2.92"; + public static final String VERSION = "2.93"; public static final int THROTTLE_SLICE_SIZE = 16 * 1024; public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024; public static final int STREAMER_PORT = 1337; diff --git a/src/main/java/com/tonikelope/megabasterd/MainPanelView.form b/src/main/java/com/tonikelope/megabasterd/MainPanelView.form index ebc295951..4047ba5f4 100644 --- a/src/main/java/com/tonikelope/megabasterd/MainPanelView.form +++ b/src/main/java/com/tonikelope/megabasterd/MainPanelView.form @@ -370,7 +370,11 @@ - + + + + + @@ -500,7 +504,11 @@ - + + + + + diff --git a/src/main/java/com/tonikelope/megabasterd/MainPanelView.java b/src/main/java/com/tonikelope/megabasterd/MainPanelView.java index 74878a560..1808d9b0e 100644 --- a/src/main/java/com/tonikelope/megabasterd/MainPanelView.java +++ b/src/main/java/com/tonikelope/megabasterd/MainPanelView.java @@ -273,7 +273,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - jScrollPane_down.setBorder(null); + jScrollPane_down.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(153, 153, 153))); jPanel_scroll_down.setLayout(new javax.swing.BoxLayout(jPanel_scroll_down, javax.swing.BoxLayout.Y_AXIS)); jScrollPane_down.setViewportView(jPanel_scroll_down); @@ -343,7 +343,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - jScrollPane_up.setBorder(null); + jScrollPane_up.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(153, 153, 153))); jPanel_scroll_up.setLayout(new javax.swing.BoxLayout(jPanel_scroll_up, javax.swing.BoxLayout.Y_AXIS)); jScrollPane_up.setViewportView(jPanel_scroll_up); diff --git a/src/main/java/com/tonikelope/megabasterd/StreamerDialog.form b/src/main/java/com/tonikelope/megabasterd/StreamerDialog.form index c9021f922..9c3706805 100644 --- a/src/main/java/com/tonikelope/megabasterd/StreamerDialog.form +++ b/src/main/java/com/tonikelope/megabasterd/StreamerDialog.form @@ -109,7 +109,7 @@ - + diff --git a/src/main/java/com/tonikelope/megabasterd/StreamerDialog.java b/src/main/java/com/tonikelope/megabasterd/StreamerDialog.java index c2fb96fc4..cd2e8adc1 100644 --- a/src/main/java/com/tonikelope/megabasterd/StreamerDialog.java +++ b/src/main/java/com/tonikelope/megabasterd/StreamerDialog.java @@ -23,6 +23,7 @@ public final class StreamerDialog extends javax.swing.JDialog implements Clipboa private final ClipboardSpy _clipboardspy; private final MainPanelView _mainPanelView; private final MainPanel _main_panel; + private String _selected_item; public JButton getDance_button() { return dance_button; @@ -53,6 +54,8 @@ public StreamerDialog(MainPanelView parent, boolean modal, ClipboardSpy clipboar _clipboardspy = clipboardspy; + _selected_item = null; + _mainPanelView = parent; if (_main_panel.isUse_mega_account_down() && _main_panel.getMega_accounts().size() > 0) { @@ -64,7 +67,17 @@ public void run() { swingInvoke(new Runnable() { @Override public void run() { - use_mega_account_down_combobox.addItem(_main_panel.getMega_account_down()); + String mega_default_down = _main_panel.getMega_account_down(); + + use_mega_account_down_combobox.addItem(mega_default_down); + + for (Object k : _main_panel.getMega_accounts().keySet()) { + + if (!mega_default_down.equals(k)) { + use_mega_account_down_combobox.addItem((String) k); + } + + } use_mega_account_down_combobox.addItem(""); use_mega_account_down_combobox.setSelectedIndex(0); } @@ -123,7 +136,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { use_mega_account_down_label.setFont(new java.awt.Font("Dialog", 1, 16)); // NOI18N use_mega_account_down_label.setText("Use this account for streaming:"); - use_mega_account_down_combobox.setFont(new java.awt.Font("Dialog", 1, 16)); // NOI18N + use_mega_account_down_combobox.setFont(new java.awt.Font("Dialog", 0, 16)); // NOI18N use_mega_account_down_combobox.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { use_mega_account_down_comboboxItemStateChanged(evt); @@ -258,55 +271,57 @@ public void run() { }//GEN-LAST:event_dance_buttonActionPerformed private void use_mega_account_down_comboboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_use_mega_account_down_comboboxItemStateChanged - final String selected_item = (String) use_mega_account_down_combobox.getSelectedItem(); - if (_main_panel.isUse_mega_account_down() && !"".equals(selected_item)) { + if (_selected_item == null || !((String) use_mega_account_down_combobox.getSelectedItem()).equals(_selected_item)) { + _selected_item = (String) use_mega_account_down_combobox.getSelectedItem(); - use_mega_account_down_combobox.setEnabled(false); + if (_main_panel.isUse_mega_account_down() && !"".equals(_selected_item)) { - dance_button.setEnabled(false); + use_mega_account_down_combobox.setEnabled(false); - dance_button.setText("Checking MEGA account..."); + dance_button.setEnabled(false); - pack(); + dance_button.setText("Checking MEGA account..."); - final String email = selected_item; + pack(); - final StreamerDialog tthis = this; + final StreamerDialog tthis = this; - THREAD_POOL.execute(new Runnable() { - @Override - public void run() { + THREAD_POOL.execute(new Runnable() { + @Override + public void run() { + + try { + checkMegaAccountLoginAndShowMasterPassDialog(_main_panel, tthis, _selected_item); + } catch (Exception ex) { - try { - checkMegaAccountLoginAndShowMasterPassDialog(_main_panel, tthis, email); - } catch (Exception ex) { + swingInvoke(new Runnable() { + @Override + public void run() { + use_mega_account_down_combobox.setSelectedIndex(_main_panel.getMega_accounts().size()); + + } + }); + } swingInvoke(new Runnable() { @Override public void run() { - use_mega_account_down_combobox.setSelectedIndex(1); - - } - }); - } + getUse_mega_account_down_combobox().setEnabled(true); - swingInvoke(new Runnable() { - @Override - public void run() { - getUse_mega_account_down_combobox().setEnabled(true); + getDance_button().setText("Let's dance, baby"); - getDance_button().setText("Let's dance, baby"); + getDance_button().setEnabled(true); - getDance_button().setEnabled(true); + pack(); - pack(); + } + }); - } - }); + } + }); - } - }); + } } }//GEN-LAST:event_use_mega_account_down_comboboxItemStateChanged