1
0
Fork 0
mirror of https://github.com/gwm17/Specter.git synced 2024-11-23 02:38:52 -05:00

Added port functionality to source events. Minor bug fixes for path display on FileDialog

This commit is contained in:
Gordon McCann 2022-01-27 17:08:15 -05:00
parent 3573bd5de4
commit 695c647d71
5 changed files with 15 additions and 16 deletions

View File

@ -36,7 +36,7 @@ namespace Navigator {
std::string text = ""; std::string text = "";
if (ImGui::BeginPopupModal(m_openFileName.c_str())) if (ImGui::BeginPopupModal(m_openFileName.c_str()))
{ {
ImGui::Text("Current Directory: %s", m_currentPath.string().c_str()); ImGui::Text("Current Directory: %s", m_currentPath.lexically_normal().string().c_str());
ImGui::SameLine(); ImGui::SameLine();
ImGui::Text("Extension Filter: %s", ext.c_str()); ImGui::Text("Extension Filter: %s", ext.c_str());
ImGui::InputText("Selected", &m_selectedItem); ImGui::InputText("Selected", &m_selectedItem);
@ -60,7 +60,6 @@ namespace Navigator {
{ {
m_selectedItem.clear(); m_selectedItem.clear();
m_currentPath.append(".."); m_currentPath.append("..");
m_currentPath = std::filesystem::absolute(m_currentPath);
} }
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::Text("N/A"); ImGui::Text("N/A");
@ -112,7 +111,7 @@ namespace Navigator {
std::string text = ""; std::string text = "";
if (ImGui::BeginPopupModal(m_saveFileName.c_str())) if (ImGui::BeginPopupModal(m_saveFileName.c_str()))
{ {
ImGui::Text("Current Directory: %s", m_currentPath.string().c_str()); ImGui::Text("Current Directory: %s", m_currentPath.lexically_normal().string().c_str());
ImGui::SameLine(); ImGui::SameLine();
ImGui::Text("Extension Filter: %s", ext.c_str()); ImGui::Text("Extension Filter: %s", ext.c_str());
ImGui::InputText("Selected", &m_selectedItem); ImGui::InputText("Selected", &m_selectedItem);
@ -136,7 +135,6 @@ namespace Navigator {
{ {
m_selectedItem.clear(); m_selectedItem.clear();
m_currentPath.append(".."); m_currentPath.append("..");
m_currentPath = std::filesystem::absolute(m_currentPath);
} }
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::Text("N/A"); ImGui::Text("N/A");
@ -186,7 +184,7 @@ namespace Navigator {
std::string text = ""; std::string text = "";
if (ImGui::BeginPopupModal(m_openDirName.c_str())) if (ImGui::BeginPopupModal(m_openDirName.c_str()))
{ {
ImGui::Text("Current Directory: %s", m_currentPath.string().c_str()); ImGui::Text("Current Directory: %s", m_currentPath.lexically_normal().string().c_str());
ImGui::InputText("Selected", &m_selectedItem); ImGui::InputText("Selected", &m_selectedItem);
if (ImGui::Button("Ok")) if (ImGui::Button("Ok"))
{ {
@ -206,7 +204,6 @@ namespace Navigator {
if (ImGui::Selectable("[DIR] ..", false, select_flags)) if (ImGui::Selectable("[DIR] ..", false, select_flags))
{ {
m_currentPath.append(".."); m_currentPath.append("..");
m_currentPath = std::filesystem::absolute(m_currentPath);
m_selectedItem = m_currentPath.string(); m_selectedItem = m_currentPath.string();
} }
ImGui::TableNextColumn(); ImGui::TableNextColumn();

View File

@ -10,11 +10,12 @@ namespace Navigator {
class NAV_API PhysicsStartEvent : public Event class NAV_API PhysicsStartEvent : public Event
{ {
public: public:
PhysicsStartEvent(const std::string& loc, DataSource::SourceType type, uint64_t window) : PhysicsStartEvent(const std::string& loc, DataSource::SourceType type, uint64_t window, const std::string& port = "51489") :
m_sourceLocation(loc), m_sourceType(type), m_coincidenceWindow(window) m_sourceLocation(loc), m_port(port), m_sourceType(type), m_coincidenceWindow(window)
{} {}
inline std::string GetSourceLocation() { return m_sourceLocation; } inline std::string GetSourceLocation() { return m_sourceLocation; }
inline std::string GetSourcePort() { return m_port; }
inline DataSource::SourceType GetSourceType() { return m_sourceType; } inline DataSource::SourceType GetSourceType() { return m_sourceType; }
inline uint64_t GetCoincidenceWindow() { return m_coincidenceWindow; } inline uint64_t GetCoincidenceWindow() { return m_coincidenceWindow; }
@ -28,6 +29,7 @@ namespace Navigator {
private: private:
std::string m_sourceLocation; std::string m_sourceLocation;
std::string m_port;
DataSource::SourceType m_sourceType; DataSource::SourceType m_sourceType;
uint64_t m_coincidenceWindow; uint64_t m_coincidenceWindow;
}; };

View File

@ -4,12 +4,12 @@
namespace Navigator { namespace Navigator {
DataSource* CreateDataSource(const std::string& loc, DataSource::SourceType type) DataSource* CreateDataSource(const std::string& loc, const std::string& port, DataSource::SourceType type)
{ {
switch(type) switch(type)
{ {
case DataSource::SourceType::CompassOffline : return new CompassRun(loc); case DataSource::SourceType::CompassOffline : return new CompassRun(loc);
case DataSource::SourceType::CompassOnline : return new CompassOnlineSource(loc, "5346"); case DataSource::SourceType::CompassOnline : return new CompassOnlineSource(loc, port);
case DataSource::SourceType::None : return nullptr; case DataSource::SourceType::None : return nullptr;
} }
} }

View File

@ -29,7 +29,7 @@ namespace Navigator {
bool m_validFlag; bool m_validFlag;
}; };
NAV_API DataSource* CreateDataSource(const std::string& loc, DataSource::SourceType type); NAV_API DataSource* CreateDataSource(const std::string& loc, const std::string& port, DataSource::SourceType type);
NAV_API std::string ConvertDataSourceTypeToString(DataSource::SourceType type); NAV_API std::string ConvertDataSourceTypeToString(DataSource::SourceType type);
} }

View File

@ -37,7 +37,7 @@ namespace Navigator {
bool PhysicsLayer::OnPhysicsStartEvent(PhysicsStartEvent& event) bool PhysicsLayer::OnPhysicsStartEvent(PhysicsStartEvent& event)
{ {
m_rawSort.SetCoincidenceWindow(event.GetCoincidenceWindow()); m_rawSort.SetCoincidenceWindow(event.GetCoincidenceWindow());
m_source.reset(CreateDataSource(event.GetSourceLocation(), event.GetSourceType())); m_source.reset(CreateDataSource(event.GetSourceLocation(), event.GetSourcePort(), event.GetSourceType()));
if (m_source->IsValid()) if (m_source->IsValid())
{ {
NAV_INFO("Attach successful. Enabling data pull..."); NAV_INFO("Attach successful. Enabling data pull...");