Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #427 #430

Merged
merged 1 commit into from
Jan 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions tools/ld-chroma-decoder/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@
#include "paldecoder.h"
#include "transformpal.h"

// Global for quiet mode (suppress info and warning messages)
static bool showOutput = true;

// Load the thresholds file for the Transform decoders, if specified. We must
// do this after PalColour has been configured, so we know how many values to
// expect.
Expand Down Expand Up @@ -227,9 +224,9 @@ int main(int argc, char *argv[])
// Process the command line options and arguments given by the user
parser.process(a);

// Get the options from the parser
bool isDebugOn = parser.isSet(showDebugOption);
if (parser.isSet(setQuietOption)) showOutput = false;
// Get the debug options from the parser
if (parser.isSet(showDebugOption)) setDebug(true); else setDebug(false);
if (parser.isSet(setQuietOption)) setQuiet(true); else setQuiet(false);

// Get the arguments from the parser
QString inputFileName;
Expand Down Expand Up @@ -345,9 +342,6 @@ int main(int argc, char *argv[])
palConfig.showFFTs = true;
}

// Process the command line options
if (isDebugOn) setDebug(true); else setDebug(false);

// Work out the metadata filename
QString inputJsonFileName = inputFileName + ".json";
if (parser.isSet(inputJsonOption)) {
Expand Down
5 changes: 1 addition & 4 deletions tools/ld-export-metadata/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
#include "logging.h"
#include "lddecodemetadata.h"

// Global for quiet mode (suppress info and warning messages)
static bool showOutput = true;

int main(int argc, char *argv[])
{
// Install the local debug message handler
Expand Down Expand Up @@ -98,7 +95,7 @@ int main(int argc, char *argv[])

// Get the options from the parser
if (parser.isSet(showDebugOption)) setDebug(true); else setDebug(false);
if (parser.isSet(setQuietOption)) showOutput = false;
if (parser.isSet(setQuietOption)) setQuiet(true); else setQuiet(false);

// Get the arguments from the parser
QString inputFileName;
Expand Down
14 changes: 12 additions & 2 deletions tools/library/tbc/logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
// Global for debug output
static bool showDebug = false;
static bool saveDebug = false;
static bool quietDebug = false;
static QFile *debugFile;

// Qt debug message handler
Expand Down Expand Up @@ -64,8 +65,11 @@ void debugOutputHandler(QtMsgType type, const QMessageLogContext &context, const
break;
}

// Display the output message on stderr
if (showDebug || (type != QtDebugMsg)) QTextStream(stderr) << outputMessage;
// If quiet mode is set, suppress all output
if (!quietDebug) {
// Display the output message on stderr
if (showDebug || (type != QtDebugMsg)) QTextStream(stderr) << outputMessage;
}

// Optional output to file
if (saveDebug) QTextStream(debugFile) << outputMessage;
Expand Down Expand Up @@ -96,3 +100,9 @@ void setDebug(bool state)
{
showDebug = state;
}

// Control the quiet flag (if set all output is suppressed)
void setQuiet(bool state)
{
quietDebug = state;
}
1 change: 1 addition & 0 deletions tools/library/tbc/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
// Prototypes
void debugOutputHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg);
void setDebug(bool state);
void setQuiet(bool state);
void openDebugFile(QString filename);
void closeDebugFile(void);

Expand Down