JError
JDirInfo::GoTo
	(
	const JCharacter* origDirName
	)
{
	JString dirName;
	if (JStringEmpty(origDirName) ||
		!JConvertToAbsolutePath(origDirName, NULL, &dirName))
		{
		return JBadPath(origDirName);
		}

	if (JSameDirEntry(dirName, *itsCWD))
		{
		Update();
		return JNoError();
		}
	JAppendDirSeparator(&dirName);

	const JString origCWD = *itsCWD;

	*itsCWD = dirName;
	const JError err = BuildInfo();
	if (err.OK())
		{
		Broadcast(PathChanged());
		}
	else
		{
		*itsCWD = origCWD;
		}

	return err;
}
示例#2
0
void GameTracker::UpdateDirectory(const QString& dir)
{
  QDirIterator it(dir, game_filters, QDir::NoFilter, QDirIterator::Subdirectories);
  while (it.hasNext())
  {
    QString path = QFileInfo(it.next()).canonicalFilePath();

    if (m_tracked_files.contains(path))
    {
      auto& tracked_file = m_tracked_files[path];
      if (!tracked_file.contains(dir))
        tracked_file.insert(dir);
    }
    else
    {
      addPath(path);
      m_tracked_files[path] = QSet<QString>{dir};
      emit PathChanged(path);
    }
  }

  for (const auto& missing : FindMissingFiles(dir))
  {
    auto& tracked_file = m_tracked_files[missing];

    tracked_file.remove(dir);
    if (tracked_file.empty())
    {
      m_tracked_files.remove(missing);
      GameRemoved(missing);
    }
  }
}
示例#3
0
void GPXMapPathRow::BrowseDone(kGUIFileReq *result,int pressed)
{
	if(pressed==MSGBOX_OK)
	{
		m_path.SetString(result->GetPath());
		PathChanged();
	}
}
示例#4
0
void FileView::ChangeFilePathWithoutUndo(const QString& new_path) {
  ui_->list->setRootIndex(model_->setRootPath(new_path));
  ui_->path->setText(QDir::toNativeSeparators(new_path));

  QDir dir(new_path);
  ui_->up->setEnabled(dir.cdUp());

  emit PathChanged(new_path);
}
示例#5
0
//---------------------------------------------------------------------------------------------------------------------
void VisToolSplinePath::RefreshGeometry()
{
    if (path.CountPoint() > 0)
    {
        QVector<VSplinePoint> pathPoints = path.GetSplinePath();
        if (path.CountPoint() == 1)
        {
            QGraphicsEllipseItem *point = this->getPoint(0);
            DrawPoint(point, pathPoints.at(0).P().toQPointF(), supportColor);

            if (mode == Mode::Creation)
            {
                QLineF sceneLine = QLineF(pathPoints.at(0).P().toQPointF(), Visualization::scenePos);
                DrawLine(line, sceneLine, mainColor, lineStyle);

                path[0].SetAngle2(sceneLine.angle());
                emit PathChanged(path);
            }
        }
        else
        {
            for (int i = 0; i < pathPoints.size(); ++i)
            {
                QGraphicsEllipseItem *point = this->getPoint(static_cast<unsigned>(i));
                DrawPoint(point, pathPoints.at(i).P().toQPointF(), supportColor);
            }

            if (mode == Mode::Creation)
            {
                QLineF sceneLine = QLineF(pathPoints.at(pathPoints.size() - 1).P().toQPointF(),
                                          Visualization::scenePos);
                DrawLine(line, sceneLine, mainColor, lineStyle);

                path[pathPoints.size() - 1].SetAngle2(sceneLine.angle());
                emit PathChanged(path);
            }

            DrawPath(this, path.GetPath(PathDirection::Show), mainColor, Qt::SolidLine, Qt::RoundCap);
        }
        Visualization::toolTip = QString(tr("<b>Curve path</b>: <b>Enter</b> - finish creation"));
    }
}
示例#6
0
void GameTracker::UpdateFile(const QString& file)
{
  if (QFileInfo(file).exists())
  {
    emit PathChanged(file);
  }
  else if (removePath(file))
  {
    m_tracked_files.remove(file);
    emit GameRemoved(file);
  }
}
示例#7
0
void GameTracker::UpdateDirectory(const QString& dir)
{
  QDirIterator it(dir, game_filters, QDir::NoFilter, QDirIterator::Subdirectories);
  while (it.hasNext())
  {
    QString path = QFileInfo(it.next()).canonicalFilePath();
    if (m_tracked_files.contains(path))
    {
      m_tracked_files[path]++;
    }
    else
    {
      addPath(path);
      m_tracked_files[path] = 1;
      emit PathChanged(path);
    }
  }
}
示例#8
0
bool nuiFileTree::SetPath(const nglPath& rPath)
{
  mPath = rPath;
  
  nglPath path(rPath);
  path.MakeRelativeTo(GetRootPath());
  std::vector<nglString> tokens;
  path.GetPathName().Tokenize(tokens, _T('/'));
  nuiTreeNodePtr pNode = mpTreeView->GetTree();
  
  if (!tokens.empty())
  {
    // Find start node:
    nuiTreeNodePtr pRes = NULL;
    for (uint32 i = 0; i < pNode->GetChildrenCount() && !pRes; i++)
    {
      nuiTreeNodePtr pBNode = (nuiTreeNodePtr)pNode->GetChild(i);
      bool old = pBNode->IsOpened();
      nglPath p(pBNode->GetProperty(_T("Path")));
      
      
      if (p.GetNodeName() == tokens.at(0))
        pRes = pBNode;
      else
      {
        if (!old)
          pBNode->Open(true);
        for (uint32 j = 0; j < pBNode->GetChildrenCount() && !pRes; j++)
        {
          nuiTreeNodePtr pBNode2 = (nuiTreeNodePtr)pBNode->GetChild(j);
          nglPath p(pBNode2->GetProperty(_T("Path")));
          
          if (p.GetNodeName() == tokens.at(0))
            pRes = pBNode2;
        }
        if (!pRes && !old)
          pBNode->Open(false);
      }
    }
    
    if (!pRes)
      return false;
    
    pNode = pRes;
  }
  else
  {
    pNode = (nuiTreeNodePtr)pNode->GetChild(0);
  }
  
  
  pNode->Select(false);
  nuiColumnTreeView* pColTreeView = dynamic_cast<nuiColumnTreeView*>(mpTreeView);
  
  for (uint i = 0; i < tokens.size(); i++)
  {
    pNode->OpenAllChildren(false);
    pNode->SelectAllChildren(false);
    
    std::vector<nuiTreePtr> children;
    pNode->GetChildren(children);
    for (uint j = 0; j< children.size(); j++)
    {
      nuiFileSelectorNode* pBNode = dynamic_cast<nuiFileSelectorNode*>(children.at(j));
      if (pBNode)
      {
        nglPath p(pBNode->GetProperty(_T("Path")));
        if (p.GetNodeName() == tokens.at(i))
        {
          pNode = pBNode;
          break;
        }
      }
      
    }
    
    if (pNode == mpTreeView->GetSelectedNode()) // Have we found the next node?
      return false; // No next node found: bail out...
    
    nuiTreeNodePtr pParent = pNode;
    while (pParent)
    {
      if (!pParent->IsEmpty())
        pParent->Open(true);
      if (pColTreeView)
        pParent->Select(true);
      pParent = static_cast<nuiTreeNodePtr>(pParent->GetParent());
    }
    
    if (pColTreeView)
      mpTreeView->Select(pNode, true);
    
    if (pNode->IsEmpty()) // Bail out if the last node is a leaf
    {
      PathChanged();
      mpTreeView->SelectionChanged();
      mpTreeView->SetLayout(mpTreeView->GetIdealRect());

      return false;
    }
    
  }
  
  PathChanged();
  mpTreeView->SelectionChanged();
  mpTreeView->SetLayout(mpTreeView->GetIdealRect());
  
  // Update infos and change the edit line:
  nglPathInfo info;
  rPath.GetInfo(info);
    
  mpTreeView->SetHotRect(mpTreeView->GetHotRect());
  
  return true;
}