12#include <QApplication>
13#include <QCoreApplication>
19#include <QProcessEnvironment>
20#include <QStyleFactory>
92 return check.exists() && check.isFile();
99#if !defined(OSX_RELEASE) && !defined(WIN_RELEASE) && !defined(APPIMAGE_RELEASE)
118 bool success =
false;
123 .arg (QDir::separator())
126 if (
file.open(QIODevice::WriteOnly | QIODevice::Text)) {
171 LOG4CPP_INFO_S ((*
mainCat)) <<
"main args=" << QApplication::arguments().join (
" ").toLatin1().data();
237 for (
int i = 1;
i <
argc;
i++) {
244 QObject::tr (
"is not a valid file name"));
250 QObject::tr (
"is not a valid image file extension"));
256 QObject::tr (
"is not a valid file name"));
342 str <<
dashForRepeatingFlag.toLatin1().data() <<
" " << QObject::tr (
"is used only with one or more load files");
364 QMessageBox::critical (
nullptr,
365 QObject::tr (
"Engauge Digitizer"),
374 str << QObject::tr (
"Available styles") <<
": " << QStyleFactory::keys ().join (
", ");
382 str <<
"<html>Usage: engauge "
383 <<
"[" <<
DASH_DEBUG.toLatin1().data() <<
"] "
390 <<
"[" <<
DASH_HELP.toLatin1().data() <<
"] "
392 <<
"[" <<
DASH_RESET.toLatin1().data () <<
"] "
393 <<
"[" <<
DASH_STYLE.toLatin1().data () <<
" <style>] "
395 <<
"[<load_file1>] [<load_file2>] ..." <<
endl
398 <<
"<td>" <<
DASH_DEBUG.toLatin1().data() <<
"</td>"
400 << QObject::tr (
"Enables extra debug information. Used for debugging").toLatin1().data()
406 << QObject::tr (
"Indicates files opened at startup are for testing drag and drop. Used for regression testing").toLatin1().data()
412 << QObject::tr (
"Specifies an error report file as input. Used for debugging and regression testing").toLatin1().data()
418 << QObject::tr (
"Export each loaded startup file, which must have all axis points defined, then stop").toLatin1().data()
424 << QObject::tr (
"Extract image in each loaded startup file to a file with the specified extension, then stop").toLatin1().data()
430 << QObject::tr (
"Specifies a file command script file as input. Used for debugging and testing").toLatin1().data()
436 << QObject::tr (
"Output diagnostic gnuplot input files. Used for debugging").toLatin1().data()
440 <<
"<td>" <<
DASH_HELP.toLatin1().data() <<
"</td>"
442 << QObject::tr (
"Show this help information").toLatin1().data()
448 << QObject::tr (
"Executes the error report file or file command script. Used for regression testing").toLatin1().data()
452 <<
"<td>" <<
DASH_RESET.toLatin1().data() <<
"</td>"
454 << QObject::tr (
"Removes all stored settings, including window positions. Used when windows start up offscreen").toLatin1().data()
458 <<
"<td>" <<
DASH_STYLE.toLatin1().data() <<
"</td>"
461 .arg (QObject::tr (
"Set the window style to one of the styles listed by the command line option"))
466 <<
"<td>" <<
DASH_STYLES.toLatin1().data() <<
"</td>"
469 .arg (QObject::tr (
"Show a list of available styles that can be used with the command line option"))
476 << QObject::tr (
"Upgrade files opened at startup to the most recent version").toLatin1().data()
480 <<
"<td>" <<
QString (
"<load file> ").toLatin1().data() <<
"</td>"
482 << QObject::tr (
"File(s) to be imported or opened at startup").toLatin1().data()
485 <<
"</table></html>";
497 QStringList::const_iterator
itr;
505 Qt::CaseInsensitive)) {
524 if (!
file.open (QFile::WriteOnly)) {
527 .arg (QObject::tr (
"Could not write to"))
533 writer.setAutoFormatting (
true);
534 writer.writeStartDocument();
535 writer.writeDTD (
"<!DOCTYPE engauge>");
537 writer.writeEndDocument ();
540 .arg (QObject::tr (
"Upgraded"))
542 .arg (QObject::tr (
"to"))
const int INNER_RADIUS_MIN
log4cpp::Category * mainCat
void initializeLogging(const QString &name, const QString &filename, bool isDebug)
Storage of one imported image and the data attached to that image.
void saveXml(QXmlStreamWriter &writer) const
Save document to xml.
Provides list of file extensions for import.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Class that stores QTranslator objects for the duration of application execution.
#define LOG4CPP_INFO_S(logger)
int main(int argc, char *argv[])
void sanityCheckLoadStartupFiles(bool isRepeatingFlag, const QString &dashForRepeatingFlag, const QString &errorReportFile, const QString &fileCmdScriptFile, const QStringList &loadStartupFiles)
const QString CMD_EXPORT_ONLY("exportonly")
const QString DASH_ERROR_REPORT("-"+CMD_ERROR_REPORT)
const QString CMD_STYLE("style")
const QString CMD_ERROR_REPORT("errorreport")
const QString CMD_RESET("reset")
bool engaugeLogFilenameAttempt(const QString &path, QString &pathAndFile)
const QString CMD_STYLES("styles")
const QString ENGAUGE_LOG_FILE(".engauge.log")
const QString CMD_DROP_REGRESSION("dropregression")
const QString CMD_REGRESSION("regression")
const QString DASH_GNUPLOT("-"+CMD_GNUPLOT)
const QString DASH_EXTRACT_IMAGE_ONLY("-"+CMD_EXTRACT_IMAGE_ONLY)
void parseCmdLine(int argc, char **argv, bool &isDebug, bool &isDropRegression, bool &isReset, QString &errorReportFile, QString &fileCmdScriptFile, bool &isErrorReportRegressionTest, bool &isGnuplot, bool &isExportOnly, bool &isExtractImageOnly, QString &extractImageOnlyExtension, bool &isUpgrade, QStringList &loadStartupFiles, QStringList &commandLineWithoutLoadStartupFiles)
void sanityCheckValue(bool requiredCondition, const QString &arg, const QString &msgUnadorned)
const QString CMD_GNUPLOT("gnuplot")
QString engaugeLogFilename()
const QString DASH_HELP("-"+CMD_HELP)
const QString DASH_UPGRADE("-"+CMD_UPGRADE)
const QString CMD_EXTRACT_IMAGE_ONLY("extractimageonly")
const QString DASH_RESET("-"+CMD_RESET)
const QString CMD_HELP("help")
const QString CMD_UPGRADE("upgrade")
void showMessageAndQuit(const QString &msg)
const QString DASH_STYLES("-"+CMD_STYLES)
const QString DASH_REGRESSION("-"+CMD_REGRESSION)
const QString CMD_FILE_CMD_SCRIPT("filecmdscript")
const QString DASH_EXPORT_ONLY("-"+CMD_EXPORT_ONLY)
const QString DASH_DROP_REGRESSION("-"+CMD_DROP_REGRESSION)
const QString DASH_DEBUG("-"+CMD_DEBUG)
const QString DASH_STYLE("-"+CMD_STYLE)
bool checkFileExists(const QString &file)
void upgradeFiles(const QStringList &loadStartupFiles)
const QString CMD_DEBUG("debug")
const QString DASH_FILE_CMD_SCRIPT("-"+CMD_FILE_CMD_SCRIPT)