本文整理汇总了C++中FileName::toUserOutput方法的典型用法代码示例。如果您正苦于以下问题:C++ FileName::toUserOutput方法的具体用法?C++ FileName::toUserOutput怎么用?C++ FileName::toUserOutput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileName
的用法示例。
在下文中一共展示了FileName::toUserOutput方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: takeParsedConfiguration
CMakeConfig TeaLeafReader::takeParsedConfiguration()
{
FileName cacheFile = m_parameters.workDirectory;
cacheFile.appendPath(QLatin1String("CMakeCache.txt"));
if (!cacheFile.exists())
return { };
QString errorMessage;
CMakeConfig result = BuildDirManager::parseCMakeConfiguration(cacheFile, &errorMessage);
if (!errorMessage.isEmpty()) {
emit errorOccured(errorMessage);
return { };
}
const FileName sourceOfBuildDir
= FileName::fromUtf8(CMakeConfigItem::valueOf("CMAKE_HOME_DIRECTORY", result));
const FileName canonicalSourceOfBuildDir = FileUtils::canonicalPath(sourceOfBuildDir);
const FileName canonicalSourceDirectory = FileUtils::canonicalPath(m_parameters.sourceDirectory);
if (canonicalSourceOfBuildDir != canonicalSourceDirectory) { // Uses case-insensitive compare where appropriate
emit errorOccured(tr("The build directory is not for %1 but for %2")
.arg(canonicalSourceOfBuildDir.toUserOutput(),
canonicalSourceDirectory.toUserOutput()));
return { };
}
return result;
}
示例2: buildHelper
bool BuildableHelperLibrary::buildHelper(const BuildHelperArguments &arguments,
QString *log, QString *errorMessage)
{
const QChar newline = QLatin1Char('\n');
// Setup process
QProcess proc;
proc.setEnvironment(arguments.environment.toStringList());
proc.setWorkingDirectory(arguments.directory);
proc.setProcessChannelMode(QProcess::MergedChannels);
log->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary",
"Building helper \"%1\" in %2\n").arg(arguments.helperName,
arguments.directory));
log->append(newline);
const FileName makeFullPath = arguments.environment.searchInPath(arguments.makeCommand);
if (QFileInfo::exists(arguments.directory + QLatin1String("/Makefile"))) {
if (makeFullPath.isEmpty()) {
*errorMessage = QCoreApplication::translate("ProjectExplorer::DebuggingHelperLibrary",
"%1 not found in PATH\n").arg(arguments.makeCommand);
return false;
}
const QString cleanTarget = QLatin1String("distclean");
log->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary",
"Running %1 %2...\n")
.arg(makeFullPath.toUserOutput(), cleanTarget));
if (!runBuildProcess(proc, makeFullPath, QStringList(cleanTarget), 30, true, log, errorMessage))
return false;
}
QStringList qmakeArgs;
if (!arguments.targetMode.isEmpty())
qmakeArgs << arguments.targetMode;
if (!arguments.mkspec.isEmpty())
qmakeArgs << QLatin1String("-spec") << arguments.mkspec.toUserOutput();
qmakeArgs << arguments.proFilename;
qmakeArgs << arguments.qmakeArguments;
log->append(newline);
log->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary",
"Running %1 %2 ...\n").arg(arguments.qmakeCommand.toUserOutput(),
qmakeArgs.join(QLatin1Char(' '))));
if (!runBuildProcess(proc, arguments.qmakeCommand, qmakeArgs, 30, false, log, errorMessage))
return false;
log->append(newline);
if (makeFullPath.isEmpty()) {
*errorMessage = QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary",
"%1 not found in PATH\n").arg(arguments.makeCommand);
return false;
}
log->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary",
"Running %1 %2 ...\n")
.arg(makeFullPath.toUserOutput(), arguments.makeArguments.join(QLatin1Char(' '))));
if (!runBuildProcess(proc, makeFullPath, arguments.makeArguments, 120, false, log, errorMessage))
return false;
return true;
}
示例3: foreach
foreach (const FileName &command, suspects) {
CMakeTool *item = new CMakeTool(CMakeTool::AutoDetection);
item->setCMakeExecutable(command);
item->setDisplayName(CMakeToolManager::tr("System CMake at %1").arg(command.toUserOutput()));
found.append(item);
}
示例4: allArguments
///
/// Returns all arguments
/// That is: possbile subpath
/// spec
/// config arguemnts
/// moreArguments
/// user arguments
QString QMakeStep::allArguments(bool shorted)
{
QmakeBuildConfiguration *bc = qmakeBuildConfiguration();
QStringList arguments;
if (bc->subNodeBuild())
arguments << bc->subNodeBuild()->path().toUserOutput();
else if (shorted)
arguments << project()->projectFilePath().fileName();
else
arguments << project()->projectFilePath().toUserOutput();
arguments << QLatin1String("-r");
bool userProvidedMkspec = false;
for (QtcProcess::ConstArgIterator ait(m_userArgs); ait.next(); ) {
if (ait.value() == QLatin1String("-spec")) {
if (ait.next()) {
userProvidedMkspec = true;
break;
}
}
}
FileName specArg = mkspec();
if (!userProvidedMkspec && !specArg.isEmpty())
arguments << QLatin1String("-spec") << specArg.toUserOutput();
// Find out what flags we pass on to qmake
arguments << bc->configCommandLineArguments();
arguments << deducedArguments().toArguments();
QString args = QtcProcess::joinArgs(arguments);
// User arguments
QtcProcess::addArgs(&args, m_userArgs);
return args;
}
示例5: foreach
foreach (const FileName &cdb, cdbs) {
if (findByCommand(cdb))
continue;
DebuggerItem item;
item.setAutoDetected(true);
item.setAbis(Abi::abisOfBinary(cdb));
item.setCommand(cdb);
item.setEngineType(CdbEngineType);
item.setDisplayName(uniqueDisplayName(tr("Auto-detected CDB at %1").arg(cdb.toUserOutput())));
addDebugger(item);
}
示例6: parseTaskFile
static bool parseTaskFile(QString *errorString, const FileName &name)
{
QFile tf(name.toString());
if (!tf.open(QIODevice::ReadOnly)) {
*errorString = TaskListPlugin::tr("Cannot open task file %1: %2").arg(
name.toUserOutput(), tf.errorString());
return false;
}
const FileName parentDir = name.parentDir();
while (!tf.atEnd()) {
QStringList chunks = parseRawLine(tf.readLine());
if (chunks.isEmpty())
continue;
QString description;
QString file;
Task::TaskType type = Task::Unknown;
int line = -1;
if (chunks.count() == 1) {
description = chunks.at(0);
} else if (chunks.count() == 2) {
type = typeFrom(chunks.at(0));
description = chunks.at(1);
} else if (chunks.count() == 3) {
file = chunks.at(0);
type = typeFrom(chunks.at(1));
description = chunks.at(2);
} else if (chunks.count() >= 4) {
file = chunks.at(0);
bool ok;
line = chunks.at(1).toInt(&ok);
if (!ok)
line = -1;
type = typeFrom(chunks.at(2));
description = chunks.at(3);
}
if (!file.isEmpty()) {
file = QDir::fromNativeSeparators(file);
QFileInfo fi(file);
if (fi.isRelative())
file = FileName(parentDir).appendPath(file).toString();
}
description = unescape(description);
TaskHub::addTask(type, description, Constants::TASKLISTTASK_ID,
FileName::fromUserInput(file), line);
}
return true;
}
示例7: reloadPrompt
QTCREATOR_UTILS_EXPORT ReloadPromptAnswer reloadPrompt(const FileName &fileName,
bool modified,
bool enableDiffOption,
QWidget *parent)
{
const QString title = QCoreApplication::translate("Utils::reloadPrompt", "File Changed");
QString msg;
if (modified) {
msg = QCoreApplication::translate("Utils::reloadPrompt",
"The unsaved file <i>%1</i> has changed outside Qt Creator. "
"Do you want to reload it and discard your changes?");
} else {
msg = QCoreApplication::translate("Utils::reloadPrompt",
"The file <i>%1</i> has changed outside Qt Creator. Do you want to reload it?");
}
msg = msg.arg(fileName.fileName());
return reloadPrompt(title, msg, fileName.toUserOutput(), enableDiffOption, parent);
}
示例8: provideData
void provideData(quint64 block)
{
const FileName fn = filePath();
if (fn.isEmpty())
return;
QFile file(fn.toString());
if (file.open(QIODevice::ReadOnly)) {
int blockSize = m_widget->dataBlockSize();
file.seek(block * blockSize);
QByteArray data = file.read(blockSize);
file.close();
const int dataSize = data.size();
if (dataSize != blockSize)
data += QByteArray(blockSize - dataSize, 0);
m_widget->addData(block, data);
} else {
QMessageBox::critical(ICore::mainWindow(), tr("File Error"),
tr("Cannot open %1: %2").arg(
fn.toUserOutput(), file.errorString()));
}
}
示例9: readCMakeTools
static QList<CMakeTool *> readCMakeTools(const FileName &fileName, Core::Id *defaultId, bool fromSDK)
{
PersistentSettingsReader reader;
if (!reader.load(fileName))
return QList<CMakeTool *>();
QVariantMap data = reader.restoreValues();
// Check version
int version = data.value(QLatin1String(CMAKETOOL_FILE_VERSION_KEY), 0).toInt();
if (version < 1)
return QList<CMakeTool *>();
QList<CMakeTool *> loaded;
int count = data.value(QLatin1String(CMAKETOOL_COUNT_KEY), 0).toInt();
for (int i = 0; i < count; ++i) {
const QString key = QString::fromLatin1(CMAKETOOL_DATA_KEY) + QString::number(i);
if (!data.contains(key))
continue;
const QVariantMap dbMap = data.value(key).toMap();
CMakeTool *item = new CMakeTool(dbMap,fromSDK);
if (item->isAutoDetected()) {
if (!item->cmakeExecutable().toFileInfo().isExecutable()) {
qWarning() << QString::fromLatin1("CMakeTool \"%1\" (%2) read from \"%3\" dropped since the command is not executable.")
.arg(item->cmakeExecutable().toUserOutput(), item->id().toString(), fileName.toUserOutput());
delete item;
continue;
}
}
loaded.append(item);
}
*defaultId = Id::fromSetting(data.value(QLatin1String(CMAKETOOL_DEFAULT_KEY), defaultId->toSetting()));
d->m_preferNinja= data.value(QLatin1String(CMAKETOOL_PREFER_NINJA_KEY), d->m_preferNinja).toBool();
return loaded;
}
示例10: setFileName
void PathChooser::setFileName(const FileName &fn)
{
d->m_lineEdit->setText(fn.toUserOutput());
}