openMSX
ImGuiMachine.hh
Go to the documentation of this file.
1#ifndef IMGUI_MACHINE_HH
2#define IMGUI_MACHINE_HH
3
4#include "ImGuiPart.hh"
5
6#include "circular_buffer.hh"
7
8#include <string>
9#include <vector>
10
11namespace openmsx {
12
13class ImGuiMachine final : public ImGuiPart
14{
15public:
16 struct MachineInfo {
17 std::string configName;
18 std::string displayName;
19 std::vector<std::pair<std::string, std::string>> configInfo;
20 std::optional<std::string> testResult; // lazily initialized
21 };
22
23public:
25
26 [[nodiscard]] zstring_view iniName() const override { return "machine"; }
27 void save(ImGuiTextBuffer& buf) override;
28 void loadLine(std::string_view name, zstring_view value) override;
29 void showMenu(MSXMotherBoard* motherBoard) override;
30 void paint(MSXMotherBoard* motherBoard) override;
31
32private:
33 void paintSelectMachine(const MSXMotherBoard* motherBoard);
34 void paintTestHardware();
35 [[nodiscard]] std::vector<MachineInfo>& getAllMachines();
36 [[nodiscard]] MachineInfo* findMachineInfo(std::string_view config);
37 [[nodiscard]] const std::string& getTestResult(MachineInfo& info);
38 bool printConfigInfo(MachineInfo& info);
39
40public:
41 bool showSelectMachine = false;
42 bool showTestHardware = false;
43
44private:
45 std::vector<MachineInfo> machineInfo; // sorted on displayName
46 std::string newMachineConfig;
47 std::string filterType;
48 std::string filterRegion;
49 std::string filterString;
50
51 static constexpr size_t HISTORY_SIZE = 8;
52 circular_buffer<std::string> recentMachines{HISTORY_SIZE};
53
54};
55
56} // namespace openmsx
57
58#endif
Circular buffer class, based on boost::circular_buffer/.
zstring_view iniName() const override
void loadLine(std::string_view name, zstring_view value) override
void showMenu(MSXMotherBoard *motherBoard) override
void save(ImGuiTextBuffer &buf) override
void paint(MSXMotherBoard *motherBoard) override
ImGuiPart(ImGuiManager &manager_)
Definition ImGuiPart.hh:12
Like std::string_view, but with the extra guarantee that it refers to a zero-terminated string.
This file implemented 3 utility functions:
Definition Autofire.cc:11
std::vector< std::pair< std::string, std::string > > configInfo
std::optional< std::string > testResult