ui: load project via MenuBar

This change adds a MenuBar to QtMainWindow and adds an action for opening a different project settings XML file. The
message MessageLoadProject is thereon used to load a new project in the Application and clearing the Storage.
This commit is contained in:
Eberhard Graether
2014-07-09 15:22:41 +02:00
parent 37f5579649
commit 2009b7526a
13 changed files with 156 additions and 27 deletions
+21 -14
View File
@@ -18,6 +18,27 @@ Storage::~Storage()
{
}
void Storage::clear()
{
m_graph.clear();
m_locationCollection.clear();
}
void Storage::logGraph() const
{
std::stringstream str;
str << "\n" << m_graph;
LOG_INFO(str.str());
}
void Storage::logLocations() const
{
std::stringstream str;
str << "\n" << m_locationCollection;
LOG_INFO(str.str());
}
void Storage::onTypedefParsed(
const ParseLocation& location, const std::string& fullName, const std::string& underlyingFullName,
AccessType access
@@ -188,20 +209,6 @@ void Storage::onCallParsed(const ParseLocation& location, const std::string& cal
addTokenLocation(edge, location);
}
void Storage::logGraph() const
{
std::stringstream str;
str << "\n" << m_graph;
LOG_INFO(str.str());
}
void Storage::logLocations() const
{
std::stringstream str;
str << "\n" << m_locationCollection;
LOG_INFO(str.str());
}
Id Storage::getIdForNodeWithName(const std::string& name) const
{
+6 -3
View File
@@ -19,6 +19,12 @@ public:
Storage();
virtual ~Storage();
void clear();
void logGraph() const;
void logLocations() const;
// ParserClient implementation
virtual void onTypedefParsed(
const ParseLocation& location, const std::string& fullName, const std::string& underlyingFullName,
AccessType access
@@ -47,9 +53,6 @@ public:
virtual void onCallParsed(
const ParseLocation& location, const std::string& callerName, const std::string& calleeName);
void logGraph() const;
void logLocations() const;
// GraphAccess implementation
virtual Id getIdForNodeWithName(const std::string& name) const;
virtual std::string getNameForNodeWithId(Id id) const;
+6
View File
@@ -223,6 +223,12 @@ void Graph::forEachToken(std::function<void(Token*)> func) const
forEachEdge(func);
}
void Graph::clear()
{
m_edges.clear();
m_nodes.clear();
}
const std::vector<std::shared_ptr<Node> >& Graph::getNodes() const
{
return m_nodes;
+2
View File
@@ -38,6 +38,8 @@ public:
Node* addNodeAsPlainCopy(Node* node);
Edge* addEdgeAsPlainCopy(Edge* edge);
void clear();
protected:
const std::vector<std::shared_ptr<Node> >& getNodes() const;
const std::vector<std::shared_ptr<Edge> >& getEdges() const;
@@ -129,6 +129,12 @@ TokenLocation* TokenLocationCollection::addTokenLocationAsPlainCopy(const TokenL
return copy;
}
void TokenLocationCollection::clear()
{
m_locations.clear();
m_files.clear();
}
TokenLocationFile* TokenLocationCollection::createTokenLocationFile(const std::string& filePath)
{
TokenLocationFile* file = findTokenLocationFileByPath(filePath);
@@ -43,6 +43,8 @@ public:
TokenLocation* addTokenLocationAsPlainCopy(const TokenLocation* location);
void clear();
private:
TokenLocationFile* createTokenLocationFile(const std::string& filePath);