Make LogLevel values Pascal-case
See https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Renum-capsmaster
parent
53e9e64215
commit
1ac4fed264
|
@ -64,7 +64,7 @@ QColor MakeColors::processImage(const QString &path)
|
||||||
}
|
}
|
||||||
if(counter == 0)
|
if(counter == 0)
|
||||||
{
|
{
|
||||||
output("could not generate color of " +path +" too much transparency", WARNING);
|
output("could not generate color of " +path +" too much transparency", Warning);
|
||||||
color = QColor();//invalid color
|
color = QColor();//invalid color
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -76,7 +76,7 @@ QColor MakeColors::processImage(const QString &path)
|
||||||
|
|
||||||
bool MakeColors::parseNodesTxt(const QString &nodesTxt)
|
bool MakeColors::parseNodesTxt(const QString &nodesTxt)
|
||||||
{
|
{
|
||||||
output("Parsing "+nodesTxt, INFO);
|
output("Parsing "+nodesTxt, Info);
|
||||||
QFile inputFile(nodesTxt);
|
QFile inputFile(nodesTxt);
|
||||||
if (inputFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
if (inputFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
|
@ -105,7 +105,7 @@ bool MakeColors::parseNodesTxt(const QString &nodesTxt)
|
||||||
numberOfNodes = requiredColors.size();
|
numberOfNodes = requiredColors.size();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
output("Could not open "+nodesTxt+" for reading!", ERROR);
|
output("Could not open "+nodesTxt+" for reading!", Error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -118,7 +118,7 @@ bool MakeColors::searchAndProgressTextures(const QString &path)
|
||||||
const QString textureFilePath = it.next();
|
const QString textureFilePath = it.next();
|
||||||
const QString textureFileName = it.fileName();
|
const QString textureFileName = it.fileName();
|
||||||
if(requiredColors.contains(textureFileName)){
|
if(requiredColors.contains(textureFileName)){
|
||||||
output("Processing "+textureFileName, VERBOSE);
|
output("Processing "+textureFileName, Verbose);
|
||||||
const QColor color = processImage(textureFilePath);
|
const QColor color = processImage(textureFilePath);
|
||||||
|
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ bool MakeColors::searchAndProgressTextures(const QString &path)
|
||||||
emit progressChanged(++numberOfColors);
|
emit progressChanged(++numberOfColors);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
output("Not required: "+textureFileName, VERBOSE);
|
output("Not required: "+textureFileName, Verbose);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -157,7 +157,7 @@ void MakeColors::setFileNodesTxt(const QString &value)
|
||||||
bool MakeColors::writeColorsTxt(const QString &file)
|
bool MakeColors::writeColorsTxt(const QString &file)
|
||||||
{
|
{
|
||||||
QFile outputFile(file);
|
QFile outputFile(file);
|
||||||
output("Writing colors.txt file to "+file ,INFO);
|
output("Writing colors.txt file to "+file ,Info);
|
||||||
if (outputFile.open(QIODevice::WriteOnly| QIODevice::Truncate | QIODevice::Text)) {
|
if (outputFile.open(QIODevice::WriteOnly| QIODevice::Truncate | QIODevice::Text)) {
|
||||||
//QTextStream in(&inputFile);
|
//QTextStream in(&inputFile);
|
||||||
QMapIterator<QString,QString> mi(nodeList);
|
QMapIterator<QString,QString> mi(nodeList);
|
||||||
|
@ -184,7 +184,7 @@ bool MakeColors::writeColorsTxt(const QString &file)
|
||||||
out<<fullNodeName<< QString(" %1 %2 %3").arg(color.red(),3).arg(color.green(),3).arg(color.blue(),3) <<endl;
|
out<<fullNodeName<< QString(" %1 %2 %3").arg(color.red(),3).arg(color.green(),3).arg(color.blue(),3) <<endl;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
output("No color found for " +fullNodeName, WARNING);
|
output("No color found for " +fullNodeName, Warning);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -201,8 +201,8 @@ void MakeColors::run()
|
||||||
parseNodesTxt(fileNodesTxt);
|
parseNodesTxt(fileNodesTxt);
|
||||||
emit maxProgressChanged(requiredColors.size());
|
emit maxProgressChanged(requiredColors.size());
|
||||||
emit progressChanged(0);
|
emit progressChanged(0);
|
||||||
output(tr("Found %Ln node(s)","",nodeList.size()), INFO);
|
output(tr("Found %Ln node(s)","",nodeList.size()), Info);
|
||||||
output(tr("Searching and parsing %Ln texture file(s)","",requiredColors.size()), INFO);
|
output(tr("Searching and parsing %Ln texture file(s)","",requiredColors.size()), Info);
|
||||||
for(int i = 0; i < textureSearchDirectorys.size(); i++)
|
for(int i = 0; i < textureSearchDirectorys.size(); i++)
|
||||||
{
|
{
|
||||||
//emit stateChanged("search and process textures "+ i +" of "+textureSearchDirectorys.size());
|
//emit stateChanged("search and process textures "+ i +" of "+textureSearchDirectorys.size());
|
||||||
|
@ -210,12 +210,12 @@ void MakeColors::run()
|
||||||
|
|
||||||
}
|
}
|
||||||
writeColorsTxt(fileColorsTxt);
|
writeColorsTxt(fileColorsTxt);
|
||||||
output("Done! :)",INFO);
|
output("Done! :)",Info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MakeColors::startProcess()
|
void MakeColors::startProcess()
|
||||||
{
|
{
|
||||||
output("Starting...",VERBOSE);
|
output("Starting...",Verbose);
|
||||||
|
|
||||||
// Set this to 0 and -1 makes the progressbar shows busy
|
// Set this to 0 and -1 makes the progressbar shows busy
|
||||||
emit maxProgressChanged(0);
|
emit maxProgressChanged(0);
|
||||||
|
|
14
makecolors.h
14
makecolors.h
|
@ -29,11 +29,11 @@ public:
|
||||||
void setTextureSearchDirectorys(const QStringList &value);
|
void setTextureSearchDirectorys(const QStringList &value);
|
||||||
|
|
||||||
enum LogLevel {
|
enum LogLevel {
|
||||||
NONE,
|
None,
|
||||||
VERBOSE,
|
Verbose,
|
||||||
INFO,
|
Info,
|
||||||
WARNING,
|
Warning,
|
||||||
ERROR
|
Error
|
||||||
};
|
};
|
||||||
Q_ENUM(LogLevel)
|
Q_ENUM(LogLevel)
|
||||||
|
|
||||||
|
@ -61,12 +61,12 @@ private:
|
||||||
QString fileColorsTxt;
|
QString fileColorsTxt;
|
||||||
QStringList textureSearchDirectorys;
|
QStringList textureSearchDirectorys;
|
||||||
QStringList textureFileFilter;
|
QStringList textureFileFilter;
|
||||||
LogLevel logLevel = INFO;
|
LogLevel logLevel = Info;
|
||||||
|
|
||||||
QHash<QString, QColor> requiredColors;
|
QHash<QString, QColor> requiredColors;
|
||||||
QMap<QString, QString> nodeList;
|
QMap<QString, QString> nodeList;
|
||||||
bool writeColorsTxt(const QString &file);
|
bool writeColorsTxt(const QString &file);
|
||||||
void output(const QString &message, LogLevel level = NONE);
|
void output(const QString &message, LogLevel level = None);
|
||||||
QMutex mutex;
|
QMutex mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue