MCPcopy Create free account
hub / github.com/CloudCompare/CloudCompare / start

Method start

qCC/ccCommandLineParser.cpp:934–1002  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

932}
933
934int ccCommandLineParser::start(QDialog* parent/*=nullptr*/)
935{
936 if (m_arguments.empty())
937 {
938 assert(false);
939 return EXIT_FAILURE;
940 }
941
942 m_parentWidget = parent;
943 //if (!m_silentMode)
944 //{
945 // m_progressDialog = new ccProgressDialog(false, parent);
946 // //m_progressDialog->setAttribute(Qt::WA_DeleteOnClose);
947 // m_progressDialog->setAutoClose(false);
948 // m_progressDialog->hide();
949 //}
950
951 QElapsedTimer eTimer;
952 eTimer.start();
953
954 bool success = true;
955 while (success && !m_arguments.empty())
956 {
957 QApplication::processEvents(); //Without this the console is just a spinner until the end of all processing
958 QString argument = m_arguments.takeFirst();
959
960 if (!argument.startsWith("-"))
961 {
962 error(QString("Command expected (commands start with '-'). Found '%1'").arg(argument));
963 success = false;
964 break;
965 }
966 QString keyword = argument.mid(1).toUpper();
967
968 if (m_commands.contains(keyword))
969 {
970 assert(m_commands[keyword]);
971 QElapsedTimer eTimerSubProcess;
972 eTimerSubProcess.start();
973 QString processName = m_commands[keyword]->m_name.toUpper();
974 printHigh(QString("[%1]").arg(processName));
975 success = m_commands[keyword]->process(*this);
976 printHigh(QString("[%2] finished in %1 s.").arg(eTimerSubProcess.elapsed() / 1.0e3, 0, 'f', 2).arg(processName));
977 }
978 //silent mode (i.e. no console)
979 else if (keyword == COMMAND_SILENT_MODE)
980 {
981 warning(QString("Misplaced command: '%1' (must be first)").arg(COMMAND_SILENT_MODE));
982 }
983 else if (keyword == COMMAND_HELP)
984 {
985 print("Available commands:");
986 for (auto it = m_commands.constBegin(); it != m_commands.constEnd(); ++it)
987 {
988 print(QString("-%1: %2").arg(it.key().toUpper(), it.value()->m_name));
989 }
990 }
991 else

Callers 1

ParseMethod · 0.45

Calls 6

constBeginMethod · 0.80
constEndMethod · 0.80
QStringClass · 0.70
containsMethod · 0.45
processMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected