Skip to content

Commit

Permalink
Fix rename functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
phdelodder committed Apr 13, 2015
1 parent a2afa3c commit afd6035
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,13 @@ public void actionPerformed(ActionEvent arg0) {

{
pnlEpisodeLibrary =
new EpisodeLibraryPanel(settingsCtrl.getSettings().getEpisodeLibrarySettings(), manager);
new EpisodeLibraryPanel(settingsCtrl.getSettings().getEpisodeLibrarySettings(), manager, false);
tabbedPane.addTab(Messages.getString("PreferenceDialog.SerieLibrary"), null,
pnlEpisodeLibrary, null);
}
{
pnlMovieLibrary =
new MovieLibraryPanel(settingsCtrl.getSettings().getMovieLibrarySettings(), manager);
new MovieLibraryPanel(settingsCtrl.getSettings().getMovieLibrarySettings(), manager, false);
tabbedPane.addTab(Messages.getString("PreferenceDialog.MovieLibrary"), null,
pnlMovieLibrary, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ public void actionPerformed(ActionEvent arg0) {
}
{
if (videoType == VideoType.EPISODE) {
pnlLibrary = new EpisodeLibraryPanel(settings.getEpisodeLibrarySettings(), manager);
pnlLibrary = new EpisodeLibraryPanel(settings.getEpisodeLibrarySettings(), manager, true);
} else {
pnlLibrary = new MovieLibraryPanel(settings.getMovieLibrarySettings(), manager);
pnlLibrary = new MovieLibraryPanel(settings.getMovieLibrarySettings(), manager, true);
}

GridBagConstraints gbc_panel = new GridBagConstraints();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public class EpisodeLibraryPanel extends VideoLibraryPanel {
private static final long serialVersionUID = -9175813173306481849L;


public EpisodeLibraryPanel(LibrarySettings libSettings, Manager manager) {
super(libSettings, VideoType.EPISODE, manager);
public EpisodeLibraryPanel(LibrarySettings libSettings, Manager manager, Boolean renameMode) {
super(libSettings, VideoType.EPISODE, manager, renameMode);
repaint();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public class MovieLibraryPanel extends VideoLibraryPanel {
private static final long serialVersionUID = -9175813173306481849L;


public MovieLibraryPanel(LibrarySettings libSettings, Manager manager) {
super(libSettings, VideoType.MOVIE, manager);
public MovieLibraryPanel(LibrarySettings libSettings, Manager manager, Boolean renameMode) {
super(libSettings, VideoType.MOVIE, manager, renameMode);
repaint();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.io.File;
import java.io.IOException;

import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
Expand Down Expand Up @@ -46,12 +47,15 @@ public abstract class VideoLibraryPanel extends JPanel {
private PartialDisableComboBox cbxLibraryOtherFileAction;
private SubtitleBackupPanel pnlBackup;
private Manager manager;

private Boolean renameMode;

private static final Logger LOGGER = LoggerFactory.getLogger(VideoLibraryPanel.class);

public VideoLibraryPanel(LibrarySettings libSettings, VideoType videoType, Manager manager) {
public VideoLibraryPanel(LibrarySettings libSettings, VideoType videoType, Manager manager,
Boolean renameMode) {
this.videoType = videoType;
this.manager = manager;
this.renameMode = renameMode;
initialize_ui();
setLibrarySettings(libSettings);
// repaint();
Expand Down Expand Up @@ -115,7 +119,8 @@ private void checkEnableStatus(JPanel panel, boolean status) {
if (!(VideoType.MOVIE == videoType && c.equals(chkUseTVDBNaming))) {
if (c instanceof JTextField && ((JTextField) c).getText().isEmpty()
&& VideoType.MOVIE == videoType && !c.equals(pnlStructureFolder.getStructure())
&& !c.equals(pnlStructureFile.getTxtDefaultNlText()) && !c.equals(pnlStructureFile.getTxtDefaultEnText())) {
&& !c.equals(pnlStructureFile.getTxtDefaultNlText())
&& !c.equals(pnlStructureFile.getTxtDefaultEnText())) {
c.setVisible(false);
} else if (c instanceof JButton && c.equals(pnlStructureFile.getBtnBuildStructure())
&& VideoType.MOVIE == videoType) {
Expand All @@ -142,7 +147,8 @@ public boolean isValidPanelValues() {
"Geen geldig pad is ingegeven in 'Map - Locatie' op Bibliotheek info ";
JOptionPane.showConfirmDialog(this, message, "MultiSubDownloader",
JOptionPane.CLOSED_OPTION, JOptionPane.ERROR_MESSAGE);
LOGGER.debug("isValidPanelValues: Geen geldig pad is ingegeven in 'Map - Locatie' op Bibliotheek info.");
LOGGER
.debug("isValidPanelValues: Geen geldig pad is ingegeven in 'Map - Locatie' op Bibliotheek info.");
return false;
}
} catch (HeadlessException | IOException e) {
Expand All @@ -156,9 +162,12 @@ public boolean isValidPanelValues() {
public void setLibrarySettings(final LibrarySettings libSettings) {
this.libSettings = libSettings;

pnlBackup.setBackupSubtitleSelected(libSettings.isLibraryBackupSubtitle());
pnlBackup.setBackupSubtitlePath(libSettings.getLibraryBackupSubtitlePath().getAbsolutePath());
pnlBackup.setBackupUseWebsiteFilenameSelected(libSettings.isLibraryBackupUseWebsiteFileName());
if (!renameMode) {
pnlBackup.setBackupSubtitleSelected(libSettings.isLibraryBackupSubtitle());
pnlBackup.setBackupSubtitlePath(libSettings.getLibraryBackupSubtitlePath().getAbsolutePath());
pnlBackup
.setBackupUseWebsiteFilenameSelected(libSettings.isLibraryBackupUseWebsiteFileName());
}
this.cbxLibraryAction.setSelectedItem(libSettings.getLibraryAction());
this.chkUseTVDBNaming.setSelected(libSettings.isLibraryUseTVDBNaming());
this.chkReplaceWindowsChar.setSelected(libSettings.isLibraryReplaceChars());
Expand Down Expand Up @@ -187,10 +196,12 @@ public void setLibrarySettings(final LibrarySettings libSettings) {
}

public LibrarySettings getLibrarySettings() {
this.libSettings.setLibraryBackupSubtitle(pnlBackup.isBackupSubtitleSelected());
this.libSettings.setLibraryBackupSubtitlePath(new File(pnlBackup.getBackupSubtitlePath()));
this.libSettings.setLibraryBackupUseWebsiteFileName(pnlBackup
.isBackupUseWebsiteFilenameSelected());
if (!renameMode) {
this.libSettings.setLibraryBackupSubtitle(pnlBackup.isBackupSubtitleSelected());
this.libSettings.setLibraryBackupSubtitlePath(new File(pnlBackup.getBackupSubtitlePath()));
this.libSettings.setLibraryBackupUseWebsiteFileName(pnlBackup
.isBackupUseWebsiteFilenameSelected());
}
this.libSettings.setLibraryAction((LibraryActionType) this.cbxLibraryAction.getSelectedItem());
this.libSettings.setLibraryUseTVDBNaming(this.chkUseTVDBNaming.isSelected());
this.libSettings.setLibraryReplaceChars(this.chkReplaceWindowsChar.isSelected());
Expand All @@ -207,12 +218,12 @@ public LibrarySettings getLibrarySettings() {
if (pnlStructureFile.isReplaceSpaceSelected()) {
this.libSettings.setLibraryFilenameReplacingSpaceSign(pnlStructureFile.getReplaceSpaceChar());
}
this.libSettings
.setLibraryFolderReplaceSpace(pnlStructureFolder.isReplaceSpaceSelected());
this.libSettings.setLibraryFolderReplaceSpace(pnlStructureFolder.isReplaceSpaceSelected());
if (pnlStructureFolder.isReplaceSpaceSelected()) {
this.libSettings.setLibraryFolderReplacingSpaceSign(pnlStructureFolder.getReplaceSpaceChar());
}
this.libSettings.setLibraryIncludeLanguageCode(pnlStructureFile.isIncludeLanguageCodeSelected());
this.libSettings
.setLibraryIncludeLanguageCode(pnlStructureFile.isIncludeLanguageCodeSelected());
this.libSettings.setDefaultEnText(pnlStructureFile.getTxtDefaultEnText().getText());
this.libSettings.setDefaultNlText(pnlStructureFile.getTxtDefaultNlText().getText());

Expand All @@ -227,13 +238,16 @@ private void initialize_ui() {
add(new JLabel("Bibiliotheek opties"), "cell 0 0 2 1,gapy 5");
add(new JSeparator(), "cell 0 0 2 1,growx,gapy 5");

createBackupPanel();
add(pnlBackup, "cell 0 1 2 1,grow");
if (!renameMode) {
createBackupPanel();
add(pnlBackup, "cell 0 1 2 1,grow");
}

add(new JLabel("Volgende acties uitvoeren:"), "cell 0 2,alignx left");

cbxLibraryAction = new JComboBox<LibraryActionType>(LibraryActionType.values());
// cbxLibraryAction = new JComboBox<LibraryActionType>();
cbxLibraryAction = new JComboBox<LibraryActionType>();
cbxLibraryAction.setModel(new DefaultComboBoxModel<LibraryActionType>(LibraryActionType
.values()));
cbxLibraryAction.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent arg0) {
checkEnableStatusPanel();
Expand Down

0 comments on commit afd6035

Please sign in to comment.