Skip to content

Commit

Permalink
Fix for issue #429
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Inns committed Jan 25, 2020
1 parent 7517f37 commit b15a51c
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 75 deletions.
13 changes: 4 additions & 9 deletions tools/ld-analyse/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,17 @@ int main(int argc, char *argv[])
parser.addHelpOption();
parser.addVersionOption();

// Option to show debug (-d)
QCommandLineOption showDebugOption(QStringList() << "d" << "debug",
QCoreApplication::translate("main", "Show debug"));
parser.addOption(showDebugOption);
// Add the standard debug options --debug and --quiet
addStandardDebugOptions(parser);

// Positional argument to specify input video file
parser.addPositionalArgument("input", QCoreApplication::translate("main", "Specify input TBC file"));

// Process the command line arguments given by the user
parser.process(a);

// Get the configured settings from the parser
bool isDebugOn = parser.isSet(showDebugOption);

// Process the command line options
if (isDebugOn) setDebug(true); else setDebug(false);
// Standard logging options
processStandardDebugOptions(parser);

// Get the arguments from the parser
QString inputFileName;
Expand Down
16 changes: 4 additions & 12 deletions tools/ld-chroma-decoder/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,8 @@ int main(int argc, char *argv[])

// -- General options --

// Option to show debug (-d)
QCommandLineOption showDebugOption(QStringList() << "d" << "debug",
QCoreApplication::translate("main", "Show debug"));
parser.addOption(showDebugOption);
// Add the standard debug options --debug and --quiet
addStandardDebugOptions(parser);

// Option to specify a different JSON input file
QCommandLineOption inputJsonOption(QStringList() << "input-json",
Expand Down Expand Up @@ -153,11 +151,6 @@ int main(int argc, char *argv[])
QCoreApplication::translate("main", "Output in black and white"));
parser.addOption(setBwModeOption);

// Option to set quiet mode (-q)
QCommandLineOption setQuietOption(QStringList() << "q" << "quiet",
QCoreApplication::translate("main", "Suppress info and warning messages"));
parser.addOption(setQuietOption);

