src: Various fixes from testing

* fixed deleted project could still be selected in the recent project menu
* fixed project file not loaded when declining for reload
* fixed main in tutorial description not clickable
* fixed clang warnings
* fixed commands not showing up in autocompletion
* fixed classes were expanded when activating aggregation
* fixed crash when messagelisteners tried to unregister after messagequeue was destructed
This commit is contained in:
Eberhard Graether
2016-04-25 17:27:20 +02:00
parent e17c42b2ef
commit f9aed67776
12 changed files with 32 additions and 18 deletions
+4 -2
View File
@@ -107,7 +107,6 @@ void Application::createAndLoadProject(const FilePath& projectSettingsFilePath)
if (m_hasGUI)
{
m_mainView->setTitle("Coati - " + projectSettingsFilePath.fileName());
m_mainView->updateRecentProjectMenu();
m_mainView->hideStartScreen();
m_componentManager->refreshViews();
@@ -227,6 +226,7 @@ void Application::handleMessage(MessageLoadProject* message)
if (result == 1)
{
m_project->load(projectSettingsFilePath);
return;
}
}
@@ -296,12 +296,14 @@ void Application::updateRecentProjects(const FilePath& projectSettingsFilePath)
}
recentProjects.insert(recentProjects.begin(), projectSettingsFilePath);
if (recentProjects.size() > 7)
while (recentProjects.size() > 7)
{
recentProjects.pop_back();
}
appSettings->setRecentProjects(recentProjects);
appSettings->save(UserPaths::getAppSettingsPath());
m_mainView->updateRecentProjectMenu();
}
}
+1 -1
View File
@@ -35,7 +35,7 @@ Project::ProjectState Project::load(const FilePath& projectSettingsFile)
m_state = PROJECT_NONE;
bool success = true;
if (!projectSettingsFile.empty() && projectSettingsFile != m_projectSettingsFilepath)
if (!projectSettingsFile.empty())
{
success = ProjectSettings::getInstance()->load(projectSettingsFile);
}
@@ -606,7 +606,7 @@ std::vector<std::string> CodeController::getProjectDescription(TokenLocationFile
// todo fixme: this split currently prevents the next step from recognizing multi level name hierarchies.
std::vector<std::string> lines = utility::splitToVector(description, "\\n");
size_t startLineNumber = 4;
size_t startLineNumber = 2;
for (size_t i = 0; i < lines.size(); i++)
{
@@ -358,6 +358,7 @@ void GraphController::setActiveAndVisibility(const std::vector<Id>& activeTokenI
if (find(activeTokenIds.begin(), activeTokenIds.end(), edge.data->getId()) != activeTokenIds.end())
{
edge.active = true;
noActive = false;
}
DummyNode* from = findDummyNodeRecursive(m_dummyNodes, edge.ownerId);
+1
View File
@@ -16,4 +16,5 @@ DefinitionType intToDefinitionType(int definitionType)
case 2:
return DEFINITION_EXPLICIT;
}
return DEFINITION_NONE;
}
+3 -9
View File
@@ -27,6 +27,9 @@
Storage::Storage(const FilePath& dbPath)
: m_sqliteStorage(dbPath)
{
m_commandIndex.addNode(0, NameHierarchy(SearchMatch::getCommandName(SearchMatch::COMMAND_ALL)));
m_commandIndex.addNode(0, NameHierarchy(SearchMatch::getCommandName(SearchMatch::COMMAND_ERROR)));
m_commandIndex.finishSetup();
}
Storage::~Storage()
@@ -45,10 +48,6 @@ Version Storage::getVersion() const
void Storage::init()
{
m_commandIndex.addNode(0, NameHierarchy(SearchMatch::getCommandName(SearchMatch::COMMAND_ALL)));
m_commandIndex.addNode(0, NameHierarchy(SearchMatch::getCommandName(SearchMatch::COMMAND_ERROR)));
m_commandIndex.finishSetup();
m_sqliteStorage.init();
}
@@ -288,11 +287,6 @@ std::vector<SearchMatch> Storage::getAutocompletionMatches(const std::string& qu
std::vector<SearchMatch> matches;
for (const SearchResult& result : results)
{
if (result.elementIds.size() == 0)
{
continue;
}
SearchMatch match;
const StorageNode* firstNode = nullptr;
+1
View File
@@ -24,4 +24,5 @@ LocationType intToLocationType(int value)
case 2:
return LOCATION_LOCAL_SYMBOL;
}
return LOCATION_TOKEN;
}
+2
View File
@@ -389,6 +389,8 @@ Node::NodeType ParserClientImpl::symbolTypeToNodeType(SymbolType symbolType) con
return Node::NODE_TEMPLATE_PARAMETER_TYPE;
case SYMBOL_UNION:
return Node::NODE_TYPE;
default:
break;
}
return Node::NODE_UNDEFINED;
}
@@ -19,8 +19,11 @@ public:
virtual ~MessageListenerBase()
{
if (m_alive)
{
MessageQueue::getInstance()->unregisterListener(this);
}
m_alive = false;
MessageQueue::getInstance()->unregisterListener(this);
}
uint getId() const
@@ -45,6 +48,11 @@ public:
}
}
void removedListener()
{
m_alive = false;
}
private:
virtual std::string doGetType() const = 0;
virtual void doHandleMessageBase(MessageBase*) = 0;
+6 -1
View File
@@ -20,7 +20,12 @@ std::shared_ptr<MessageQueue> MessageQueue::getInstance()
MessageQueue::~MessageQueue()
{
// TODO: remove remaining listeners. And tell them that they shouldn't unregister anymore.
std::lock_guard<std::mutex> lock(m_listenersMutex);
for (size_t i = 0; i < m_listeners.size(); i++)
{
m_listeners[i]->removedListener();
}
m_listeners.clear();
}
void MessageQueue::registerListener(MessageListenerBase* listener)
+1 -1
View File
@@ -559,7 +559,7 @@ void QtMainWindow::updateRecentProjectMenu()
std::vector<FilePath> recentProjects = ApplicationSettings::getInstance()->getRecentProjects();
for (int i = 0; i < ApplicationSettings::getInstance()->getMaxRecentProjectsCount(); i++)
{
if ((size_t)i < recentProjects.size())
if ((size_t)i < recentProjects.size() && recentProjects[i].exists())
{
FilePath project = recentProjects[i];
m_recentProjectAction[i]->setVisible(true);
@@ -528,8 +528,8 @@ void QtProjectWizzard::showSummary()
summary->addContent(source, false, true);
connectShowFiles(source);
summary->addContent(new QtProjectWizzardContentSimple(settings, window), false, true);
summary->addContent(new QtProjectWizzardContentPathsHeaderSearch(settings, window), false, false);
summary->addContent(new QtProjectWizzardContentPathsHeaderSearch(settings, window), false, true);
summary->addContent(new QtProjectWizzardContentSimple(settings, window), false, false);
summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(settings, window), false, false);
if (QSysInfo::macVersion() != QSysInfo::MV_None)