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


C++ TFilePath::isEmpty方法代码示例

本文整理汇总了C++中TFilePath::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ TFilePath::isEmpty方法的具体用法?C++ TFilePath::isEmpty怎么用?C++ TFilePath::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TFilePath的用法示例。


在下文中一共展示了TFilePath::isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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

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

示例3: eraseUncompatibleExistingLevel

		static void eraseUncompatibleExistingLevel(const TFilePath &fp, const TDimension &imageSize) // nothrow
		{
			assert(!fp.isEmpty());

			if (TSystem::doesExistFileOrLevel(fp)) {
				bool remove = false;

				// In case the raster specifics are different from those of a currently
				// existing movie, erase it
				try {
					TLevelReaderP lr(fp);
					lr->loadInfo();

					const TImageInfo *info = lr->getImageInfo();
					if (!info || info->m_lx != imageSize.lx || info->m_ly != imageSize.ly)
						TSystem::removeFileOrLevel(fp); // nothrow
				} catch (...) {
					// Same if the level could not be read/opened
					TSystem::removeFileOrLevel(fp); // nothrow
				}

				// NOTE: The level removal procedure could still fail.
				// In this case, no signaling takes place. The level readers will throw
				// when the time to write on the file comes, leading to a render failure.
			}
		}
开发者ID:titer1,项目名称:opentoonz,代码行数:26,代码来源:movierenderer.cpp

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

示例5: dropEvent

void StudioPaletteTreeViewer::dropEvent(QDropEvent *event) {
  TFilePath newPath = getItemPath(m_dropItem);

  resetDropItem();

  if (newPath.isEmpty()) return;

  const QMimeData *mimeData      = event->mimeData();
  const PaletteData *paletteData = dynamic_cast<const PaletteData *>(mimeData);
  if (paletteData) {
    if (paletteData->hasOnlyPalette()) {
      TPalette *palette = paletteData->getPalette();
      if (!palette) return;

      try {
        StudioPaletteCmd::createPalette(
            newPath, ::to_string(palette->getPaletteName()), palette);
      } catch (TException &e) {
        error("Can't create palette: " +
              QString(::to_string(e.getMessage()).c_str()));
      } catch (...) {
        error("Can't create palette");
      }
    }
    return;
  }

  if (!mimeData->hasUrls() || mimeData->urls().size() == 0) return;

  QList<QUrl> urls = mimeData->urls();
  TUndoManager::manager()->beginBlock();
  int i;
  for (i = 0; i < urls.size(); i++) {
    QUrl url       = urls[i];
    TFilePath path = TFilePath(url.toLocalFile().toStdWString());

    StudioPalette *studioPalette = StudioPalette::instance();
    if (path == newPath || path.getParentDir() == newPath) continue;

    if (isInStudioPalette(path)) {
      TFilePath newPalettePath =
          newPath +
          TFilePath(path.getWideName() + ::to_wstring(path.getDottedType()));
      try {
        StudioPaletteCmd::movePalette(newPalettePath, path);
      } catch (TException &e) {
        error("Can't rename palette: " +
              QString(::to_string(e.getMessage()).c_str()));
      } catch (...) {
        error("Can't rename palette");
      }
    }
  }
  TUndoManager::manager()->endBlock();
  event->setDropAction(Qt::CopyAction);
  event->accept();
}
开发者ID:jcome,项目名称:opentoonz,代码行数:57,代码来源:studiopaletteviewer.cpp

示例6: decode

TFilePath TFilePath::decode(const std::map<string, string> &dictionary) const {
  TFilePath parent   = getParentDir();
  TFilePath filename = withParentDir("");
  std::map<string, string>::const_iterator it =
      dictionary.find(filename.getFullPath());
  if (it != dictionary.end()) filename = TFilePath(it->second);
  if (parent.isEmpty())
    return filename;
  else
    return parent.decode(dictionary) + filename;
}
开发者ID:walkerka,项目名称:opentoonz,代码行数:11,代码来源:tfilepath.cpp

示例7: refreshItem

