logic: Fixed log warnings of color scheme and edge

* fixed warnings for overriden node and edge colors
* fixed warnings for edges connecting the wrong node types
* removed tool tip from color scheme
* changed names in project setup screen
This commit is contained in:
Eberhard Graether
2015-12-16 11:33:59 +01:00
parent a44af51122
commit f06bb0e031
18 changed files with 60 additions and 39 deletions
@@ -315,9 +315,4 @@
</aggregation> </aggregation>
</edge> </edge>
</graph> </graph>
<tool_tip>
<text>black</text>
<background>#E0E0E0</background>
</tool_tip>
</config> </config>
-5
View File
@@ -299,9 +299,4 @@
</aggregation> </aggregation>
</edge> </edge>
</graph> </graph>
<tool_tip>
<text>black</text>
<background>#E0E0E0</background>
</tool_tip>
</config> </config>
-5
View File
@@ -321,9 +321,4 @@
</aggregation> </aggregation>
</edge> </edge>
</graph> </graph>
<tool_tip>
<text>black</text>
<background>#E0E0E0</background>
</tool_tip>
</config> </config>
+2 -2
View File
@@ -132,7 +132,7 @@
} }
QToolTip { QToolTip {
background-color: <color:tool_tip/background>; background-color: #E0E0E0;
color: <color:tool_tip/text>; color: black;
font-size: <setting:font_size>pt; font-size: <setting:font_size>pt;
} }
+2 -2
View File
@@ -3,7 +3,7 @@ QGraphicsView, QGraphicsScene {
} }
QToolTip { QToolTip {
background-color: <color:tool_tip/background>; background-color: #E0E0E0;
color: <color:tool_tip/text>; color: black;
font-size: <setting:font_size>pt; font-size: <setting:font_size>pt;
} }
@@ -29,7 +29,7 @@ QPushButton:pressed {
} }
QToolTip { QToolTip {
background-color: <color:tool_tip/background>; background-color: #E0E0E0;
color: <color:tool_tip/text>; color: black;
font-size: <setting:font_size>pt; font-size: <setting:font_size>pt;
} }
+2 -2
View File
@@ -59,7 +59,7 @@ QPushButton#search_button {
} }
QToolTip { QToolTip {
background-color: <color:tool_tip/background>; background-color: #E0E0E0;
color: <color:tool_tip/text>; color: black;
font-size: <setting:font_size>pt; font-size: <setting:font_size>pt;
} }
@@ -75,3 +75,9 @@ QLineEdit:disabled {
color: white; color: white;
background: #2D3F85; background: #2D3F85;
} }
QToolTip {
background-color: #E0E0E0;
color: black;
font-size: <setting:font_size>pt;
}
@@ -27,9 +27,3 @@
font-size: 16pt; font-size: 16pt;
font-weight: bold; font-weight: bold;
} }
QToolTip {
background-color: <color:tool_tip/background>;
color: <color:tool_tip/text>;
font-size: <setting:font_size>pt;
}
@@ -34,7 +34,7 @@ QPushButton:pressed {
} }
QToolTip { QToolTip {
background-color: <color:tool_tip/background>; background-color: #E0E0E0;
color: <color:tool_tip/text>; color: black;
font-size: <setting:font_size>pt; font-size: <setting:font_size>pt;
} }
+1 -1
View File
@@ -243,7 +243,7 @@ std::ostream& operator<<(std::ostream& ostream, const Edge& edge)
bool Edge::checkType() const // TODO: remove this function bool Edge::checkType() const // TODO: remove this function
{ {
Node::NodeTypeMask complexTypeMask = Node::NODE_CLASS | Node::NODE_STRUCT | Node:: NODE_TEMPLATE_PARAMETER_TYPE; Node::NodeTypeMask complexTypeMask = Node::NODE_CLASS | Node::NODE_STRUCT | Node:: NODE_TEMPLATE_PARAMETER_TYPE;
Node::NodeTypeMask typeMask = Node::NODE_ENUM | Node::NODE_TYPEDEF | complexTypeMask; Node::NodeTypeMask typeMask = Node::NODE_UNDEFINED | Node::NODE_TYPE | Node::NODE_ENUM | Node::NODE_TYPEDEF | complexTypeMask;
Node::NodeTypeMask variableMask = Node::NODE_GLOBAL_VARIABLE | Node::NODE_FIELD; Node::NodeTypeMask variableMask = Node::NODE_GLOBAL_VARIABLE | Node::NODE_FIELD;
Node::NodeTypeMask functionMask = Node::NODE_FUNCTION | Node::NODE_METHOD; Node::NodeTypeMask functionMask = Node::NODE_FUNCTION | Node::NODE_METHOD;
+8
View File
@@ -28,6 +28,8 @@ std::string ColorScheme::getNodeTypeColor(Node::NodeType type, const std::string
std::string ColorScheme::getNodeTypeColor(const std::string& typeStr, const std::string& key, ColorState state) const std::string ColorScheme::getNodeTypeColor(const std::string& typeStr, const std::string& key, ColorState state) const
{ {
disableWarnings();
std::string type = getValue<std::string>("graph/node/" + typeStr + "/like", typeStr); std::string type = getValue<std::string>("graph/node/" + typeStr + "/like", typeStr);
std::string color = getValue<std::string>("graph/node/" + type + "/" + key + "/" + stateToString(state), ""); std::string color = getValue<std::string>("graph/node/" + type + "/" + key + "/" + stateToString(state), "");
@@ -41,6 +43,8 @@ std::string ColorScheme::getNodeTypeColor(const std::string& typeStr, const std:
color = getValue<std::string>("graph/node/default/" + key + "/" + stateToString(state), ""); color = getValue<std::string>("graph/node/default/" + key + "/" + stateToString(state), "");
} }
enableWarnings();
if (!color.size() && state != NORMAL) if (!color.size() && state != NORMAL)
{ {
color = getValue<std::string>("graph/node/default/" + key + "/" + stateToString(NORMAL), "#FFFFFF"); color = getValue<std::string>("graph/node/default/" + key + "/" + stateToString(NORMAL), "#FFFFFF");
@@ -56,6 +60,8 @@ std::string ColorScheme::getEdgeTypeColor(Edge::EdgeType type, ColorState state)
std::string ColorScheme::getEdgeTypeColor(const std::string& typeStr, ColorState state) const std::string ColorScheme::getEdgeTypeColor(const std::string& typeStr, ColorState state) const
{ {
disableWarnings();
std::string type = getValue<std::string>("graph/edge/" + typeStr + "/like", typeStr); std::string type = getValue<std::string>("graph/edge/" + typeStr + "/like", typeStr);
std::string color = getValue<std::string>("graph/edge/" + type + "/" + stateToString(state), ""); std::string color = getValue<std::string>("graph/edge/" + type + "/" + stateToString(state), "");
@@ -69,6 +75,8 @@ std::string ColorScheme::getEdgeTypeColor(const std::string& typeStr, ColorState
color = getValue<std::string>("graph/edge/default/" + stateToString(state), ""); color = getValue<std::string>("graph/edge/default/" + stateToString(state), "");
} }
enableWarnings();
if (!color.size() && state != NORMAL) if (!color.size() && state != NORMAL)
{ {
color = getValue<std::string>("graph/edge/default/" + stateToString(NORMAL), "#FFFFFF"); color = getValue<std::string>("graph/edge/default/" + stateToString(NORMAL), "#FFFFFF");
+1
View File
@@ -14,6 +14,7 @@ std::vector<std::string> ProjectSettings::getDefaultSourceExtensions()
defaultValues.push_back(".cpp"); defaultValues.push_back(".cpp");
defaultValues.push_back(".cxx"); defaultValues.push_back(".cxx");
defaultValues.push_back(".cc"); defaultValues.push_back(".cc");
defaultValues.push_back(".c");
return defaultValues; return defaultValues;
} }
+10
View File
@@ -136,3 +136,13 @@ bool Settings::moveRelativePathValues(const std::string& key, const FilePath& fi
return setValues(key, values); return setValues(key, values);
} }
void Settings::enableWarnings() const
{
m_config->setWarnOnEmptyKey(true);
}
void Settings::disableWarnings() const
{
m_config->setWarnOnEmptyKey(false);
}
+3
View File
@@ -43,6 +43,9 @@ protected:
bool setPathValues(const std::string& key, const std::vector<FilePath>& paths); bool setPathValues(const std::string& key, const std::vector<FilePath>& paths);
bool moveRelativePathValues(const std::string& key, const FilePath& filePath); bool moveRelativePathValues(const std::string& key, const FilePath& filePath);
void enableWarnings() const;
void disableWarnings() const;
private: private:
FilePath m_filePath; FilePath m_filePath;
std::shared_ptr<ConfigManager> m_config; std::shared_ptr<ConfigManager> m_config;
+13 -2
View File
@@ -34,7 +34,10 @@ bool ConfigManager::getValue(const std::string& key, std::string& value) const
} }
else else
{ {
LOG_WARNING("value " + key + " is not present in config."); if (m_warnOnEmptyKey)
{
LOG_WARNING("value " + key + " is not present in config.");
}
return false; return false;
} }
} }
@@ -89,7 +92,10 @@ bool ConfigManager::getValues(const std::string& key, std::vector<std::string>&
} }
else else
{ {
LOG_WARNING("value " + key + " is not present in config."); if (m_warnOnEmptyKey)
{
LOG_WARNING("value " + key + " is not present in config.");
}
return false; return false;
} }
} }
@@ -236,6 +242,11 @@ void ConfigManager::save(const std::string filepath)
createXmlDocument(true, filepath, output); createXmlDocument(true, filepath, output);
} }
void ConfigManager::setWarnOnEmptyKey(bool warnOnEmptyKey) const
{
m_warnOnEmptyKey = warnOnEmptyKey;
}
ConfigManager::ConfigManager() ConfigManager::ConfigManager()
{ {
} }
+3
View File
@@ -41,6 +41,8 @@ public:
void save(const std::string filepath); void save(const std::string filepath);
std::string toString(); std::string toString();
void setWarnOnEmptyKey(bool warnOnEmptyKey) const;
private: private:
ConfigManager(); ConfigManager();
ConfigManager(const ConfigManager&); ConfigManager(const ConfigManager&);
@@ -50,6 +52,7 @@ private:
bool createXmlDocument(bool saveAsFile, std::string filepath, std::string& output); bool createXmlDocument(bool saveAsFile, std::string filepath, std::string& output);
std::multimap<std::string, std::string> m_values; std::multimap<std::string, std::string> m_values;
mutable bool m_warnOnEmptyKey;
}; };
#endif // CONFIG_MANAGER_H #endif // CONFIG_MANAGER_H
@@ -182,7 +182,7 @@ void QtProjectSetupScreen::populateForm(QFormLayout* layout)
QPushButton* helpButton; QPushButton* helpButton;
QWidget* sourcePathsWidget = createLabelWithHelpButton("Source Paths", &helpButton); QWidget* sourcePathsWidget = createLabelWithHelpButton("Analyzed Paths", &helpButton);
connect(helpButton, SIGNAL(clicked()), this, SLOT(handleSourcePathHelpPress())); connect(helpButton, SIGNAL(clicked()), this, SLOT(handleSourcePathHelpPress()));
m_sourcePaths = new QtDirectoryListBox(this); m_sourcePaths = new QtDirectoryListBox(this);
m_sourcePaths->setMinimumWidth(minimumWidthForSecondCol); m_sourcePaths->setMinimumWidth(minimumWidthForSecondCol);
@@ -280,8 +280,8 @@ void QtProjectSetupScreen::handleUpdateButtonPress()
void QtProjectSetupScreen::handleSourcePathHelpPress() void QtProjectSetupScreen::handleSourcePathHelpPress()
{ {
showHelpMessage( showHelpMessage(
"Source Paths define the files and directories that will be analysed by Coati. Usually these are the source " "Analyzed Paths define the source files and directories that will be analysed by Coati. Usually these are the source "
"files of your project or a subset of them." "and header files of your project or a subset of them."
); );
} }