本文整理汇总了C++中TFilePath类的典型用法代码示例。如果您正苦于以下问题:C++ TFilePath类的具体用法?C++ TFilePath怎么用?C++ TFilePath使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TFilePath类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: presetsFilepath
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;
}
示例2: TFilePath
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 (...) {
}
}
示例3: addFolder
/*! Add a folder in StudioPalette TFilePath \b parentFolderPath. If there
are any problems send an error message.
*/
TFilePath StudioPaletteCmd::addFolder(const TFilePath &parentFolderPath) {
TFilePath folderPath;
folderPath = StudioPalette::instance()->createFolder(parentFolderPath);
if (!folderPath.isEmpty())
TUndoManager::manager()->add(new CreateFolderUndo(folderPath));
return folderPath;
}
示例4: while
void TPanelTitleBarButtonForSafeArea::getSafeAreaNameList(
QList<QString> &nameList) {
TFilePath fp = TEnv::getConfigDir();
QString currentSafeAreaName = QString::fromStdString(EnvSafeAreaName);
std::string safeAreaFileName = "safearea.ini";
while (!TFileStatus(fp + safeAreaFileName).doesExist() && !fp.isRoot() &&
fp.getParentDir() != TFilePath())
fp = fp.getParentDir();
fp = fp + safeAreaFileName;
if (TFileStatus(fp).doesExist()) {
QSettings settings(toQString(fp), QSettings::IniFormat);
// find the current safearea name from the list
QStringList groups = settings.childGroups();
for (int g = 0; g < groups.size(); g++) {
settings.beginGroup(groups.at(g));
nameList.push_back(settings.value("name", "").toString());
settings.endGroup();
}
}
}
示例5: TSystemException
/*! to retrieve the both lists with groupFrames option = on and off.
*/
void TSystem::readDirectory(TFilePathSet &groupFpSet, TFilePathSet &allFpSet,
const TFilePath &path) {
if (!TFileStatus(path).isDirectory())
throw TSystemException(path, " is not a directory");
std::set<TFilePath, CaselessFilepathLess> fileSet_group;
std::set<TFilePath, CaselessFilepathLess> fileSet_all;
QStringList fil =
QDir(toQString(path))
.entryList(QDir::Files | QDir::NoDotAndDotDot | QDir::Readable);
if (fil.size() == 0) return;
for (int i = 0; i < fil.size(); i++) {
QString fi = fil.at(i);
TFilePath son = path + TFilePath(fi.toStdWString());
// store all file paths
fileSet_all.insert(son);
// in case of the sequencial files
if (son.getDots() == "..") son = son.withFrame();
// store the group. insersion avoids duplication of the item
fileSet_group.insert(son);
}
groupFpSet.insert(groupFpSet.end(), fileSet_group.begin(),
fileSet_group.end());
allFpSet.insert(allFpSet.end(), fileSet_all.begin(), fileSet_all.end());
}
示例6: refresh
void refresh() override {
TDoubleKeyframe kf;
TDoubleParam *curve = getCurve();
if (curve) kf = curve->getKeyframeAt(getR0());
if (curve && kf.m_isKeyframe) {
TFilePath path;
int fieldIndex = 0;
std::string unitName = "";
if (kf.m_type == TDoubleKeyframe::File) {
path = kf.m_fileParams.m_path;
fieldIndex = kf.m_fileParams.m_fieldIndex;
if (fieldIndex < 0) fieldIndex = 0;
unitName = kf.m_unitName;
if (unitName == "") {
TMeasure *measure = curve->getMeasure();
if (measure) {
const TUnit *unit = measure->getCurrentUnit();
if (unit) unitName = ::to_string(unit->getDefaultExtension());
}
}
}
m_fileFld->setPath(QString::fromStdWString(path.getWideString()));
m_fieldIndexFld->setText(QString::number(fieldIndex + 1));
m_measureFld->setText(QString::fromStdString(unitName));
}
}
示例7: QDrag
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();
}
示例8: match
bool TFilePath::match(const TFilePath &fp) const
{
return getParentDir() == fp.getParentDir() &&
getName() == fp.getName() &&
getFrame() == fp.getFrame() &&
getType() == fp.getType();
}
示例9: ProjectDvDirModelSpecialFileFolderNode
void ProjectDvDirModelRootNode::refreshChildren() {
m_childrenValid = true;
if (m_children.empty()) {
TProjectManager *pm = TProjectManager::instance();
std::vector<TFilePath> projectRoots;
pm->getProjectRoots(projectRoots);
int i;
for (i = 0; i < (int)projectRoots.size(); i++) {
TFilePath projectRoot = projectRoots[i];
std::wstring rootDir = projectRoot.getWideString();
ProjectDvDirModelSpecialFileFolderNode *projectRootNode =
new ProjectDvDirModelSpecialFileFolderNode(
this, L"Project root (" + rootDir + L")", projectRoot);
projectRootNode->setPixmap(svgToPixmap(":Resources/projects.svg"));
addChild(projectRootNode);
}
// SVN Repository
QList<SVNRepository> repositories =
VersionControl::instance()->getRepositories();
int count = repositories.size();
for (int i = 0; i < count; i++) {
SVNRepository repo = repositories.at(i);
ProjectDvDirModelSpecialFileFolderNode *node =
new ProjectDvDirModelSpecialFileFolderNode(
this, repo.m_name.toStdWString(),
TFilePath(repo.m_localPath.toStdWString()));
node->setPixmap(svgToPixmap(":Resources/vcroot.svg"));
addChild(node);
}
}
}
示例10: execute
bool execute()
{
TFilePath fp;
QString fileName = "helloworld.qs";
QFile scriptFile(QString::fromStdWString(fp.getWideString()));
if (!scriptFile.open(QIODevice::ReadOnly)) {
DVGui::MsgBox(DVGui::WARNING, QObject::tr("File not found"));
return false;
} else {
QTextStream stream(&scriptFile);
QString contents = stream.readAll();
scriptFile.close();
QScriptEngine myEngine;
QScriptEngineDebugger debugger;
debugger.attachTo(&myEngine);
QScriptValue fFoo = myEngine.newFunction(foo);
QScriptValue fGetLevel = myEngine.newFunction(getLevel);
myEngine.globalObject().setProperty("foo", fFoo);
myEngine.globalObject().setProperty("getLevel", fGetLevel);
debugger.action(QScriptEngineDebugger::InterruptAction)->trigger();
myEngine.evaluate(contents, fileName);
}
return true;
}
示例11: QVariant
void MagpieFileImportPopup::showEvent(QShowEvent *)
{
if (m_info == 0)
return;
int frameCount = m_info->getFrameCount();
m_fromField->setRange(1, frameCount);
m_fromField->setValue(1);
m_toField->setRange(1, frameCount);
m_toField->setValue(frameCount);
int i;
QList<QString> actsIdentifier = m_info->getActsIdentifier();
for (i = 0; i < m_actFields.size(); i++) {
IntLineEdit *field = m_actFields.at(i).second;
QLabel *label = m_actFields.at(i).first;
if (i >= actsIdentifier.size()) {
field->hide();
label->hide();
continue;
}
QString act = actsIdentifier.at(i);
field->setProperty("act", QVariant(act));
field->show();
label->setText(act);
label->show();
}
QString oldLevelPath = m_levelField->getPath();
TFilePath oldFilePath(oldLevelPath.toStdWString());
TFilePath perntDir = oldFilePath.getParentDir();
m_levelField->setPath(QString::fromStdWString(perntDir.getWideString()));
}
示例12: getAbsolutePath
inline static TFilePath getAbsolutePath(const TFilePath &file,
const TFilePath &relTo) {
QDir relToDir(
QString::fromStdWString(relTo.getParentDir().getWideString()));
QString absFileStr(relToDir.absoluteFilePath(
QString::fromStdWString(file.getWideString())));
return TFilePath(absFileStr.toStdWString());
}
示例13: 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");
}
示例14: getRelativePath
inline static TFilePath getRelativePath(const TFilePath &file,
const TFilePath &relTo) {
QDir relToDir(
QString::fromStdWString(relTo.getParentDir().getWideString()));
QString relFileStr(relToDir.relativeFilePath(
QString::fromStdWString(file.getWideString())));
return TFilePath(relFileStr.toStdWString());
}
示例15: getPath
TFilePath CleanupParameters::getPath(ToonzScene *scene) const
{
if (m_path == TFilePath()) {
int levelType = (m_lineProcessingMode != lpNone) ? TZP_XSHLEVEL : OVL_XSHLEVEL;
TFilePath fp = scene->getDefaultLevelPath(levelType);
return fp.getParentDir();
} else
return scene->decodeSavePath(m_path);
}