001/* 002 * To change this template, choose Tools | Templates 003 * and open the template in the editor. 004 */ 005package org.anarres.qemu.exec; 006 007import java.util.List; 008import javax.annotation.Nonnull; 009 010/** 011 * 012 * @author shevek 013 */ 014public class QEmuDisplayOption extends AbstractQEmuOption { 015 016 public static enum DisplayType { 017 018 sdl, curses, none, gtk, vnc, nographic 019 } 020 021 public static enum VgaType { 022 023 cirrus, std, vmware, qxl, tcx, cg3, none; 024 } 025 private final DisplayType displayType; 026 private VgaType vgaType; 027 private VncDisplay vncDisplay; 028 029 public QEmuDisplayOption(@Nonnull DisplayType displayType) { 030 this.displayType = displayType; 031 } 032 033 public QEmuDisplayOption(@Nonnull VncDisplay vncDisplay) { 034 this(DisplayType.vnc); 035 withVncDisplay(vncDisplay); 036 } 037 038 @Nonnull 039 public QEmuDisplayOption withVgaType(@Nonnull VgaType vgaType) { 040 this.vgaType = vgaType; 041 return this; 042 } 043 044 @Nonnull 045 public QEmuDisplayOption withVncDisplay(@Nonnull VncDisplay vncDisplay) { 046 this.vncDisplay = vncDisplay; 047 return this; 048 } 049 050 @Override 051 public void appendTo(List<? super String> line) { 052 switch (displayType) { 053 case nographic: 054 add(line, "-nographic"); 055 break; 056 case vnc: 057 add(line, "-display", "vnc=" + vncDisplay); 058 break; 059 default: 060 add(line, "-display", displayType); 061 break; 062 } 063 if (vgaType != null) 064 add(line, "-vga", vgaType); 065 } 066}