- Adding buttons the Troubleshooting section to improve users finding their profiles/content locations

This commit is contained in:
Sol
2014-02-22 04:57:35 +00:00
parent fbddce946b
commit 03c32a6292
2 changed files with 47 additions and 0 deletions

View File

@@ -14,12 +14,15 @@ import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FOptionPane; import forge.gui.toolbox.FOptionPane;
import forge.properties.ForgePreferences; import forge.properties.ForgePreferences;
import forge.properties.ForgePreferences.FPref; import forge.properties.ForgePreferences.FPref;
import forge.properties.NewConstants;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import javax.swing.*; import javax.swing.*;
import java.awt.Desktop;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -121,6 +124,20 @@ public enum CSubmenuPreferences implements ICDoc {
} }
}); });
view.getBtnUserProfileUI().setCommand(new UiCommand() {
@Override
public void run() {
CSubmenuPreferences.this.openUserProfileDirectory();
}
});
view.getBtnContentDirectoryUI().setCommand(new UiCommand() {
@Override
public void run() {
CSubmenuPreferences.this.openContentDirectory();
}
});
initializeGameLogVerbosityComboBox(); initializeGameLogVerbosityComboBox();
initializeCloseActionComboBox(); initializeCloseActionComboBox();
initializeAiProfilesComboBox(); initializeAiProfilesComboBox();
@@ -207,6 +224,28 @@ public enum CSubmenuPreferences implements ICDoc {
} }
} }
private void openUserProfileDirectory() {
try{
if (Desktop.isDesktopSupported()) {
Desktop.getDesktop().open(new File(NewConstants.USER_DIR));
}
}
catch(Exception e) {
System.out.println("Unable to open Directory: " + e.toString());
}
}
private void openContentDirectory() {
try{
if (Desktop.isDesktopSupported()) {
Desktop.getDesktop().open(new File(NewConstants.CACHE_DIR));
}
}
catch(Exception e) {
System.out.println("Unable to open Directory: " + e.toString());
}
}
private void initializeGameLogVerbosityComboBox() { private void initializeGameLogVerbosityComboBox() {
FPref userSetting = FPref.DEV_LOG_ENTRY_TYPE; FPref userSetting = FPref.DEV_LOG_ENTRY_TYPE;
FComboBoxPanel<GameLogEntryType> panel = this.view.getGameLogVerbosityComboBoxPanel(); FComboBoxPanel<GameLogEntryType> panel = this.view.getGameLogVerbosityComboBoxPanel();

View File

@@ -49,6 +49,8 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
private final FLabel btnDeleteMatchUI = new FLabel.Builder().opaque(true).hoverable(true).text("Reset Match Layout").build(); private final FLabel btnDeleteMatchUI = new FLabel.Builder().opaque(true).hoverable(true).text("Reset Match Layout").build();
private final FLabel btnDeleteEditorUI = new FLabel.Builder().opaque(true).hoverable(true).text("Reset Editor Layout").build(); private final FLabel btnDeleteEditorUI = new FLabel.Builder().opaque(true).hoverable(true).text("Reset Editor Layout").build();
private final FLabel btnDeleteWorkshopUI = new FLabel.Builder().opaque(true).hoverable(true).text("Reset Workshop Layout").build(); private final FLabel btnDeleteWorkshopUI = new FLabel.Builder().opaque(true).hoverable(true).text("Reset Workshop Layout").build();
private final FLabel btnUserProfileUI = new FLabel.Builder().opaque(true).hoverable(true).text("Open User Directory").build();
private final FLabel btnContentDirectoryUI = new FLabel.Builder().opaque(true).hoverable(true).text("Open Content Directory").build();
private final FLabel btnPlayerName = new FLabel.Builder().opaque(true).hoverable(true).text("").build(); private final FLabel btnPlayerName = new FLabel.Builder().opaque(true).hoverable(true).text("").build();
private final JCheckBox cbRemoveSmall = new OptionsCheckBox("Remove Small Creatures"); private final JCheckBox cbRemoveSmall = new OptionsCheckBox("Remove Small Creatures");
@@ -104,6 +106,8 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
pnlPrefs.add(btnDeleteMatchUI, twoButtonConstraints2); pnlPrefs.add(btnDeleteMatchUI, twoButtonConstraints2);
pnlPrefs.add(btnDeleteEditorUI, twoButtonConstraints1); pnlPrefs.add(btnDeleteEditorUI, twoButtonConstraints1);
pnlPrefs.add(btnDeleteWorkshopUI, twoButtonConstraints2); pnlPrefs.add(btnDeleteWorkshopUI, twoButtonConstraints2);
pnlPrefs.add(btnUserProfileUI, twoButtonConstraints1);
pnlPrefs.add(btnContentDirectoryUI, twoButtonConstraints2);
// General Configuration // General Configuration
pnlPrefs.add(new SectionLabel("General Configuration"), sectionConstraints + ", gaptop 2%"); pnlPrefs.add(new SectionLabel("General Configuration"), sectionConstraints + ", gaptop 2%");
@@ -527,6 +531,10 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
return btnDeleteWorkshopUI; return btnDeleteWorkshopUI;
} }
public final FLabel getBtnContentDirectoryUI() { return btnContentDirectoryUI; }
public final FLabel getBtnUserProfileUI() { return btnUserProfileUI; }
/* (non-Javadoc) /* (non-Javadoc)
* @see forge.gui.framework.IVDoc#getDocumentID() * @see forge.gui.framework.IVDoc#getDocumentID()
*/ */