// Option to select which decoder to use (-f)
QCommandLineOption decoderOption(QStringList() << "f" << "decoder",
QCoreApplication::translate("main", "Decoder to use (pal2d, transform2d, transform3d, ntsc2d, ntsc3d, mono; default automatic)"),
Expand Down Expand Up @@ -224,9 +217,8 @@ int main(int argc, char *argv[])
// Process the command line options and arguments given by the user
parser.process(a);

// 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);
// Standard logging options
processStandardDebugOptions(parser);

// Get the arguments from the parser
QString inputFileName;
Expand Down
13 changes: 5 additions & 8 deletions tools/ld-diffdod/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ int main(int argc, char *argv[])
parser.addHelpOption();
parser.addVersionOption();

// Option to show debug (-d / --debug)
QCommandLineOption showDebugOption(QStringList() << "d" << "debug",
QCoreApplication::translate("main", "Show debug"));
parser.addOption(showDebugOption);
// Add the standard debug options --debug and --quiet
addStandardDebugOptions(parser);

// Option to reverse the field order (-r / --reverse)
QCommandLineOption setReverseOption(QStringList() << "r" << "reverse",
Expand Down Expand Up @@ -92,14 +90,13 @@ int main(int argc, char *argv[])
// Process the command line options and arguments given by the user
parser.process(a);

// Standard logging options
processStandardDebugOptions(parser);

// Get the options from the parser
bool isDebugOn = parser.isSet(showDebugOption);
bool reverse = parser.isSet(setReverseOption);
bool lumaClip = parser.isSet(setLumaOption);

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

QVector<QString> inputFilenames;
QStringList positionalArguments = parser.positionalArguments();

Expand Down
13 changes: 5 additions & 8 deletions tools/ld-dropout-correct/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,8 @@ int main(int argc, char *argv[])
parser.addHelpOption();
parser.addVersionOption();

// Option to show debug (-d)
QCommandLineOption showDebugOption(QStringList() << "d" << "debug",
QCoreApplication::translate("main", "Show debug"));
parser.addOption(showDebugOption);
// Add the standard debug options --debug and --quiet
addStandardDebugOptions(parser);

// Option to specify a different JSON input file
QCommandLineOption inputJsonOption(QStringList() << "input-json",
Expand Down Expand Up @@ -105,8 +103,10 @@ int main(int argc, char *argv[])
// Process the command line options and arguments given by the user -----------------------------------------------
parser.process(a);

// Standard logging options
processStandardDebugOptions(parser);

// Get the options from the parser
bool isDebugOn = parser.isSet(showDebugOption);
bool reverse = parser.isSet(setReverseOption);
bool intraField = parser.isSet(setIntrafieldOption);
bool overCorrect = parser.isSet(setOverCorrectOption);
Expand Down Expand Up @@ -188,9 +188,6 @@ int main(int argc, char *argv[])
}
}

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

// Metadata filename for output TBC
QString outputJsonFilename = outputFilename + ".json";
if (parser.isSet(outputJsonOption)) {
Expand Down
16 changes: 4 additions & 12 deletions tools/ld-export-metadata/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,8 @@ int main(int argc, char *argv[])

// -- General options --

// Option to show debug (-d)
QCommandLineOption showDebugOption({"d", "debug"},
QCoreApplication::translate("main", "Show debug"));
parser.addOption(showDebugOption);

// Option to set quiet mode (-q)
QCommandLineOption setQuietOption({"q", "quiet"},
QCoreApplication::translate("main", "Suppress info and warning messages"));
parser.addOption(setQuietOption);
// Add the standard debug options --debug and --quiet
addStandardDebugOptions(parser);

// -- Output types --

Expand All @@ -93,9 +86,8 @@ 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
if (parser.isSet(showDebugOption)) setDebug(true); else setDebug(false);
if (parser.isSet(setQuietOption)) setQuiet(true); else setQuiet(false);
// Standard logging options
processStandardDebugOptions(parser);

// Get the arguments from the parser
QString inputFileName;
Expand Down
13 changes: 5 additions & 8 deletions tools/ld-lds-converter/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ int main(int argc, char *argv[])
parser.addHelpOption();
parser.addVersionOption();

// Option to show debug (-d)
QCommandLineOption showDebugOption(QStringList() << "d" << "debug",
QCoreApplication::translate("main", "Show debug"));
parser.addOption(showDebugOption);
// Add the standard debug options --debug and --quiet
addStandardDebugOptions(parser);

// Option to specify input video file (-i)
QCommandLineOption sourceVideoFileOption(QStringList() << "i" << "input",
Expand All @@ -83,16 +81,15 @@ int main(int argc, char *argv[])
// Process the command line arguments given by the user
parser.process(a);

// Standard logging options
processStandardDebugOptions(parser);

// Get the configured settings from the parser
bool isDebugOn = parser.isSet(showDebugOption);
bool isUnpacking = parser.isSet(showUnpackOption);
bool isPacking = parser.isSet(showPackOption);
QString inputFileName = parser.value(sourceVideoFileOption);
QString outputFileName = parser.value(targetVideoFileOption);

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

bool modeUnpack = true;
if (isPacking) modeUnpack = false;

Expand Down
17 changes: 7 additions & 10 deletions tools/ld-process-efm/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,10 @@ int main(int argc, char *argv[])
parser.addHelpOption();
parser.addVersionOption();

// Option to show debug (-d / --debug)
QCommandLineOption showDebugOption(QStringList() << "d" << "debug",
QCoreApplication::translate("main", "Show debug"));
parser.addOption(showDebugOption);
// Add the standard debug options --debug and --quiet
addStandardDebugOptions(parser);

// Option to show debug (-d / --debug)
// Option to run in non-interactive mode (-n / --noninteractive)
QCommandLineOption nonInteractiveOption(QStringList() << "n" << "noninteractive",
QCoreApplication::translate("main", "Run in non-interactive mode"));
parser.addOption(nonInteractiveOption);
Expand All @@ -74,13 +72,12 @@ int main(int argc, char *argv[])
// Process the command line options and arguments given by the user
parser.process(a);

// Standard logging options
processStandardDebugOptions(parser);

// Get the options from the parser
bool isDebugOn = parser.isSet(showDebugOption);
bool isNonInteractiveOn = parser.isSet(nonInteractiveOption);

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

// Get the arguments from the parser
QString inputEfmFilename;
QString outputAudioFilename;
Expand All @@ -100,7 +97,7 @@ int main(int argc, char *argv[])
}

// Start the GUI application
MainWindow w(isDebugOn, isNonInteractiveOn, outputAudioFilename);
MainWindow w(getDebugState(), isNonInteractiveOn, outputAudioFilename);
if (!inputEfmFilename.isEmpty()) {
// Load the file to decode
if (!w.loadInputEfmFile(inputEfmFilename)) {
Expand Down
13 changes: 5 additions & 8 deletions tools/ld-process-vbi/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@ int main(int argc, char *argv[])
parser.addHelpOption();
parser.addVersionOption();

// Option to show debug (-d)
QCommandLineOption showDebugOption(QStringList() << "d" << "debug",
QCoreApplication::translate("main", "Show debug"));
parser.addOption(showDebugOption);
// Add the standard debug options --debug and --quiet
addStandardDebugOptions(parser);

// Option to specify a different JSON input file
QCommandLineOption inputJsonOption(QStringList() << "input-json",
Expand Down Expand Up @@ -88,8 +86,10 @@ int main(int argc, char *argv[])
// Process the command line options and arguments given by the user
parser.process(a);

// Standard logging options
processStandardDebugOptions(parser);

// Get the options from the parser
bool isDebugOn = parser.isSet(showDebugOption);
bool noBackup = parser.isSet(showNoBackupOption);

qint32 maxThreads = QThread::idealThreadCount();
Expand All @@ -114,9 +114,6 @@ int main(int argc, char *argv[])
return -1;
}

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

// Work out the metadata filenames
QString inputJsonFilename = inputFilename + ".json";
if (parser.isSet(inputJsonOption)) {
Expand Down
6 changes: 6 additions & 0 deletions tools/library/tbc/logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,9 @@ void processStandardDebugOptions(QCommandLineParser &parser)
if (parser.isSet(showDebugOption)) setDebug(true); else setDebug(false);
if (parser.isSet(setQuietOption)) setQuiet(true); else setQuiet(false);
}

// Method to get the current debug logging state
bool getDebugState()
{
return showDebug;
}
1 change: 1 addition & 0 deletions tools/library/tbc/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ void openDebugFile(QString filename);
void closeDebugFile(void);
void addStandardDebugOptions(QCommandLineParser &parser);
void processStandardDebugOptions(QCommandLineParser &parser);
bool getDebugState();

#endif // LOGGING_H

0 comments on commit b15a51c

Please sign in to comment.