Some cleanup
This commit is contained in:
+1
-1
@@ -95,7 +95,7 @@ void pixelarium::application::AppGLFW::InitMainWindow()
|
|||||||
ImGui_ImplOpenGL3_Init(glsl_version);
|
ImGui_ImplOpenGL3_Init(glsl_version);
|
||||||
}
|
}
|
||||||
|
|
||||||
int pixelarium::application::AppGLFW::RunInternal()
|
int pixelarium::application::AppGLFW::RunLoop()
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
(void)io;
|
(void)io;
|
||||||
|
|||||||
+4
-4
@@ -12,9 +12,9 @@ namespace pixelarium::application
|
|||||||
class AppGLFW
|
class AppGLFW
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit AppGLFW(std::unique_ptr<utils::log::ILog>& log) : logger_(*log) { this->InitMainWindow(); }
|
explicit AppGLFW(const utils::log::ILog& log) : logger_(log) { this->InitMainWindow(); }
|
||||||
|
|
||||||
void Start() { this->RunInternal(); }
|
void Start() { this->RunLoop(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void MenuBarOptionsColumn1() {}
|
virtual void MenuBarOptionsColumn1() {}
|
||||||
@@ -24,10 +24,10 @@ class AppGLFW
|
|||||||
virtual void MenuBarOptionsColumn5() {}
|
virtual void MenuBarOptionsColumn5() {}
|
||||||
virtual void Run() {}
|
virtual void Run() {}
|
||||||
|
|
||||||
utils::log::ILog& logger_;
|
const utils::log::ILog& logger_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int RunInternal();
|
int RunLoop();
|
||||||
void InitMainWindow();
|
void InitMainWindow();
|
||||||
void MenuBar();
|
void MenuBar();
|
||||||
void LogLevelSelect();
|
void LogLevelSelect();
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ enum class LogLevel
|
|||||||
class ILog
|
class ILog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Info(const std::string& msg) = 0;
|
virtual void Info(const std::string& msg) const = 0;
|
||||||
virtual void Debug(const std::string& msg) = 0;
|
virtual void Debug(const std::string& msg) const = 0;
|
||||||
virtual void Warn(const std::string& msg) = 0;
|
virtual void Warn(const std::string& msg) const = 0;
|
||||||
virtual void Error(const std::string& msg) = 0;
|
virtual void Error(const std::string& msg) const = 0;
|
||||||
virtual void ChangeLevel(LogLevel lvl) = 0;
|
virtual void ChangeLevel(LogLevel lvl) const = 0;
|
||||||
|
|
||||||
virtual ~ILog() {}
|
virtual ~ILog() {}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,12 +19,12 @@ SpdLogger::SpdLogger(const std::string& file_sink, const std::string& name)
|
|||||||
logger_->info("Logger initiated");
|
logger_->info("Logger initiated");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpdLogger::Info(const std::string& msg) { this->logger_->info(msg); }
|
void SpdLogger::Info(const std::string& msg) const { this->logger_->info(msg); }
|
||||||
void SpdLogger::Debug(const std::string& msg) { this->logger_->debug(msg); }
|
void SpdLogger::Debug(const std::string& msg) const { this->logger_->debug(msg); }
|
||||||
void SpdLogger::Warn(const std::string& msg) { this->logger_->warn(msg); }
|
void SpdLogger::Warn(const std::string& msg) const { this->logger_->warn(msg); }
|
||||||
void SpdLogger::Error(const std::string& msg) { this->logger_->error(msg); }
|
void SpdLogger::Error(const std::string& msg) const { this->logger_->error(msg); }
|
||||||
|
|
||||||
void SpdLogger::ChangeLevel(LogLevel lvl)
|
void SpdLogger::ChangeLevel(LogLevel lvl) const
|
||||||
{
|
{
|
||||||
constexpr auto LogLevelToString = [](LogLevel l) -> const char*
|
constexpr auto LogLevelToString = [](LogLevel l) -> const char*
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ class SpdLogger : public ILog
|
|||||||
public:
|
public:
|
||||||
explicit SpdLogger(const std::string& file_sink, const std::string& name);
|
explicit SpdLogger(const std::string& file_sink, const std::string& name);
|
||||||
|
|
||||||
void Info(const std::string& msg) override;
|
void Info(const std::string& msg) const override;
|
||||||
void Debug(const std::string& msg) override;
|
void Debug(const std::string& msg) const override;
|
||||||
void Warn(const std::string& msg) override;
|
void Warn(const std::string& msg) const override;
|
||||||
void Error(const std::string& msg) override;
|
void Error(const std::string& msg) const override;
|
||||||
void ChangeLevel(LogLevel lvl) override;
|
void ChangeLevel(LogLevel lvl) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<spdlog::logger> logger_;
|
std::shared_ptr<spdlog::logger> logger_;
|
||||||
|
|||||||
+2
-3
@@ -15,8 +15,8 @@ namespace pixelarium::ui
|
|||||||
class MyApp : public application::AppGLFW
|
class MyApp : public application::AppGLFW
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyApp(std::unique_ptr<utils::log::ILog>& log, std::unique_ptr<pixelarium::resources::ImageResourcePool>& pool)
|
MyApp(const utils::log::ILog& log, pixelarium::resources::ImageResourcePool& pool)
|
||||||
: application::AppGLFW(log), pool_(*pool)
|
: application::AppGLFW(log), pool_(pool)
|
||||||
{
|
{
|
||||||
image_view_model_ = std::make_unique<ImageViewFactory>(pool_);
|
image_view_model_ = std::make_unique<ImageViewFactory>(pool_);
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,6 @@ class MyApp : public application::AppGLFW
|
|||||||
std::unique_ptr<ImageViewFactory> image_view_model_;
|
std::unique_ptr<ImageViewFactory> image_view_model_;
|
||||||
bool imagep_{false};
|
bool imagep_{false};
|
||||||
bool demop_{false};
|
bool demop_{false};
|
||||||
int log_level_{0};
|
|
||||||
ImVec2 curr_dim_;
|
ImVec2 curr_dim_;
|
||||||
};
|
};
|
||||||
} // namespace pixelarium::ui
|
} // namespace pixelarium::ui
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ int main(int argc, char** argv)
|
|||||||
logger->ChangeLevel(utils::log::LogLevel::Debug);
|
logger->ChangeLevel(utils::log::LogLevel::Debug);
|
||||||
auto image_pool{std::make_unique<resources::ImageResourcePool>()};
|
auto image_pool{std::make_unique<resources::ImageResourcePool>()};
|
||||||
|
|
||||||
pixelarium::ui::MyApp app = pixelarium::ui::MyApp(logger, image_pool);
|
pixelarium::ui::MyApp app = pixelarium::ui::MyApp(*logger, *image_pool);
|
||||||
|
|
||||||
app.Start();
|
app.Start();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user