当前位置: 首页>>代码示例>>C++>>正文


C++ TFilePath类代码示例

本文整理汇总了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;
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:25,代码来源:insertfxpopup.cpp

示例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 (...) {
	}
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:25,代码来源:insertfxpopup.cpp

示例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;
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:10,代码来源:studiopalettecmd.cpp

示例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();
    }
  }
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:25,代码来源:pane.cpp

示例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());
}
开发者ID:SaierMe,项目名称:opentoonz,代码行数:35,代码来源:tsystem.cpp

示例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));
   }
 }
开发者ID:janisozaur,项目名称:opentoonz,代码行数:26,代码来源:functionsegmentviewer.cpp

示例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();
}
开发者ID:jcome,项目名称:opentoonz,代码行数:25,代码来源:studiopaletteviewer.cpp

示例8: match

bool TFilePath::match(const TFilePath &fp) const
{
	return getParentDir() == fp.getParentDir() &&
		   getName() == fp.getName() &&
		   getFrame() == fp.getFrame() &&
		   getType() == fp.getType();
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:7,代码来源:tfilepath.cpp

示例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);
    }
  }
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:34,代码来源:projectpopup.cpp

示例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;
	}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:26,代码来源:scriptengine.cpp

示例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()));
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:32,代码来源:magpiefileimportpopup.cpp

示例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());
 }
开发者ID:SaierMe,项目名称:opentoonz,代码行数:8,代码来源:shaderinterface.cpp

示例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");
}
开发者ID:jcome,项目名称:opentoonz,代码行数:8,代码来源:gutil.cpp

示例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());
 }
开发者ID:SaierMe,项目名称:opentoonz,代码行数:8,代码来源:shaderinterface.cpp

示例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);
}
开发者ID:JosefMeixner,项目名称:opentoonz,代码行数:9,代码来源:cleanupparameters.cpp


注:本文中的TFilePath类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。