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>
</edge>
</graph>
<tool_tip>
<text>black</text>
<background>#E0E0E0</background>
</tool_tip>
</config>
-5
View File
@@ -299,9 +299,4 @@
</aggregation>
</edge>
</graph>
<tool_tip>
<text>black</text>
<background>#E0E0E0</background>
</tool_tip>
</config>
-5
View File
@@ -321,9 +321,4 @@
</aggregation>
</edge>
</graph>
<tool_tip>
<text>black</text>
<background>#E0E0E0</background>
</tool_tip>
</config>
+2 -2
View File
@@ -132,7 +132,7 @@
}
QToolTip {
background-color: <color:tool_tip/background>;
color: <color:tool_tip/text>;
background-color: #E0E0E0;
color: black;
font-size: <setting:font_size>pt;
}
+2 -2
View File
@@ -3,7 +3,7 @@ QGraphicsView, QGraphicsScene {
}
QToolTip {
background-color: <color:tool_tip/background>;
color: <color:tool_tip/text>;
background-color: #E0E0E0;
color: black;
font-size: <setting:font_size>pt;
}
@@ -29,7 +29,7 @@ QPushButton:pressed {
}
QToolTip {
background-color: <color:tool_tip/background>;
color: <color:tool_tip/text>;
background-color: #E0E0E0;
color: black;
font-size: <setting:font_size>pt;
}
+2 -2
View File
@@ -59,7 +59,7 @@ QPushButton#search_button {
}
QToolTip {
background-color: <color:tool_tip/background>;
color: <color:tool_tip/text>;
background-color: #E0E0E0;
color: black;
font-size: <setting:font_size>pt;
}
@@ -75,3 +75,9 @@ QLineEdit:disabled {
color: white;
background: #2D3F85;
}
QToolTip {
background-color: #E0E0E0;
color: black;
font-size: <setting:font_size>pt;
}
@@ -27,9 +27,3 @@
font-size: 16pt;
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 {
background-color: <color:tool_tip/background>;
color: <color:tool_tip/text>;
background-color: #E0E0E0;
color: black;
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
{
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 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
{
disableWarnings();
std::string type = getValue<std::string>("graph/node/" + typeStr + "/like", typeStr);
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), "");
}
enableWarnings();
if (!color.size() && state != NORMAL)
{
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
{
disableWarnings();
std::string type = getValue<std::string>("graph/edge/" + typeStr + "/like", typeStr);
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), "");
}
enableWarnings();
if (!color.size() && state != NORMAL)
{
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(".cxx");
defaultValues.push_back(".cc");
defaultValues.push_back(".c");
return defaultValues;
}
+10
View File
@@ -136,3 +136,13 @@ bool Settings::moveRelativePathValues(const std::string& key, const FilePath& fi
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 moveRelativePathValues(const std::string& key, const FilePath& filePath);
void enableWarnings() const;
void disableWarnings() const;
private:
FilePath m_filePath;
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
{
LOG_WARNING("value " + key + " is not present in config.");
if (m_warnOnEmptyKey)
{
LOG_WARNING("value " + key + " is not present in config.");
}
return false;
}
}
@@ -89,7 +92,10 @@ bool ConfigManager::getValues(const std::string& key, std::vector<std::string>&
}
else
{
LOG_WARNING("value " + key + " is not present in config.");
if (m_warnOnEmptyKey)
{
LOG_WARNING("value " + key + " is not present in config.");
}
return false;
}
}
@@ -236,6 +242,11 @@ void ConfigManager::save(const std::string filepath)
createXmlDocument(true, filepath, output);
}
void ConfigManager::setWarnOnEmptyKey(bool warnOnEmptyKey) const
{
m_warnOnEmptyKey = warnOnEmptyKey;
}
ConfigManager::ConfigManager()
{
}
+3
View File
@@ -41,6 +41,8 @@ public:
void save(const std::string filepath);
std::string toString();
void setWarnOnEmptyKey(bool warnOnEmptyKey) const;
private:
ConfigManager();
ConfigManager(const ConfigManager&);
@@ -50,6 +52,7 @@ private:
bool createXmlDocument(bool saveAsFile, std::string filepath, std::string& output);
std::multimap<std::string, std::string> m_values;
mutable bool m_warnOnEmptyKey;
};
#endif // CONFIG_MANAGER_H
@@ -182,7 +182,7 @@ void QtProjectSetupScreen::populateForm(QFormLayout* layout)
QPushButton* helpButton;
QWidget* sourcePathsWidget = createLabelWithHelpButton("Source Paths", &helpButton);
QWidget* sourcePathsWidget = createLabelWithHelpButton("Analyzed Paths", &helpButton);
connect(helpButton, SIGNAL(clicked()), this, SLOT(handleSourcePathHelpPress()));
m_sourcePaths = new QtDirectoryListBox(this);
m_sourcePaths->setMinimumWidth(minimumWidthForSecondCol);
@@ -261,7 +261,7 @@ void QtProjectSetupScreen::handleUpdateButtonPress()
projSettings->save(projectFile);
projSettings->setLanguage(m_language->currentText().toStdString());
if (m_cppStandard->isVisible())
{
projSettings->setStandard(m_cppStandard->currentText().toStdString());
@@ -280,8 +280,8 @@ void QtProjectSetupScreen::handleUpdateButtonPress()
void QtProjectSetupScreen::handleSourcePathHelpPress()
{
showHelpMessage(
"Source Paths define the files and directories that will be analysed by Coati. Usually these are the source "
"files of your project or a subset of them."
"Analyzed Paths define the source files and directories that will be analysed by Coati. Usually these are the source "
"and header files of your project or a subset of them."
);
}
@@ -307,7 +307,7 @@ void QtProjectSetupScreen::handlePreferencesButtonPress()
{
emit showPreferences();
}
void QtProjectSetupScreen::handleSelectionChanged(int index)
{
if (index != 0)