1
0
Fork 0
mirror of https://github.com/gwm17/Specter.git synced 2024-11-26 12:18:51 -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 = "";
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::Text("Extension Filter: %s", ext.c_str());
ImGui::InputText("Selected", &m_selectedItem);
@ -60,7 +60,6 @@ namespace Navigator {
{
m_selectedItem.clear();
m_currentPath.append("..");
m_currentPath = std::filesystem::absolute(m_currentPath);
}
ImGui::TableNextColumn();
ImGui::Text("N/A");
@ -112,7 +111,7 @@ namespace Navigator {
std::string text = "";
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::Text("Extension Filter: %s", ext.c_str());
ImGui::InputText("Selected", &m_selectedItem);
@ -136,7 +135,6 @@ namespace Navigator {
{
m_selectedItem.clear();
m_currentPath.append("..");
m_currentPath = std::filesystem::absolute(m_currentPath);
}
ImGui::TableNextColumn();
ImGui::Text("N/A");
@ -186,7 +184,7 @@ namespace Navigator {
std::string text = "";
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);
if (ImGui::Button("Ok"))
{
@ -206,7 +204,6 @@ namespace Navigator {
if (ImGui::Selectable("[DIR] ..", false, select_flags))
{
m_currentPath.append("..");
m_currentPath = std::filesystem::absolute(m_currentPath);
m_selectedItem = m_currentPath.string();
}
ImGui::TableNextColumn();

View File

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

View File

@ -4,12 +4,12 @@
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)
{
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;
}
}

View File

@ -29,7 +29,7 @@ namespace Navigator {
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);
}

View File

@ -37,7 +37,7 @@ namespace Navigator {
bool PhysicsLayer::OnPhysicsStartEvent(PhysicsStartEvent& event)
{
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())
{
NAV_INFO("Attach successful. Enabling data pull...");