mirror of
https://github.com/jamessanford/kegs.git
synced 2025-01-20 03:29:57 +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">
|
||||
<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>
|
||||
</string-array>
|
||||
|
||||
|
@ -57,6 +57,7 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
|
||||
final Runnable mErrorFinish = new Runnable() { public void run() { finish(); } };
|
||||
|
||||
private DiskLoader mDiskLoader = null;
|
||||
private int mNextDriveNumber = 2;
|
||||
|
||||
private void withUIActive(final Runnable runnable) {
|
||||
if(!mPaused) {
|
||||
@ -151,6 +152,14 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
|
||||
mConfigFile.setConfig(image);
|
||||
getThread().allowPowerOn();
|
||||
} 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());
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
if (other instanceof DiskImage) {
|
||||
return this.getTitle().compareToIgnoreCase(((DiskImage)other).getTitle());
|
||||
|
@ -21,8 +21,8 @@ public class SwapDiskFragment extends SherlockDialogFragment {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
builder.setTitle(mImage.getTitle());
|
||||
builder.setIcon(mImage.getIconId());
|
||||
builder.setItems(R.array.swapdisk_choices,
|
||||
new DialogInterface.OnClickListener() {
|
||||
final int choices = mImage.isHardDrive() ? R.array.swapdisk_hd_choices : R.array.swapdisk_choices;
|
||||
builder.setItems(choices, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int item) {
|
||||
dismiss();
|
||||
if (item == 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user