- Added option to select number of threads for image download

This commit is contained in:
fwannmacher 2016-07-20 16:05:11 -03:00 committed by fwann
parent 4732686d8f
commit 9861f762b7
3 changed files with 127 additions and 75 deletions

View file

@ -122,7 +122,7 @@
<Component id="showCardName" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="showCardName" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="tooltipDelay" alignment="1" max="32767" attributes="0"/> <Component id="tooltipDelay" alignment="1" max="32767" attributes="0"/>
</Group> </Group>
<EmptySpace pref="233" max="32767" attributes="0"/> <EmptySpace max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -146,7 +146,7 @@
<Property name="toolTipText" type="java.lang.String" value="Write the card&apos;s name on the card to make the card name more recognizable."/> <Property name="toolTipText" type="java.lang.String" value="Write the card&apos;s name on the card to make the card name more recognizable."/>
<Property name="actionCommand" type="java.lang.String" value=""/> <Property name="actionCommand" type="java.lang.String" value=""/>
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor"> <Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
<Color id="Standardcursor"/> <Color id="Default Cursor"/>
</Property> </Property>
</Properties> </Properties>
<Events> <Events>
@ -3918,11 +3918,11 @@
<Layout> <Layout>
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0"> <Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="panelCardImages" max="32767" attributes="0"/> <Component id="panelCardImages" alignment="0" max="32767" attributes="0"/>
<Component id="panelBackgroundImages" max="32767" attributes="0"/> <Component id="panelBackgroundImages" alignment="0" max="32767" attributes="0"/>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
</Group> </Group>
@ -3932,10 +3932,10 @@
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="panelCardImages" min="-2" max="-2" attributes="0"/> <Component id="panelCardImages" min="-2" pref="231" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="panelBackgroundImages" min="-2" max="-2" attributes="0"/> <Component id="panelBackgroundImages" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/> <EmptySpace pref="90" max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -3959,30 +3959,38 @@
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="cbUseDefaultImageFolder" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="cbCheckForNewImages" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="labelPreferedImageLanguage" max="-2" attributes="0"/>
</Group>
<Component id="cbSaveToZipFiles" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="cbPreferedImageLanguage" min="-2" pref="153" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="24" max="-2" attributes="0"/> <EmptySpace min="-2" pref="24" max="-2" attributes="0"/>
<Component id="txtImageFolderPath" max="32767" attributes="0"/> <Component id="txtImageFolderPath" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="btnBrowseImageLocation" min="-2" max="-2" attributes="0"/> <Component id="btnBrowseImageLocation" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="labelNumberOfDownloadThreads" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="cbNumberOfDownloadThreads" min="-2" pref="153" max="-2" attributes="0"/>
</Group>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="cbUseDefaultImageFolder" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="cbCheckForNewImages" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="labelPreferedImageLanguage" max="-2" attributes="0"/>
</Group>
<Component id="cbSaveToZipFiles" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="40" max="-2" attributes="0"/>
<Component id="cbPreferedImageLanguage" min="-2" pref="153" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace min="0" pref="142" max="32767" attributes="0"/>
</Group>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
</Group> </Group>
@ -4003,6 +4011,11 @@
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="cbSaveToZipFiles" min="-2" max="-2" attributes="0"/> <Component id="cbSaveToZipFiles" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelNumberOfDownloadThreads" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="cbNumberOfDownloadThreads" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Group type="103" groupAlignment="3" attributes="0">
<Component id="cbPreferedImageLanguage" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="cbPreferedImageLanguage" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="labelPreferedImageLanguage" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="labelPreferedImageLanguage" alignment="3" min="-2" max="-2" attributes="0"/>
@ -4071,6 +4084,23 @@
<Property name="focusable" type="boolean" value="false"/> <Property name="focusable" type="boolean" value="false"/>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JLabel" name="labelNumberOfDownloadThreads">
<Properties>
<Property name="text" type="java.lang.String" value="Number of download threads:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="cbNumberOfDownloadThreads">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
</SubComponents> </SubComponents>
</Container> </Container>
<Container class="javax.swing.JPanel" name="panelBackgroundImages"> <Container class="javax.swing.JPanel" name="panelBackgroundImages">
@ -5329,7 +5359,7 @@
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<Group type="103" groupAlignment="0" max="-2" attributes="0"> <Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="lblURLServerList" max="32767" attributes="0"/> <Component id="lblURLServerList" max="32767" attributes="0"/>
<Component id="txtURLServerList" max="32767" attributes="0"/> <Component id="txtURLServerList" pref="28" max="32767" attributes="0"/>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="jLabel17" min="-2" max="-2" attributes="0"/> <Component id="jLabel17" min="-2" max="-2" attributes="0"/>

