package me.coley.recaf.config.impl;

import me.coley.logging.Level;
import me.coley.recaf.config.Conf;
import me.coley.recaf.config.Config;

/**
 * Options for user-interface.
 * 
 * @author Matt
 */
public class ConfDisplay extends Config {
	/**
	 * Simplify descriptor displays.
	 */
	@Conf(category = "display", key = "simplfy")
	public boolean simplify = true;
	/**
	 * Show in-line hints
	 */
	@Conf(category = "display", key = "jumphelp")
	public boolean jumpHelp = true;
	/**
	 * Editor windows become topmost.
	 */
	@Conf(category = "display", key = "topmost")
	public boolean topmost = true;
	/**
	 * Editor windows become topmost.
	 */
	@Conf(category = "display", key = "showsearchmethodtype")
	public boolean showSearchMethodType;
	/**
	 * UI language.
	 */
	@Conf(category = "display", key = "language")
	public String language = "en";
	/**
	 * Logging level to display in UI.
	 */
	@Conf(category = "display", key = "loglevel")
	public Level loglevel = Level.INFO;
	
	/**
	 * Show button bar in main window. Disable and relaunch for more vertical space.
	 */
	@Conf(category = "display", key = "buttonbar")
	public boolean toolbar = true;
	/**
	 * Max length of class-name shown in class tree. Helpful for obfuscated programs with long names.
	 */
	@Conf(category = "display", key = "maxlength.tree")
	public int maxLengthTree = 75;


	public ConfDisplay() {
		super("rc_display");
		load();
	}

	/**
	 * Static getter.
	 * 
	 * @return ConfDisplay instance.
	 */
	public static ConfDisplay instance() {
		return ConfDisplay.instance(ConfDisplay.class);
	}

}

package me.coley.recaf.config.impl;

import com.eclipsesource.json.Json;
import com.eclipsesource.json.JsonValue;

import me.coley.logging.Level;
import me.coley.recaf.config.Conf;
import me.coley.recaf.config.Config;

/**
 * Options for user-interface.
 * 
 * @author Matt
 */
public class ConfDisplay extends Config {
	/**
	 * Simplify descriptor displays.
	 */
	@Conf(category = "display", key = "simplfy")
	public boolean simplify = true;
	/**
	 * Show in-line hints
	 */
	@Conf(category = "display", key = "jumphelp")
	public boolean jumpHelp = true;
	/**
	 * Editor windows become topmost.
	 */
	@Conf(category = "display", key = "topmost")
	public boolean topmost = true;
	/**
	 * Editor windows become topmost.
	 */
	@Conf(category = "display", key = "showsearchmethodtype")
	public boolean showSearchMethodType;
	/**
	 * UI language.
	 */
	@Conf(category = "display", key = "language")
	public String language = "en";
	/**
	 * Logging level to display in UI.
	 */
	@Conf(category = "display", key = "loglevel")
	public Level loglevel = Level.INFO;

	/**
	 * Show button bar in main window. Disable and relaunch for more vertical
	 * space.
	 */
	@Conf(category = "display", key = "buttonbar")
	public boolean toolbar = true;
	/**
	 * Max length of class-name shown in class tree. Helpful for obfuscated
	 * programs with long names.
	 */
	@Conf(category = "display", key = "maxlength.tree")
	public int maxLengthTree = 75;

	public ConfDisplay() {
		super("rc_display");
		load();
	}

	@Override
	protected JsonValue convert(Class<?> type, Object value) {
		if (type.equals(Level.class)) {
			return Json.value(((Level) value).name());
		}
		return null;
	}

	@Override
	protected Object parse(Class<?> type, JsonValue value) {
		if (type.equals(Level.class)) {
			return Level.valueOf(value.asString());
		}
		return null;
	}

	/**
	 * Static getter.
	 * 
	 * @return ConfDisplay instance.
	 */
	public static ConfDisplay instance() {
		return ConfDisplay.instance(ConfDisplay.class);
	}

}

Fix #63