本文整理汇总了C++中TFilePath::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ TFilePath::getName方法的具体用法?C++ TFilePath::getName怎么用?C++ TFilePath::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TFilePath
的用法示例。
在下文中一共展示了TFilePath::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onDeliver
void onDeliver()
{
if (m_error) {
m_error = false;
MsgBox(DVGui::CRITICAL, QObject::tr("There was an error saving frames for the %1 level.").arg(QString::fromStdWString(m_fp.withoutParentDir().getWideString())));
}
bool isPreview = (m_fp.getType() == "noext");
TImageCache::instance()->remove(toString(m_fp.getWideString() + L".0"));
TNotifier::instance()->notify(TSceneNameChange());
if (Preferences::instance()->isGeneratedMovieViewEnabled()) {
if (!isPreview && (Preferences::instance()->isDefaultViewerEnabled()) &&
(m_fp.getType() == "mov" || m_fp.getType() == "avi" || m_fp.getType() == "3gp")) {
QString name = QString::fromStdString(m_fp.getName());
int index;
if ((index = name.indexOf("#RENDERID")) != -1) //!quite ugly I know....
m_fp = m_fp.withName(name.left(index).toStdWString());
if (!TSystem::showDocument(m_fp)) {
QString msg(QObject::tr("It is not possible to display the file %1: no player associated with its format").arg(QString::fromStdWString(m_fp.withoutParentDir().getWideString())));
MsgBox(WARNING, msg);
}
}
else {
int r0, r1, step;
TApp *app = TApp::instance();
ToonzScene *scene = app->getCurrentScene()->getScene();
TOutputProperties &outputSettings = isPreview ? *scene->getProperties()->getPreviewProperties() : *scene->getProperties()->getOutputProperties();
outputSettings.getRange(r0, r1, step);
const TRenderSettings rs = outputSettings.getRenderSettings();
if (r0 == 0 && r1 == -1)
r0 = 0, r1 = scene->getFrameCount() - 1;
double timeStretchFactor = isPreview ? 1.0 : (double)outputSettings.getRenderSettings().m_timeStretchTo /
outputSettings.getRenderSettings().m_timeStretchFrom;
r0 = tfloor(r0 * timeStretchFactor);
r1 = tceil((r1 + 1) * timeStretchFactor) - 1;
TXsheet::SoundProperties *prop = new TXsheet::SoundProperties();
prop->m_frameRate = outputSettings.getFrameRate();
TSoundTrack *snd = app->getCurrentXsheet()->getXsheet()->makeSound(prop);
if (outputSettings.getRenderSettings().m_stereoscopic) {
assert(!isPreview);
::viewFile(m_fp.withName(m_fp.getName() + "_l"), r0 + 1, r1 + 1, step, isPreview ? rs.m_shrinkX : 1, snd, 0, false, true);
::viewFile(m_fp.withName(m_fp.getName() + "_r"), r0 + 1, r1 + 1, step, isPreview ? rs.m_shrinkX : 1, snd, 0, false, true);
} else
::viewFile(m_fp, r0 + 1, r1 + 1, step, isPreview ? rs.m_shrinkX : 1, snd, 0, false, true);
}
}
}
示例2: doPsdParser
void PsdSettingsPopup::doPsdParser() {
TFilePath psdpath =
TApp::instance()->getCurrentScene()->getScene()->decodeFilePath(m_path);
std::string mode = "";
switch (m_mode) {
case FLAT: {
break;
}
case FRAMES: {
mode = "#frames";
std::string name =
psdpath.getName() + "#1" + mode + psdpath.getDottedType();
psdpath = psdpath.getParentDir() + TFilePath(name);
break;
}
case COLUMNS: {
std::string name = psdpath.getName() + "#1" + psdpath.getDottedType();
psdpath = psdpath.getParentDir() + TFilePath(name);
break;
}
case FOLDER: {
mode = "#group";
std::string name =
psdpath.getName() + "#1" + mode + psdpath.getDottedType();
psdpath = psdpath.getParentDir() + TFilePath(name);
break;
}
default: {
assert(false);
return;
}
}
try {
m_psdparser = new TPSDParser(psdpath);
m_psdLevelPaths.clear();
for (int i = 0; i < m_psdparser->getLevelsCount(); i++) {
int layerId = m_psdparser->getLevelId(i);
std::string name = m_path.getName();
if (layerId > 0 && m_mode != FRAMES) {
if (m_levelNameType->currentIndex() == 0) // FileName#LevelName
name += "#" + std::to_string(layerId);
else // LevelName
name += "##" + std::to_string(layerId);
}
if (mode != "") name += mode;
name += m_path.getDottedType();
TFilePath psdpath = m_path.getParentDir() + TFilePath(name);
m_psdLevelPaths.push_back(psdpath);
}
} catch (TImageException &e) {
error(QString::fromStdString(::to_string(e.getMessage())));
return;
}
}
示例3: updatePresets
void InsertFxPopup::updatePresets()
{
int i;
for (i = 0; i < m_fxTree->topLevelItemCount(); i++) {
QTreeWidgetItem *folder = m_fxTree->topLevelItem(i);
TFilePath path = TFilePath(folder->data(0, Qt::UserRole).toString().toStdWString());
if (folder->text(0).toStdString() == "Plugins") {
continue;
}
if (path.getName() == "macroFx") {
int j;
for (j = folder->childCount() - 1; j >= 0; j--)
folder->removeChild(folder->child(j));
m_fxTree->removeItemWidget(folder, 0);
delete folder;
} else if (path.getParentDir().getName() == "macroFx")
continue;
else
for (int i = 0; i < folder->childCount(); i++) {
bool isPresetLoaded = loadPreset(folder->child(i));
if (isPresetLoaded)
folder->child(i)->setIcon(0, m_presetIcon);
else
folder->child(i)->setIcon(0, m_fxIcon);
}
}
loadMacro();
update();
}
示例4: loadMacro
void InsertFxPopup::loadMacro()
{
TFilePath fp = m_presetFolder + TFilePath("macroFx");
try {
if (TFileStatus(fp).isDirectory()) {
TFilePathSet macros = TSystem::readDirectory(fp);
if (macros.empty())
return;
QTreeWidgetItem *macroFolder = new QTreeWidgetItem((QTreeWidget *)0, QStringList(tr("Macro")));
macroFolder->setData(0, Qt::UserRole, QVariant(toQString(fp)));
macroFolder->setIcon(0, m_folderIcon);
m_fxTree->addTopLevelItem(macroFolder);
for (TFilePathSet::iterator it = macros.begin(); it != macros.end(); ++it) {
TFilePath macroPath = *it;
QString name(macroPath.getName().c_str());
QTreeWidgetItem *macroItem = new QTreeWidgetItem((QTreeWidget *)0, QStringList(name));
macroItem->setData(0, Qt::UserRole, QVariant(toQString(macroPath)));
macroItem->setIcon(0, m_fxIcon);
macroFolder->addChild(macroItem);
}
}
} catch (...) {
}
}
示例5: loadPreset
bool InsertFxPopup::loadPreset(QTreeWidgetItem *item)
{
QString str = item->data(0, Qt::UserRole).toString();
TFilePath presetsFilepath(m_presetFolder + str.toStdWString());
int i;
for (i = item->childCount() - 1; i >= 0; i--)
item->removeChild(item->child(i));
if (TFileStatus(presetsFilepath).isDirectory()) {
TFilePathSet presets = TSystem::readDirectory(presetsFilepath);
if (!presets.empty()) {
for (TFilePathSet::iterator it2 = presets.begin(); it2 != presets.end(); ++it2) {
TFilePath presetPath = *it2;
QString name(presetPath.getName().c_str());
QTreeWidgetItem *presetItem = new QTreeWidgetItem((QTreeWidget *)0, QStringList(name));
presetItem->setData(0, Qt::UserRole, QVariant(toQString(presetPath)));
item->addChild(presetItem);
presetItem->setIcon(0, m_fxIcon);
}
} else
return false;
} else
return false;
return true;
}
示例6: match
bool TFilePath::match(const TFilePath &fp) const
{
return getParentDir() == fp.getParentDir() &&
getName() == fp.getName() &&
getFrame() == fp.getFrame() &&
getType() == fp.getType();
}
示例7: extractPsdSuffix
std::string ResourceImporter::extractPsdSuffix(TFilePath &path) {
if (path.getType() != "psd") return "";
std::string name = path.getName();
int i = name.find("#");
if (i == std::string::npos) return "";
std::string suffix = name.substr(i);
path = path.withName(name.substr(0, i));
return suffix;
}
示例8: setPath
void PsdSettingsPopup::setPath(const TFilePath &path) {
m_path = path;
// doPSDInfo(path,m_psdTree);
QString filename =
QString::fromStdString(path.getName()); //+psdpath.getDottedType());
QString pathLbl =
QString::fromStdWString(path.getParentDir().getWideString());
m_filename->setText(filename);
m_parentDir->setText(pathLbl);
}
示例9: copyDir
void TSystem::copyDir(const TFilePath &dst, const TFilePath &src) {
QFileInfoList fil = QDir(toQString(src)).entryInfoList();
QDir::current().mkdir(toQString(dst));
int i;
for (i = 0; i < fil.size(); i++) {
QFileInfo fi = fil.at(i);
if (fi.fileName() == QString(".") || fi.fileName() == QString(".."))
continue;
if (fi.isDir()) {
TFilePath srcDir = TFilePath(fi.filePath().toStdString());
TFilePath dstDir = dst + srcDir.getName();
copyDir(dstDir, srcDir);
} else
QFile::copy(fi.filePath(),
toQString(dst) + QString("\\") + fi.fileName());
}
}
示例10: saveFolder
void TLevelSet::saveFolder(TOStream &os, TFilePath folder) {
std::map<std::string, std::string> attr;
attr["name"] = folder.getName();
if (folder == getDefaultFolder()) attr["type"] = "default";
os.openChild("folder", attr);
std::vector<TFilePath> folders;
listFolders(folders, folder);
if (!folders.empty()) {
for (int i = 0; i < (int)folders.size(); i++) saveFolder(os, folders[i]);
}
std::vector<TXshLevel *> levels;
listLevels(levels, folder);
if (!levels.empty()) {
os.openChild("levels");
for (int i = 0; i < (int)levels.size(); i++)
if (m_saveSet.empty() || m_saveSet.count(levels[i]) > 0) os << levels[i];
os.closeChild();
}
os.closeChild();
}
示例11: removePreset
void InsertFxPopup::removePreset()
{
QTreeWidgetItem *item = m_fxTree->currentItem();
QString itemRole = item->data(0, Qt::UserRole).toString();
TFilePath path = TFilePath(itemRole.toStdWString());
QString question = QString(tr("Are you sure you want to delete %1?").arg(path.getName().c_str()));
int ret = DVGui::MsgBox(question, tr("Yes"), tr("No"), 1);
if (ret == 2 || ret == 0)
return;
try {
TSystem::deleteFile(path);
} catch (...) {
error(QString(tr("It is not possible to delete %1.").arg(toQString(path))));
return;
}
m_fxTree->removeItemWidget(item, 0);
delete item;
TApp::instance()->getCurrentFx()->notifyFxPresetRemoved();
}
示例12: getFolderIndexFromPath
/*! Returns the index of the folder specified in the path \b folderDir.
Returns -1 if \b folderDir isn't a folder of the project.
*/
int TProject::getFolderIndexFromPath(const TFilePath &folderDir) {
TFilePath scenePath = decode(getFolder(Scenes));
bool sceneDependentScenePath = false;
if (scenePath.getName().find("$scene") != string::npos) {
scenePath = scenePath.getParentDir();
sceneDependentScenePath = true;
}
int folderIndex;
for (folderIndex = 0; folderIndex < getFolderCount(); folderIndex++)
if (isConstantFolder(folderIndex)) {
TFilePath fp = decode(getFolder(folderIndex));
if (fp == folderDir) return folderIndex;
} else {
TFilePath fp = decode(getFolder(folderIndex));
wstring a = fp.getWideString();
wstring b = folderDir.getWideString();
int alen = a.length();
int blen = b.length();
int i = a.find(L"$scene");
assert(i != (int)wstring::npos);
if (i == (int)wstring::npos) continue;
int j = i + 1;
while (j < alen && isalnum(a[j])) j++;
// a.substr(i,j-i) == "$scenexxxx"
int k = j + blen - alen;
if (!(0 <= i && i < k && k <= blen)) continue;
assert(i < blen);
if (i > 0 && a.substr(0, i) != b.substr(0, i)) continue;
if (k < blen && (j >= alen || a.substr(j) != b.substr(k))) continue;
wstring v = b.substr(i, k - i);
TFilePath scene(v + L".tnz");
if (sceneDependentScenePath)
scene = scenePath + scene.getWideName() + scene;
else
scene = scenePath + scene;
if (TFileStatus(scene).doesExist()) return folderIndex;
}
return -1;
}
示例13: buildPsd
TFilePath ResourceImporter::buildPsd(const TFilePath &basePath, const string &suffix)
{
return basePath.withName(basePath.getName() + suffix);
}
示例14: codePath
TFilePath ResourceImporter::codePath(const TFilePath &oldPath, const TFilePath &newActualPath)
{
return oldPath.withName(newActualPath.getName());
}
示例15: save
void SceneLevel::save()
{
TFilePath fp = m_oldPath;
SceneResource::updatePath(fp);
TFilePath actualFp = m_scene->decodeFilePath(fp);
actualFp = restorePsdPath(actualFp);
TFilePath oldActualPath = restorePsdPath(m_oldActualPath);
assert(actualFp.getWideString() == L"" || actualFp.getWideString()[0] != L'+');
if (actualFp != oldActualPath || !TSystem::doesExistFileOrLevel(oldActualPath) || m_sl->getProperties()->getDirtyFlag() || (m_sl->getPalette() && m_sl->getPalette()->getDirtyFlag())) {
try {
TSystem::touchParentDir(actualFp);
if (actualFp != oldActualPath &&
TSystem::doesExistFileOrLevel(oldActualPath) &&
m_sl->getProperties()->getDirtyFlag() == false &&
(!m_sl->getPalette() || (m_sl->getPalette() && m_sl->getPalette()->getDirtyFlag() == false))) {
try {
TXshSimpleLevel::copyFiles(actualFp, oldActualPath);
} catch (...) {
}
//Must NOT KEEP FRAMES, it generate a level frames bind necessary to imageBuilder path refresh.
m_sl->setPath(fp, false);
} else {
m_sl->save(actualFp, oldActualPath);
if ((actualFp.getType() == "tlv" || actualFp.getType() == "pli") &&
actualFp != oldActualPath &&
m_oldRefImgPath != TFilePath()) {
//Devo preoccuparmi dell'eventuale livello colormodel
TFilePath actualRefImagPath = m_scene->decodeFilePath(m_oldRefImgPath);
TFilePath actualRefImagPathTpl = actualRefImagPath.withType("tpl");
TFilePath oldRefImagPathTpl = m_oldActualRefImgPath.withType("tpl");
TSystem::copyFile(actualRefImagPath, m_oldActualRefImgPath);
if (actualRefImagPath.getType() == "tlv")
TSystem::copyFile(actualRefImagPathTpl, oldRefImagPathTpl);
}
if (actualFp.getType() == "tif" || actualFp.getType() == "tiff" || actualFp.getType() == "tga" || actualFp.getType() == "tzi") {
TFilePath clnin = oldActualPath.withNoFrame().withType("cln");
if (TSystem::doesExistFileOrLevel(clnin))
TSystem::copyFile(actualFp.withNoFrame().withType("cln"), clnin);
}
}
//Se il livello e' tlv verifico se esiste il corrispondente unpainted ed in caso affermativo lo copio.
//Questo controllo viene fatto qui e non nella copia o nel salvataggio del livello perche' in generale
//non si vuole che il livello unpainted venga copiato con il livello.
if (actualFp.getType() == "tlv") {
TFilePath oldUnpaintedLevelPath = oldActualPath.getParentDir() + TFilePath(oldActualPath.getName() + "-unpainted." + oldActualPath.getType());
TFilePath unpaintedLevelPath = actualFp.getParentDir() + TFilePath(actualFp.getName() + "-unpainted." + actualFp.getType());
if (TSystem::doesExistFileOrLevel(oldUnpaintedLevelPath) && !TSystem::doesExistFileOrLevel(unpaintedLevelPath))
TSystem::copyFile(unpaintedLevelPath, oldUnpaintedLevelPath);
TFilePath oldUnpaintedPalettePath = oldUnpaintedLevelPath.withType("tpl");
TFilePath unpaintedPalettePath = unpaintedLevelPath.withType("tpl");
if (TSystem::doesExistFileOrLevel(oldUnpaintedPalettePath) && !TSystem::doesExistFileOrLevel(unpaintedPalettePath))
TSystem::copyFile(unpaintedPalettePath, oldUnpaintedPalettePath);
}
} catch (...) {
}
}
fp = m_oldScannedPath;
if (fp != TFilePath()) {
SceneResource::updatePath(fp);
actualFp = m_scene->decodeFilePath(fp);
if (actualFp != m_oldActualScannedPath &&
TSystem::doesExistFileOrLevel(m_oldActualScannedPath)) {
try {
TSystem::touchParentDir(actualFp);
TSystem::copyFileOrLevel_throw(actualFp, m_oldActualScannedPath);
m_sl->clearFrames();
m_sl->load();
} catch (...) {
}
}
}
}