void StudioPaletteTreeViewer::refreshItem(QTreeWidgetItem *item) {
  TFilePath folderPath = getItemPath(item);
  assert(folderPath != TFilePath());
  // correct only tpl files and folders
  std::vector<TFilePath> childrenPath;
  StudioPalette::instance()->getChildren(childrenPath, folderPath);
  int currentChildCount = item->childCount();
  std::vector<QTreeWidgetItem *> currentChildren;
  int i;
  for (i = 0; i < currentChildCount; i++)
    currentChildren.push_back(item->child(i));

  int childrenPathCount = childrenPath.size();
  int itemIndex         = 0;
  int pathIndex         = 0;
  while (itemIndex < currentChildCount || pathIndex < childrenPathCount) {
    TFilePath path =
        (pathIndex < childrenPathCount) ? childrenPath[pathIndex] : TFilePath();

    QTreeWidgetItem *currentItem =
        (itemIndex < currentChildCount) ? currentChildren[itemIndex] : 0;
    TFilePath currentItemPath = getItemPath(currentItem);

    if (path == currentItemPath) {
      itemIndex++;
      pathIndex++;
    } else if ((!path.isEmpty() && path < currentItemPath) ||
               currentItemPath.isEmpty()) {
      currentItem = createItem(path);
      item->insertChild(itemIndex, currentItem);
      itemIndex++;
      pathIndex++;
    } else {
      assert(currentItemPath < path || path.isEmpty());
      assert(currentItem);
      item->removeChild(currentItem);
      itemIndex++;
    }
  }
  m_openedItems.insert(item);
}
开发者ID:jcome,项目名称:opentoonz,代码行数:41,代码来源:studiopaletteviewer.cpp

示例8:

MovieRenderer::Imp::Imp(ToonzScene *scene,
						const TFilePath &moviePath,
						int threadCount,
						bool cacheResults)
	: m_scene(scene), m_renderer(threadCount), m_fp(moviePath), m_frameSize(scene->getCurrentCamera()->getRes()), m_xDpi(72), m_yDpi(72), m_renderSessionId(RenderSessionId++), m_nextFrameIdxToSave(0), m_savingThreadsCount(0), m_whiteSample(0), m_firstCompletedRaster(true) //< I know, sounds weird - it's just set to false
	  ,
	  m_failure(false) //  AFTER the first completed raster gets processed
	  ,
	  m_cacheResults(cacheResults), m_preview(moviePath.isEmpty()), m_movieType(isMovieType(moviePath))
{
	m_renderCacheId = m_fp.withName(m_fp.getName() + "#RENDERID" + QString::number(m_renderSessionId).toStdString())
						  .getLevelName();

	m_renderer.addPort(this);
}
开发者ID:titer1,项目名称:opentoonz,代码行数:15,代码来源:movierenderer.cpp

示例9: save

void TCacheResource::save(const TFilePath &fp)
{
	assert(!fp.isEmpty());

	std::map<PointLess, CellData>::iterator it;
	for (it = m_cellDatas.begin(); it != m_cellDatas.end(); ++it) {
		TRasterP cellRas = getRaster(TImageCache::instance()->get(
			getCellCacheId(it->first.x, it->first.y), false));

		assert(m_tileType != NONE);

		TFilePath cellFp(fp + TFilePath(getCellName(it->first.x, it->first.y)));

		if (m_tileType == CM32)
			::saveCompressed(cellFp, cellRas);
		else
			TImageWriter::save(cellFp.withType(".tif"), cellRas);
	}
}
开发者ID:GREYFOXRGR,项目名称:opentoonz,代码行数:19,代码来源:tcacheresource.cpp

示例10: onItemChanged

void StudioPaletteTreeViewer::onItemChanged(QTreeWidgetItem *item, int column) {
  if (item != currentItem() || isRootItem(item)) return;
  wstring name      = item->text(column).toStdWString();
  TFilePath oldPath = getCurrentFolderPath();
  if (oldPath.isEmpty() || name.empty() || oldPath.getWideName() == name)
    return;
  TFilePath newPath(oldPath.getParentDir() +
                    TFilePath(name + ::to_wstring(oldPath.getDottedType())));
  try {
    StudioPaletteCmd::movePalette(newPath, oldPath);
  } catch (TException &e) {
    error(QString(::to_string(e.getMessage()).c_str()));
    item->setText(column, QString::fromStdWString(oldPath.getWideName()));
  } catch (...) {
    error("Can't rename file");
    item->setText(column, QString::fromStdWString(oldPath.getWideName()));
  }
  refreshItem(getItem(oldPath.getParentDir()));
  setCurrentItem(getItem(newPath));
}
开发者ID:jcome,项目名称:opentoonz,代码行数:20,代码来源:studiopaletteviewer.cpp

示例11: getControllerData

