40 bool isDirectory =
false;
41 bool isSelected =
false;
44 struct ChangeDir { std::string_view name; };
45 struct Delete { std::string_view name; };
46 struct Rename { std::string_view name; };
47 using Action = std::variant<Nop, ChangeDir, Delete, Rename>;
49 struct DrivePartitionTar {
51 std::unique_ptr<DiskPartition> disk;
52 std::unique_ptr<MSXtar> tar;
54 [[nodiscard]] DiskContainer* getDrive();
55 [[nodiscard]] std::optional<DiskManipulator::DriveAndPartition> getDriveAndDisk();
56 [[nodiscard]] std::optional<DrivePartitionTar> getMsxStuff();
58 [[nodiscard]]
bool isValidMsxDirectory(DrivePartitionTar& stuff,
const std::string& dir)
const;
59 [[nodiscard]] std::string getDiskImageName();
60 [[nodiscard]] std::vector<FileInfo> dirMSX(DrivePartitionTar& stuff);
61 void refreshMsx(DrivePartitionTar& stuff);
63 void checkSort(std::vector<FileInfo>& files,
bool& forceSort)
const;
64 [[nodiscard]] Action drawTable(std::vector<FileInfo>& files,
int& lastClickIdx,
bool& forceSort,
bool drawAttrib)
const;
66 void exportDiskImage();
67 void msxParentDirectory();
68 void hostParentDirectory();
71 [[nodiscard]]
bool setupTransferHostToMsx(DrivePartitionTar& stuff);
72 void executeTransferHostToMsx(DrivePartitionTar& stuff);
73 void transferMsxToHost(DrivePartitionTar& stuff);
76 struct PartitionSize {
78 enum Unit :
int { KB, MB };
81 [[nodiscard]]
unsigned asSectorCount()
const {
82 return count * (((unit == KB) ? 1024 : (1024 * 1024)) / SectorAccessibleDisk::SECTOR_SIZE);
86 std::vector<FileInfo> msxFileCache;
87 std::vector<FileInfo> hostFileCache;
88 std::string selectedDrive =
"virtual_drive";
89 std::string msxDir =
"/", editMsxDir =
"/";
90 std::string hostDir, editHostDir;
91 std::string editModal;
92 std::string renameFrom;
93 int msxLastClick = -1;
94 int hostLastClick = -1;
95 bool hostNeedRefresh =
true;
96 bool hostForceSort =
false;
98 enum TransferHostToMsxPhase {
103 } transferHostToMsxPhase = IDLE;
104 std::vector<FileInfo> existingFiles;
105 std::vector<FileInfo> existingDirs;
106 std::map<std::string, std::vector<FileInfo>, std::less<>> duplicateEntries;
108 enum NewDiskType :
int { UNPARTITIONED = 0, PARTITIONED = 1 };
109 int newDiskType = UNPARTITIONED;
111 PartitionSize unpartitionedSize = {720, PartitionSize::KB};
112 std::vector<PartitionSize> partitionSizes;