Example #1
0
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;
}
Example #2
0
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 (...) {
	}
}
Example #3
0
void InsertFxPopup::contextMenuEvent(QContextMenuEvent *event)
{
	QTreeWidgetItem *item = m_fxTree->currentItem();
	QString itemRole = item->data(0, Qt::UserRole).toString();

	TFilePath path = TFilePath(itemRole.toStdWString());
	if (TFileStatus(path).doesExist() && TFileStatus(path.getParentDir()).isDirectory()) {
		QMenu *menu = new QMenu(this);
		std::string folder = path.getParentDir().getName();
		if (folder == "macroFx") //Menu' macro
		{
			QAction *remove = new QAction(tr("Remove Macro FX"), menu);
			connect(remove, SIGNAL(triggered()), this, SLOT(removePreset()));
			menu->addAction(remove);
		} else //Verifico se devo caricare un preset
		{
			folder = path.getParentDir().getParentDir().getName();
			if (folder == "presets") //Menu' preset
			{
				QAction *remove = new QAction(tr("Remove Preset"), menu);
				connect(remove, SIGNAL(triggered()), this, SLOT(removePreset()));
				menu->addAction(remove);
			}
		}
		menu->exec(event->globalPos());
	}
}
/*! 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;
}
Example #5
0
TFx *InsertFxPopup::createFx()
{
	TApp *app = TApp::instance();
	ToonzScene *scene = app->getCurrentScene()->getScene();
	TXsheet *xsh = scene->getXsheet();

	QTreeWidgetItem *item = m_fxTree->currentItem();
	QString text = item->data(0, Qt::UserRole).toString();

	if (text.isEmpty())
		return 0;

	TFx *fx;

	TFilePath path = TFilePath(text.toStdWString());

	if (TFileStatus(path).doesExist() && TFileStatus(path.getParentDir()).isDirectory()) {
		std::string folder = path.getParentDir().getName();
		if (folder == "macroFx") //Devo caricare una macro
			fx = createMacroFxByPath(path);
		else //Verifico se devo caricare un preset
		{
			folder = path.getParentDir().getParentDir().getName();
			if (folder == "presets") //Devo caricare un preset
				fx = createPresetFxByName(path);
		}
	} else
		fx = createFxByName(text.toStdString());

	if (fx)
		return fx;
	else
		return 0;
}
Example #6
0
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();
    }
  }
}
Example #7
0
/*! 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());
}
 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));
   }
 }
Example #9
0
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();
}
Example #10
0
bool TFilePath::match(const TFilePath &fp) const
{
	return getParentDir() == fp.getParentDir() &&
		   getName() == fp.getName() &&
		   getFrame() == fp.getFrame() &&
		   getType() == fp.getType();
}
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);
    }
  }
}
	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;
	}
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()));
}
Example #14
0
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();
}
Example #15
0
 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());
 }
Example #16
0
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");
}
Example #17
0
 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());
 }
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);
}
Example #19
0
void TSystem::hideFile(const TFilePath &fp) {
#ifdef _WIN32
  if (!SetFileAttributesW(fp.getWideString().c_str(), FILE_ATTRIBUTE_HIDDEN))
    throw TSystemException(fp, "can't hide file!");
#else  // MACOSX, and others
  TSystem::renameFile(TFilePath(fp.getParentDir() + L"." + fp.getLevelNameW()),
                      fp);
#endif
}
std::wstring OverwriteDialog::execute(ToonzScene *scene, const TFilePath &srcLevelPath, bool multiload)
{
	TFilePath levelPath = srcLevelPath;
	TFilePath actualLevelPath = scene->decodeFilePath(levelPath);
	if (!TSystem::doesExistFileOrLevel(actualLevelPath))
		return levelPath.getWideName();

	if (m_applyToAll && m_choice == RENAME) {
		levelPath = addSuffix(levelPath);
		actualLevelPath = scene->decodeFilePath(levelPath);
	}
	if (m_applyToAll) {
		if (m_choice != RENAME || !TSystem::doesExistFileOrLevel(actualLevelPath))
			return levelPath.getWideName();
	}

	m_label->setText(tr("File %1 already exists.\nWhat do you want to do?").arg(toQString(levelPath)));
	// find a compatible suffix
	if (TSystem::doesExistFileOrLevel(actualLevelPath)) {
		int i = 0;
		while (TSystem::doesExistFileOrLevel(scene->decodeFilePath(addSuffix(srcLevelPath)))) {
			m_suffix->setText("_" + QString::number(++i));
		}
	}

	if (multiload)
		m_okToAllBtn->show();
	else
		m_okToAllBtn->hide();

	// there could be a WaitCursor cursor
	QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
	raise();
	exec();
	QApplication::restoreOverrideCursor();

	if (m_rename->isChecked()) {
		if (m_suffix->text() == "") {
			MsgBox(WARNING, tr("The suffix field is empty. Please specify a suffix."));
			return execute(scene, srcLevelPath, multiload);
		}
		levelPath = addSuffix(srcLevelPath);
		actualLevelPath = scene->decodeFilePath(levelPath);
		if (TSystem::doesExistFileOrLevel(actualLevelPath)) {
			MsgBox(WARNING, tr("File %1 exists as well; please choose a different suffix.").arg(toQString(levelPath)));
			return execute(scene, srcLevelPath, multiload);
		}
		m_choice = RENAME;
	} else if (m_overwrite->isChecked())
		m_choice = OVERWRITE;
	else {
		assert(m_keep->isChecked());
		m_choice = KEEP_OLD;
	}

	return levelPath.getWideName();
}
Example #21
0
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;
}
Example #22
0
void CastTreeViewer::onItemChanged(QTreeWidgetItem *item, int column) {
  if (column != 0) return;
  if (item->isSelected()) {
    TFilePath oldPath(item->data(1, Qt::DisplayRole).toString().toStdWString());
    TFilePath newPath =
        getLevelSet()->renameFolder(oldPath, item->text(0).toStdWString());
    item->setText(1, QString::fromStdWString(newPath.getWideString()));
  }
}
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);
}
Example #24
0
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;
}
Example #25
0
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);
}
void makeScreenSaver(
	TFilePath scrFn,
	TFilePath swfFn,
	std::string screenSaverName)
{
	struct _stat results;
	if (_wstat(swfFn.getWideString().c_str(), &results) != 0)
		throw TException(L"Can't stat file " + swfFn.getWideString());

	int swfSize = results.st_size;
	std::auto_ptr<char> swf(new char[swfSize]);
	FILE *chan = _wfopen(swfFn.getWideString().c_str(), L"rb");
	if (!chan)
		throw TException(L"fopen failed on " + swfFn.getWideString());
	fread(swf.get(), swfSize, 1, chan);
	fclose(chan);

	TFilePath svscrn = TSystem::getBinDir() + "screensaver.dat";
	if (!TFileStatus(svscrn).doesExist()) {
		throw TException(
			std::wstring(L"Screensaver template not found: ") +
			svscrn.getWideString());
	}
	TSystem::copyFile(scrFn, svscrn);
	HANDLE hUpdateRes =
		BeginUpdateResourceW(scrFn.getWideString().c_str(), FALSE);
	if (hUpdateRes == NULL)
		throw TException(L"can't write " + scrFn.getWideString());

	BOOL result = UpdateResource(
		hUpdateRes,
		"FLASHFILE",
		MAKEINTRESOURCE(101),
		MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
		swf.get(),
		swfSize);
	if (result == FALSE)
		throw TException(L"can't add resource to " + scrFn.getWideString());
	/*
  result = UpdateResource(
     hUpdateRes,      
     RT_STRING,  
     MAKEINTRESOURCE(1),                  
     MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),  
     (void*)screenSaverName.c_str(),                   
     screenSaverName.size());

  if (result == FALSE) 
    throw TException(L"can't add name to "+scrFn.getWideString());
 */

	if (!EndUpdateResource(hUpdateRes, FALSE))
		throw TException(L"Couldn't write " + scrFn.getWideString());
}
Example #27
0
void TLevelSet::removeFolder(const TFilePath &folder) {
  if (folder == m_defaultFolder) return;
  std::vector<TFilePath> folders;
  for (int i = 0; i < (int)m_folders.size(); i++)
    if (!folder.isAncestorOf(m_folders[i])) folders.push_back(m_folders[i]);
  folders.swap(m_folders);
  std::map<TXshLevel *, TFilePath>::iterator it;
  for (it = m_folderTable.begin(); it != m_folderTable.end(); ++it) {
    if (folder.isAncestorOf(it->second)) it->second = m_defaultFolder;
  }
}
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;
  }
}
Example #29
0
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;
}
Example #30
0
void CastTreeViewer::onCastFolderAdded(const TFilePath &path)
{
	QTreeWidgetItem *root = topLevelItem(0)->child(0);
	assert(root->data(1, Qt::DisplayRole).toString() == toQString(getLevelSet()->getDefaultFolder()));
	QString childName = QString::fromStdWString(path.getWideName());
	QString childPathQstr = QString::fromStdWString(path.getWideString());
	QTreeWidgetItem *childItem = new QTreeWidgetItem(root, QStringList(childName) << childPathQstr);
	childItem->setFlags(childItem->flags() | Qt::ItemIsEditable);
	root->addChild(childItem);
	setCurrentItem(childItem);
}