本文整理汇总了C++中QProcessEnvironment::systemEnvironment方法的典型用法代码示例。如果您正苦于以下问题:C++ QProcessEnvironment::systemEnvironment方法的具体用法?C++ QProcessEnvironment::systemEnvironment怎么用?C++ QProcessEnvironment::systemEnvironment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QProcessEnvironment
的用法示例。
在下文中一共展示了QProcessEnvironment::systemEnvironment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void ProcessRunner::run()
{
if (!process)
process = new QProcess();
#ifdef WIN32
QProcessEnvironment env = env.systemEnvironment();
env.insert("CYGWIN", "nodosfilewarning");
process->setProcessEnvironment(env);
#endif
connect(process, SIGNAL(readyReadStandardError()), this, SLOT(updateError()), Qt::DirectConnection);
connect(process, SIGNAL(readyReadStandardOutput()), this, SLOT(updateText()), Qt::DirectConnection);
if(arguments)
process->start(program, *arguments);
else
process->start(program);
interact(process);
process->waitForFinished(-1); // no timeout
process->close();
disconnect(process, SIGNAL(readyReadStandardError()), this, SLOT(updateError()));
disconnect(process, SIGNAL(readyReadStandardOutput()), this, SLOT(updateText()));
}
示例2: main_
ExitCodes main_(int, const char **) override
{
//-------------------------------------------------------------
// Parsing parameters
//-------------------------------------------------------------
String in = getStringOption_("in");
String out_sirius = getStringOption_("out_sirius");
String out_csifingerid = getStringOption_("out_fingerid");
// needed for counting
int number_compounds = getIntOption_("number");
// Parameter for Sirius3
QString executable = getStringOption_("executable").toQString();
const QString profile = getStringOption_("profile").toQString();
const QString elements = getStringOption_("elements").toQString();
const QString database = getStringOption_("database").toQString();
const QString isotope = getStringOption_("isotope").toQString();
const QString noise = QString::number(getIntOption_("noise"));
const QString ppm_max = QString::number(getIntOption_("ppm_max"));
const QString candidates = QString::number(getIntOption_("candidates"));
bool auto_charge = getFlag_("auto_charge");
bool no_recalibration = getFlag_("no_recalibration");
bool iontree = getFlag_("iontree");
//-------------------------------------------------------------
// Determination of the Executable
//-------------------------------------------------------------
// Parameter executable not provided
if (executable.isEmpty())
{
const QProcessEnvironment env;
const QString & qsiriuspathenv = env.systemEnvironment().value("SIRIUS_PATH");
if (qsiriuspathenv.isEmpty())
{
writeLog_( "FATAL: Executable of Sirius could not be found. Please either use SIRIUS_PATH env variable or provide with -executable");
return MISSING_PARAMETERS;
}
executable = qsiriuspathenv;
}
// Normalize file path
QFileInfo file_info(executable);
executable = file_info.canonicalFilePath();
writeLog_("Executable is: " + executable);
const QString & path_to_executable = File::path(executable).toQString();
//-------------------------------------------------------------
// Calculations
//-------------------------------------------------------------
PeakMap spectra;
MzMLFile f;
f.setLogType(log_type_);
f.load(in, spectra);
std::vector<String> subdirs;
QString tmp_base_dir = File::getTempDirectory().toQString();
QString tmp_dir = QDir(tmp_base_dir).filePath(File::getUniqueName().toQString());
String tmp_ms_file = QDir(tmp_base_dir).filePath((File::getUniqueName() + ".ms").toQString());
String out_dir = QDir(tmp_dir).filePath("sirius_out");
//Write msfile
SiriusMSFile::store(spectra, tmp_ms_file);
// Assemble SIRIUS parameters
QStringList process_params;
process_params << "-p" << profile
<< "-e" << elements
<< "-d" << database
<< "-s" << isotope
<< "--noise" << noise
<< "--candidates" << candidates
<< "--ppm-max" << ppm_max
<< "--quiet"
<< "--output" << out_dir.toQString(); //internal output folder for temporary SIRIUS output file storage
// Add flags
if (no_recalibration)
{
process_params << "--no-recalibration";
}
if (!out_csifingerid.empty())
{
process_params << "--fingerid";
}
if (iontree)
{
process_params << "--iontree";
}
if (auto_charge)
{
process_params << "--auto-charge";
}
process_params << tmp_ms_file.toQString();
//.........这里部分代码省略.........