本文整理汇总了C++中FileName::toFileInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ FileName::toFileInfo方法的具体用法?C++ FileName::toFileInfo怎么用?C++ FileName::toFileInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileName
的用法示例。
在下文中一共展示了FileName::toFileInfo方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: triggerQtVersionRestore
void QtVersionManager::triggerQtVersionRestore()
{
disconnect(ProjectExplorer::ToolChainManager::instance(), SIGNAL(toolChainsLoaded()),
this, SLOT(triggerQtVersionRestore()));
bool success = restoreQtVersions();
m_instance->updateFromInstaller(false);
if (!success) {
// We did neither restore our settings or upgraded
// in that case figure out if there's a qt in path
// and add it to the Qt versions
findSystemQt();
}
emit m_instance->qtVersionsLoaded();
emit m_instance->qtVersionsChanged(m_versions.keys(), QList<int>(), QList<int>());
saveQtVersions();
const FileName configFileName = globalSettingsFileName();
if (configFileName.toFileInfo().exists()) {
m_configFileWatcher = new FileSystemWatcher(m_instance);
connect(m_configFileWatcher, SIGNAL(fileChanged(QString)),
m_fileWatcherTimer, SLOT(start()));
m_configFileWatcher->addFile(configFileName.toString(),
FileSystemWatcher::WatchModifiedDate);
} // exists
}
示例2: readAndDeleteLegacyCMakeSettings
static void readAndDeleteLegacyCMakeSettings ()
{
// restore the legacy cmake
QSettings *settings = ICore::settings();
settings->beginGroup(QLatin1String("CMakeSettings"));
FileName exec = FileName::fromUserInput(settings->value(QLatin1String("cmakeExecutable")).toString());
if (exec.toFileInfo().isExecutable()) {
CMakeTool *item = CMakeToolManager::findByCommand(exec);
if (!item) {
item = new CMakeTool(CMakeTool::ManualDetection);
item->setCMakeExecutable(exec);
item->setDisplayName(CMakeToolManager::tr("CMake at %1").arg(item->cmakeExecutable().toUserOutput()));
if (!CMakeToolManager::registerCMakeTool(item)) {
delete item;
item = 0;
}
}
//this setting used to be the default cmake, make sure it is again
if (item)
d->m_defaultCMake = item->id();
}
//read the legacy ninja setting, if its not available use the current value
d->m_preferNinja = settings->value(QLatin1String("preferNinja"), d->m_preferNinja).toBool();
settings->remove(QString());
settings->endGroup();
}
示例3: defaultDisplayName
QString BaseQtVersion::defaultDisplayName(const QString &versionString, const FileName &qmakePath,
bool fromPath)
{
QString location;
if (qmakePath.isEmpty()) {
location = QCoreApplication::translate("QtVersion", "<unknown>");
} else {
// Deduce a description from '/foo/qt-folder/[qtbase]/bin/qmake' -> '/foo/qt-folder'.
// '/usr' indicates System Qt 4.X on Linux.
QDir dir = qmakePath.toFileInfo().absoluteDir();
do {
const QString dirName = dir.dirName();
if (dirName == QLatin1String("usr")) { // System-installed Qt.
location = QCoreApplication::translate("QtVersion", "System");
break;
}
location = dirName;
// Also skip default checkouts named 'qt'. Parent dir might have descriptive name.
if (dirName.compare(QLatin1String("bin"), Qt::CaseInsensitive)
&& dirName.compare(QLatin1String("qtbase"), Qt::CaseInsensitive)
&& dirName.compare(QLatin1String("qt"), Qt::CaseInsensitive)) {
break;
}
} while (dir.cdUp());
}
return fromPath ?
QCoreApplication::translate("QtVersion", "Qt %1 in PATH (%2)").arg(versionString, location) :
QCoreApplication::translate("QtVersion", "Qt %1 (%2)").arg(versionString, location);
}
示例4: handleCompilerCommandChange
void GoToolChainConfigWidget::handleCompilerCommandChange()
{
bool haveCompiler = false;
Abi currentAbi = m_abiWidget->currentAbi();
bool customAbi = m_abiWidget->isCustomAbi();
FileName path = m_compilerCommand->fileName();
QList<Abi> abiList;
if (!path.isEmpty()) {
QFileInfo fi(path.toFileInfo());
haveCompiler = fi.isExecutable() && fi.isFile();
}
if (haveCompiler) {
Environment env = Environment::systemEnvironment();
GccToolChain::addCommandPathToEnvironment(path, env);
abiList = GoToolChain::guessGoAbi(path, env.toStringList());
}
m_abiWidget->setEnabled(haveCompiler);
// Find a good ABI for the new compiler:
Abi newAbi;
if (customAbi)
newAbi = currentAbi;
else if (abiList.contains(currentAbi))
newAbi = currentAbi;
m_abiWidget->setAbis(abiList, newAbi);
emit dirty();
}
示例5: findEnvFromSysroot
FileName PokySDKKitInformation::findEnvFromSysroot(const FileName &sysRoot)
{
const QString sysRootStr = sysRoot.toString();
int idx = sysRootStr.indexOf(QLatin1String("/sysroots/"));
if (idx < 0)
return FileName();
QString envFile = QString(QLatin1String("%1/environment-setup-%2"))
.arg(sysRootStr.left(idx), sysRoot.toFileInfo().fileName());
return FileName::fromString(envFile);
}
示例6: findEnvFromCompiler
FileName PokySDKKitInformation::findEnvFromCompiler(const FileName &compilerCmd)
{
const QString compilerCmdStr = compilerCmd.toString();
int idx = compilerCmdStr.indexOf(QLatin1String("/sysroots/"));
if (idx < 0)
return FileName();
QString target = compilerCmd.toFileInfo().fileName().remove(QLatin1String("-g++"));
QString envFile = QString(QLatin1String("%1/environment-setup-%2"))
.arg(compilerCmdStr.left(idx), target);
return FileName::fromString(envFile);
}
示例7: isMetaDataNewerThan
bool MaemoDebianPackageCreationStep::isMetaDataNewerThan(const QDateTime &packageDate) const
{
const FileName debianPath = DebianManager::debianDirectory(target());
if (packageDate <= debianPath.toFileInfo().lastModified())
return true;
const QStringList debianFiles = DebianManager::debianFiles(debianPath);
foreach (const QString &debianFile, debianFiles) {
FileName absFilePath = debianPath;
absFilePath.appendPath(debianFile);
if (packageDate <= absFilePath.toFileInfo().lastModified())
return true;
}
示例8: androidToolPath
FileName AndroidConfigurations::androidToolPath() const
{
if (HostOsInfo::isWindowsHost()) {
// I want to switch from using android.bat to using an executable. All it really does is call
// Java and I've made some progress on it. So if android.exe exists, return that instead.
FileName path = m_config.sdkLocation;
path.appendPath(QLatin1String("tools/android" QTC_HOST_EXE_SUFFIX));
if (path.toFileInfo().exists())
return path;
path = m_config.sdkLocation;
return path.appendPath(QLatin1String("tools/android" ANDROID_BAT_SUFFIX));
} else {
FileName path = m_config.sdkLocation;
return path.appendPath(QLatin1String("tools/android"));
}
}
示例9: save
bool SubmitEditorFile::save(QString *errorString, const QString &fileName, bool autoSave)
{
const FileName fName = fileName.isEmpty() ? filePath() : FileName::fromString(fileName);
FileSaver saver(fName.toString(),
QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text);
saver.write(m_editor->fileContents());
if (!saver.finalize(errorString))
return false;
if (autoSave)
return true;
setFilePath(FileName::fromUserInput(fName.toFileInfo().absoluteFilePath()));
setModified(false);
if (!errorString->isEmpty())
return false;
emit changed();
return true;
}
示例10: createKit
Kit* MerTarget::createKit() const
{
if (!isValid())
return 0;
const QString sysroot(m_sdk->sharedTargetsPath() + QLatin1Char('/') + m_name);
FileName path = FileName::fromString(sysroot);
if (!path.toFileInfo().exists()) {
qWarning() << "Sysroot does not exist" << sysroot;
return 0;
}
Kit *k = new Kit();
k->setAutoDetected(true);
k->setUnexpandedDisplayName(QString::fromLatin1("%1-%2").arg(m_sdk->virtualMachineName(), m_name));
k->setIconPath(FileName::fromString(QLatin1String(Constants::MER_OPTIONS_CATEGORY_ICON)));
SysRootKitInformation::setSysRoot(k, FileName::fromUserInput(sysroot));
DeviceTypeKitInformation::setDeviceTypeId(k, Constants::MER_DEVICE_TYPE);
k->setMutable(DeviceKitInformation::id(), true);
const QString gdb = HostOsInfo::withExecutableSuffix(m_defaultGdb);
QString gdbDir = QCoreApplication::applicationDirPath();
if (HostOsInfo::isMacHost()) {
QDir dir = QDir(gdbDir);
dir.cdUp();
dir.cdUp();
dir.cdUp();
gdbDir = dir.path();
}
FileName gdbFileName = FileName::fromString(gdbDir + QLatin1Char('/') + gdb);
DebuggerItem debugger;
debugger.setCommand(gdbFileName);
debugger.setEngineType(GdbEngineType);
const QString vmName = m_sdk->virtualMachineName();
debugger.setUnexpandedDisplayName(QObject::tr("GDB for %1 %2").arg(vmName, m_name));
debugger.setAutoDetected(true);
debugger.setAbi(Abi::abiFromTargetTriplet(m_gccMachineDump)); // TODO is this OK?
QVariant id = DebuggerItemManager::registerDebugger(debugger);
DebuggerKitInformation::setDebugger(k, id);
MerSdkKitInformation::setSdk(k,m_sdk);
MerTargetKitInformation::setTargetName(k,name());
return k;
}
示例11: extractSpecFromArguments
FileName QmakeBuildConfiguration::extractSpecFromArguments(QString *args,
const QString &directory, const BaseQtVersion *version,
QStringList *outArgs)
{
FileName parsedSpec;
bool ignoreNext = false;
bool nextIsSpec = false;
for (QtcProcess::ArgIterator ait(args); ait.next(); ) {
if (ignoreNext) {
ignoreNext = false;
ait.deleteArg();
} else if (nextIsSpec) {
nextIsSpec = false;
parsedSpec = FileName::fromUserInput(ait.value());
ait.deleteArg();
} else if (ait.value() == QLatin1String("-spec") || ait.value() == QLatin1String("-platform")) {
nextIsSpec = true;
ait.deleteArg();
} else if (ait.value() == QLatin1String("-cache")) {
// We ignore -cache, because qmake contained a bug that it didn't
// mention the -cache in the Makefile.
// That means changing the -cache option in the additional arguments
// does not automatically rerun qmake. Alas, we could try more
// intelligent matching for -cache, but i guess people rarely
// do use that.
ignoreNext = true;
ait.deleteArg();
} else if (outArgs && ait.isSimple()) {
outArgs->append(ait.value());
}
}
if (parsedSpec.isEmpty())
return FileName();
FileName baseMkspecDir = FileName::fromUserInput(
version->qmakeProperty("QT_HOST_DATA") + QLatin1String("/mkspecs"));
baseMkspecDir = Utils::FileName::fromString(baseMkspecDir.toFileInfo().canonicalFilePath());
// if the path is relative it can be
// relative to the working directory (as found in the Makefiles)
// or relatively to the mkspec directory
// if it is the former we need to get the canonical form
// for the other one we don't need to do anything
if (parsedSpec.toFileInfo().isRelative()) {
if (QFileInfo::exists(directory + QLatin1Char('/') + parsedSpec.toString()))
parsedSpec = FileName::fromUserInput(directory + QLatin1Char('/') + parsedSpec.toString());
else
parsedSpec = FileName::fromUserInput(baseMkspecDir.toString() + QLatin1Char('/') + parsedSpec.toString());
}
QFileInfo f2 = parsedSpec.toFileInfo();
while (f2.isSymLink()) {
parsedSpec = FileName::fromString(f2.symLinkTarget());
f2.setFile(parsedSpec.toString());
}
if (parsedSpec.isChildOf(baseMkspecDir)) {
parsedSpec = parsedSpec.relativeChildPath(baseMkspecDir);
} else {
FileName sourceMkSpecPath = FileName::fromString(version->sourcePath().toString()
+ QLatin1String("/mkspecs"));
if (parsedSpec.isChildOf(sourceMkSpecPath))
parsedSpec = parsedSpec.relativeChildPath(sourceMkSpecPath);
}
return parsedSpec;
}
示例12: isVcsDirectory
bool BazaarClient::isVcsDirectory(const FileName &fileName) const
{
return fileName.toFileInfo().isDir()
&& !fileName.fileName().compare(Constants::BAZAARREPO, HostOsInfo::fileNameCaseSensitivity());
}
示例13: isVcsDirectory
bool MercurialClient::isVcsDirectory(const FileName &fileName) const
{
return fileName.toFileInfo().isDir()
&& !fileName.fileName().compare(Constants::MERCURIALREPO, HostOsInfo::fileNameCaseSensitivity());
}