ui: force refresh option in menu for reloading whole project

This commit is contained in:
Eberhard Graether
2015-09-23 16:44:39 +02:00
parent 502909c789
commit bb3a8bf351
11 changed files with 62 additions and 22 deletions
-2
View File
@@ -830,9 +830,7 @@ void QtSmartSearchBox::hideAutoCompletions()
completer()->popup()->hide();
}
// #include "data/query/QueryTree.h"
std::deque<SearchMatch> QtSmartSearchBox::getMatchesForInput(const std::string& text) const
{
// return SearchMatch::stringDequeToSearchMatchDeque(QueryTree::tokenizeQuery(text));
return std::deque<SearchMatch>(1, SearchMatch(text));
}
+16
View File
@@ -6,6 +6,7 @@
#include <QMenuBar>
#include <QMessageBox>
#include <QSettings>
#include <QSysInfo>
#include "component/view/View.h"
#include "component/view/CompositeView.h"
@@ -329,6 +330,11 @@ void QtMainWindow::refresh()
MessageRefresh().dispatch();
}
void QtMainWindow::forceRefresh()
{
MessageRefresh().refreshAll().dispatch();
}
void QtMainWindow::saveProject()
{
MessageSaveProject("").dispatch();
@@ -434,6 +440,16 @@ void QtMainWindow::setupEditMenu()
menu->addSeparator();
menu->addAction(tr("&Refresh"), this, SLOT(refresh()), QKeySequence::Refresh);
if (QSysInfo::windowsVersion() != QSysInfo::WV_None)
{
menu->addAction(tr("&Force Refresh"), this, SLOT(forceRefresh()), QKeySequence(Qt::SHIFT + Qt::Key_F5));
}
else
{
menu->addAction(tr("&Force Refresh"), this, SLOT(forceRefresh()), QKeySequence(Qt::SHIFT + Qt::CTRL + Qt::Key_R));
}
menu->addAction(tr("&Find"), this, SLOT(find()), QKeySequence::Find);
}
+1
View File
@@ -70,6 +70,7 @@ public slots:
void find();
void closeWindow();
void refresh();
void forceRefresh();
void saveProject();
void saveAsProject();
+5
View File
@@ -143,6 +143,11 @@ void Application::handleMessage(MessageRefresh* message)
{
m_componentManager->refreshViews();
}
else if (message->all)
{
m_project->clearStorage();
refreshProject();
}
else
{
refreshProject();
+11 -9
View File
@@ -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
View File
@@ -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();
}
+7 -2
View File
@@ -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);
}
}
}
}
+1 -1
View File
@@ -37,7 +37,7 @@ void FileManager::setPaths(
m_includeExtensions = includeExtensions;
}
void FileManager::reset()
void FileManager::clear()
{
m_files.clear();
m_addedFiles.clear();
+1 -1
View File
@@ -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