This change adds the refresh component that allows for refreshing the source code via UI or shortcut. If automatic refreshing is activated via the UI, the code is refreshed anytime the window gets focus. The contents of all the updated source files get removed from Storage, before reparsing them. File dependencies are not respected yet.
36 lines
656 B
C++
36 lines
656 B
C++
#include "component/controller/RefreshController.h"
|
|
|
|
#include "component/view/RefreshView.h"
|
|
|
|
RefreshController::RefreshController()
|
|
: m_autoRefreshEnabled(false)
|
|
{
|
|
}
|
|
|
|
RefreshController::~RefreshController()
|
|
{
|
|
}
|
|
|
|
void RefreshController::handleMessage(MessageAutoRefreshChanged* message)
|
|
{
|
|
m_autoRefreshEnabled = message->enabled;
|
|
}
|
|
|
|
void RefreshController::handleMessage(MessageRefresh* message)
|
|
{
|
|
getView()->refreshView();
|
|
}
|
|
|
|
void RefreshController::handleMessage(MessageWindowFocus* message)
|
|
{
|
|
if (m_autoRefreshEnabled)
|
|
{
|
|
MessageRefresh().dispatch();
|
|
}
|
|
}
|
|
|
|
RefreshView* RefreshController::getView()
|
|
{
|
|
return Controller::getView<RefreshView>();
|
|
}
|