本文整理汇总了C++中TFilePath::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ TFilePath::getType方法的具体用法?C++ TFilePath::getType怎么用?C++ TFilePath::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TFilePath
的用法示例。
在下文中一共展示了TFilePath::getType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renameFileOrLevel_throw
void TSystem::renameFileOrLevel_throw(const TFilePath &dst,
const TFilePath &src,
bool renamePalette) {
if (renamePalette && ((src.getType() == "tlv") || (src.getType() == "tzp") ||
(src.getType() == "tzu"))) {
// Special case: since renames cannot be 'grouped' in the UI, palettes are
// automatically
// renamed here if required
const char *type = (src.getType() == "tlv") ? "tpl" : "plt";
TFilePath srcpltname(src.withNoFrame().withType(type));
TFilePath dstpltname(dst.withNoFrame().withType(type));
if (TSystem::doesExistFileOrLevel(src) &&
TSystem::doesExistFileOrLevel(srcpltname))
TSystem::renameFile(dstpltname, srcpltname, false);
}
if (src.isLevelName()) {
TFilePathSet files;
files = TSystem::readDirectory(src.getParentDir(), false);
for (TFilePathSet::iterator it = files.begin(); it != files.end(); it++) {
if (it->getLevelName() == src.getLevelName()) {
TFilePath src1 = *it;
TFilePath dst1 = dst.withFrame(it->getFrame());
TSystem::renameFile(dst1, src1);
}
}
} else
TSystem::renameFile(dst, src);
}
示例2: startDragDrop
void StudioPaletteTreeViewer::startDragDrop() {
TRepetitionGuard guard;
if (!guard.hasLock()) return;
QDrag *drag = new QDrag(this);
QMimeData *mimeData = new QMimeData;
QList<QUrl> urls;
QList<QTreeWidgetItem *> items = selectedItems();
int i;
for (i = 0; i < items.size(); i++) {
// Sposto solo le palette.
TFilePath path = getItemPath(items[i]);
if (!path.isEmpty() &&
(path.getType() == "tpl" || path.getType() == "pli" ||
path.getType() == "tlv" || path.getType() == "tnz"))
urls.append(pathToUrl(path));
}
if (urls.isEmpty()) return;
mimeData->setUrls(urls);
drag->setMimeData(mimeData);
Qt::DropAction dropAction = drag->exec(Qt::CopyAction | Qt::MoveAction);
viewport()->update();
}
示例3: doRender
void RenderCommand::doRender(bool isPreview)
{
bool isWritable = true;
bool isMultiFrame;
/*-- 初期化処理。フレーム範囲の計算や、Renderの場合はOutputSettingsから保存先パスも作る --*/
if (!init(isPreview))
return;
if (m_fp.getDots() == ".") {
isMultiFrame = false;
TFileStatus fs(m_fp);
if (fs.doesExist())
isWritable = fs.isWritable();
} else {
isMultiFrame = true;
TFilePath dir = m_fp.getParentDir();
QDir qDir(QString::fromStdWString(dir.getWideString()));
QString levelName = QRegExp::escape(QString::fromStdWString(m_fp.getWideName()));
QString levelType = QString::fromStdString(m_fp.getType());
QString exp(levelName + ".[0-9]{1,4}." + levelType);
QRegExp regExp(exp);
QStringList list = qDir.entryList(QDir::Files);
QStringList livelFrames = list.filter(regExp);
int i;
for (i = 0; i < livelFrames.size() && isWritable; i++) {
TFilePath frame = dir + TFilePath(livelFrames[i].toStdWString());
if (frame.isEmpty() || !frame.isAbsolute())
continue;
TFileStatus fs(frame);
isWritable = fs.isWritable();
}
}
if (!isWritable) {
string str = "It is not possible to write the output: the file";
str += isMultiFrame ? "s are read only." : " is read only.";
MsgBox(WARNING, QString::fromStdString(str));
return;
}
ToonzScene *scene = 0;
TCamera *camera = 0;
try {
/*-- Xsheetノードに繋がっている各ラインごとに計算するモード。
MultipleRender で Schematic Flows または Fx Schematic Terminal Nodes が選択されている場合
--*/
if (m_multimediaRender && m_fp.getType() != "swf") //swf is not currently supported on multimedia...
multimediaRender();
else if (!isPreview && m_fp.getType() == "swf")
flashRender();
else
/*-- 通常のRendering --*/
rasterRender(isPreview);
} catch (TException &e) {
MsgBox(WARNING, QString::fromStdString(toString(e.getMessage())));
} catch (...) {
MsgBox(WARNING, QObject::tr("It is not possible to complete the rendering."));
}
}
示例4: FlashMovieGenerator
MovieGenerator::MovieGenerator(const TFilePath &path,
const TDimension &resolution,
TOutputProperties &outputProperties,
bool useMarkers) {
if (path.getType() == "swf" || path.getType() == "scr")
m_imp.reset(new FlashMovieGenerator(path, resolution, outputProperties));
else
m_imp.reset(new RasterMovieGenerator(path, resolution, outputProperties));
m_imp->m_useMarkers = useMarkers;
}
示例5: 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);
}
}
}
示例6: TSmartObject
TLevelWriter::TLevelWriter(const TFilePath &path, TPropertyGroup *prop)
: TSmartObject(m_classCode), m_path(path), m_properties(prop), m_contentHistory(0)
{
string ext = path.getType();
if (!prop)
m_properties = Tiio::makeWriterProperties(ext);
}
示例7: match
bool TFilePath::match(const TFilePath &fp) const
{
return getParentDir() == fp.getParentDir() &&
getName() == fp.getName() &&
getFrame() == fp.getFrame() &&
getType() == fp.getType();
}
示例8: doesExistFileOrLevel
bool TSystem::doesExistFileOrLevel(const TFilePath &fp) {
if (TFileStatus(fp).doesExist()) return true;
if (fp.isLevelName()) {
const TFilePath &parentDir = fp.getParentDir();
if (!TFileStatus(parentDir).doesExist()) return false;
TFilePathSet files;
try {
files = TSystem::readDirectory(parentDir, false, true, true);
} catch (...) {
}
TFilePathSet::iterator it, end = files.end();
for (it = files.begin(); it != end; ++it) {
if (it->getLevelNameW() == fp.getLevelNameW()) return true;
}
} else if (fp.getType() == "psd") {
QString name(QString::fromStdWString(fp.getWideName()));
name.append(QString::fromStdString(fp.getDottedType()));
int sepPos = name.indexOf("#");
int dotPos = name.indexOf(".", sepPos);
int removeChars = dotPos - sepPos;
int doubleUnderscorePos = name.indexOf("__", sepPos);
if (doubleUnderscorePos > 0) removeChars = doubleUnderscorePos - sepPos;
name.remove(sepPos, removeChars);
TFilePath psdpath(fp.getParentDir() + TFilePath(name.toStdWString()));
if (TFileStatus(psdpath).doesExist()) return true;
}
return false;
}
示例9: isResource
bool isResource(const QString &path) {
const TFilePath fp(path.toStdWString());
TFileType::Type type = TFileType::getInfo(fp);
return (TFileType::isViewable(type) || type & TFileType::MESH_IMAGE ||
type == TFileType::AUDIO_LEVEL || type == TFileType::TABSCENE ||
type == TFileType::TOONZSCENE || fp.getType() == "tpl");
}
示例10: 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;
}
示例11: TLevelWriter
TLevelWriterP::TLevelWriterP(const TFilePath &path, TPropertyGroup *winfo)
{
QString type = QString::fromStdString(toLower(path.getType()));
std::map<QString, std::pair<TLevelWriterCreateProc *, bool>>::iterator it;
it = LevelWriterTable.find(type);
if (it != LevelWriterTable.end())
m_pointer = it->second.first(path, winfo ? winfo->clone() : Tiio::makeWriterProperties(path.getType()));
else
m_pointer = new TLevelWriter(path, winfo ? winfo->clone() : Tiio::makeWriterProperties(path.getType()));
assert(m_pointer);
m_pointer->addRef();
}
示例12: center
FlashMovieGenerator(const TFilePath &fp, const TDimension cameraSize,
TOutputProperties &properties)
: Imp(fp, cameraSize, properties.getFrameRate())
, m_flash(cameraSize.lx, cameraSize.ly, 0, properties.getFrameRate(),
properties.getFileFormatProperties("swf"))
, m_frameIndex(0)
, m_sceneIndex(0)
, m_frameCountLoader(0)
, m_screenSaverMode(false) {
TPointD center(0.5 * cameraSize.lx, 0.5 * cameraSize.ly);
m_viewAff = TAffine();
m_screenSaverMode = fp.getType() == "scr";
}
示例13: key
TLevelReaderP::TLevelReaderP(const TFilePath &path, int reader)
{
QString extension = QString::fromStdString(toLower(path.getType()));
LevelReaderKey key(extension, reader);
std::map<LevelReaderKey, TLevelReaderCreateProc *>::iterator it;
it = LevelReaderTable.find(key);
if (it != LevelReaderTable.end()) {
m_pointer = it->second(path);
assert(m_pointer);
} else {
m_pointer = new TLevelReader(path);
}
m_pointer->addRef();
}
示例14: TException
TSoundTrackWriterP::TSoundTrackWriterP(const TFilePath &path) {
QString type = QString::fromStdString(toLower(path.getType()));
std::map<QString, TSoundTrackWriterCreateProc *>::iterator it;
it = SoundTrackWriterTable.find(type);
if (it != SoundTrackWriterTable.end()) {
m_pointer = it->second(path);
assert(m_pointer);
m_pointer->addRef();
} else {
m_pointer = 0;
throw TException(path.getWideString() +
L"soundtrack writer not implemented");
}
}
示例15: readPaperFormat
void TPaperFormatManager::readPaperFormat(const TFilePath &path) {
if (path.getType() != "pap") return;
Tifstream is(path);
std::string name;
TDimensionD size(0, 0);
while (is) {
char buffer[1024];
is.getline(buffer, sizeof buffer);
// i e' il carattere successivo alla fine della linea
unsigned int i = 0;
for (i = 0; i < sizeof buffer && buffer[i]; i++) {
}
if (i > 0 && buffer[i - 1] == '\n') i--;
while (i > 0 && buffer[i - 1] == ' ') i--;
unsigned int j = 0;
unsigned int k = 0;
// j e' il carattere successivo alla fine del primo token
for (j = 0; j < i && buffer[j] != ' '; j++) {
}
// k e' l'inizio del secondo token (se c'e', altrimenti == i)
for (k = j; k < i && buffer[k] == ' '; k++) {
}
std::string value;
if (k < i) value = std::string(buffer + k, i - k);
if (buffer[0] == '#') {
if (k < i && name == "") name = value;
} else if (std::string(buffer).find("WIDTH") == 0) {
if (isDouble(value)) size.lx = std::stod(value);
} else if (std::string(buffer).find("LENGTH") == 0) {
if (isDouble(value)) size.ly = std::stod(value);
}
}
if (name == "" || size.lx == 0 || size.ly == 0) {
// TMessage::error("Error reading paper format file : %1",path);
} else
m_formats[name] = Format(size);
}