void TFarmStuff::getControllerData(QString &hostName, QString &ipAddr,
                                   int &port) {
  ControllerData data;

  TFilePath groot   = getGlobalRoot();
  QString grootpath = QString::fromStdWString(groot.getWideString());

  if (groot.isEmpty() || grootpath == " ")
    throw TFarmStuff::TMissingGRootEnvironmentVariable();

  bool fileExists = false;
  TFileStatus fs(groot);
  fileExists = fs.doesExist();
  if (!fileExists) throw TFarmStuff::TMissingGRootFolder();

  TFilePath fp = groot + "config" + "controller.txt";
  ::loadControllerData(fp, data);

  hostName = data.m_hostName;
  ipAddr   = data.m_ipAddress;
  port     = data.m_port;
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:22,代码来源:tfarmstuff.cpp

示例12: browseDirectory

/*
"Save In"
フィールドのためのFileField。browseDirectoryを再実装して、フィールドが空欄のときは、
カレントレベル(Scan画像。TIF等)の入っているフォルダの1つ上をデフォルトフォルダにして開くようにしたい。
*/
void CleanupSaveInField::browseDirectory() {
  if (!m_fileBrowseButton->hasFocus()) return;
  QString directory = QString();

  if (!m_browserPopupController) return;

  /*
  ここで、m_lastSelectedPathが空のとき、カレントレベルがScan画像の場合、
  そのファイルの入っているフォルダの1つ上のフォルダを初期フォルダにする
  */
  QString initialFolder = m_lastSelectedPath;
  if (initialFolder.isEmpty()) {
    /*--- 親Widgetを取得する ---*/
    CleanupSettingsPane *parentCSP =
        dynamic_cast<CleanupSettingsPane *>(parentWidget());
    if (parentCSP) {
      TFilePath lastSelectedPath = parentCSP->getLastSelectedPath();
      if (!lastSelectedPath.isEmpty()) {
        /*----
         * 親Widgetのm_lastSelectedPathが、CLNファイルの見込み所在地なので、その1つ上のフォルダを初期フォルダにする。---*/
        initialFolder = QString::fromStdWString(
            lastSelectedPath.getParentDir().getParentDir().getWideString());
      }
    }
  }

  m_browserPopupController->openPopup(QStringList(), true, initialFolder);
  if (m_browserPopupController->isExecute())
    directory = m_browserPopupController->getPath();

  if (!directory.isEmpty()) {
    setPath(directory);
    m_lastSelectedPath = directory;
    emit pathChanged();
    return;
  }
}
开发者ID:luc--,项目名称:opentoonz,代码行数:42,代码来源:cleanupsettingspane.cpp

示例13: pathString

QString CleanupTab::pathString(const TFilePath &path, bool lpNone)
{
	return path.isEmpty() ? lpNone ? QString("+extras") : QString("+drawings") : toQString(path);
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:4,代码来源:cleanupsettingspopup.cpp

示例14: save

/*! Saves the project in the specified path.
        The TfilePath fp must be an absolute path. The project is saved as a xml
   file.\n
        Uses TProjectManager and TOStream.
        \note Exceptions can be thrown.
        \see TProjectManager and TOStream.
*/
bool TProject::save(const TFilePath &projectPath) {
  assert(isAProjectPath(projectPath));

  TProjectManager *pm     = TProjectManager::instance();
  m_name                  = pm->projectPathToProjectName(projectPath);
  m_path                  = getLatestVersionProjectPath(projectPath);
  TFilePath projectFolder = projectPath.getParentDir();

  if (!TFileStatus(projectFolder).doesExist()) {
    try {
      TSystem::mkDir(projectFolder);
    } catch (...) {
      return false;
    }
  }

  TFilePath sceneFolder    = decode(getFolder(TProject::Scenes));
  TFilePath scenesDescPath = sceneFolder + "scenes.xml";

  TFileStatus fs(projectPath);
  if (fs.doesExist() && !fs.isWritable()) {
    throw TSystemException(
        projectPath,
        "Cannot save the project settings. The file is read-only.");
    return false;
  }
  TFileStatus fs2(scenesDescPath);
  if (fs2.doesExist() && !fs2.isWritable()) {
    throw TSystemException(
        projectPath,
        "Cannot save the project settings. The scenes file is read-only.");
    return false;
  }

  TOStream os(m_path);
  os.openChild("project");
  os.openChild("version");
  os << 70 << 1;    // Standard version signature:
  os.closeChild();  //   <Major Toonz version number * 10>.<Major version
                    //   advancement>
  os.openChild("folders");
  int i = 0;
  for (i = 0; i < getFolderCount(); i++) {
    TFilePath folderRelativePath = getFolder(i);
    if (folderRelativePath == TFilePath()) continue;
    std::map<std::string, string> attr;
    string folderName = getFolderName(i);
    attr["name"]      = folderName;
    attr["path"]      = ::to_string(folderRelativePath);  // escape()
    if (getUseScenePath(folderName)) attr["useScenePath"] = "yes";
    os.openCloseChild("folder", attr);
  }
  os.closeChild();

  os.openChild("sceneProperties");
  getSceneProperties().saveData(os);
  os.closeChild();
  os.closeChild();

  // crea (se necessario) le directory relative ai vari folder
  for (i = 0; i < getFolderCount(); i++)
    if (isConstantFolder(i)) {
      TFilePath fp = getFolder(i);
      if (fp == TFilePath()) continue;
      fp = decode(fp);
      // if(!fp.isAbsolute()) fp = projectFolder + fp;
      if (!TFileStatus(fp).doesExist()) {
        try {
          TSystem::mkDir(fp);
        } catch (...) {
        }
      }
    }

  /*-- +scenes だけでなく、全てのProject Folderにscenes.xmlを生成する --*/
  std::vector<std::string> foldernames;
  pm->getFolderNames(foldernames);
  for (int f = 0; f < foldernames.size(); f++) {
    TFilePath folderpath = decode(getFolder(foldernames.at(f)));
    if (folderpath.isEmpty() || !isConstantFolder(f)) continue;

    TFilePath xmlPath = folderpath + "scenes.xml";
    TFileStatus xmlfs(xmlPath);
    if (xmlfs.doesExist() && !xmlfs.isWritable()) continue;

    TFilePath relativeProjectFolder =
        makeRelative(folderpath, m_path.getParentDir());

    TOStream os2(xmlPath);
    std::map<std::string, string> attr;
    attr["type"] = "projectFolder";
    os2.openChild("parentProject", attr);
    os2 << relativeProjectFolder;
//.........这里部分代码省略.........
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:101,代码来源:tproject.cpp

示例15: main


//.........这里部分代码省略.........

	splash.showMessage(offsetStr + "Loading styles ...", Qt::AlignCenter, Qt::white);
	a.processEvents();

	// stile
	QApplication::setStyle("windows");

	IconGenerator::setFilmstripIconSize(Preferences::instance()->getIconSize());

	splash.showMessage(offsetStr + "Loading shaders ...", Qt::AlignCenter, Qt::white);
	a.processEvents();

	loadShaderInterfaces(ToonzFolder::getLibraryFolder() + TFilePath("shaders"));

	splash.showMessage(offsetStr + "Initializing Toonz application ...", Qt::AlignCenter, Qt::white);
	a.processEvents();

	TTool::setApplication(TApp::instance());
	TApp::instance()->init();

//iwsw commented out temporarily
#if 0 
  QStringList monitorNames;
  /*-- 接続モニタがPVM-2541の場合のみLUTを読み込む --*/
  if (Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled())
  {
	  /*-- 接続モニタがPVM-2541の場合のみLUTを読み込む --*/
	  monitorNames = Ghibli3DLutUtil::getMonitorName();
	  if (monitorNames.contains(QString::fromStdWString(L"PVM-2541")))
		  /*-- 3DLUTファイルを読み込む --*/
		  Ghibli3DLutUtil::loadLutFile(Preferences::instance()->get3DLutPath());
  }
  /*-- 接続モニタをスプラッシュ画面にも表示 --*/
  if (!monitorNames.isEmpty())
  {
	  lastUpdateStr += QString("Monitor Name : ");
	  for (int mn = 0; mn < monitorNames.size(); mn++)
	  {
		  if (mn != 0)
			  lastUpdateStr += QString(", ");
		  lastUpdateStr += monitorNames.at(mn);
	  }
	  lastUpdateStr += QString("\n");
  }
#endif

	splash.showMessage(offsetStr + "Loading Plugins...", Qt::AlignCenter, Qt::white);
	a.processEvents();
	/* poll the thread ends: 
	 絶対に必要なわけではないが PluginLoader は中で setup ハンドラが常に固有のスレッドで呼ばれるよう main thread queue の blocking をしているので
	 processEvents を行う必要がある
   */
	while (!PluginLoader::load_entries("")) {
		a.processEvents();
	}

	splash.showMessage(offsetStr + "Creating main window ...", Qt::AlignCenter, Qt::white);
	a.processEvents();

	/*-- Layoutファイル名をMainWindowのctorに渡す --*/
	MainWindow w(argumentLayoutFileName);

	splash.showMessage(offsetStr + "Loading style sheet ...", Qt::AlignCenter, Qt::white);
	a.processEvents();

	// Carico lo styleSheet
开发者ID:JosefMeixner,项目名称:opentoonz,代码行数:67,代码来源:main.cpp


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