Second and last part of the icon indicator work.
251
src/config.c
@@ -795,6 +795,33 @@ load_ports(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
load_image_file(char *dest, char *p, uint8_t *ui_wp)
|
||||||
|
{
|
||||||
|
char *prefix = "";
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
if (strstr(p, "wp://") == p) {
|
||||||
|
p += 5;
|
||||||
|
prefix = "wp://";
|
||||||
|
if (ui_wp != NULL)
|
||||||
|
*ui_wp = 1;
|
||||||
|
} else if ((ui_wp != NULL) && *ui_wp)
|
||||||
|
prefix = "wp://";
|
||||||
|
|
||||||
|
if (path_abs(p)) {
|
||||||
|
if (strlen(p) > (MAX_IMAGE_PATH_LEN - 1))
|
||||||
|
ret = 1;
|
||||||
|
else
|
||||||
|
snprintf(dest, MAX_IMAGE_PATH_LEN, "%s%s", prefix, p);
|
||||||
|
} else
|
||||||
|
snprintf(dest, MAX_IMAGE_PATH_LEN, "%s%s%s%s", prefix, usr_path, path_get_slash(usr_path), p);
|
||||||
|
|
||||||
|
path_normalize(dest);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/* Load "Storage Controllers" section. */
|
/* Load "Storage Controllers" section. */
|
||||||
static void
|
static void
|
||||||
load_storage_controllers(void)
|
load_storage_controllers(void)
|
||||||
@@ -888,20 +915,17 @@ load_storage_controllers(void)
|
|||||||
else
|
else
|
||||||
cassette_enable = 0;
|
cassette_enable = 0;
|
||||||
|
|
||||||
|
cassette_ui_writeprot = !!ini_section_get_int(cat, "cassette_writeprot", 0);
|
||||||
|
ini_section_delete_var(cat, "cassette_writeprot");
|
||||||
|
|
||||||
p = ini_section_get_string(cat, "cassette_file", "");
|
p = ini_section_get_string(cat, "cassette_file", "");
|
||||||
|
|
||||||
if (!strcmp(p, usr_path))
|
if (!strcmp(p, usr_path))
|
||||||
p[0] = 0x00;
|
p[0] = 0x00;
|
||||||
|
|
||||||
if (p[0] != 0x00) {
|
if (p[0] != 0x00) {
|
||||||
if (path_abs(p)) {
|
if (load_image_file(cassette_fname, p, (uint8_t *) &cassette_ui_writeprot))
|
||||||
if (strlen(p) > 511)
|
fatal("Configuration: Length of cassette_file is more than 511\n");
|
||||||
fatal("Configuration: Length of cassette_file is more than 511\n");
|
|
||||||
else
|
|
||||||
strncpy(cassette_fname, p, 511);
|
|
||||||
} else
|
|
||||||
path_append_filename(cassette_fname, usr_path, p);
|
|
||||||
path_normalize(cassette_fname);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p = ini_section_get_string(cat, "cassette_mode", "load");
|
p = ini_section_get_string(cat, "cassette_mode", "load");
|
||||||
@@ -915,16 +939,9 @@ load_storage_controllers(void)
|
|||||||
sprintf(temp, "cassette_image_history_%02i", i + 1);
|
sprintf(temp, "cassette_image_history_%02i", i + 1);
|
||||||
p = ini_section_get_string(cat, temp, NULL);
|
p = ini_section_get_string(cat, temp, NULL);
|
||||||
if (p) {
|
if (p) {
|
||||||
if (path_abs(p)) {
|
if (load_image_file(cassette_image_history[i], p, NULL))
|
||||||
if (strlen(p) > (MAX_IMAGE_PATH_LEN - 1))
|
fatal("Configuration: Length of cassette_image_history_%02i is more "
|
||||||
fatal("Configuration: Length of cassette_image_history_%02i is more "
|
"than %i\n", i + 1, MAX_IMAGE_PATH_LEN - 1);
|
||||||
"than %i\n", i + 1, MAX_IMAGE_PATH_LEN - 1);
|
|
||||||
else
|
|
||||||
snprintf(cassette_image_history[i], MAX_IMAGE_PATH_LEN, "%s", p);
|
|
||||||
} else
|
|
||||||
snprintf(cassette_image_history[i], MAX_IMAGE_PATH_LEN, "%s%s%s", usr_path,
|
|
||||||
path_get_slash(usr_path), p);
|
|
||||||
path_normalize(cassette_image_history[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cassette_pos = ini_section_get_int(cat, "cassette_position", 0);
|
cassette_pos = ini_section_get_int(cat, "cassette_position", 0);
|
||||||
@@ -939,9 +956,6 @@ load_storage_controllers(void)
|
|||||||
cassette_pcm = ini_section_get_int(cat, "cassette_pcm", 0);
|
cassette_pcm = ini_section_get_int(cat, "cassette_pcm", 0);
|
||||||
if (!cassette_pcm)
|
if (!cassette_pcm)
|
||||||
ini_section_delete_var(cat, "cassette_pcm");
|
ini_section_delete_var(cat, "cassette_pcm");
|
||||||
cassette_ui_writeprot = !!ini_section_get_int(cat, "cassette_writeprot", 0);
|
|
||||||
if (!cassette_ui_writeprot)
|
|
||||||
ini_section_delete_var(cat, "cassette_writeprot");
|
|
||||||
|
|
||||||
if (!cassette_enable) {
|
if (!cassette_enable) {
|
||||||
ini_section_delete_var(cat, "cassette_file");
|
ini_section_delete_var(cat, "cassette_file");
|
||||||
@@ -1227,6 +1241,11 @@ load_floppy_and_cdrom_drives(void)
|
|||||||
if (fdd_get_type(c) > 13)
|
if (fdd_get_type(c) > 13)
|
||||||
fdd_set_type(c, 13);
|
fdd_set_type(c, 13);
|
||||||
|
|
||||||
|
sprintf(temp, "fdd_%02i_writeprot", c + 1);
|
||||||
|
ui_writeprot[c] = !!ini_section_get_int(cat, temp, 0);
|
||||||
|
if (ui_writeprot[c] == 0)
|
||||||
|
ini_section_delete_var(cat, temp);
|
||||||
|
|
||||||
sprintf(temp, "fdd_%02i_fn", c + 1);
|
sprintf(temp, "fdd_%02i_fn", c + 1);
|
||||||
p = ini_section_get_string(cat, temp, "");
|
p = ini_section_get_string(cat, temp, "");
|
||||||
|
|
||||||
@@ -1234,22 +1253,14 @@ load_floppy_and_cdrom_drives(void)
|
|||||||
p[0] = 0x00;
|
p[0] = 0x00;
|
||||||
|
|
||||||
if (p[0] != 0x00) {
|
if (p[0] != 0x00) {
|
||||||
if (path_abs(p)) {
|
if (load_image_file(floppyfns[c], p, (uint8_t *) &(ui_writeprot[c])))
|
||||||
if (strlen(p) > 511)
|
fatal("Configuration: Length of fdd_%02i_fn is more than 511\n", c + 1);
|
||||||
fatal("Configuration: Length of fdd_%02i_fn is more than 511\n", c + 1);
|
|
||||||
else
|
|
||||||
strncpy(floppyfns[c], p, 511);
|
|
||||||
} else
|
|
||||||
path_append_filename(floppyfns[c], usr_path, p);
|
|
||||||
path_normalize(floppyfns[c]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ENABLE_CONFIG_LOG) && (ENABLE_CONFIG_LOG == 2)
|
#if defined(ENABLE_CONFIG_LOG) && (ENABLE_CONFIG_LOG == 2)
|
||||||
if (*p != '\0')
|
if (*p != '\0')
|
||||||
config_log("Floppy%d: %ls\n", c, floppyfns[c]);
|
config_log("Floppy%d: %ls\n", c, floppyfns[c]);
|
||||||
#endif
|
#endif
|
||||||
sprintf(temp, "fdd_%02i_writeprot", c + 1);
|
|
||||||
ui_writeprot[c] = !!ini_section_get_int(cat, temp, 0);
|
|
||||||
sprintf(temp, "fdd_%02i_turbo", c + 1);
|
sprintf(temp, "fdd_%02i_turbo", c + 1);
|
||||||
fdd_set_turbo(c, !!ini_section_get_int(cat, temp, 0));
|
fdd_set_turbo(c, !!ini_section_get_int(cat, temp, 0));
|
||||||
sprintf(temp, "fdd_%02i_check_bpb", c + 1);
|
sprintf(temp, "fdd_%02i_check_bpb", c + 1);
|
||||||
@@ -1265,10 +1276,6 @@ load_floppy_and_cdrom_drives(void)
|
|||||||
sprintf(temp, "fdd_%02i_fn", c + 1);
|
sprintf(temp, "fdd_%02i_fn", c + 1);
|
||||||
ini_section_delete_var(cat, temp);
|
ini_section_delete_var(cat, temp);
|
||||||
}
|
}
|
||||||
if (ui_writeprot[c] == 0) {
|
|
||||||
sprintf(temp, "fdd_%02i_writeprot", c + 1);
|
|
||||||
ini_section_delete_var(cat, temp);
|
|
||||||
}
|
|
||||||
if (fdd_get_turbo(c) == 0) {
|
if (fdd_get_turbo(c) == 0) {
|
||||||
sprintf(temp, "fdd_%02i_turbo", c + 1);
|
sprintf(temp, "fdd_%02i_turbo", c + 1);
|
||||||
ini_section_delete_var(cat, temp);
|
ini_section_delete_var(cat, temp);
|
||||||
@@ -1282,16 +1289,9 @@ load_floppy_and_cdrom_drives(void)
|
|||||||
sprintf(temp, "fdd_%02i_image_history_%02i", c + 1, i + 1);
|
sprintf(temp, "fdd_%02i_image_history_%02i", c + 1, i + 1);
|
||||||
p = ini_section_get_string(cat, temp, NULL);
|
p = ini_section_get_string(cat, temp, NULL);
|
||||||
if (p) {
|
if (p) {
|
||||||
if (path_abs(p)) {
|
if (load_image_file(fdd_image_history[c][i], p, NULL))
|
||||||
if (strlen(p) > (MAX_IMAGE_PATH_LEN - 1))
|
fatal("Configuration: Length of fdd_%02i_image_history_%02i is more "
|
||||||
fatal("Configuration: Length of fdd_%02i_image_history_%02i is more "
|
"than %i\n", c + 1, i + 1, MAX_IMAGE_PATH_LEN - 1);
|
||||||
"than %i\n", c + 1, i + 1, MAX_IMAGE_PATH_LEN - 1);
|
|
||||||
else
|
|
||||||
snprintf(fdd_image_history[c][i], MAX_IMAGE_PATH_LEN, "%s", p);
|
|
||||||
} else
|
|
||||||
snprintf(fdd_image_history[c][i], MAX_IMAGE_PATH_LEN, "%s%s%s", usr_path,
|
|
||||||
path_get_slash(usr_path), p);
|
|
||||||
path_normalize(fdd_image_history[c][i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1520,19 +1520,14 @@ load_other_removable_devices(void)
|
|||||||
|
|
||||||
sprintf(temp, "zip_%02i_writeprot", c + 1);
|
sprintf(temp, "zip_%02i_writeprot", c + 1);
|
||||||
zip_drives[c].read_only = ini_section_get_int(cat, temp, 0);
|
zip_drives[c].read_only = ini_section_get_int(cat, temp, 0);
|
||||||
|
ini_section_delete_var(cat, temp);
|
||||||
|
|
||||||
if (!strcmp(p, usr_path))
|
if (!strcmp(p, usr_path))
|
||||||
p[0] = 0x00;
|
p[0] = 0x00;
|
||||||
|
|
||||||
if (p[0] != 0x00) {
|
if (p[0] != 0x00) {
|
||||||
if (path_abs(p)) {
|
if (load_image_file(zip_drives[c].image_path, p, &(zip_drives[c].read_only)))
|
||||||
if (strlen(p) > 511)
|
fatal("Configuration: Length of zip_%02i_image_path is more than 511\n", c + 1);
|
||||||
fatal("Configuration: Length of zip_%02i_image_path is more than 511\n", c + 1);
|
|
||||||
else
|
|
||||||
strncpy(zip_drives[c].image_path, p, 511);
|
|
||||||
} else
|
|
||||||
path_append_filename(zip_drives[c].image_path, usr_path, p);
|
|
||||||
path_normalize(zip_drives[c].image_path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < MAX_PREV_IMAGES; i++) {
|
for (int i = 0; i < MAX_PREV_IMAGES; i++) {
|
||||||
@@ -1540,16 +1535,9 @@ load_other_removable_devices(void)
|
|||||||
sprintf(temp, "zip_%02i_image_history_%02i", c + 1, i + 1);
|
sprintf(temp, "zip_%02i_image_history_%02i", c + 1, i + 1);
|
||||||
p = ini_section_get_string(cat, temp, NULL);
|
p = ini_section_get_string(cat, temp, NULL);
|
||||||
if (p) {
|
if (p) {
|
||||||
if (path_abs(p)) {
|
if (load_image_file(zip_drives[c].image_history[i], p, NULL))
|
||||||
if (strlen(p) > (MAX_IMAGE_PATH_LEN - 1))
|
fatal("Configuration: Length of zip_%02i_image_history_%02i is more than %i\n",
|
||||||
fatal("Configuration: Length of zip_%02i_image_history_%02i is more than %i\n",
|
c + 1, i + 1, MAX_IMAGE_PATH_LEN - 1);
|
||||||
c + 1, i + 1, MAX_IMAGE_PATH_LEN - 1);
|
|
||||||
else
|
|
||||||
snprintf(zip_drives[c].image_history[i], MAX_IMAGE_PATH_LEN, "%s", p);
|
|
||||||
} else
|
|
||||||
snprintf(zip_drives[c].image_history[i], MAX_IMAGE_PATH_LEN, "%s%s%s", usr_path,
|
|
||||||
path_get_slash(usr_path), p);
|
|
||||||
path_normalize(zip_drives[c].image_history[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1635,19 +1623,14 @@ load_other_removable_devices(void)
|
|||||||
|
|
||||||
sprintf(temp, "mo_%02i_writeprot", c + 1);
|
sprintf(temp, "mo_%02i_writeprot", c + 1);
|
||||||
mo_drives[c].read_only = ini_section_get_int(cat, temp, 0);
|
mo_drives[c].read_only = ini_section_get_int(cat, temp, 0);
|
||||||
|
ini_section_delete_var(cat, temp);
|
||||||
|
|
||||||
if (!strcmp(p, usr_path))
|
if (!strcmp(p, usr_path))
|
||||||
p[0] = 0x00;
|
p[0] = 0x00;
|
||||||
|
|
||||||
if (p[0] != 0x00) {
|
if (p[0] != 0x00) {
|
||||||
if (path_abs(p)) {
|
if (load_image_file(mo_drives[c].image_path, p, &(mo_drives[c].read_only)))
|
||||||
if (strlen(p) > 511)
|
fatal("Configuration: Length of mo_%02i_image_path is more than 511\n", c + 1);
|
||||||
fatal("Configuration: Length of mo_%02i_image_path is more than 511\n", c + 1);
|
|
||||||
else
|
|
||||||
strncpy(mo_drives[c].image_path, p, 511);
|
|
||||||
} else
|
|
||||||
path_append_filename(mo_drives[c].image_path, usr_path, p);
|
|
||||||
path_normalize(mo_drives[c].image_path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < MAX_PREV_IMAGES; i++) {
|
for (int i = 0; i < MAX_PREV_IMAGES; i++) {
|
||||||
@@ -1655,16 +1638,9 @@ load_other_removable_devices(void)
|
|||||||
sprintf(temp, "mo_%02i_image_history_%02i", c + 1, i + 1);
|
sprintf(temp, "mo_%02i_image_history_%02i", c + 1, i + 1);
|
||||||
p = ini_section_get_string(cat, temp, NULL);
|
p = ini_section_get_string(cat, temp, NULL);
|
||||||
if (p) {
|
if (p) {
|
||||||
if (path_abs(p)) {
|
if (load_image_file(mo_drives[c].image_history[i], p, NULL))
|
||||||
if (strlen(p) > (MAX_IMAGE_PATH_LEN - 1))
|
fatal("Configuration: Length of mo_%02i_image_history_%02i is more than %i\n",
|
||||||
fatal("Configuration: Length of mo_%02i_image_history_%02i is more than %i\n",
|
c + 1, i + 1, MAX_IMAGE_PATH_LEN - 1);
|
||||||
c + 1, i + 1, MAX_IMAGE_PATH_LEN - 1);
|
|
||||||
else
|
|
||||||
snprintf(mo_drives[c].image_history[i], MAX_IMAGE_PATH_LEN, "%s", p);
|
|
||||||
} else
|
|
||||||
snprintf(mo_drives[c].image_history[i], MAX_IMAGE_PATH_LEN, "%s%s%s", usr_path,
|
|
||||||
path_get_slash(usr_path), p);
|
|
||||||
path_normalize(mo_drives[c].image_history[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2579,6 +2555,27 @@ save_keybinds(void)
|
|||||||
ini_delete_section_if_empty(config, cat);
|
ini_delete_section_if_empty(config, cat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
save_image_file(char *cat, char *var, char *src)
|
||||||
|
{
|
||||||
|
char temp[2048] = { 0 };
|
||||||
|
char *prefix = "";
|
||||||
|
|
||||||
|
path_normalize(src);
|
||||||
|
|
||||||
|
if (strstr(src, "wp://") == src) {
|
||||||
|
src += 5;
|
||||||
|
prefix = "wp://";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!strnicmp(src, usr_path, strlen(usr_path)))
|
||||||
|
sprintf(temp, "%s%s", prefix, &src[strlen(usr_path)]);
|
||||||
|
else
|
||||||
|
sprintf(temp, "%s%s", prefix, src);
|
||||||
|
|
||||||
|
ini_section_set_string(cat, var, temp);
|
||||||
|
}
|
||||||
|
|
||||||
/* Save "Storage Controllers" section. */
|
/* Save "Storage Controllers" section. */
|
||||||
static void
|
static void
|
||||||
save_storage_controllers(void)
|
save_storage_controllers(void)
|
||||||
@@ -2640,13 +2637,8 @@ save_storage_controllers(void)
|
|||||||
|
|
||||||
if (strlen(cassette_fname) == 0)
|
if (strlen(cassette_fname) == 0)
|
||||||
ini_section_delete_var(cat, "cassette_file");
|
ini_section_delete_var(cat, "cassette_file");
|
||||||
else {
|
else
|
||||||
path_normalize(cassette_fname);
|
save_image_file(cat, "cassette_file", cassette_fname);
|
||||||
if (!strnicmp(cassette_fname, usr_path, strlen(usr_path)))
|
|
||||||
ini_section_set_string(cat, "cassette_file", &cassette_fname[strlen(usr_path)]);
|
|
||||||
else
|
|
||||||
ini_section_set_string(cat, "cassette_file", cassette_fname);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strcmp(cassette_mode, "load"))
|
if (!strcmp(cassette_mode, "load"))
|
||||||
ini_section_delete_var(cat, "cassette_mode");
|
ini_section_delete_var(cat, "cassette_mode");
|
||||||
@@ -2657,13 +2649,8 @@ save_storage_controllers(void)
|
|||||||
sprintf(temp, "cassette_image_history_%02i", i + 1);
|
sprintf(temp, "cassette_image_history_%02i", i + 1);
|
||||||
if ((cassette_image_history[i] == 0) || strlen(cassette_image_history[i]) == 0)
|
if ((cassette_image_history[i] == 0) || strlen(cassette_image_history[i]) == 0)
|
||||||
ini_section_delete_var(cat, temp);
|
ini_section_delete_var(cat, temp);
|
||||||
else {
|
else
|
||||||
path_normalize(cassette_image_history[i]);
|
save_image_file(cat, temp, cassette_image_history[i]);
|
||||||
if (!strnicmp(cassette_image_history[i], usr_path, strlen(usr_path)))
|
|
||||||
ini_section_set_string(cat, temp, &cassette_image_history[i][strlen(usr_path)]);
|
|
||||||
else
|
|
||||||
ini_section_set_string(cat, temp, cassette_image_history[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cassette_pos == 0)
|
if (cassette_pos == 0)
|
||||||
@@ -2686,10 +2673,7 @@ save_storage_controllers(void)
|
|||||||
else
|
else
|
||||||
ini_section_set_int(cat, "cassette_pcm", cassette_pcm);
|
ini_section_set_int(cat, "cassette_pcm", cassette_pcm);
|
||||||
|
|
||||||
if (cassette_ui_writeprot == 0)
|
ini_section_delete_var(cat, "cassette_writeprot");
|
||||||
ini_section_delete_var(cat, "cassette_writeprot");
|
|
||||||
else
|
|
||||||
ini_section_set_int(cat, "cassette_writeprot", cassette_ui_writeprot);
|
|
||||||
|
|
||||||
for (c = 0; c < 2; c++) {
|
for (c = 0; c < 2; c++) {
|
||||||
sprintf(temp, "cartridge_%02i_fn", c + 1);
|
sprintf(temp, "cartridge_%02i_fn", c + 1);
|
||||||
@@ -2944,19 +2928,11 @@ save_floppy_and_cdrom_drives(void)
|
|||||||
|
|
||||||
sprintf(temp, "fdd_%02i_writeprot", c + 1);
|
sprintf(temp, "fdd_%02i_writeprot", c + 1);
|
||||||
ini_section_delete_var(cat, temp);
|
ini_section_delete_var(cat, temp);
|
||||||
} else {
|
} else
|
||||||
path_normalize(floppyfns[c]);
|
save_image_file(cat, temp, floppyfns[c]);
|
||||||
if (!strnicmp(floppyfns[c], usr_path, strlen(usr_path)))
|
|
||||||
ini_section_set_string(cat, temp, &floppyfns[c][strlen(usr_path)]);
|
|
||||||
else
|
|
||||||
ini_section_set_string(cat, temp, floppyfns[c]);
|
|
||||||
}
|
|
||||||
|
|
||||||
sprintf(temp, "fdd_%02i_writeprot", c + 1);
|
sprintf(temp, "fdd_%02i_writeprot", c + 1);
|
||||||
if (ui_writeprot[c] == 0)
|
ini_section_delete_var(cat, temp);
|
||||||
ini_section_delete_var(cat, temp);
|
|
||||||
else
|
|
||||||
ini_section_set_int(cat, temp, ui_writeprot[c]);
|
|
||||||
|
|
||||||
sprintf(temp, "fdd_%02i_turbo", c + 1);
|
sprintf(temp, "fdd_%02i_turbo", c + 1);
|
||||||
if (fdd_get_turbo(c) == 0)
|
if (fdd_get_turbo(c) == 0)
|
||||||
@@ -2974,13 +2950,8 @@ save_floppy_and_cdrom_drives(void)
|
|||||||
sprintf(temp, "fdd_%02i_image_history_%02i", c + 1, i + 1);
|
sprintf(temp, "fdd_%02i_image_history_%02i", c + 1, i + 1);
|
||||||
if ((fdd_image_history[c][i] == 0) || strlen(fdd_image_history[c][i]) == 0)
|
if ((fdd_image_history[c][i] == 0) || strlen(fdd_image_history[c][i]) == 0)
|
||||||
ini_section_delete_var(cat, temp);
|
ini_section_delete_var(cat, temp);
|
||||||
else {
|
else
|
||||||
path_normalize(fdd_image_history[c][i]);
|
save_image_file(cat, temp, fdd_image_history[c][i]);
|
||||||
if (!strnicmp(fdd_image_history[c][i], usr_path, strlen(usr_path)))
|
|
||||||
ini_section_set_string(cat, temp, &fdd_image_history[c][i][strlen(usr_path)]);
|
|
||||||
else
|
|
||||||
ini_section_set_string(cat, temp, fdd_image_history[c][i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3097,10 +3068,7 @@ save_other_removable_devices(void)
|
|||||||
ini_section_delete_var(cat, temp);
|
ini_section_delete_var(cat, temp);
|
||||||
|
|
||||||
sprintf(temp, "zip_%02i_writeprot", c + 1);
|
sprintf(temp, "zip_%02i_writeprot", c + 1);
|
||||||
if (zip_drives[c].read_only)
|
ini_section_delete_var(cat, temp);
|
||||||
ini_section_set_int(cat, temp, zip_drives[c].read_only);
|
|
||||||
else
|
|
||||||
ini_section_delete_var(cat, temp);
|
|
||||||
|
|
||||||
sprintf(temp, "zip_%02i_scsi_location", c + 1);
|
sprintf(temp, "zip_%02i_scsi_location", c + 1);
|
||||||
if (zip_drives[c].bus_type != ZIP_BUS_SCSI)
|
if (zip_drives[c].bus_type != ZIP_BUS_SCSI)
|
||||||
@@ -3114,25 +3082,15 @@ save_other_removable_devices(void)
|
|||||||
sprintf(temp, "zip_%02i_image_path", c + 1);
|
sprintf(temp, "zip_%02i_image_path", c + 1);
|
||||||
if ((zip_drives[c].bus_type == 0) || (strlen(zip_drives[c].image_path) == 0))
|
if ((zip_drives[c].bus_type == 0) || (strlen(zip_drives[c].image_path) == 0))
|
||||||
ini_section_delete_var(cat, temp);
|
ini_section_delete_var(cat, temp);
|
||||||
else {
|
else
|
||||||
path_normalize(zip_drives[c].image_path);
|
save_image_file(cat, temp, zip_drives[c].image_path);
|
||||||
if (!strnicmp(zip_drives[c].image_path, usr_path, strlen(usr_path)))
|
|
||||||
ini_section_set_string(cat, temp, &zip_drives[c].image_path[strlen(usr_path)]);
|
|
||||||
else
|
|
||||||
ini_section_set_string(cat, temp, zip_drives[c].image_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < MAX_PREV_IMAGES; i++) {
|
for (int i = 0; i < MAX_PREV_IMAGES; i++) {
|
||||||
sprintf(temp, "zip_%02i_image_history_%02i", c + 1, i + 1);
|
sprintf(temp, "zip_%02i_image_history_%02i", c + 1, i + 1);
|
||||||
if ((zip_drives[c].image_history[i] == 0) || strlen(zip_drives[c].image_history[i]) == 0)
|
if ((zip_drives[c].image_history[i] == 0) || strlen(zip_drives[c].image_history[i]) == 0)
|
||||||
ini_section_delete_var(cat, temp);
|
ini_section_delete_var(cat, temp);
|
||||||
else {
|
else
|
||||||
path_normalize(zip_drives[c].image_history[i]);
|
save_image_file(cat, temp, zip_drives[c].image_history[i]);
|
||||||
if (!strnicmp(zip_drives[c].image_history[i], usr_path, strlen(usr_path)))
|
|
||||||
ini_section_set_string(cat, temp, &zip_drives[c].image_history[i][strlen(usr_path)]);
|
|
||||||
else
|
|
||||||
ini_section_set_string(cat, temp, zip_drives[c].image_history[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3159,10 +3117,7 @@ save_other_removable_devices(void)
|
|||||||
ini_section_delete_var(cat, temp);
|
ini_section_delete_var(cat, temp);
|
||||||
|
|
||||||
sprintf(temp, "mo_%02i_writeprot", c + 1);
|
sprintf(temp, "mo_%02i_writeprot", c + 1);
|
||||||
if (mo_drives[c].read_only)
|
ini_section_delete_var(cat, temp);
|
||||||
ini_section_set_int(cat, temp, mo_drives[c].read_only);
|
|
||||||
else
|
|
||||||
ini_section_delete_var(cat, temp);
|
|
||||||
|
|
||||||
sprintf(temp, "mo_%02i_scsi_location", c + 1);
|
sprintf(temp, "mo_%02i_scsi_location", c + 1);
|
||||||
if (mo_drives[c].bus_type != MO_BUS_SCSI)
|
if (mo_drives[c].bus_type != MO_BUS_SCSI)
|
||||||
@@ -3176,25 +3131,15 @@ save_other_removable_devices(void)
|
|||||||
sprintf(temp, "mo_%02i_image_path", c + 1);
|
sprintf(temp, "mo_%02i_image_path", c + 1);
|
||||||
if ((mo_drives[c].bus_type == 0) || (strlen(mo_drives[c].image_path) == 0))
|
if ((mo_drives[c].bus_type == 0) || (strlen(mo_drives[c].image_path) == 0))
|
||||||
ini_section_delete_var(cat, temp);
|
ini_section_delete_var(cat, temp);
|
||||||
else {
|
else
|
||||||
path_normalize(mo_drives[c].image_path);
|
save_image_file(cat, temp, mo_drives[c].image_path);
|
||||||
if (!strnicmp(mo_drives[c].image_path, usr_path, strlen(usr_path)))
|
|
||||||
ini_section_set_string(cat, temp, &mo_drives[c].image_path[strlen(usr_path)]);
|
|
||||||
else
|
|
||||||
ini_section_set_string(cat, temp, mo_drives[c].image_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < MAX_PREV_IMAGES; i++) {
|
for (int i = 0; i < MAX_PREV_IMAGES; i++) {
|
||||||
sprintf(temp, "mo_%02i_image_history_%02i", c + 1, i + 1);
|
sprintf(temp, "mo_%02i_image_history_%02i", c + 1, i + 1);
|
||||||
if ((mo_drives[c].image_history[i] == 0) || strlen(mo_drives[c].image_history[i]) == 0)
|
if ((mo_drives[c].image_history[i] == 0) || strlen(mo_drives[c].image_history[i]) == 0)
|
||||||
ini_section_delete_var(cat, temp);
|
ini_section_delete_var(cat, temp);
|
||||||
else {
|
else
|
||||||
path_normalize(mo_drives[c].image_history[i]);
|
save_image_file(cat, temp, mo_drives[c].image_history[i]);
|
||||||
if (!strnicmp(mo_drives[c].image_history[i], usr_path, strlen(usr_path)))
|
|
||||||
ini_section_set_string(cat, temp, &mo_drives[c].image_history[i][strlen(usr_path)]);
|
|
||||||
else
|
|
||||||
ini_section_set_string(cat, temp, mo_drives[c].image_history[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -152,10 +152,11 @@ pc_cas_del(pc_cassette_t *cas)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
pc_cas_set_fname(pc_cassette_t *cas, const char *fname)
|
pc_cas_set_fname(pc_cassette_t *cas, char *fname)
|
||||||
{
|
{
|
||||||
unsigned n;
|
unsigned n;
|
||||||
const char *ext;
|
const char *ext;
|
||||||
|
int offs = 0;
|
||||||
|
|
||||||
if (cas->close)
|
if (cas->close)
|
||||||
fclose(cas->fp);
|
fclose(cas->fp);
|
||||||
@@ -176,6 +177,13 @@ pc_cas_set_fname(pc_cassette_t *cas, const char *fname)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strstr(fname, "wp://") == fname) {
|
||||||
|
offs = 5;
|
||||||
|
cassette_ui_writeprot = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
fname += offs;
|
||||||
|
|
||||||
cas->fp = plat_fopen(fname, "r+b");
|
cas->fp = plat_fopen(fname, "r+b");
|
||||||
|
|
||||||
if (cas->fp == NULL)
|
if (cas->fp == NULL)
|
||||||
@@ -197,10 +205,10 @@ pc_cas_set_fname(pc_cassette_t *cas, const char *fname)
|
|||||||
|
|
||||||
n = strlen(fname);
|
n = strlen(fname);
|
||||||
|
|
||||||
cas->fname = malloc((n + 1) * sizeof(char));
|
cas->fname = malloc((n + offs + 1) * sizeof(char));
|
||||||
|
|
||||||
if (cas->fname != NULL)
|
if (cas->fname != NULL)
|
||||||
memcpy(cas->fname, fname, (n + 1) * sizeof(char));
|
memcpy(cas->fname, fname - offs, (n + offs + 1) * sizeof(char));
|
||||||
|
|
||||||
if (n > 4) {
|
if (n > 4) {
|
||||||
ext = fname + (n - 4);
|
ext = fname + (n - 4);
|
||||||
@@ -216,6 +224,8 @@ pc_cas_set_fname(pc_cassette_t *cas, const char *fname)
|
|||||||
pc_cas_set_pcm(cas, 0);
|
pc_cas_set_pcm(cas, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui_sb_update_icon_wp(SB_CASSETTE, cassette_ui_writeprot);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -152,6 +152,14 @@ mo_load(const mo_t *dev, const char *fn, const int skip_insert)
|
|||||||
{
|
{
|
||||||
const int was_empty = mo_is_empty(dev->id);
|
const int was_empty = mo_is_empty(dev->id);
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
int offs = 0;
|
||||||
|
|
||||||
|
if (strstr(fn, "wp://") == fn) {
|
||||||
|
offs = 5;
|
||||||
|
dev->drv->read_only = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn += offs;
|
||||||
|
|
||||||
if (dev->drv == NULL)
|
if (dev->drv == NULL)
|
||||||
mo_eject(dev->id);
|
mo_eject(dev->id);
|
||||||
@@ -202,7 +210,7 @@ mo_load(const mo_t *dev, const char *fn, const int skip_insert)
|
|||||||
log_fatal(dev->log, "mo_load(): Error seeking to the beginning of "
|
log_fatal(dev->log, "mo_load(): Error seeking to the beginning of "
|
||||||
"the file\n");
|
"the file\n");
|
||||||
|
|
||||||
strncpy(dev->drv->image_path, fn, sizeof(dev->drv->image_path) - 1);
|
strncpy(dev->drv->image_path, fn - offs, sizeof(dev->drv->image_path) - 1);
|
||||||
|
|
||||||
ret = 1;
|
ret = 1;
|
||||||
} else
|
} else
|
||||||
@@ -218,6 +226,9 @@ mo_load(const mo_t *dev, const char *fn, const int skip_insert)
|
|||||||
if (was_empty)
|
if (was_empty)
|
||||||
mo_insert((mo_t *) dev);
|
mo_insert((mo_t *) dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ret)
|
||||||
|
ui_sb_update_icon_wp(SB_MO | dev->id, dev->drv->read_only);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -194,6 +194,14 @@ zip_load(const zip_t *dev, const char *fn, const int skip_insert)
|
|||||||
{
|
{
|
||||||
const int was_empty = zip_is_empty(dev->id);
|
const int was_empty = zip_is_empty(dev->id);
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
int offs = 0;
|
||||||
|
|
||||||
|
if (strstr(fn, "wp://") == fn) {
|
||||||
|
offs = 5;
|
||||||
|
dev->drv->read_only = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn += offs;
|
||||||
|
|
||||||
if (dev->drv == NULL)
|
if (dev->drv == NULL)
|
||||||
zip_eject(dev->id);
|
zip_eject(dev->id);
|
||||||
@@ -247,7 +255,7 @@ zip_load(const zip_t *dev, const char *fn, const int skip_insert)
|
|||||||
log_fatal(dev->log, "zip_load(): Error seeking to the beginning of "
|
log_fatal(dev->log, "zip_load(): Error seeking to the beginning of "
|
||||||
"the file\n");
|
"the file\n");
|
||||||
|
|
||||||
strncpy(dev->drv->image_path, fn, sizeof(dev->drv->image_path) - 1);
|
strncpy(dev->drv->image_path, fn - offs, sizeof(dev->drv->image_path) - 1);
|
||||||
/*
|
/*
|
||||||
After using strncpy, dev->drv->image_path needs to be explicitly null
|
After using strncpy, dev->drv->image_path needs to be explicitly null
|
||||||
terminated to make gcc happy.
|
terminated to make gcc happy.
|
||||||
@@ -270,6 +278,9 @@ zip_load(const zip_t *dev, const char *fn, const int skip_insert)
|
|||||||
if (was_empty)
|
if (was_empty)
|
||||||
zip_insert((zip_t *) dev);
|
zip_insert((zip_t *) dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ret)
|
||||||
|
ui_sb_update_icon_wp(SB_ZIP | dev->id, dev->drv->read_only);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -459,11 +459,17 @@ fdd_load(int drive, char *fn)
|
|||||||
int size;
|
int size;
|
||||||
const char *p;
|
const char *p;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
int offs = 0;
|
||||||
|
|
||||||
fdd_log("FDD: loading drive %d with '%s'\n", drive, fn);
|
fdd_log("FDD: loading drive %d with '%s'\n", drive, fn);
|
||||||
|
|
||||||
if (!fn)
|
if (!fn)
|
||||||
return;
|
return;
|
||||||
|
if (strstr(fn, "wp://") == fn) {
|
||||||
|
offs = 5;
|
||||||
|
ui_writeprot[drive] = 1;
|
||||||
|
}
|
||||||
|
fn += offs;
|
||||||
p = path_get_extension(fn);
|
p = path_get_extension(fn);
|
||||||
if (!p)
|
if (!p)
|
||||||
return;
|
return;
|
||||||
@@ -476,10 +482,10 @@ fdd_load(int drive, char *fn)
|
|||||||
while (loaders[c].ext) {
|
while (loaders[c].ext) {
|
||||||
if (!strcasecmp(p, (char *) loaders[c].ext) && (size == loaders[c].size || loaders[c].size == -1)) {
|
if (!strcasecmp(p, (char *) loaders[c].ext) && (size == loaders[c].size || loaders[c].size == -1)) {
|
||||||
driveloaders[drive] = c;
|
driveloaders[drive] = c;
|
||||||
if (floppyfns[drive] != fn)
|
if (floppyfns[drive] != (fn - offs))
|
||||||
strcpy(floppyfns[drive], fn);
|
strcpy(floppyfns[drive], fn - offs);
|
||||||
d86f_setup(drive);
|
d86f_setup(drive);
|
||||||
loaders[c].load(drive, floppyfns[drive]);
|
loaders[c].load(drive, floppyfns[drive] + offs);
|
||||||
drive_empty[drive] = 0;
|
drive_empty[drive] = 0;
|
||||||
fdd_forced_seek(drive, 0);
|
fdd_forced_seek(drive, 0);
|
||||||
fdd_changed[drive] = 1;
|
fdd_changed[drive] = 1;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ void pc_cas_del(pc_cassette_t *cas);
|
|||||||
* @short Set the cassette file
|
* @short Set the cassette file
|
||||||
* @return True on error, false otherwise
|
* @return True on error, false otherwise
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int pc_cas_set_fname(pc_cassette_t *cas, const char *fname);
|
int pc_cas_set_fname(pc_cassette_t *cas, char *fname);
|
||||||
|
|
||||||
/*!***************************************************************************
|
/*!***************************************************************************
|
||||||
* @short Get the cassette mode
|
* @short Get the cassette mode
|
||||||
|
|||||||
BIN
src/qt/icons/browse.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/cartridge_image.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/cassette_image.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/cdrom_nomedia.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/eject.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/export.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/fast_forward.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/floppy_35_image.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/floppy_525_image.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/mo_image.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/new.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/record.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/rewind.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/superdisk.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/superdisk_disabled.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/superdisk_image.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
|
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/zip_image.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
@@ -14,6 +14,14 @@ getIndicatorIcon(IconIndicator indicator)
|
|||||||
return QIcon(":/settings/qt/icons/disabled.ico");
|
return QIcon(":/settings/qt/icons/disabled.ico");
|
||||||
case WriteProtected:
|
case WriteProtected:
|
||||||
return QIcon(":/settings/qt/icons/write_protected.ico");
|
return QIcon(":/settings/qt/icons/write_protected.ico");
|
||||||
|
case New:
|
||||||
|
return QIcon(":/settings/qt/icons/new.ico");
|
||||||
|
case Browse:
|
||||||
|
return QIcon(":/settings/qt/icons/browse.ico");
|
||||||
|
case Eject:
|
||||||
|
return QIcon(":/settings/qt/icons/eject.ico");
|
||||||
|
case Export:
|
||||||
|
return QIcon(":/settings/qt/icons/eject.ico");
|
||||||
default:
|
default:
|
||||||
return QIcon();
|
return QIcon();
|
||||||
}
|
}
|
||||||
@@ -30,12 +38,18 @@ getIconWithIndicator(const QIcon &icon, const QSize &size, QIcon::Mode iconMode,
|
|||||||
auto painter = QPainter(&iconPixmap);
|
auto painter = QPainter(&iconPixmap);
|
||||||
auto indicatorPixmap = getIndicatorIcon((indicator == ReadWriteActive || indicator == WriteProtectedActive) ? Active : indicator).pixmap(size);
|
auto indicatorPixmap = getIndicatorIcon((indicator == ReadWriteActive || indicator == WriteProtectedActive) ? Active : indicator).pixmap(size);
|
||||||
|
|
||||||
|
if (indicator == WriteProtectedBrowse)
|
||||||
|
indicatorPixmap = getIndicatorIcon(WriteProtected).pixmap(size);
|
||||||
|
|
||||||
painter.drawPixmap(0, 0, indicatorPixmap);
|
painter.drawPixmap(0, 0, indicatorPixmap);
|
||||||
if (indicator == ReadWriteActive || indicator == WriteProtectedActive) {
|
if ((indicator == ReadWriteActive) || (indicator == WriteProtectedActive)) {
|
||||||
auto writeIndicatorPixmap = getIndicatorIcon(indicator == WriteProtectedActive ? WriteProtected : WriteActive).pixmap(size);
|
auto writeIndicatorPixmap = getIndicatorIcon(indicator == WriteProtectedActive ? WriteProtected : WriteActive).pixmap(size);
|
||||||
painter.drawPixmap(0, 0, writeIndicatorPixmap);
|
painter.drawPixmap(0, 0, writeIndicatorPixmap);
|
||||||
|
} else if (indicator == WriteProtectedBrowse) {
|
||||||
|
auto browseIndicatorPixmap = getIndicatorIcon(Browse).pixmap(size);
|
||||||
|
painter.drawPixmap(0, 0, browseIndicatorPixmap);
|
||||||
}
|
}
|
||||||
painter.end();
|
painter.end();
|
||||||
|
|
||||||
return iconPixmap;
|
return iconPixmap;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,11 @@ enum IconIndicator {
|
|||||||
Disabled,
|
Disabled,
|
||||||
WriteProtected,
|
WriteProtected,
|
||||||
WriteProtectedActive,
|
WriteProtectedActive,
|
||||||
|
New,
|
||||||
|
Browse,
|
||||||
|
WriteProtectedBrowse,
|
||||||
|
Export,
|
||||||
|
Eject
|
||||||
};
|
};
|
||||||
|
|
||||||
QPixmap getIconWithIndicator(const QIcon &icon, const QSize &size, QIcon::Mode iconMode, IconIndicator indicator);
|
QPixmap getIconWithIndicator(const QIcon &icon, const QSize &size, QIcon::Mode iconMode, IconIndicator indicator);
|
||||||
|
|||||||
@@ -617,7 +617,12 @@ MachineStatus::refresh(QStatusBar *sbar)
|
|||||||
if (cassette_enable) {
|
if (cassette_enable) {
|
||||||
d->cassette.label = std::make_unique<ClickableLabel>();
|
d->cassette.label = std::make_unique<ClickableLabel>();
|
||||||
d->cassette.setEmpty(QString(cassette_fname).isEmpty());
|
d->cassette.setEmpty(QString(cassette_fname).isEmpty());
|
||||||
d->cassette.setWriteProtected(cassette_ui_writeprot);
|
if (QString(cassette_fname).isEmpty())
|
||||||
|
d->cassette.setWriteProtected(false);
|
||||||
|
else if (QString(cassette_fname).left(5) == "wp://")
|
||||||
|
d->cassette.setWriteProtected(true);
|
||||||
|
else
|
||||||
|
d->cassette.setWriteProtected(cassette_ui_writeprot);
|
||||||
d->cassette.refresh();
|
d->cassette.refresh();
|
||||||
connect((ClickableLabel *) d->cassette.label.get(), &ClickableLabel::clicked, [](QPoint pos) {
|
connect((ClickableLabel *) d->cassette.label.get(), &ClickableLabel::clicked, [](QPoint pos) {
|
||||||
MediaMenu::ptr->cassetteMenu->popup(pos - QPoint(0, MediaMenu::ptr->cassetteMenu->sizeHint().height()));
|
MediaMenu::ptr->cassetteMenu->popup(pos - QPoint(0, MediaMenu::ptr->cassetteMenu->sizeHint().height()));
|
||||||
@@ -658,7 +663,12 @@ MachineStatus::refresh(QStatusBar *sbar)
|
|||||||
}
|
}
|
||||||
d->fdd[i].label = std::make_unique<ClickableLabel>();
|
d->fdd[i].label = std::make_unique<ClickableLabel>();
|
||||||
d->fdd[i].setEmpty(QString(floppyfns[i]).isEmpty());
|
d->fdd[i].setEmpty(QString(floppyfns[i]).isEmpty());
|
||||||
d->fdd[i].setWriteProtected(ui_writeprot[i]);
|
if (QString(floppyfns[i]).isEmpty())
|
||||||
|
d->fdd[i].setWriteProtected(false);
|
||||||
|
else if (QString(floppyfns[i]).left(5) == "wp://")
|
||||||
|
d->fdd[i].setWriteProtected(true);
|
||||||
|
else
|
||||||
|
d->fdd[i].setWriteProtected(ui_writeprot[i]);
|
||||||
d->fdd[i].setActive(false);
|
d->fdd[i].setActive(false);
|
||||||
d->fdd[i].setWriteActive(false);
|
d->fdd[i].setWriteActive(false);
|
||||||
d->fdd[i].refresh();
|
d->fdd[i].refresh();
|
||||||
@@ -693,7 +703,12 @@ MachineStatus::refresh(QStatusBar *sbar)
|
|||||||
iterateZIP([this, sbar](int i) {
|
iterateZIP([this, sbar](int i) {
|
||||||
d->zip[i].label = std::make_unique<ClickableLabel>();
|
d->zip[i].label = std::make_unique<ClickableLabel>();
|
||||||
d->zip[i].setEmpty(QString(zip_drives[i].image_path).isEmpty());
|
d->zip[i].setEmpty(QString(zip_drives[i].image_path).isEmpty());
|
||||||
d->zip[i].setWriteProtected(zip_drives[i].read_only);
|
if (QString(zip_drives[i].image_path).isEmpty())
|
||||||
|
d->zip[i].setWriteProtected(false);
|
||||||
|
else if (QString(zip_drives[i].image_path).left(5) == "wp://")
|
||||||
|
d->zip[i].setWriteProtected(true);
|
||||||
|
else
|
||||||
|
d->zip[i].setWriteProtected(zip_drives[i].read_only);
|
||||||
d->zip[i].setActive(false);
|
d->zip[i].setActive(false);
|
||||||
d->zip[i].setWriteActive(false);
|
d->zip[i].setWriteActive(false);
|
||||||
d->zip[i].refresh();
|
d->zip[i].refresh();
|
||||||
@@ -711,7 +726,12 @@ MachineStatus::refresh(QStatusBar *sbar)
|
|||||||
iterateMO([this, sbar](int i) {
|
iterateMO([this, sbar](int i) {
|
||||||
d->mo[i].label = std::make_unique<ClickableLabel>();
|
d->mo[i].label = std::make_unique<ClickableLabel>();
|
||||||
d->mo[i].setEmpty(QString(mo_drives[i].image_path).isEmpty());
|
d->mo[i].setEmpty(QString(mo_drives[i].image_path).isEmpty());
|
||||||
d->mo[i].setWriteProtected(mo_drives[i].read_only);
|
if (QString(zip_drives[i].image_path).isEmpty())
|
||||||
|
d->mo[i].setWriteProtected(false);
|
||||||
|
else if (QString(zip_drives[i].image_path).left(5) == "wp://")
|
||||||
|
d->mo[i].setWriteProtected(true);
|
||||||
|
else
|
||||||
|
d->mo[i].setWriteProtected(zip_drives[i].read_only);
|
||||||
d->mo[i].setActive(false);
|
d->mo[i].setActive(false);
|
||||||
d->mo[i].setWriteActive(false);
|
d->mo[i].setWriteActive(false);
|
||||||
d->mo[i].refresh();
|
d->mo[i].refresh();
|
||||||
|
|||||||
@@ -21,6 +21,9 @@
|
|||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include "qt_mediahistorymanager.hpp"
|
#include "qt_mediahistorymanager.hpp"
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <86box/timer.h>
|
#include <86box/timer.h>
|
||||||
@@ -205,6 +208,8 @@ MediaHistoryManager::initialDeduplication()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
deduplicateList(device_history, QVector<QString>(1, current_image));
|
deduplicateList(device_history, QVector<QString>(1, current_image));
|
||||||
|
device_history = removeMissingImages(device_history);
|
||||||
|
device_history = pathAdjustFull(device_history);
|
||||||
// Fill in missing, if any
|
// Fill in missing, if any
|
||||||
int missing = MAX_PREV_IMAGES - device_history.size();
|
int missing = MAX_PREV_IMAGES - device_history.size();
|
||||||
if (missing) {
|
if (missing) {
|
||||||
@@ -213,6 +218,7 @@ MediaHistoryManager::initialDeduplication()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
setHistoryListForDeviceIndex(device_index, device_type, device_history);
|
setHistoryListForDeviceIndex(device_index, device_type, device_history);
|
||||||
|
serializeImageHistoryType(device_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -343,24 +349,42 @@ MediaHistoryManager::removeMissingImages(device_index_list_t &device_history)
|
|||||||
|
|
||||||
char temp[MAX_IMAGE_PATH_LEN * 2] = { 0 };
|
char temp[MAX_IMAGE_PATH_LEN * 2] = { 0 };
|
||||||
|
|
||||||
if (path_abs(checked_path.toUtf8().data())) {
|
if (checked_path.left(8) == "ioctl://") {
|
||||||
if (checked_path.length() > (MAX_IMAGE_PATH_LEN - 1))
|
strncpy(temp, checked_path.toUtf8().data(), sizeof(temp));
|
||||||
fatal("removeMissingImages(): checked_path.length() > %i\n", MAX_IMAGE_PATH_LEN - 1);
|
temp[sizeof(temp) - 1] = '\0';
|
||||||
else
|
|
||||||
snprintf(temp, (MAX_IMAGE_PATH_LEN - 1), "%s", checked_path.toUtf8().constData());
|
|
||||||
} else {
|
} else {
|
||||||
if ((strlen(usr_path) + strlen(path_get_slash(usr_path)) + checked_path.length()) > (MAX_IMAGE_PATH_LEN - 1))
|
QString path_only;
|
||||||
fatal("removeMissingImages(): Combined absolute path length > %i\n", MAX_IMAGE_PATH_LEN - 1);
|
if (checked_path.left(5) == "wp://")
|
||||||
|
path_only = checked_path.right(checked_path.length() - 5);
|
||||||
else
|
else
|
||||||
snprintf(temp, (MAX_IMAGE_PATH_LEN - 1), "%s%s%s", usr_path,
|
path_only = checked_path;
|
||||||
path_get_slash(usr_path), checked_path.toUtf8().constData());
|
|
||||||
|
if (path_abs(path_only.toUtf8().data())) {
|
||||||
|
if (path_only.length() > (MAX_IMAGE_PATH_LEN - 1))
|
||||||
|
fatal("removeMissingImages(): path_only.length() > %i\n", MAX_IMAGE_PATH_LEN - 1);
|
||||||
|
else
|
||||||
|
snprintf(temp, (MAX_IMAGE_PATH_LEN - 1), "%s", path_only.toUtf8().constData());
|
||||||
|
} else {
|
||||||
|
if ((strlen(usr_path) + strlen(path_get_slash(usr_path)) + path_only.length()) > (MAX_IMAGE_PATH_LEN - 1))
|
||||||
|
fatal("removeMissingImages(): Combined absolute path length > %i\n", MAX_IMAGE_PATH_LEN - 1);
|
||||||
|
else
|
||||||
|
snprintf(temp, (MAX_IMAGE_PATH_LEN - 1), "%s%s%s", usr_path,
|
||||||
|
path_get_slash(usr_path), path_only.toUtf8().constData());
|
||||||
|
}
|
||||||
|
path_normalize(temp);
|
||||||
}
|
}
|
||||||
path_normalize(temp);
|
|
||||||
|
|
||||||
QString qstr = QString::fromUtf8(temp);
|
QString qstr = QString::fromUtf8(temp);
|
||||||
QFileInfo new_fi(qstr);
|
QFileInfo new_fi(qstr);
|
||||||
|
|
||||||
if ((new_fi.filePath().left(8) != "ioctl://") && !new_fi.exists()) {
|
bool file_exists = new_fi.exists();
|
||||||
|
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
if (new_fi.filePath().left(8) == "ioctl://")
|
||||||
|
file_exists = (GetDriveType(new_fi.filePath().right(2).toUtf8().data()) == DRIVE_CDROM);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!file_exists) {
|
||||||
qWarning("Image file %s does not exist - removing from history", qPrintable(new_fi.filePath()));
|
qWarning("Image file %s does not exist - removing from history", qPrintable(new_fi.filePath()));
|
||||||
checked_path = "";
|
checked_path = "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,9 +69,12 @@ extern "C" {
|
|||||||
#include "qt_deviceconfig.hpp"
|
#include "qt_deviceconfig.hpp"
|
||||||
#include "qt_mediahistorymanager.hpp"
|
#include "qt_mediahistorymanager.hpp"
|
||||||
#include "qt_mediamenu.hpp"
|
#include "qt_mediamenu.hpp"
|
||||||
|
#include "qt_iconindicators.hpp"
|
||||||
|
|
||||||
std::shared_ptr<MediaMenu> MediaMenu::ptr;
|
std::shared_ptr<MediaMenu> MediaMenu::ptr;
|
||||||
|
|
||||||
|
static QSize pixmap_size(16, 16);
|
||||||
|
|
||||||
MediaMenu::MediaMenu(QWidget *parent)
|
MediaMenu::MediaMenu(QWidget *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
@@ -86,27 +89,28 @@ MediaMenu::refresh(QMenu *parentMenu)
|
|||||||
|
|
||||||
if (MachineStatus::hasCassette()) {
|
if (MachineStatus::hasCassette()) {
|
||||||
cassetteMenu = parentMenu->addMenu("");
|
cassetteMenu = parentMenu->addMenu("");
|
||||||
cassetteMenu->addAction(tr("&New image..."), [this]() { cassetteNewImage(); });
|
QIcon img_icon = QIcon(":/settings/qt/icons/cassette_image.ico");
|
||||||
|
cassetteMenu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, New), tr("&New image..."), [this]() { cassetteNewImage(); });
|
||||||
cassetteMenu->addSeparator();
|
cassetteMenu->addSeparator();
|
||||||
cassetteMenu->addAction(tr("&Existing image..."), [this]() { cassetteSelectImage(false); });
|
cassetteMenu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Browse), tr("&Existing image..."), [this]() { cassetteSelectImage(false); });
|
||||||
cassetteMenu->addAction(tr("Existing image (&Write-protected)..."), [this]() { cassetteSelectImage(true); });
|
cassetteMenu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, WriteProtectedBrowse), tr("Existing image (&Write-protected)..."), [this]() { cassetteSelectImage(true); });
|
||||||
cassetteMenu->addSeparator();
|
cassetteMenu->addSeparator();
|
||||||
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
|
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
|
||||||
cassetteImageHistoryPos[slot] = cassetteMenu->children().count();
|
cassetteImageHistoryPos[slot] = cassetteMenu->children().count();
|
||||||
cassetteMenu->addAction(tr("Image %1").arg(slot), [this, slot]() { cassetteMenuSelect(slot); })->setCheckable(false);
|
cassetteMenu->addAction(img_icon, tr("Image %1").arg(slot), [this, slot]() { cassetteMenuSelect(slot); })->setCheckable(false);
|
||||||
}
|
}
|
||||||
cassetteMenu->addSeparator();
|
cassetteMenu->addSeparator();
|
||||||
cassetteRecordPos = cassetteMenu->children().count();
|
cassetteRecordPos = cassetteMenu->children().count();
|
||||||
cassetteMenu->addAction(tr("&Record"), [this] { pc_cas_set_mode(cassette, 1); cassetteUpdateMenu(); })->setCheckable(true);
|
cassetteMenu->addAction(QIcon(":/settings/qt/icons/record.ico"), tr("&Record"), [this] { pc_cas_set_mode(cassette, 1); cassetteUpdateMenu(); })->setCheckable(true);
|
||||||
cassettePlayPos = cassetteMenu->children().count();
|
cassettePlayPos = cassetteMenu->children().count();
|
||||||
cassetteMenu->addAction(tr("&Play"), [this] { pc_cas_set_mode(cassette, 0); cassetteUpdateMenu(); })->setCheckable(true);
|
cassetteMenu->addAction(QIcon(":/menuicons/qt/icons/run.ico"), tr("&Play"), [this] { pc_cas_set_mode(cassette, 0); cassetteUpdateMenu(); })->setCheckable(true);
|
||||||
cassetteRewindPos = cassetteMenu->children().count();
|
cassetteRewindPos = cassetteMenu->children().count();
|
||||||
cassetteMenu->addAction(tr("&Rewind to the beginning"), [] { pc_cas_rewind(cassette); });
|
cassetteMenu->addAction(QIcon(":/settings/qt/icons/rewind.ico"), tr("&Rewind to the beginning"), [] { pc_cas_rewind(cassette); });
|
||||||
cassetteFastFwdPos = cassetteMenu->children().count();
|
cassetteFastFwdPos = cassetteMenu->children().count();
|
||||||
cassetteMenu->addAction(tr("&Fast forward to the end"), [] { pc_cas_append(cassette); });
|
cassetteMenu->addAction(QIcon(":/settings/qt/icons/fast_forward.ico"), tr("&Fast forward to the end"), [] { pc_cas_append(cassette); });
|
||||||
cassetteMenu->addSeparator();
|
cassetteMenu->addSeparator();
|
||||||
cassetteEjectPos = cassetteMenu->children().count();
|
cassetteEjectPos = cassetteMenu->children().count();
|
||||||
cassetteMenu->addAction(tr("E&ject"), [this]() { cassetteEject(); });
|
cassetteMenu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Eject), tr("E&ject"), [this]() { cassetteEject(); });
|
||||||
cassetteUpdateMenu();
|
cassetteUpdateMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,15 +118,16 @@ MediaMenu::refresh(QMenu *parentMenu)
|
|||||||
if (machine_has_cartridge(machine)) {
|
if (machine_has_cartridge(machine)) {
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
auto *menu = parentMenu->addMenu("");
|
auto *menu = parentMenu->addMenu("");
|
||||||
menu->addAction(tr("&Image..."), [this, i]() { cartridgeSelectImage(i); });
|
QIcon img_icon = QIcon(":/settings/qt/icons/cartridge_image.ico");
|
||||||
|
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Browse), tr("&Image..."), [this, i]() { cartridgeSelectImage(i); });
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
|
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
|
||||||
cartridgeImageHistoryPos[slot] = menu->children().count();
|
cartridgeImageHistoryPos[slot] = menu->children().count();
|
||||||
menu->addAction(tr("Image %1").arg(slot), [this, i, slot]() { cartridgeMenuSelect(i, slot); })->setCheckable(false);
|
menu->addAction(img_icon, tr("Image %1").arg(slot), [this, i, slot]() { cartridgeMenuSelect(i, slot); })->setCheckable(false);
|
||||||
}
|
}
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
cartridgeEjectPos = menu->children().count();
|
cartridgeEjectPos = menu->children().count();
|
||||||
menu->addAction(tr("E&ject"), [this, i]() { cartridgeEject(i); });
|
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Eject), tr("E&ject"), [this, i]() { cartridgeEject(i); });
|
||||||
cartridgeMenus[i] = menu;
|
cartridgeMenus[i] = menu;
|
||||||
cartridgeUpdateMenu(i);
|
cartridgeUpdateMenu(i);
|
||||||
}
|
}
|
||||||
@@ -131,21 +136,23 @@ MediaMenu::refresh(QMenu *parentMenu)
|
|||||||
floppyMenus.clear();
|
floppyMenus.clear();
|
||||||
MachineStatus::iterateFDD([this, parentMenu](int i) {
|
MachineStatus::iterateFDD([this, parentMenu](int i) {
|
||||||
auto *menu = parentMenu->addMenu("");
|
auto *menu = parentMenu->addMenu("");
|
||||||
menu->addAction(tr("&New image..."), [this, i]() { floppyNewImage(i); });
|
QIcon img_icon = fdd_is_525(i) ? QIcon(":/settings/qt/icons/floppy_525_image.ico") :
|
||||||
|
QIcon(":/settings/qt/icons/floppy_35_image.ico");
|
||||||
|
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, New), tr("&New image..."), [this, i]() { floppyNewImage(i); });
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
menu->addAction(tr("&Existing image..."), [this, i]() { floppySelectImage(i, false); });
|
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Browse), tr("&Existing image..."), [this, i]() { floppySelectImage(i, false); });
|
||||||
menu->addAction(tr("Existing image (&Write-protected)..."), [this, i]() { floppySelectImage(i, true); });
|
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, WriteProtectedBrowse), tr("Existing image (&Write-protected)..."), [this, i]() { floppySelectImage(i, true); });
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
|
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
|
||||||
floppyImageHistoryPos[slot] = menu->children().count();
|
floppyImageHistoryPos[slot] = menu->children().count();
|
||||||
menu->addAction(tr("Image %1").arg(slot), [this, i, slot]() { floppyMenuSelect(i, slot); })->setCheckable(false);
|
menu->addAction(img_icon, tr("Image %1").arg(slot), [this, i, slot]() { floppyMenuSelect(i, slot); })->setCheckable(false);
|
||||||
}
|
}
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
floppyExportPos = menu->children().count();
|
floppyExportPos = menu->children().count();
|
||||||
menu->addAction(tr("E&xport to 86F..."), [this, i]() { floppyExportTo86f(i); });
|
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Export), tr("E&xport to 86F..."), [this, i]() { floppyExportTo86f(i); });
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
floppyEjectPos = menu->children().count();
|
floppyEjectPos = menu->children().count();
|
||||||
menu->addAction(tr("E&ject"), [this, i]() { floppyEject(i); });
|
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Eject), tr("E&ject"), [this, i]() { floppyEject(i); });
|
||||||
floppyMenus[i] = menu;
|
floppyMenus[i] = menu;
|
||||||
floppyUpdateMenu(i);
|
floppyUpdateMenu(i);
|
||||||
});
|
});
|
||||||
@@ -156,8 +163,8 @@ MediaMenu::refresh(QMenu *parentMenu)
|
|||||||
cdromMutePos = menu->children().count();
|
cdromMutePos = menu->children().count();
|
||||||
menu->addAction(QIcon(":/settings/qt/icons/cdrom_mute.ico"), tr("&Mute"), [this, i]() { cdromMute(i); })->setCheckable(true);
|
menu->addAction(QIcon(":/settings/qt/icons/cdrom_mute.ico"), tr("&Mute"), [this, i]() { cdromMute(i); })->setCheckable(true);
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
menu->addAction(QIcon(":/settings/qt/icons/cdrom_image.ico"), tr("&Image..."), [this, i]() { cdromMount(i, 0, nullptr); })->setCheckable(false);
|
menu->addAction(getIconWithIndicator(QIcon(":/settings/qt/icons/cdrom_image.ico"), pixmap_size, QIcon::Normal, Browse), tr("&Image..."), [this, i]() { cdromMount(i, 0, nullptr); })->setCheckable(false);
|
||||||
menu->addAction(QIcon(":/settings/qt/icons/cdrom_folder.ico"), tr("&Folder..."), [this, i]() { cdromMount(i, 1, nullptr); })->setCheckable(false);
|
menu->addAction(getIconWithIndicator(QIcon(":/settings/qt/icons/cdrom_folder.ico"), pixmap_size, QIcon::Normal, Browse), tr("&Folder..."), [this, i]() { cdromMount(i, 1, nullptr); })->setCheckable(false);
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
|
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
|
||||||
cdromImageHistoryPos[slot] = menu->children().count();
|
cdromImageHistoryPos[slot] = menu->children().count();
|
||||||
@@ -183,18 +190,19 @@ MediaMenu::refresh(QMenu *parentMenu)
|
|||||||
zipMenus.clear();
|
zipMenus.clear();
|
||||||
MachineStatus::iterateZIP([this, parentMenu](int i) {
|
MachineStatus::iterateZIP([this, parentMenu](int i) {
|
||||||
auto *menu = parentMenu->addMenu("");
|
auto *menu = parentMenu->addMenu("");
|
||||||
menu->addAction(tr("&New image..."), [this, i]() { zipNewImage(i); });
|
QIcon img_icon = QIcon(":/settings/qt/icons/zip_image.ico");
|
||||||
|
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, New), tr("&New image..."), [this, i]() { zipNewImage(i); });
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
menu->addAction(tr("&Existing image..."), [this, i]() { zipSelectImage(i, false); });
|
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Browse), tr("&Existing image..."), [this, i]() { zipSelectImage(i, false); });
|
||||||
menu->addAction(tr("Existing image (&Write-protected)..."), [this, i]() { zipSelectImage(i, true); });
|
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, WriteProtectedBrowse), tr("Existing image (&Write-protected)..."), [this, i]() { zipSelectImage(i, true); });
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
|
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
|
||||||
zipImageHistoryPos[slot] = menu->children().count();
|
zipImageHistoryPos[slot] = menu->children().count();
|
||||||
menu->addAction(tr("Image %1").arg(slot), [this, i, slot]() { zipReload(i, slot); })->setCheckable(false);
|
menu->addAction(img_icon, tr("Image %1").arg(slot), [this, i, slot]() { zipReload(i, slot); })->setCheckable(false);
|
||||||
}
|
}
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
zipEjectPos = menu->children().count();
|
zipEjectPos = menu->children().count();
|
||||||
menu->addAction(tr("E&ject"), [this, i]() { zipEject(i); });
|
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Eject), tr("E&ject"), [this, i]() { zipEject(i); });
|
||||||
zipMenus[i] = menu;
|
zipMenus[i] = menu;
|
||||||
zipUpdateMenu(i);
|
zipUpdateMenu(i);
|
||||||
});
|
});
|
||||||
@@ -202,18 +210,19 @@ MediaMenu::refresh(QMenu *parentMenu)
|
|||||||
moMenus.clear();
|
moMenus.clear();
|
||||||
MachineStatus::iterateMO([this, parentMenu](int i) {
|
MachineStatus::iterateMO([this, parentMenu](int i) {
|
||||||
auto *menu = parentMenu->addMenu("");
|
auto *menu = parentMenu->addMenu("");
|
||||||
menu->addAction(tr("&New image..."), [this, i]() { moNewImage(i); });
|
QIcon img_icon = QIcon(":/settings/qt/icons/mo_image.ico");
|
||||||
|
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, New), tr("&New image..."), [this, i]() { moNewImage(i); });
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
menu->addAction(tr("&Existing image..."), [this, i]() { moSelectImage(i, false); });
|
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Browse), tr("&Existing image..."), [this, i]() { moSelectImage(i, false); });
|
||||||
menu->addAction(tr("Existing image (&Write-protected)..."), [this, i]() { moSelectImage(i, true); });
|
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, WriteProtectedBrowse), tr("Existing image (&Write-protected)..."), [this, i]() { moSelectImage(i, true); });
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
|
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
|
||||||
moImageHistoryPos[slot] = menu->children().count();
|
moImageHistoryPos[slot] = menu->children().count();
|
||||||
menu->addAction(tr("Image %1").arg(slot), [this, i, slot]() { moReload(i, slot); })->setCheckable(false);
|
menu->addAction(img_icon, tr("Image %1").arg(slot), [this, i, slot]() { moReload(i, slot); })->setCheckable(false);
|
||||||
}
|
}
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
moEjectPos = menu->children().count();
|
moEjectPos = menu->children().count();
|
||||||
menu->addAction(tr("E&ject"), [this, i]() { moEject(i); });
|
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Eject), tr("E&ject"), [this, i]() { moEject(i); });
|
||||||
moMenus[i] = menu;
|
moMenus[i] = menu;
|
||||||
moUpdateMenu(i);
|
moUpdateMenu(i);
|
||||||
});
|
});
|
||||||
@@ -277,6 +286,12 @@ MediaMenu::cassetteMount(const QString &filename, bool wp)
|
|||||||
|
|
||||||
if (!filename.isEmpty()) {
|
if (!filename.isEmpty()) {
|
||||||
QByteArray filenameBytes = filename.toUtf8();
|
QByteArray filenameBytes = filename.toUtf8();
|
||||||
|
|
||||||
|
if (filename.left(5) == "wp://")
|
||||||
|
cassette_ui_writeprot = 1;
|
||||||
|
else if (cassette_ui_writeprot)
|
||||||
|
filenameBytes = QString::asprintf(R"(wp://%s)", filename.toUtf8().data()).toUtf8();
|
||||||
|
|
||||||
strncpy(cassette_fname, filenameBytes.data(), sizeof(cassette_fname) - 1);
|
strncpy(cassette_fname, filenameBytes.data(), sizeof(cassette_fname) - 1);
|
||||||
pc_cas_set_fname(cassette, cassette_fname);
|
pc_cas_set_fname(cassette, cassette_fname);
|
||||||
}
|
}
|
||||||
@@ -444,11 +459,18 @@ MediaMenu::floppyMount(int i, const QString &filename, bool wp)
|
|||||||
ui_writeprot[i] = wp ? 1 : 0;
|
ui_writeprot[i] = wp ? 1 : 0;
|
||||||
if (!filename.isEmpty()) {
|
if (!filename.isEmpty()) {
|
||||||
QByteArray filenameBytes = filename.toUtf8();
|
QByteArray filenameBytes = filename.toUtf8();
|
||||||
|
|
||||||
|
if (filename.left(5) == "wp://")
|
||||||
|
ui_writeprot[i] = 1;
|
||||||
|
else if (ui_writeprot[i])
|
||||||
|
filenameBytes = QString::asprintf(R"(wp://%s)", filename.toUtf8().data()).toUtf8();
|
||||||
|
|
||||||
fdd_load(i, filenameBytes.data());
|
fdd_load(i, filenameBytes.data());
|
||||||
}
|
mhm.addImageToHistory(i, ui::MediaType::Floppy, previous_image.filePath(), QString(filenameBytes));
|
||||||
|
} else
|
||||||
|
mhm.addImageToHistory(i, ui::MediaType::Floppy, previous_image.filePath(), filename);
|
||||||
ui_sb_update_icon_state(SB_FLOPPY | i, filename.isEmpty() ? 1 : 0);
|
ui_sb_update_icon_state(SB_FLOPPY | i, filename.isEmpty() ? 1 : 0);
|
||||||
ui_sb_update_icon_wp(SB_FLOPPY | i, ui_writeprot[i]);
|
ui_sb_update_icon_wp(SB_FLOPPY | i, ui_writeprot[i]);
|
||||||
mhm.addImageToHistory(i, ui::MediaType::Floppy, previous_image.filePath(), filename);
|
|
||||||
floppyUpdateMenu(i);
|
floppyUpdateMenu(i);
|
||||||
ui_sb_update_tip(SB_FLOPPY | i);
|
ui_sb_update_tip(SB_FLOPPY | i);
|
||||||
config_save();
|
config_save();
|
||||||
@@ -569,7 +591,7 @@ MediaMenu::cdromMount(int i, int dir, const QString &arg)
|
|||||||
QFileInfo fi(cdrom[i].image_path);
|
QFileInfo fi(cdrom[i].image_path);
|
||||||
|
|
||||||
if (dir > 1)
|
if (dir > 1)
|
||||||
filename = QString::asprintf(R"(ioctl://%s)", arg.toStdString().c_str());
|
filename = QString::asprintf(R"(ioctl://%s)", arg.toUtf8().data());
|
||||||
else if (dir == 1)
|
else if (dir == 1)
|
||||||
filename = QFileDialog::getExistingDirectory(parentWidget);
|
filename = QFileDialog::getExistingDirectory(parentWidget);
|
||||||
else {
|
else {
|
||||||
@@ -641,8 +663,18 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type)
|
|||||||
menu = cassetteMenu;
|
menu = cassetteMenu;
|
||||||
children = menu->children();
|
children = menu->children();
|
||||||
imageHistoryUpdatePos = dynamic_cast<QAction *>(children[cassetteImageHistoryPos[slot]]);
|
imageHistoryUpdatePos = dynamic_cast<QAction *>(children[cassetteImageHistoryPos[slot]]);
|
||||||
fi.setFile(fn);
|
menu_icon = QIcon(":/settings/qt/icons/cassette_image.ico");
|
||||||
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn;
|
if (fn.left(5) == "wp://")
|
||||||
|
fi.setFile(fn.right(fn.length() - 5));
|
||||||
|
else
|
||||||
|
fi.setFile(fn);
|
||||||
|
if (!fi.fileName().isEmpty() && (fn.left(5) == "wp://")) {
|
||||||
|
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn.right(fn.length() - 5);
|
||||||
|
imageHistoryUpdatePos->setIcon(getIconWithIndicator(menu_icon, pixmap_size, QIcon::Normal, WriteProtected));
|
||||||
|
} else {
|
||||||
|
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn;
|
||||||
|
imageHistoryUpdatePos->setIcon(menu_icon);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ui::MediaType::Cartridge:
|
case ui::MediaType::Cartridge:
|
||||||
if (!machine_has_cartridge(machine))
|
if (!machine_has_cartridge(machine))
|
||||||
@@ -659,8 +691,19 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type)
|
|||||||
menu = floppyMenus[index];
|
menu = floppyMenus[index];
|
||||||
children = menu->children();
|
children = menu->children();
|
||||||
imageHistoryUpdatePos = dynamic_cast<QAction *>(children[floppyImageHistoryPos[slot]]);
|
imageHistoryUpdatePos = dynamic_cast<QAction *>(children[floppyImageHistoryPos[slot]]);
|
||||||
fi.setFile(fn);
|
menu_icon = fdd_is_525(index) ? QIcon(":/settings/qt/icons/floppy_525_image.ico") :
|
||||||
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn;
|
QIcon(":/settings/qt/icons/floppy_35_image.ico");
|
||||||
|
if (fn.left(5) == "wp://")
|
||||||
|
fi.setFile(fn.right(fn.length() - 5));
|
||||||
|
else
|
||||||
|
fi.setFile(fn);
|
||||||
|
if (!fi.fileName().isEmpty() && (fn.left(5) == "wp://")) {
|
||||||
|
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn.right(fn.length() - 5);
|
||||||
|
imageHistoryUpdatePos->setIcon(getIconWithIndicator(menu_icon, pixmap_size, QIcon::Normal, WriteProtected));
|
||||||
|
} else {
|
||||||
|
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn;
|
||||||
|
imageHistoryUpdatePos->setIcon(menu_icon);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ui::MediaType::Optical:
|
case ui::MediaType::Optical:
|
||||||
if (!cdromMenus.contains(index))
|
if (!cdromMenus.contains(index))
|
||||||
@@ -688,8 +731,18 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type)
|
|||||||
menu = zipMenus[index];
|
menu = zipMenus[index];
|
||||||
children = menu->children();
|
children = menu->children();
|
||||||
imageHistoryUpdatePos = dynamic_cast<QAction *>(children[zipImageHistoryPos[slot]]);
|
imageHistoryUpdatePos = dynamic_cast<QAction *>(children[zipImageHistoryPos[slot]]);
|
||||||
fi.setFile(fn);
|
menu_icon = QIcon(":/settings/qt/icons/mo_image.ico");
|
||||||
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn;
|
if (fn.left(5) == "wp://")
|
||||||
|
fi.setFile(fn.right(fn.length() - 5));
|
||||||
|
else
|
||||||
|
fi.setFile(fn);
|
||||||
|
if (!fi.fileName().isEmpty() && (fn.left(5) == "wp://")) {
|
||||||
|
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn.right(fn.length() - 5);
|
||||||
|
imageHistoryUpdatePos->setIcon(getIconWithIndicator(menu_icon, pixmap_size, QIcon::Normal, WriteProtected));
|
||||||
|
} else {
|
||||||
|
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn;
|
||||||
|
imageHistoryUpdatePos->setIcon(menu_icon);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ui::MediaType::Mo:
|
case ui::MediaType::Mo:
|
||||||
if (!moMenus.contains(index))
|
if (!moMenus.contains(index))
|
||||||
@@ -697,8 +750,18 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type)
|
|||||||
menu = moMenus[index];
|
menu = moMenus[index];
|
||||||
children = menu->children();
|
children = menu->children();
|
||||||
imageHistoryUpdatePos = dynamic_cast<QAction *>(children[moImageHistoryPos[slot]]);
|
imageHistoryUpdatePos = dynamic_cast<QAction *>(children[moImageHistoryPos[slot]]);
|
||||||
fi.setFile(fn);
|
menu_icon = QIcon(":/settings/qt/icons/mo_image.ico");
|
||||||
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn;
|
if (fn.left(5) == "wp://")
|
||||||
|
fi.setFile(fn.right(fn.length() - 5));
|
||||||
|
else
|
||||||
|
fi.setFile(fn);
|
||||||
|
if (!fi.fileName().isEmpty() && (fn.left(5) == "wp://")) {
|
||||||
|
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn.right(fn.length() - 5);
|
||||||
|
imageHistoryUpdatePos->setIcon(getIconWithIndicator(menu_icon, pixmap_size, QIcon::Normal, WriteProtected));
|
||||||
|
} else {
|
||||||
|
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn;
|
||||||
|
imageHistoryUpdatePos->setIcon(menu_icon);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -749,9 +812,12 @@ MediaMenu::cdromUpdateMenu(int i)
|
|||||||
|
|
||||||
menu_item_name = name.isEmpty() ? QString() : fi.fileName();
|
menu_item_name = name.isEmpty() ? QString() : fi.fileName();
|
||||||
name2 = name;
|
name2 = name;
|
||||||
menu_icon = fi.isDir() ? QIcon(":/settings/qt/icons/cdrom_folder.ico") : QIcon(":/settings/qt/icons/cdrom_image.ico");
|
if (name.isEmpty())
|
||||||
|
menu_icon = QIcon(":/settings/qt/icons/cdrom.ico");
|
||||||
|
else
|
||||||
|
menu_icon = fi.isDir() ? QIcon(":/settings/qt/icons/cdrom_folder.ico") : QIcon(":/settings/qt/icons/cdrom_image.ico");
|
||||||
}
|
}
|
||||||
ejectMenu->setIcon(menu_icon);
|
ejectMenu->setIcon(getIconWithIndicator(menu_icon, pixmap_size, QIcon::Normal, Eject));
|
||||||
ejectMenu->setText(name.isEmpty() ? tr("E&ject") : tr("E&ject %1").arg(menu_item_name));
|
ejectMenu->setText(name.isEmpty() ? tr("E&ject") : tr("E&ject %1").arg(menu_item_name));
|
||||||
|
|
||||||
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++)
|
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++)
|
||||||
@@ -812,6 +878,12 @@ MediaMenu::zipMount(int i, const QString &filename, bool wp)
|
|||||||
zip_drives[i].read_only = wp;
|
zip_drives[i].read_only = wp;
|
||||||
if (!filename.isEmpty()) {
|
if (!filename.isEmpty()) {
|
||||||
QByteArray filenameBytes = filename.toUtf8();
|
QByteArray filenameBytes = filename.toUtf8();
|
||||||
|
|
||||||
|
if (filename.left(5) == "wp://")
|
||||||
|
zip_drives[i].read_only = 1;
|
||||||
|
else if (zip_drives[i].read_only)
|
||||||
|
filenameBytes = QString::asprintf(R"(wp://%s)", filename.toUtf8().data()).toUtf8();
|
||||||
|
|
||||||
zip_load(dev, filenameBytes.data(), 1);
|
zip_load(dev, filenameBytes.data(), 1);
|
||||||
|
|
||||||
/* Signal media change to the emulated machine. */
|
/* Signal media change to the emulated machine. */
|
||||||
@@ -951,6 +1023,12 @@ MediaMenu::moMount(int i, const QString &filename, bool wp)
|
|||||||
mo_drives[i].read_only = wp;
|
mo_drives[i].read_only = wp;
|
||||||
if (!filename.isEmpty()) {
|
if (!filename.isEmpty()) {
|
||||||
QByteArray filenameBytes = filename.toUtf8();
|
QByteArray filenameBytes = filename.toUtf8();
|
||||||
|
|
||||||
|
if (filename.left(5) == "wp://")
|
||||||
|
mo_drives[i].read_only = 1;
|
||||||
|
else if (mo_drives[i].read_only)
|
||||||
|
filenameBytes = QString::asprintf(R"(wp://%s)", filename.toUtf8().data()).toUtf8();
|
||||||
|
|
||||||
mo_load(dev, filenameBytes.data(), 1);
|
mo_load(dev, filenameBytes.data(), 1);
|
||||||
|
|
||||||
/* Signal media change to the emulated machine. */
|
/* Signal media change to the emulated machine. */
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/settings">
|
<qresource prefix="/settings">
|
||||||
|
<file>qt/icons/browse.ico</file>
|
||||||
<file>qt/icons/cartridge.ico</file>
|
<file>qt/icons/cartridge.ico</file>
|
||||||
|
<file>qt/icons/cartridge_image.ico</file>
|
||||||
|
<file>qt/icons/cassette_image.ico</file>
|
||||||
<file>qt/icons/cassette.ico</file>
|
<file>qt/icons/cassette.ico</file>
|
||||||
<file>qt/icons/cdrom.ico</file>
|
<file>qt/icons/cdrom.ico</file>
|
||||||
<file>qt/icons/cdrom_disabled.ico</file>
|
<file>qt/icons/cdrom_disabled.ico</file>
|
||||||
@@ -10,22 +13,35 @@
|
|||||||
<file>qt/icons/cdrom_folder.ico</file>
|
<file>qt/icons/cdrom_folder.ico</file>
|
||||||
<file>qt/icons/cdrom_host.ico</file>
|
<file>qt/icons/cdrom_host.ico</file>
|
||||||
<file>qt/icons/display.ico</file>
|
<file>qt/icons/display.ico</file>
|
||||||
|
<file>qt/icons/eject.ico</file>
|
||||||
|
<file>qt/icons/export.ico</file>
|
||||||
|
<file>qt/icons/fast_forward.ico</file>
|
||||||
<file>qt/icons/floppy_35.ico</file>
|
<file>qt/icons/floppy_35.ico</file>
|
||||||
|
<file>qt/icons/floppy_35_image.ico</file>
|
||||||
<file>qt/icons/floppy_525.ico</file>
|
<file>qt/icons/floppy_525.ico</file>
|
||||||
|
<file>qt/icons/floppy_525_image.ico</file>
|
||||||
<file>qt/icons/floppy_and_cdrom_drives.ico</file>
|
<file>qt/icons/floppy_and_cdrom_drives.ico</file>
|
||||||
<file>qt/icons/floppy_disabled.ico</file>
|
<file>qt/icons/floppy_disabled.ico</file>
|
||||||
<file>qt/icons/hard_disk.ico</file>
|
<file>qt/icons/hard_disk.ico</file>
|
||||||
<file>qt/icons/input_devices.ico</file>
|
<file>qt/icons/input_devices.ico</file>
|
||||||
<file>qt/icons/machine.ico</file>
|
<file>qt/icons/machine.ico</file>
|
||||||
<file>qt/icons/mo.ico</file>
|
<file>qt/icons/mo.ico</file>
|
||||||
|
<file>qt/icons/mo_image.ico</file>
|
||||||
<file>qt/icons/mo_disabled.ico</file>
|
<file>qt/icons/mo_disabled.ico</file>
|
||||||
<file>qt/icons/network.ico</file>
|
<file>qt/icons/network.ico</file>
|
||||||
|
<file>qt/icons/new.ico</file>
|
||||||
<file>qt/icons/other_peripherals.ico</file>
|
<file>qt/icons/other_peripherals.ico</file>
|
||||||
<file>qt/icons/other_removable_devices.ico</file>
|
<file>qt/icons/other_removable_devices.ico</file>
|
||||||
<file>qt/icons/ports.ico</file>
|
<file>qt/icons/ports.ico</file>
|
||||||
|
<file>qt/icons/record.ico</file>
|
||||||
|
<file>qt/icons/rewind.ico</file>
|
||||||
<file>qt/icons/sound.ico</file>
|
<file>qt/icons/sound.ico</file>
|
||||||
<file>qt/icons/storage_controllers.ico</file>
|
<file>qt/icons/storage_controllers.ico</file>
|
||||||
|
<file>qt/icons/superdisk.ico</file>
|
||||||
|
<file>qt/icons/superdisk_image.ico</file>
|
||||||
|
<file>qt/icons/superdisk_disabled.ico</file>
|
||||||
<file>qt/icons/zip.ico</file>
|
<file>qt/icons/zip.ico</file>
|
||||||
|
<file>qt/icons/zip_image.ico</file>
|
||||||
<file>qt/icons/zip_disabled.ico</file>
|
<file>qt/icons/zip_disabled.ico</file>
|
||||||
<file>qt/icons/active.ico</file>
|
<file>qt/icons/active.ico</file>
|
||||||
<file>qt/icons/write_protected.ico</file>
|
<file>qt/icons/write_protected.ico</file>
|
||||||
|
|||||||