View file

@ -112,6 +112,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
public static final String KEY_CARD_IMAGES_USE_DEFAULT = "cardImagesUseDefault"; public static final String KEY_CARD_IMAGES_USE_DEFAULT = "cardImagesUseDefault";
public static final String KEY_CARD_IMAGES_PATH = "cardImagesPath"; public static final String KEY_CARD_IMAGES_PATH = "cardImagesPath";
public static final String KEY_CARD_IMAGES_THREADS = "cardImagesThreads";
public static final String KEY_CARD_IMAGES_CHECK = "cardImagesCheck"; public static final String KEY_CARD_IMAGES_CHECK = "cardImagesCheck";
public static final String KEY_CARD_IMAGES_SAVE_TO_ZIP = "cardImagesSaveToZip"; public static final String KEY_CARD_IMAGES_SAVE_TO_ZIP = "cardImagesSaveToZip";
public static final String KEY_CARD_IMAGES_PREF_LANGUAGE = "cardImagesPreferedImageLaguage"; public static final String KEY_CARD_IMAGES_PREF_LANGUAGE = "cardImagesPreferedImageLaguage";
@ -349,7 +350,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
addAvatars(); addAvatars();
cbPreferedImageLanguage.setModel(new DefaultComboBoxModel<>(new String[]{"en", "de", "fr", "it", "es", "pt", "jp", "cn", "ru", "tw", "ko"})); cbPreferedImageLanguage.setModel(new DefaultComboBoxModel<>(new String[]{"en", "de", "fr", "it", "es", "pt", "jp", "cn", "ru", "tw", "ko"}));
cbNumberOfDownloadThreads.setModel(new DefaultComboBoxModel<>(new String[]{"10", "9", "8", "7", "6", "5", "4", "3", "2", "1"}));
} }
/** /**
@ -446,8 +447,10 @@ public class PreferencesDialog extends javax.swing.JDialog {
btnBrowseImageLocation = new javax.swing.JButton(); btnBrowseImageLocation = new javax.swing.JButton();
cbCheckForNewImages = new javax.swing.JCheckBox(); cbCheckForNewImages = new javax.swing.JCheckBox();
cbSaveToZipFiles = new javax.swing.JCheckBox(); cbSaveToZipFiles = new javax.swing.JCheckBox();
cbPreferedImageLanguage = new javax.swing.JComboBox<>(); cbPreferedImageLanguage = new javax.swing.JComboBox<String>();
labelPreferedImageLanguage = new javax.swing.JLabel(); labelPreferedImageLanguage = new javax.swing.JLabel();
labelNumberOfDownloadThreads = new javax.swing.JLabel();
cbNumberOfDownloadThreads = new javax.swing.JComboBox();
panelBackgroundImages = new javax.swing.JPanel(); panelBackgroundImages = new javax.swing.JPanel();
cbUseDefaultBackground = new javax.swing.JCheckBox(); cbUseDefaultBackground = new javax.swing.JCheckBox();
txtBackgroundImagePath = new javax.swing.JTextField(); txtBackgroundImagePath = new javax.swing.JTextField();
@ -502,7 +505,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
txtURLServerList = new javax.swing.JTextField(); txtURLServerList = new javax.swing.JTextField();
jLabel17 = new javax.swing.JLabel(); jLabel17 = new javax.swing.JLabel();
lblProxyType = new javax.swing.JLabel(); lblProxyType = new javax.swing.JLabel();
cbProxyType = new javax.swing.JComboBox<>(); cbProxyType = new javax.swing.JComboBox<ProxyType>();
pnlProxySettings = new javax.swing.JPanel(); pnlProxySettings = new javax.swing.JPanel();
pnlProxy = new javax.swing.JPanel(); pnlProxy = new javax.swing.JPanel();
lblProxyServer = new javax.swing.JLabel(); lblProxyServer = new javax.swing.JLabel();
@ -556,10 +559,10 @@ public class PreferencesDialog extends javax.swing.JDialog {
.add(main_cardLayout.createSequentialGroup() .add(main_cardLayout.createSequentialGroup()
.add(6, 6, 6) .add(6, 6, 6)
.add(main_cardLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) .add(main_cardLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
.add(tooltipDelayLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 308, Short.MAX_VALUE) .add(tooltipDelayLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 308, Short.MAX_VALUE)
.add(org.jdesktop.layout.GroupLayout.LEADING, showCardName) .add(org.jdesktop.layout.GroupLayout.LEADING, showCardName)
.add(tooltipDelay, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .add(tooltipDelay, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(233, Short.MAX_VALUE)) .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
); );
main_cardLayout.setVerticalGroup( main_cardLayout.setVerticalGroup(
main_cardLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) main_cardLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
@ -1388,35 +1391,45 @@ public class PreferencesDialog extends javax.swing.JDialog {
} }
}); });
cbPreferedImageLanguage.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cbPreferedImageLanguage.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
labelPreferedImageLanguage.setText("Prefered image language:"); labelPreferedImageLanguage.setText("Prefered image language:");
labelPreferedImageLanguage.setFocusable(false); labelPreferedImageLanguage.setFocusable(false);
labelNumberOfDownloadThreads.setText("Number of download threads:");
cbNumberOfDownloadThreads.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
org.jdesktop.layout.GroupLayout panelCardImagesLayout = new org.jdesktop.layout.GroupLayout(panelCardImages); org.jdesktop.layout.GroupLayout panelCardImagesLayout = new org.jdesktop.layout.GroupLayout(panelCardImages);
panelCardImages.setLayout(panelCardImagesLayout); panelCardImages.setLayout(panelCardImagesLayout);
panelCardImagesLayout.setHorizontalGroup( panelCardImagesLayout.setHorizontalGroup(
panelCardImagesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) panelCardImagesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(panelCardImagesLayout.createSequentialGroup() .add(panelCardImagesLayout.createSequentialGroup()
.add(panelCardImagesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(panelCardImagesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(panelCardImagesLayout.createSequentialGroup()
.add(panelCardImagesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(cbUseDefaultImageFolder)
.add(cbCheckForNewImages)
.add(panelCardImagesLayout.createSequentialGroup()
.add(panelCardImagesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
.add(org.jdesktop.layout.GroupLayout.LEADING, panelCardImagesLayout.createSequentialGroup()
.addContainerGap()
.add(labelPreferedImageLanguage))
.add(org.jdesktop.layout.GroupLayout.LEADING, cbSaveToZipFiles))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
.add(cbPreferedImageLanguage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 153, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
.add(0, 0, Short.MAX_VALUE))
.add(panelCardImagesLayout.createSequentialGroup() .add(panelCardImagesLayout.createSequentialGroup()
.add(24, 24, 24) .add(24, 24, 24)
.add(txtImageFolderPath) .add(txtImageFolderPath)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(btnBrowseImageLocation))) .add(btnBrowseImageLocation))
.add(panelCardImagesLayout.createSequentialGroup()
.add(panelCardImagesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
.add(org.jdesktop.layout.GroupLayout.LEADING, panelCardImagesLayout.createSequentialGroup()
.addContainerGap()
.add(labelNumberOfDownloadThreads)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(cbNumberOfDownloadThreads, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 153, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(panelCardImagesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(cbUseDefaultImageFolder)
.add(cbCheckForNewImages)
.add(panelCardImagesLayout.createSequentialGroup()
.add(panelCardImagesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
.add(org.jdesktop.layout.GroupLayout.LEADING, panelCardImagesLayout.createSequentialGroup()
.addContainerGap()
.add(labelPreferedImageLanguage))
.add(org.jdesktop.layout.GroupLayout.LEADING, cbSaveToZipFiles))
.add(40, 40, 40)
.add(cbPreferedImageLanguage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 153, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
.add(0, 142, Short.MAX_VALUE)))
.addContainerGap()) .addContainerGap())
); );
panelCardImagesLayout.setVerticalGroup( panelCardImagesLayout.setVerticalGroup(
@ -1433,6 +1446,10 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(cbSaveToZipFiles) .add(cbSaveToZipFiles)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(panelCardImagesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(labelNumberOfDownloadThreads)
.add(cbNumberOfDownloadThreads, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(panelCardImagesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(panelCardImagesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(cbPreferedImageLanguage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(cbPreferedImageLanguage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(labelPreferedImageLanguage)) .add(labelPreferedImageLanguage))
@ -1558,10 +1575,10 @@ public class PreferencesDialog extends javax.swing.JDialog {
tabImagesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) tabImagesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(tabImagesLayout.createSequentialGroup() .add(tabImagesLayout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.add(panelCardImages, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(panelCardImages, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 231, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(panelBackgroundImages, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(panelBackgroundImages, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap(90, Short.MAX_VALUE))
); );
tabsPanel.addTab("Images", tabImages); tabsPanel.addTab("Images", tabImages);
@ -2178,7 +2195,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
.add(connection_serversLayout.createSequentialGroup() .add(connection_serversLayout.createSequentialGroup()
.add(connection_serversLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) .add(connection_serversLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
.add(lblURLServerList, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(lblURLServerList, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(txtURLServerList, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .add(txtURLServerList, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 28, Short.MAX_VALUE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel17)) .add(jLabel17))
); );
@ -2474,6 +2491,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
saveImagesPath(prefs); saveImagesPath(prefs);
save(prefs, dialog.cbCheckForNewImages, KEY_CARD_IMAGES_CHECK, "true", "false", UPDATE_CACHE_POLICY); save(prefs, dialog.cbCheckForNewImages, KEY_CARD_IMAGES_CHECK, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.cbSaveToZipFiles, KEY_CARD_IMAGES_SAVE_TO_ZIP, "true", "false", UPDATE_CACHE_POLICY); save(prefs, dialog.cbSaveToZipFiles, KEY_CARD_IMAGES_SAVE_TO_ZIP, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.cbNumberOfDownloadThreads, KEY_CARD_IMAGES_THREADS);
save(prefs, dialog.cbPreferedImageLanguage, KEY_CARD_IMAGES_PREF_LANGUAGE); save(prefs, dialog.cbPreferedImageLanguage, KEY_CARD_IMAGES_PREF_LANGUAGE);
save(prefs, dialog.cbUseDefaultBackground, KEY_BACKGROUND_IMAGE_DEFAULT, "true", "false", UPDATE_CACHE_POLICY); save(prefs, dialog.cbUseDefaultBackground, KEY_BACKGROUND_IMAGE_DEFAULT, "true", "false", UPDATE_CACHE_POLICY);
@ -2525,14 +2543,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
dialog.setVisible(false); dialog.setVisible(false);
}//GEN-LAST:event_exitButtonActionPerformed }//GEN-LAST:event_exitButtonActionPerformed
private void cbUseDefaultImageFolderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbUseDefaultImageFolderActionPerformed
if (cbUseDefaultImageFolder.isSelected()) {
useDefaultPath();
} else {
useConfigurablePath();
}
}//GEN-LAST:event_cbUseDefaultImageFolderActionPerformed
private void useDefaultPath() { private void useDefaultPath() {
txtImageFolderPath.setText("./plugins/images/"); txtImageFolderPath.setText("./plugins/images/");
txtImageFolderPath.setEnabled(false); txtImageFolderPath.setEnabled(false);
@ -2546,15 +2556,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
btnBrowseImageLocation.setEnabled(true); btnBrowseImageLocation.setEnabled(true);
} }
private void btnBrowseImageLocationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBrowseImageLocationActionPerformed
int returnVal = fc.showOpenDialog(PreferencesDialog.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
txtImageFolderPath.setText(file.getAbsolutePath());
}
}//GEN-LAST:event_btnBrowseImageLocationActionPerformed
private void cbProxyTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbProxyTypeActionPerformed private void cbProxyTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbProxyTypeActionPerformed
this.showProxySettings(); this.showProxySettings();
}//GEN-LAST:event_cbProxyTypeActionPerformed }//GEN-LAST:event_cbProxyTypeActionPerformed
@ -2568,14 +2569,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
private void rememberPswdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rememberPswdActionPerformed private void rememberPswdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rememberPswdActionPerformed
}//GEN-LAST:event_rememberPswdActionPerformed }//GEN-LAST:event_rememberPswdActionPerformed
private void cbSaveToZipFilesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbSaveToZipFilesActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_cbSaveToZipFilesActionPerformed
private void cbCheckForNewImagesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbCheckForNewImagesActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_cbCheckForNewImagesActionPerformed
private void cbEnableGameSoundsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbEnableGameSoundsActionPerformed private void cbEnableGameSoundsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbEnableGameSoundsActionPerformed
// TODO add your handling code here: // TODO add your handling code here:
}//GEN-LAST:event_cbEnableGameSoundsActionPerformed }//GEN-LAST:event_cbEnableGameSoundsActionPerformed
@ -2777,6 +2770,31 @@ public class PreferencesDialog extends javax.swing.JDialog {
// TODO add your handling code here: // TODO add your handling code here:
}//GEN-LAST:event_cbAutoOrderTriggerActionPerformed }//GEN-LAST:event_cbAutoOrderTriggerActionPerformed
private void cbSaveToZipFilesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbSaveToZipFilesActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_cbSaveToZipFilesActionPerformed
private void cbCheckForNewImagesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbCheckForNewImagesActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_cbCheckForNewImagesActionPerformed
private void btnBrowseImageLocationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBrowseImageLocationActionPerformed
int returnVal = fc.showOpenDialog(PreferencesDialog.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
txtImageFolderPath.setText(file.getAbsolutePath());
}
}//GEN-LAST:event_btnBrowseImageLocationActionPerformed
private void cbUseDefaultImageFolderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbUseDefaultImageFolderActionPerformed
if (cbUseDefaultImageFolder.isSelected()) {
useDefaultPath();
} else {
useConfigurablePath();
}
}//GEN-LAST:event_cbUseDefaultImageFolderActionPerformed
private void showProxySettings() { private void showProxySettings() {
Connection.ProxyType proxyType = (Connection.ProxyType) cbProxyType.getSelectedItem(); Connection.ProxyType proxyType = (Connection.ProxyType) cbProxyType.getSelectedItem();
switch (proxyType) { switch (proxyType) {
@ -2946,6 +2964,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
} }
load(prefs, dialog.cbCheckForNewImages, KEY_CARD_IMAGES_CHECK, "true"); load(prefs, dialog.cbCheckForNewImages, KEY_CARD_IMAGES_CHECK, "true");
load(prefs, dialog.cbSaveToZipFiles, KEY_CARD_IMAGES_SAVE_TO_ZIP, "true"); load(prefs, dialog.cbSaveToZipFiles, KEY_CARD_IMAGES_SAVE_TO_ZIP, "true");
dialog.cbNumberOfDownloadThreads.setSelectedItem(MageFrame.getPreferences().get(KEY_CARD_IMAGES_THREADS, "10"));
dialog.cbPreferedImageLanguage.setSelectedItem(MageFrame.getPreferences().get(KEY_CARD_IMAGES_PREF_LANGUAGE, "en")); dialog.cbPreferedImageLanguage.setSelectedItem(MageFrame.getPreferences().get(KEY_CARD_IMAGES_PREF_LANGUAGE, "en"));
//add background load precedure //add background load precedure
@ -3337,6 +3356,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
private javax.swing.JCheckBox cbEnableOtherSounds; private javax.swing.JCheckBox cbEnableOtherSounds;
private javax.swing.JCheckBox cbEnableSkipButtonsSounds; private javax.swing.JCheckBox cbEnableSkipButtonsSounds;
private javax.swing.JCheckBox cbGameLogAutoSave; private javax.swing.JCheckBox cbGameLogAutoSave;
private javax.swing.JComboBox cbNumberOfDownloadThreads;
private javax.swing.JCheckBox cbPassPriorityActivation; private javax.swing.JCheckBox cbPassPriorityActivation;
private javax.swing.JCheckBox cbPassPriorityCast; private javax.swing.JCheckBox cbPassPriorityCast;
private javax.swing.JComboBox<String> cbPreferedImageLanguage; private javax.swing.JComboBox<String> cbPreferedImageLanguage;
@ -3418,6 +3438,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
private javax.swing.JLabel labelEditorCardOffset; private javax.swing.JLabel labelEditorCardOffset;
private javax.swing.JLabel labelEditorCardSize; private javax.swing.JLabel labelEditorCardSize;
private javax.swing.JLabel labelGameFeedback; private javax.swing.JLabel labelGameFeedback;
private javax.swing.JLabel labelNumberOfDownloadThreads;
private javax.swing.JLabel labelPreferedImageLanguage; private javax.swing.JLabel labelPreferedImageLanguage;
private javax.swing.JLabel labelStackWidth; private javax.swing.JLabel labelStackWidth;
private javax.swing.JLabel labelTooltipSize; private javax.swing.JLabel labelTooltipSize;

View file

@ -472,7 +472,8 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
update(0, cardsToDownload.size()); update(0, cardsToDownload.size());
ExecutorService executor = Executors.newFixedThreadPool(10); int numberOfThreads = Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_THREADS, "10"));
ExecutorService executor = Executors.newFixedThreadPool(numberOfThreads);
for (int i = 0; i < cardsToDownload.size() && !cancel; i++) { for (int i = 0; i < cardsToDownload.size() && !cancel; i++) {
try { try {