ui/logic/data: refreshing only source files that have been updated
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.
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#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>();
|
||||
}
|
||||
Reference in New Issue
Block a user