ui: force refresh option in menu for reloading whole project
This commit is contained in:
@@ -143,6 +143,11 @@ void Application::handleMessage(MessageRefresh* message)
|
||||
{
|
||||
m_componentManager->refreshViews();
|
||||
}
|
||||
else if (message->all)
|
||||
{
|
||||
m_project->clearStorage();
|
||||
refreshProject();
|
||||
}
|
||||
else
|
||||
{
|
||||
refreshProject();
|
||||
|
||||
+11
-9
@@ -28,7 +28,7 @@ bool Project::loadProjectSettings(const FilePath& projectSettingsFile)
|
||||
{
|
||||
setProjectSettingsFilePath(projectSettingsFile);
|
||||
|
||||
m_fileManager.reset();
|
||||
m_fileManager.clear();
|
||||
updateFileManager();
|
||||
}
|
||||
return success;
|
||||
@@ -53,14 +53,6 @@ bool Project::saveProjectSettings(const FilePath& projectSettingsFile)
|
||||
return true;
|
||||
}
|
||||
|
||||
void Project::clearProjectSettings()
|
||||
{
|
||||
setProjectSettingsFilePath(FilePath());
|
||||
ProjectSettings::getInstance()->clear();
|
||||
|
||||
m_fileManager.reset();
|
||||
}
|
||||
|
||||
void Project::reloadProjectSettings()
|
||||
{
|
||||
if (!m_projectSettingsFilepath.empty())
|
||||
@@ -70,6 +62,16 @@ void Project::reloadProjectSettings()
|
||||
}
|
||||
}
|
||||
|
||||
void Project::clearStorage()
|
||||
{
|
||||
m_fileManager.clear();
|
||||
|
||||
if (m_storage)
|
||||
{
|
||||
m_storage->clear();
|
||||
}
|
||||
}
|
||||
|
||||
void Project::parseCode()
|
||||
{
|
||||
if (m_projectSettingsFilepath.empty())
|
||||
|
||||
+1
-2
@@ -19,10 +19,9 @@ public:
|
||||
|
||||
bool loadProjectSettings(const FilePath& projectSettingsFile);
|
||||
bool saveProjectSettings(const FilePath& projectSettingsFile);
|
||||
|
||||
void clearProjectSettings();
|
||||
void reloadProjectSettings();
|
||||
|
||||
void clearStorage();
|
||||
void parseCode();
|
||||
|
||||
void logStats() const;
|
||||
|
||||
@@ -123,7 +123,7 @@ void FeatureController::handleMessage(MessageSwitchColorScheme* message)
|
||||
settings->setColorSchemePath(message->colorSchemeFilePath);
|
||||
settings->save();
|
||||
|
||||
MessageRefresh(true).dispatch();
|
||||
MessageRefresh().refreshUiOnly().dispatch();
|
||||
}
|
||||
|
||||
void FeatureController::handleMessage(MessageZoom* message)
|
||||
@@ -132,5 +132,5 @@ void FeatureController::handleMessage(MessageZoom* message)
|
||||
settings->setFontSize(std::max(settings->getFontSize() + (message->zoomIn ? 1 : -1), 5));
|
||||
settings->save();
|
||||
|
||||
MessageRefresh(true).dispatch();
|
||||
MessageRefresh().refreshUiOnly().dispatch();
|
||||
}
|
||||
|
||||
@@ -896,7 +896,7 @@ std::shared_ptr<TokenLocationCollection> Storage::getTokenLocationsForTokenIds(c
|
||||
const StorageSourceLocation& location = locations[i];
|
||||
StorageFile storageFile = m_sqliteStorage.getFileById(location.fileNodeId);
|
||||
|
||||
collection->addTokenLocation(
|
||||
TokenLocation* loc = collection->addTokenLocation(
|
||||
location.id,
|
||||
location.elementId,
|
||||
storageFile.filePath,
|
||||
@@ -904,7 +904,12 @@ std::shared_ptr<TokenLocationCollection> Storage::getTokenLocationsForTokenIds(c
|
||||
location.startCol,
|
||||
location.endLine,
|
||||
location.endCol
|
||||
)->setType(location.isScope ? TokenLocation::LOCATION_SCOPE : TokenLocation::LOCATION_TOKEN);
|
||||
);
|
||||
|
||||
if (loc)
|
||||
{
|
||||
loc->setType(location.isScope ? TokenLocation::LOCATION_SCOPE : TokenLocation::LOCATION_TOKEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ void FileManager::setPaths(
|
||||
m_includeExtensions = includeExtensions;
|
||||
}
|
||||
|
||||
void FileManager::reset()
|
||||
void FileManager::clear()
|
||||
{
|
||||
m_files.clear();
|
||||
m_addedFiles.clear();
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
std::vector<std::string> includeExtensions
|
||||
);
|
||||
|
||||
void reset();
|
||||
void clear();
|
||||
void fetchFilePaths(const std::vector<FileInfo>& oldFileInfos);
|
||||
|
||||
std::set<FilePath> getAddedFilePaths() const;
|
||||
|
||||
@@ -6,8 +6,9 @@
|
||||
class MessageRefresh: public Message<MessageRefresh>
|
||||
{
|
||||
public:
|
||||
MessageRefresh(bool uiOnly = false)
|
||||
: uiOnly(uiOnly)
|
||||
MessageRefresh()
|
||||
: uiOnly(false)
|
||||
, all(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -16,7 +17,20 @@ public:
|
||||
return "MessageRefresh";
|
||||
}
|
||||
|
||||
const bool uiOnly;
|
||||
MessageRefresh& refreshUiOnly()
|
||||
{
|
||||
uiOnly = true;
|
||||
return *this;
|
||||
}
|
||||
|
||||
MessageRefresh& refreshAll()
|
||||
{
|
||||
all = true;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool uiOnly;
|
||||
bool all;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_REFRESH_H
|
||||
|
||||
Reference in New Issue
Block a user