mirror of
https://github.com/jamessanford/kegs.git
synced 2025-02-08 03:30:41 +00:00
Hack to allow multiple hard drives.
This commit is contained in:
parent
428315b553
commit
cfad789cf8
@ -30,7 +30,13 @@
|
|||||||
|
|
||||||
<string-array name="swapdisk_choices">
|
<string-array name="swapdisk_choices">
|
||||||
<item>Ignore this disk</item>
|
<item>Ignore this disk</item>
|
||||||
<item>Swap to this disk</item>
|
<item>Put disk into drive</item>
|
||||||
|
<item>Boot this disk</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="swapdisk_hd_choices">
|
||||||
|
<item>Ignore this disk</item>
|
||||||
|
<item>Attach hard drive</item>
|
||||||
<item>Boot this disk</item>
|
<item>Boot this disk</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
@ -57,6 +57,7 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
|
|||||||
final Runnable mErrorFinish = new Runnable() { public void run() { finish(); } };
|
final Runnable mErrorFinish = new Runnable() { public void run() { finish(); } };
|
||||||
|
|
||||||
private DiskLoader mDiskLoader = null;
|
private DiskLoader mDiskLoader = null;
|
||||||
|
private int mNextDriveNumber = 2;
|
||||||
|
|
||||||
private void withUIActive(final Runnable runnable) {
|
private void withUIActive(final Runnable runnable) {
|
||||||
if(!mPaused) {
|
if(!mPaused) {
|
||||||
@ -151,6 +152,14 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
|
|||||||
mConfigFile.setConfig(image);
|
mConfigFile.setConfig(image);
|
||||||
getThread().allowPowerOn();
|
getThread().allowPowerOn();
|
||||||
} else if (image.action == DiskImage.SWAP) {
|
} else if (image.action == DiskImage.SWAP) {
|
||||||
|
if (image.isHardDrive()) {
|
||||||
|
// Probably not the right place for this.
|
||||||
|
image.updateDriveNumber(mNextDriveNumber);
|
||||||
|
mNextDriveNumber += 1;
|
||||||
|
if (mNextDriveNumber > 7) {
|
||||||
|
mNextDriveNumber = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
getThread().getEventQueue().add(image.getDiskImageEvent());
|
getThread().getEventQueue().add(image.getDiskImageEvent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,6 +116,14 @@ class DiskImage implements Comparable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateDriveNumber(int drive) {
|
||||||
|
this.drive = this.drive.substring(0, 3) + drive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isHardDrive() {
|
||||||
|
return this.drive.substring(0, 2).equals("s7");
|
||||||
|
}
|
||||||
|
|
||||||
public int compareTo(Object other) {
|
public int compareTo(Object other) {
|
||||||
if (other instanceof DiskImage) {
|
if (other instanceof DiskImage) {
|
||||||
return this.getTitle().compareToIgnoreCase(((DiskImage)other).getTitle());
|
return this.getTitle().compareToIgnoreCase(((DiskImage)other).getTitle());
|
||||||
|
@ -21,8 +21,8 @@ public class SwapDiskFragment extends SherlockDialogFragment {
|
|||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
builder.setTitle(mImage.getTitle());
|
builder.setTitle(mImage.getTitle());
|
||||||
builder.setIcon(mImage.getIconId());
|
builder.setIcon(mImage.getIconId());
|
||||||
builder.setItems(R.array.swapdisk_choices,
|
final int choices = mImage.isHardDrive() ? R.array.swapdisk_hd_choices : R.array.swapdisk_choices;
|
||||||
new DialogInterface.OnClickListener() {
|
builder.setItems(choices, new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int item) {
|
public void onClick(DialogInterface dialog, int item) {
|
||||||
dismiss();
|
dismiss();
|
||||||
if (item == 0) {
|
if (item == 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user