Example #1
0
 QImage FluidLauncher::ExtractImage(QFileInfo fileInfo) {
     QImage img;

     if (fileInfo.completeSuffix()=="pdf") {
         return QImage(":/core/pdfthumbnail.png");
     }

     if (fileInfo.completeSuffix()=="pml") {
         QFile file(fileInfo.fileName());

         file.open(QIODevice::ReadOnly);
         QXmlStreamReader xml;
         xml.setDevice(&file);
         while (!xml.atEnd()) {
             if (xml.readNextStartElement()) {
                 QString elt = xml.name().toString();
                 if (elt=="snapshot")  {
                     img.loadFromData(QByteArray::fromBase64(xml.readElementText().toAscii()),"PNG");
                     break;
                 }
             }
         }
         file.close();
     }
     return img;
 }
void
SoundSettings::suggestedTargetFilePath (
        const QString &filePath,
        QString       &baseDir,
        QString       &fileName,
        QString       &xmlFileName)
{
    QString            subDir;
    QFileInfo          fileInfo (filePath);
    QCryptographicHash hash(QCryptographicHash::Sha1);

    hash.addData (fileInfo.path().toUtf8());
    subDir = QString(hash.result().toHex());
    subDir.truncate (32);

    baseDir = userSaveDir() +
        QDir::separator() +
        subDir;

    fileName = fileInfo.baseName() + "." + fileInfo.completeSuffix();
    xmlFileName = fileInfo.baseName() + ".xml";

    SYS_DEBUG ("*** baseName()       = %s", SYS_STR(fileInfo.baseName()));
    SYS_DEBUG ("*** path()           = %s", SYS_STR(fileInfo.path()));
    SYS_DEBUG ("*** completeSuffix() = %s", SYS_STR(fileInfo.completeSuffix()));
}
    bool operator()( pAbstractChild* left, pAbstractChild* right ) const
    {
        const QFileInfo leftInfos( left->filePath() );
        const QString leftBaseName = leftInfos.baseName().toLower();
        const QString leftSuffix = leftInfos.completeSuffix().toLower();
        const QFileInfo rightInfos( right->filePath() );
        const QString rightBaseName = rightInfos.baseName().toLower();
        const QString rightSuffix = rightInfos.completeSuffix().toLower();

        if ( leftSuffix == rightSuffix )
        {
            return leftBaseName < rightBaseName;
        }

        return leftSuffix < rightSuffix;
    }
Example #4
0
/** \fn     ImageUtils::LoadFileData(QFileInfo &, DataMap *)
 *  \brief  Loads the information from the fileInfo into the dataMap object
 *  \param  fileInfo Holds the information about the file
 *  \param  data Holds the loaded information about a file
 *  \return void
 */
void ImageUtils::LoadFileData(QFileInfo &fileInfo,
                              ImageMetadata *data)
{
    data->m_fileName	= fileInfo.absoluteFilePath();
    data->m_name        = fileInfo.fileName();
    data->m_path        = fileInfo.path();
    data->m_modTime     = fileInfo.lastModified().toTime_t();
    data->m_size        = fileInfo.size();
    data->m_isHidden    = fileInfo.isHidden();
    data->m_extension   = fileInfo.completeSuffix().toLower();

    // Set defaults, the data will be loaded later
    data->SetAngle(0);
    data->m_date = MAX_UTCTIME;

    if (m_imageFileExt.contains(data->m_extension))
    {
        data->m_type = kImageFile;
    }
    else if (m_videoFileExt.contains(data->m_extension))
    {
        data->m_type = kVideoFile;
    }
    else
    {
        data->m_type = kUnknown;
    }
}
PyObject* Application::sOpen(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
    // only used to open Python files
    char* Name;
    if (!PyArg_ParseTuple(args, "et","utf-8",&Name))
        return NULL;
    std::string Utf8Name = std::string(Name);
    PyMem_Free(Name);
    PY_TRY {
        QString fileName = QString::fromUtf8(Utf8Name.c_str());
        QFileInfo fi;
        fi.setFile(fileName);
        QString ext = fi.completeSuffix().toLower();
        QList<EditorView*> views = getMainWindow()->findChildren<EditorView*>();
        for (QList<EditorView*>::Iterator it = views.begin(); it != views.end(); ++it) {
            if ((*it)->fileName() == fileName) {
                (*it)->setFocus();
                Py_Return;
            }
        }

        if (ext == QLatin1String("iv")) {
            if (!Application::Instance->activeDocument())
                App::GetApplication().newDocument();
            //QString cmd = QString("Gui.activeDocument().addAnnotation(\"%1\",\"%2\")").arg(fi.baseName()).arg(fi.absoluteFilePath());
            QString cmd = QString::fromLatin1(
                "App.ActiveDocument.addObject(\"App::InventorObject\",\"%1\")."
                "FileName=\"%2\"\n"
                "App.ActiveDocument.ActiveObject.Label=\"%1\"\n"
                "App.ActiveDocument.recompute()")
                .arg(fi.baseName()).arg(fi.absoluteFilePath());
            Base::Interpreter().runString(cmd.toUtf8());
        }
        else if (ext == QLatin1String("wrl") ||
                 ext == QLatin1String("vrml") ||
                 ext == QLatin1String("wrz")) {
            if (!Application::Instance->activeDocument())
                App::GetApplication().newDocument();
            //QString cmd = QString("Gui.activeDocument().addAnnotation(\"%1\",\"%2\")").arg(fi.baseName()).arg(fi.absoluteFilePath());
            QString cmd = QString::fromLatin1(
                "App.ActiveDocument.addObject(\"App::VRMLObject\",\"%1\")."
                "VrmlFile=\"%2\"\n"
                "App.ActiveDocument.ActiveObject.Label=\"%1\"\n"
                "App.ActiveDocument.recompute()")
                .arg(fi.baseName()).arg(fi.absoluteFilePath());
            Base::Interpreter().runString(cmd.toUtf8());
        }
        else if (ext == QLatin1String("py") || ext == QLatin1String("fcmacro") ||
                 ext == QLatin1String("fcscript")) {
            PythonEditor* editor = new PythonEditor();
            editor->setWindowIcon(Gui::BitmapFactory().pixmap("applications-python"));
            PythonEditorView* edit = new PythonEditorView(editor, getMainWindow());
            edit->open(fileName);
            edit->resize(400, 300);
            getMainWindow()->addWindow( edit );
        }
    } PY_CATCH;

    Py_Return;
}
Example #6
0
void ATPAssetMigrator::migrateResource(ResourceRequest* request) {
    // use an asset client to upload the asset
    auto assetClient = DependencyManager::get<AssetClient>();
    
    QFileInfo assetInfo { request->getUrl().fileName() };
    
    auto upload = assetClient->createUpload(request->getData(), assetInfo.completeSuffix());
    
    if (upload) {
        // add this URL to our hash of AssetUpload to original URL
        _originalURLs.insert(upload, request->getUrl());
        
        qCDebug(asset_migrator) << "Starting upload of asset from" << request->getUrl();
        
        // connect to the finished signal so we know when the AssetUpload is done
        QObject::connect(upload, &AssetUpload::finished, this, &ATPAssetMigrator::assetUploadFinished);
        
        // start the upload now
        upload->start();
    } else {
        // show a QMessageBox to say that there is no local asset server
        QString messageBoxText = QString("Could not upload \n\n%1\n\nbecause you are currently not connected" \
                                         " to a local asset-server.").arg(assetInfo.fileName());
        
        QMessageBox::information(_dialogParent, "Failed to Upload", messageBoxText);
    }
}
/// open pov file
static PyObject *
open(PyObject *self, PyObject *args)
{
    // only used to open Povray files
    const char* Name;
    const char* DocName;
    if (!PyArg_ParseTuple(args, "s|s",&Name, &DocName))
        return NULL;
    PY_TRY {
        QString fileName = QString::fromUtf8(Name);
        QFileInfo fi;
        fi.setFile(fileName);
        QString ext = fi.completeSuffix().toLower();
        QList<Gui::EditorView*> views = Gui::getMainWindow()->findChildren<Gui::EditorView*>();
        for (QList<Gui::EditorView*>::Iterator it = views.begin(); it != views.end(); ++it) {
            if ((*it)->fileName() == fileName) {
                (*it)->setFocus();
                Py_Return;
            }
        }

        if (ext == QLatin1String("pov") || ext == QLatin1String("inc")) {
            Gui::TextEditor* editor = new Gui::TextEditor();
            editor->setSyntaxHighlighter(new PovrayHighlighter(editor));
            Gui::EditorView* edit = new Gui::EditorView(editor, Gui::getMainWindow());
            edit->open(fileName);
            edit->resize(400, 300);
            Gui::getMainWindow()->addWindow(edit);
        }
    } PY_CATCH;

    Py_Return;
}
Example #8
0
QIcon ImIconProvider::icon(const QFileInfo &fi) const
{
	QStringList allFormatsV = LoadSavePlugin::getExtensionsForImport(FORMATID_ODGIMPORT);
	QString ext = fi.suffix().toLower();
	if (ext.isEmpty())
		return QFileIconProvider::icon(fi);
	if (fmts.contains(ext, Qt::CaseInsensitive))
		return imagepm;
	else
	{
		ext = fi.completeSuffix().toLower();
		if (ext.endsWith("ps", Qt::CaseInsensitive))
			return pspm;
		else if (ext.endsWith("txt", Qt::CaseInsensitive))
			return txtpm;
		else if (ext.endsWith("scd", Qt::CaseInsensitive) || ext.endsWith("scd.gz", Qt::CaseInsensitive))
			return docpm;
		else if (ext.endsWith("sla", Qt::CaseInsensitive) || ext.endsWith("sla.gz", Qt::CaseInsensitive))
			return docpm;
		else if (ext.endsWith("pdf", Qt::CaseInsensitive))
			return pdfpm;
		else if (ext.endsWith("sxd", Qt::CaseInsensitive))
			return oosxdpm;
		else if (ext.endsWith("sxw", Qt::CaseInsensitive))
			return oosxwpm;
		else if (allFormatsV.contains(ext) || ext.endsWith("sce", Qt::CaseInsensitive) || ext.endsWith("sml", Qt::CaseInsensitive) || ext.endsWith("shape", Qt::CaseInsensitive))
			return vectorpm;
		else
			return QFileIconProvider::icon(fi);
	}
	return QIcon();
}
PyObject* Application::sInsert(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
    const char* Name;
    const char* DocName=0;
    if (!PyArg_ParseTuple(args, "s|s",&Name,&DocName))
        return NULL;

    PY_TRY {
        QString fileName = QString::fromUtf8(Name);
        QFileInfo fi;
        fi.setFile(fileName);
        QString ext = fi.completeSuffix().toLower();
        if (ext == QLatin1String("iv")) {
            App::Document *doc = 0;
            if (DocName)
                doc = App::GetApplication().getDocument(DocName);
            else
                doc = App::GetApplication().getActiveDocument();
            if (!doc)
                doc = App::GetApplication().newDocument(DocName);

            App::DocumentObject* obj = doc->addObject("App::InventorObject",
                (const char*)fi.baseName().toUtf8());
            obj->Label.setValue((const char*)fi.baseName().toUtf8());
            static_cast<App::PropertyString*>(obj->getPropertyByName("FileName"))
                ->setValue((const char*)fi.absoluteFilePath().toUtf8());
            doc->recompute();
        }
        else if (ext == QLatin1String("wrl") ||
                 ext == QLatin1String("vrml") ||
                 ext == QLatin1String("wrz")) {
            App::Document *doc = 0;
            if (DocName)
                doc = App::GetApplication().getDocument(DocName);
            else
                doc = App::GetApplication().getActiveDocument();
            if (!doc)
                doc = App::GetApplication().newDocument(DocName);

            App::DocumentObject* obj = doc->addObject("App::VRMLObject",
                (const char*)fi.baseName().toUtf8());
            obj->Label.setValue((const char*)fi.baseName().toUtf8());
            static_cast<App::PropertyFileIncluded*>(obj->getPropertyByName("VrmlFile"))
                ->setValue((const char*)fi.absoluteFilePath().toUtf8());
            doc->recompute();
        }
        else if (ext == QLatin1String("py") || ext == QLatin1String("fcmacro") ||
                 ext == QLatin1String("fcscript")) {
            PythonEditor* editor = new PythonEditor();
            editor->setWindowIcon(Gui::BitmapFactory().pixmap("python_small"));
            PythonEditorView* edit = new PythonEditorView(editor, getMainWindow());
            edit->open(fileName);
            edit->resize(400, 300);
            getMainWindow()->addWindow( edit );
        }
    } PY_CATCH;

    Py_Return;
}
bool ComponentManager::hasValidExtension(const QFileInfo& file)
{
  if (m_componentFileExtensions.contains("*." + file.suffix())
      || m_componentFileExtensions.contains("*." + file.completeSuffix()))
    return true;
  else
    return false;
}
Example #11
0
void FileManager::copyFileToFolder(QString originPath, QString originName,QString newPath,QString rename,int digits) {
    QFileInfo* info = new QFileInfo(originPath + "/" + originName);
    QString name = generateName(newPath,rename,info->completeSuffix(),digits);
    copyFileToFolder(originPath,originName, newPath, name);
    historyFromPath.push(originPath);
    historyFromName.push(originName);
    historyToPath.push(newPath);
    historyToName.push(name);
    historyType.push_back("folder");
    delete info;
}
Example #12
0
void parseFile(const QFileInfo& file, bool force_update=false)
{
    if(!file.exists())return;
    if(file.isSymLink())return;
    //skip files in skiplist
    if(skip_paths.contains(file.fileName()))return;
    //force update on our files
    if(!force_update)force_update=our_paths.contains(file.filePath());

    if(file.isDir())
    {
        QString name=file.baseName();
        //ignore system dirs
        if(name.length()==0 || name.at(0)==QChar('.'))return;

        QDir dir(file.absoluteFilePath());
        QFileInfoList list = dir.entryInfoList(
            QDir::NoDotAndDotDot|QDir::Readable|QDir::Dirs|QDir::Files,
            QDir::DirsFirst|QDir::Name);
        QFileInfoList::const_iterator iter=list.constBegin();
        for(;iter!=list.constEnd(); ++iter)
        {
            qDebug()<<"... "<<iter->filePath();

            parseFile(*iter,force_update);
        }
        return;
    }
    if(file.isFile())
    {
        filereported=false;//reset flag
        QStringList exts;
        exts<<"cpp"<<"c"<<"hpp"<<"h"<<"java"<<"qml";
        QString ext=file.completeSuffix().toLower();
        if(exts.contains(ext))
        {
            qDebug()<<"Parsing "<<file.baseName();
            processCXXFile(file.absoluteFilePath(),force_update);
            removeExtraLines(file.absoluteFilePath());

        }
        else if(file.baseName().toLower()=="makefile")
        {
            qDebug()<<"Parsing "<<file.baseName();
            processMakeFile(file.absoluteFilePath(),force_update);
            removeExtraLines(file.absoluteFilePath());
        }

    }

}
Example #13
0
/*!
 \fn int FileLoader::TestFile()
 \author Franz Schmid
 \date
 \brief Tests if the file "FileName" exists and determines the type of the file.
 \retval int -1 if the file doesn't exist or any other error has occurred, 0 for the old Format, 1 for the new Format, 2 for EPS and PS files, 3 for SVG files and 4 for PDF files
 */
int FileLoader::TestFile()
{
	QFileInfo fi = QFileInfo(FileName);
	int ret = -1;
	if (!fi.exists())
		ret = -1;
	QString ext = fi.completeSuffix().toLower();

	QList<FileFormat> fileFormats(LoadSavePlugin::supportedFormats());
	QList<FileFormat>::const_iterator it(fileFormats.constBegin());
	QList<FileFormat>::const_iterator itEnd(fileFormats.constEnd());
	for ( ; it != itEnd ; ++it )
	{
		if ((*it).nameMatch.indexIn("."+ext)!=-1)
		{
//  		qDebug() << QString("Match :%1: :.%2: on %3").arg((*it).nameMatch.pattern()).arg(ext).arg((*it).trName);
			if ((*it).plug!=0)
			{
				if ((*it).plug->fileSupported(0, FileName))
				{
// 					qDebug(QString("File Supported With: %1").arg((*it).trName));
					ret=(*it).formatId;
					break;
				}
			}
		}
// 		else
// 			qDebug() << QString("No Match :%1: :.%2: on %3").arg((*it).nameMatch.pattern()).arg(ext).arg((*it).trName);
	}
	
// 	if (ret==-1)
// 	{
// 		if ((ext.endsWith("sla.gz")) || (ext.endsWith("sla")) || (ext.endsWith("scd.gz")) || (ext.endsWith("scd")))
// 			ret = CheckScribus();
// 		else 
// 		if (((ext.endsWith("ps")) || (ext.endsWith("eps"))) && (formatPS))
// 			ret = FORMATID_PSIMPORT;
// 		else if (((ext.endsWith("svg")) || (ext.endsWith("svgz"))) && (formatSVG))
// 			ret = FORMATID_SVGIMPORT;
// 		else if ((ext.endsWith("sxd")) && (formatSXD))
// 			ret = FORMATID_SXDIMPORT;
// 		else if ((ext.endsWith("odg")) && (formatODG))
// 			ret = FORMATID_ODGIMPORT;
// 	}
/*	if (ext == "pdf")
		ret = 4; */
	FileType = ret;
	return ret;
}
void ChannelConfigurationsWidget::rename()
{
	QItemSelection selection = ui->configs->selectionModel()->selection();
	if(selection.indexes().size() != 1) return;
	QModelIndex index = selection.indexes()[0];
	
	QFileInfo file = m_model->fileInfo(index);
	KeyboardDialog keyboard(tr("Rename %1").arg(file.fileName()));
	keyboard.setInput(file.baseName());
	RootController::ref().presentDialog(&keyboard);
	if(!QFile::rename(file.filePath(),
		file.path() + "/" + keyboard.input() + "." + file.completeSuffix())) {
		qWarning() << "Failed to change name";
		// TODO: Make this error user visible
		return;
	}
}
	void DriveManager::DownloadFile (const QString& filePath, const QUrl& url,
			TaskParameters tp, bool silent, bool open)
	{
		QString savePath;
		if (silent)
			savePath = QDesktopServices::storageLocation (QDesktopServices::TempLocation) +
					"/" + QFileInfo (filePath).fileName ();

		auto e = Util::MakeEntity (url, savePath, tp);
		QFileInfo fi (filePath);
		e.Additional_ ["Filename"] = QString ("%1_%2.%3")
				.arg (fi.baseName ())
				.arg (QDateTime::currentDateTime ().toTime_t ())
				.arg (fi.completeSuffix ());
		silent ?
			Core::Instance ().DelegateEntity (e, filePath, open) :
			Core::Instance ().SendEntity (e);
	}
Example #16
0
static QFileInfo MakeUnique(const QFileInfo &dest)
{
    QFileInfo newDest = dest;

    for (uint i = 0; newDest.exists(); i++)
    {
        QString basename = QString("%1_%2.%3")
            .arg(dest.baseName()).arg(i).arg(dest.completeSuffix());

        newDest.setFile(dest.dir(), basename);

        LOG(VB_GENERAL, LOG_ERR, LOC +
            QString("Need to find a new name for '%1' trying '%2'")
                .arg(dest.absoluteFilePath()).arg(newDest.absoluteFilePath()));
    }

    return newDest;
}
    QString DownloadManager::saveFilename(const QString &url, bool &exist, QString &fileName, bool &tempExist, bool noFilePathSpecified )
    {
        QFileInfo fileInfo = QFileInfo( url );
        QString   baseName = fileInfo.baseName();
        QString   filenameSuffix = fileInfo.completeSuffix();

        if( baseName.isEmpty() ){
            baseName = QUuid::createUuid();
        }
        if( filenameSuffix.isEmpty() ){
            filenameSuffix = "nil";
        }

        QString filePath = url;
        fileName = fileInfo.fileName();

        if( noFilePathSpecified ){
            filePath = m_filePath + QString( "/%1.%2" ).arg( baseName ).arg( filenameSuffix );
            fileName = baseName + "." + filenameSuffix;
        }

        if( QFile::exists( filePath ) ){
            exist = true;
            if( RenameFile == m_existDownloadPolicy ){
                baseName += "(";
                int i = 1;
                while( QFile::exists( m_filePath + "/" + baseName + "(" + QString::number(i) + ")" + filenameSuffix )){
                    ++i;
                }

                baseName += QString::number( i ) + ")";
                filePath = m_filePath + "/" + baseName + "." + filenameSuffix;
            } else if ( m_existDownloadPolicy == OverwriteFile ){
                QFile::remove( filePath );
            }
        }

        QString filePart = filePath + ".part";
        if( QFile::exists( filePart ) ){
            tempExist = true;
        }
        return filePath;
    }
Example #18
0
void CycleRead::read_dcmrawdatapath(QString dcmrawpath)
{
  QFileInfo file;
  QDir dcmrawdir;

  dcmrawdir.setPath(dcmrawpath);


  QFileInfoList fList = dcmrawdir.entryInfoList(QDir::NoDotAndDotDot | QDir::Files , QDir::Name);

  if (!fList.isEmpty())
//    QMessageBox::warning(this, tr("Warning"), "No Files in Directory!\n"+file.absoluteFilePath(),
//                               QMessageBox::Ok);

  {
    for(int i=0;i < fList.size(); ++i)
    {
      file = fList.at(i);

      if(("dcm" == file.completeSuffix()) && (!_all_filenames.contains(file.filePath())))
      {
        _all_filenames.push_back(file.filePath());

        if(_fileblocks.isEmpty())
        { //if its the fist file - and no fileblocks exist - create first
          FileBlock fileblock;
          fileblock.set_file(file);
          _fileblocks.push_back(fileblock);
        }
        else
        {
          if(!_fileblocks.last().set_file(file))
          { //if actual file is not for actual block
            FileBlock fileblock;
            fileblock.set_file(file);
            _fileblocks.push_back(fileblock);  //create new block at the back
          }
        }
      }
    }
  }
}
Example #19
0
void CustomFDialog::handleCompress()
{
	QFileInfo tmp;
	tmp.setFile(selectedFile());
	QString e(tmp.completeSuffix());
	QStringList ex = e.split(".", QString::SkipEmptyParts);
	QString baseExt = "";
	for (int a = 0; a < ex.count(); a++)
	{
		if ((ex[a] != "sla") && (ex[a] != "SLA") && (ex[a] != "gz") && (ex[a] != "GZ"))
			baseExt += "."+ex[a];
	}
	if (SaveZip->isChecked())
	{
		if (e != extZip)
			tmp.setFile(tmp.baseName() + baseExt + "." + extZip);
	}
	else
	{
		if (e != ext)
			tmp.setFile(tmp.baseName() + baseExt + "." + ext);
	}
	setSelection(tmp.fileName());
}
Example #20
0
/**
 * For image0.jpg, this will return image1.jpg, etc.
 */
QFileInfo MaidFacade::increaseFilenameNumber(const QFileInfo& fileInfo) {
	
	qDebug() << "file info before increasing: " << fileInfo.absoluteFilePath();

	QFileInfo newInfo;

	// test file names
	while (true) {
		newInfo = QFileInfo(fileInfo.absolutePath(), fileInfo.baseName() + "-" + QString::number(++prevFileNumber) + "." + fileInfo.completeSuffix());
		if (!newInfo.exists())
			break;
	}

	return newInfo;
}
Example #21
0
ImageSequence::ImageSequence(QString targetDir, float frameRate) : AbstractMedia()
{
    QDir directory(targetDir);
    QStringList dirFiles = directory.entryList();
    this->targetDir = targetDir;
    this->maxIndex = 0;
    this->minIndex = 0;
    this->numPackedChars = 0;
    this->maxPrefix = "";
    this->maxExt = "";
    this->frameRate = frameRate;
    int packedChars = 0;

    //Get highest value image
    for (int i = 0; i < dirFiles.size(); ++i)
    {
        QString fina = dirFiles.at(i);
        QFileInfo finai = fina;

        QString baseName = finai.baseName(); //filename without extension
        QString extName = finai.completeSuffix();
        //cout << fina.toLocal8Bit().constData() <<"," << baseName.toLocal8Bit().constData() << endl;
        QString stripName = StripLeftAlphaChars(baseName);
        packedChars = stripName.length();
        long long unsigned ind = stripName.toInt();
        QString prefix = GetLeftAlphaChars(baseName);
        if(ind > maxIndex)
        {
            this->maxIndex = ind;
            this->maxPrefix = prefix;
            this->maxExt = extName;
        }
    }

    //Get lowest value file
    //TODO this is a much better place to determine if the file name is packed
    for(long long unsigned i=0;i<=this->maxIndex;i++)
    {
        //Test for packed name
        QString formatStr;
        formatStr.sprintf("%%s/%%s%%0%illd.%%s", packedChars);

        QString fina;
        fina.sprintf(formatStr.toLocal8Bit().constData(),
                 this->targetDir.toLocal8Bit().constData(),
                 this->maxPrefix.toLocal8Bit().constData(), i,
                 this->maxExt.toLocal8Bit().constData());
        QFile file(fina);
        if(file.exists())
        {
            this->minIndex = i;
            this->numPackedChars = packedChars;
            break;
        }

        //Test for unpacked name
        QString fina2;
        fina2.sprintf("%s/%s%lld.%s", this->targetDir.toLocal8Bit().constData(),
                 this->maxPrefix.toLocal8Bit().constData(), i,
                 this->maxExt.toLocal8Bit().constData());
        QFile file2(fina2);
        if(file2.exists())
        {
            this->minIndex = i;
            this->numPackedChars = 0;
            break;
        }

    }

    //cout << this->maxPrefix.toLocal8Bit().constData()
    //     << "\t" << this->maxIndex << "\t" << this->maxExt.toLocal8Bit().constData()
    //     << "\t" << this->maxPackedChars << endl;
}
PyObject* Application::sExport(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
    PyObject* object;
    const char* filename;
    if (!PyArg_ParseTuple(args, "Os",&object,&filename))
        return NULL;

    PY_TRY {
        App::Document* doc = 0;
        Py::List list(object);
        for (Py::List::iterator it = list.begin(); it != list.end(); ++it) {
            PyObject* item = (*it).ptr();
            if (PyObject_TypeCheck(item, &(App::DocumentObjectPy::Type))) {
                App::DocumentObject* obj = static_cast<App::DocumentObjectPy*>(item)->getDocumentObjectPtr();
                doc = obj->getDocument();
                break;
            }
        }

        // get the view that belongs to the found document
        if (doc) {
            QString fileName = QString::fromUtf8(filename);
            QFileInfo fi;
            fi.setFile(fileName);
            QString ext = fi.completeSuffix().toLower();
            if (ext == QLatin1String("iv") || ext == QLatin1String("wrl") ||
                ext == QLatin1String("vrml") || ext == QLatin1String("wrz") ||
                ext == QLatin1String("svg") || ext == QLatin1String("idtf")) {
                Gui::Document* gui_doc = Application::Instance->getDocument(doc);
                std::list<MDIView*> view3d = gui_doc->getMDIViewsOfType(View3DInventor::getClassTypeId());
                if (view3d.empty()) {
                    PyErr_SetString(PyExc_Exception, "Cannot export to SVG because document doesn't have a 3d view");
                    return 0;
                }
                else {
                    QString cmd = QString::fromLatin1(
                        "Gui.getDocument(\"%1\").mdiViewsOfType('Gui::View3DInventor')[0].dump(\"%2\")"
                        ).arg(QLatin1String(doc->getName())).arg(fi.absoluteFilePath());
                    Base::Interpreter().runString(cmd.toUtf8());
                }
            }
            else if (ext == QLatin1String("pdf")) {
                Gui::Document* gui_doc = Application::Instance->getDocument(doc);
                if (gui_doc) {
                    Gui::MDIView* view = gui_doc->getActiveView();
                    if (view) {
                        View3DInventor* view3d = qobject_cast<View3DInventor*>(view);
                        if (view3d)
                            view3d->viewAll();
                        QPrinter printer(QPrinter::ScreenResolution);
                        printer.setOutputFormat(QPrinter::PdfFormat);
                        printer.setOutputFileName(fileName);
                        view->print(&printer);
                    }
                }
            }
        }
    } PY_CATCH;

    Py_Return;
}
Example #23
0
void FLMSettings::load()
{
    // find all .ini files
    QDir dir;
    dir.setFilter(QDir::Files | QDir::NoDotAndDotDot);
    QFileInfoList list = dir.entryInfoList();

    for (int i = 0; i < list.size(); ++i) {
        QFileInfo f = list.at(i);
        if (f.completeSuffix().size() == 3 && f.completeSuffix().compare("ini") == 0) {
            RenderConfig config;
            config.filename = f.fileName();

            QSettings mSettings(config.filename, QSettings::IniFormat);
            mSettings.beginGroup(QObject::tr("application_state"));
            // Scale slider position
            config.mScale = mSettings.value(KEY_SCALE, DEFAULT_SCALE).toInt();
            if (config.mScale < 1 || config.mScale > 100)
                config.mScale = 1;
            // Render mode state
            config.mRenderMode =
                    static_cast<Render_Mode>(mSettings.
                                             value(KEY_RENDER_MODE,DEFAULT_RENDER_MODE).toInt());
            config.mDrawIdleMotion =
                    mSettings.value(KEY_DRAW_IDLE_MOTION,DEFAULT_DRAW_IDLE_MOTION).toBool();
            config.mCorrTurnedOn = mSettings.value(KEY_CORR_TURNED_ON,DEFAULT_CORR_TURNED_ON).toBool();
            mSettings.endGroup();

            mSettings.beginGroup(QObject::tr("mark_delays"));
            config.mDelays.mDXY_LaserOn =
                    mSettings.value(KEY_DXY_LASER_ON, DEFAULT_DXY_LASER_ON).toInt();
            config.mDelays.mDXY_LaserOff =
                    mSettings.value(KEY_DXY_LASER_OFF, DEFAULT_DXY_LASER_OFF).toInt();
            config.mDelays.mLaserOnDelay =
                    mSettings.value(KEY_LASER_ON_DELAY, DEFAULT_LASER_ON_DELAY).toInt();
            config.mDelays.mLaserOffDelay =
                    mSettings.value(KEY_LASER_OFF_DELAY, DEFAULT_LASER_OFF_DELAY).toInt();
            config.mDelays.mPointDelay =
                    mSettings.value(KEY_POINT_DELAY, DEFAULT_POINT_DELAY).toInt();
            config.mDelays.mQSWPeriod =
                    mSettings.value(KEY_QSW_PERIOD, DEFAULT_QSW_PERIOD).toInt();
            config.mDelays.mQSWDuration =
                    mSettings.value(KEY_QSW_DURATION, DEFAULT_QSW_DURATION).toInt();
            mSettings.endGroup();
            configs.append(config);
        }
    }

    // load default configs if needed
    if (configs.size() <= 0) {
        configs.append(RenderConfig());
        activeConfig = 0;
        save(0);
    }

    //load correction matrix here
    loadCorrectionMatrix();

    QSettings appGlobalSettings(FLMSETTINGS_FILENAME, QSettings::IniFormat);
    appGlobalSettings.beginGroup(QObject::tr("flm"));
    lastUsedConfig = appGlobalSettings.value(KEY_LAST_USED_CONFIG, DEFAULT_LAST_USED_CONFIG).toString();
}
Example #24
0
bool typeLessthan(const QFileInfo& file1, const QFileInfo& file2){
    return file1.completeSuffix() < file2.completeSuffix();
}
Example #25
0
bool typeGreaterthan(const QFileInfo& file1, const QFileInfo& file2){
    return file1.completeSuffix() > file2.completeSuffix();
}
Example #26
0
/*!
 \fn int FileLoader::TestFile()
 \author Franz Schmid
 \date
 \brief Tests if the file "FileName" exists and determines the type of the file.
 \retval int -1 if the file doesn't exist or any other error has occurred, 0 for the old Format, 1 for the new Format, 2 for EPS and PS files, 3 for SVG files and 4 for PDF files
 */
int FileLoader::testFile()
{
	QFileInfo fi = QFileInfo(m_fileName);
	int ret = -1;
	if (!fi.exists())
		ret = -1;
	QString ext = fi.completeSuffix().toLower();

	bool found = false;
	QList<FileFormat> fileFormats(LoadSavePlugin::supportedFormats());
	QList<FileFormat>::const_iterator it(fileFormats.constBegin());
	QList<FileFormat>::const_iterator itEnd(fileFormats.constEnd());
	for ( ; it != itEnd ; ++it )
	{
		for (int a = 0; a < it->fileExtensions.count(); a++)
		{
			QString exts = it->fileExtensions[a].toLower();
			if (ext == exts)
			{
				if (it->plug != 0)
				{
					if (it->plug->fileSupported(0, m_fileName))
					{
						ret = it->formatId;
						found = true;
						break;
					}
				}
			}
		}
		if (found)
			break;
	}
	if (!found)
	{
	// now try for the last suffix
		ext = fi.suffix().toLower();
		it = fileFormats.constBegin();
		itEnd = fileFormats.constEnd();
		for ( ; it != itEnd ; ++it )
		{
			bool found = false;
			for (int a = 0; a < it->fileExtensions.count(); a++)
			{
				QString exts = it->fileExtensions[a].toLower();
				if (ext == exts)
				{
					if (it->plug != 0)
					{
						if (it->plug->fileSupported(0, m_fileName))
						{
							ret = it->formatId;
							found = true;
							break;
						}
					}
				}
			}
			if (found)
				break;
		}
	}
	m_fileType = ret;
	return ret;
}
Example #27
0
int ImageFrame::discoverIncrement(QFileInfo fi) const{
  // We have no idea of the increment lets try to determine it the hard way
  QDir dir = QDir(fi.absolutePath());
  QStringList filters;
  QRegExp rep  = QRegExp("(.*)-(\\d+)");
  rep.exactMatch(fi.baseName());
  int iter1 = rep.cap(2).toInt();
  QString s = rep.cap(2);
  s.chop(4);
  filters << rep.cap(1)+"-"+s+"*"+fi.completeSuffix();
  dir.setNameFilters(filters);  
  dir.setFilter(QDir::Files|QDir::Readable);
  QStringList currentFiles = dir.entryList();
  int size = currentFiles.size();
  QFileInfo previous;
  QFileInfo next;
  for(int i = 0;i<size;i++){
    QFileInfo fi2 = QFileInfo(dir,currentFiles[i]);
    if(fi2.created() > fi.created()){
      if(next.fileName().isEmpty()){
	next = fi2;
      }else{
	if(fi2.created() < next.created()){
	  next = fi2;
	}
      }
    }else if(fi2.created() < fi.created()){
      if(previous.fileName().isEmpty()){
	previous = fi2;
      }else{
	if(fi2.created() > previous.created()){
	  previous = fi2;
	}
      }    
    }
  }
  int iter0 = -1;
  if(!previous.fileName().isEmpty()){
    rep.exactMatch(previous.baseName());
    iter0 = rep.cap(2).toInt();
  }
  int iter2 = -1;
  if(!next.fileName().isEmpty()){
    rep.exactMatch(next.baseName());
    iter2 = rep.cap(2).toInt();
  }
  if(iter0 == -1 && iter2 == -1){
    qDebug("Could not determine increment");
    return -1;
  }
  if(iter0 == -1){
    return iter2-iter1;
  }
  if(iter2 == -1){
    return iter1-iter0;
  }
  if(iter2-iter1 == iter1-iter0){
    return iter2-iter1;
  }else{
    qDebug("Iteration increment not constant");
    return iter2-iter1;
  }
  return -1;
}
Example #28
0
int IMT_MRGui::writeoutfile(unsigned num_rows, unsigned num_columns, unsigned num_coils, const std::vector<TType_image>& image_data,
                            const std::vector<TType_data>& matrix_read, QString name_index)
{
  QFileInfo file;

  QDateTime datum = QDateTime::currentDateTime() ;
  QString dat_str;
  dat_str = datum.toString("hh-mm-ss");

  agile::DICOM dicomfile;
  agile::GPUMatrix<TType_data> Coil_assigned;
  agile::GPUMatrix<TType_data>* Coil_fov = new agile::GPUMatrix<TType_data> [num_coils];
  std::vector<TType_data > matrix_read_fov, matrix_read_fov_help;
  agile::KSpaceFOV<TType_data>* kspacefovobj = new agile::KSpaceFOV<TType_data>();

  matrix_read_fov.resize(num_rows * num_columns * num_coils);
  matrix_read_fov.clear();

  if(ui->radioButton_rawdata->isChecked())    // no calculation - only RAWdata will be written
  {
    if(ui->cb_autofilename->isChecked())
      _str_outfilename = _pathsetting->get_outputpath()+"/"+name_index+".bin";
    else
      emit sendSaveFile(tr("Save file as"),tr("Rawdata (*.bin)"));

//    qDebug()<<"\n _str_outfilename: "<<_str_outfilename;
    if(ui->cb_cropFOV->isChecked())
    {
      for(unsigned i=0; i<num_coils;++i)
      {
        Coil_assigned.assignFromHost(_num_rows_data, _num_columns_data, &matrix_read[_num_rows_data*_num_columns_data*i]);
        kspacefovobj->genkspace_fov(Coil_assigned,Coil_fov[i]);
        Coil_fov[i].copyToHost(matrix_read_fov_help);

//        for(unsigned lauf=0;lauf<matrix_read_fov_help.size();++lauf)
//        {
//          matrix_read_fov.push_back(matrix_read_fov_help[lauf]);
//        }

        matrix_read_fov.insert(matrix_read_fov.end(),matrix_read_fov_help.begin() , matrix_read_fov_help.end());
      }
    agile::writeMatrixFile3D(_str_outfilename.toStdString().c_str(),num_rows,num_columns,num_coils,matrix_read_fov);   //write RAWdata
    }
    else
      agile::writeMatrixFile3D(_str_outfilename.toStdString().c_str(),num_rows,num_columns,num_coils,matrix_read);   //write RAWdata
  }
  else    // image_data will be written to dicom file
  {
    if(ui->cb_autofilename->isChecked())
      _str_outfilename = _pathsetting->get_outputpath()+"/"+name_index+".dcm";
    else
      emit sendSaveFile(tr("Save file as"),tr("Dicom (*.dcm);;Image (*.img)"));

    file.setFile(_str_outfilename);

    if( "dcm" == file.completeSuffix())
    {
      dicomfile.set_dicominfo(_in_dicomfile.get_dicominfo());
      dicomfile.gendicom(_str_outfilename.toStdString().c_str(), image_data, num_rows, num_columns);   //generate Dicom file
    }
    else //if *.img
      agile::writeVectorFile(_str_outfilename.toStdString().c_str(),image_data);
  }

  delete kspacefovobj;
  kspacefovobj = 0;
}
void ScanFileOrFolder::listFolder(QFileInfo source,QFileInfo destination)
{
    ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("source: %1 (%2), destination: %3 (%4)").arg(source.absoluteFilePath()).arg(source.isSymLink()).arg(destination.absoluteFilePath()).arg(destination.isSymLink()));
    if(stopIt)
        return;
    destination=resolvDestination(destination);
    if(stopIt)
        return;
    if(fileErrorAction==FileError_Skip)
        return;
    //if is same
    if(source.absoluteFilePath()==destination.absoluteFilePath())
    {
        emit folderAlreadyExists(source,destination,true);
        waitOneAction.acquire();
        QString destinationSuffixPath;
        switch(folderExistsAction)
        {
            case FolderExists_Merge:
            break;
            case FolderExists_Skip:
                return;
            break;
            case FolderExists_Rename:
                ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"destination before rename: "+destination.absoluteFilePath());
                if(newName.isEmpty())
                {
                    ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"pattern: "+folder_isolation.pattern());
                    //resolv the new name
                    destinationSuffixPath=destination.baseName();
                    int num=1;
                    do
                    {
                        if(num==1)
                        {
                            if(firstRenamingRule.isEmpty())
                                destinationSuffixPath=tr("%1 - copy").arg(destination.baseName());
                            else
                            {
                                destinationSuffixPath=firstRenamingRule;
                                destinationSuffixPath.replace(QStringLiteral("%name%"),destination.baseName());
                            }
                        }
                        else
                        {
                            if(otherRenamingRule.isEmpty())
                                destinationSuffixPath=tr("%1 - copy (%2)").arg(destination.baseName()).arg(num);
                            else
                            {
                                destinationSuffixPath=otherRenamingRule;
                                destinationSuffixPath.replace(QStringLiteral("%name%"),destination.baseName());
                                destinationSuffixPath.replace(QStringLiteral("%number%"),QString::number(num));
                            }
                        }
                        num++;
                        if(destination.completeSuffix().isEmpty())
                            destination.setFile(destination.absolutePath()+text_slash+destinationSuffixPath);
                        else
                            destination.setFile(destination.absolutePath()+text_slash+destinationSuffixPath+text_dot+destination.completeSuffix());
                    }
                    while(destination.exists());
                }
                else
                {
                    ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"use new name: "+newName);
                    destinationSuffixPath = newName;
                }
                destination.setFile(destination.absolutePath()+text_slash+destinationSuffixPath);
                ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"destination after rename: "+destination.absoluteFilePath());
            break;
            default:
                return;
            break;
        }
    }
    //check if destination exists
    if(checkDestinationExists)
    {
        if(destination.exists())
        {
            emit folderAlreadyExists(source,destination,false);
            waitOneAction.acquire();
            QString destinationSuffixPath;
            switch(folderExistsAction)
            {
                case FolderExists_Merge:
                break;
                case FolderExists_Skip:
                    return;
                break;
                case FolderExists_Rename:
                    ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"destination before rename: "+destination.absoluteFilePath());
                    if(newName.isEmpty())
                    {
                        //resolv the new name
                        QFileInfo destinationInfo;
                        int num=1;
                        do
                        {
                            if(num==1)
                            {
                                if(firstRenamingRule.isEmpty())
                                    destinationSuffixPath=tr("%1 - copy").arg(destination.baseName());
                                else
                                {
                                    destinationSuffixPath=firstRenamingRule;
                                    destinationSuffixPath.replace(QStringLiteral("%name%"),destination.baseName());
                                }
                            }
                            else
                            {
                                if(otherRenamingRule.isEmpty())
                                    destinationSuffixPath=tr("%1 - copy (%2)").arg(destination.baseName()).arg(num);
                                else
                                {
                                    destinationSuffixPath=otherRenamingRule;
                                    destinationSuffixPath.replace(QStringLiteral("%name%"),destination.baseName());
                                    destinationSuffixPath.replace(QStringLiteral("%number%"),QString::number(num));
                                }
                            }
                            destinationInfo.setFile(destinationInfo.absolutePath()+text_slash+destinationSuffixPath);
                            num++;
                        }
                        while(destinationInfo.exists());
                    }
                    else
                    {
                        ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"use new name: "+newName);
                        destinationSuffixPath = newName;
                    }
                    if(destination.completeSuffix().isEmpty())
                        destination.setFile(destination.absolutePath()+text_slash+destinationSuffixPath);
                    else
                        destination.setFile(destination.absolutePath()+text_slash+destinationSuffixPath+QStringLiteral(".")+destination.completeSuffix());
                    ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"destination after rename: "+destination.absoluteFilePath());
                break;
                default:
                    return;
                break;
            }
        }
    }
    //do source check
    //check of source is readable
    do
    {
        fileErrorAction=FileError_NotSet;
        if(!source.isReadable() || !source.isExecutable() || !source.exists() || !source.isDir())
        {
            if(!source.isDir())
                emit errorOnFolder(source,tr("This is not a folder"));
            else if(!source.exists())
                emit errorOnFolder(source,tr("The folder does exists"));
            else
                emit errorOnFolder(source,tr("The folder is not readable"));
            waitOneAction.acquire();
            ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"actionNum: "+QString::number(fileErrorAction));
        }
    } while(fileErrorAction==FileError_Retry);
    do
    {
        QDir tempDir(source.absoluteFilePath());
        fileErrorAction=FileError_NotSet;
        if(!tempDir.isReadable() || !tempDir.exists())
        {
            emit errorOnFolder(source,tr("Problem with name encoding"));
            waitOneAction.acquire();
            ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"actionNum: "+QString::number(fileErrorAction));
        }
    } while(fileErrorAction==FileError_Retry);
    if(stopIt)
        return;
    /// \todo check here if the folder is not readable or not exists
    QFileInfoList entryList;
    if(copyListOrder)
        entryList=QDir(source.absoluteFilePath()).entryInfoList(QDir::AllEntries|QDir::NoDotAndDotDot|QDir::Hidden|QDir::System,QDir::DirsFirst|QDir::Name|QDir::IgnoreCase);//possible wait time here
    else
        entryList=QDir(source.absoluteFilePath()).entryInfoList(QDir::AllEntries|QDir::NoDotAndDotDot|QDir::Hidden|QDir::System);//possible wait time here
    if(stopIt)
        return;
    int sizeEntryList=entryList.size();
    emit newFolderListing(source.absoluteFilePath());
    if(mode!=Ultracopier::Move)
        emit addToMkPath(source,destination,sizeEntryList);
    for (int index=0;index<sizeEntryList;++index)
    {
        QFileInfo fileInfo=entryList.at(index);
        if(stopIt)
            return;
        if(haveFilters)
        {
            if(reloadTheNewFilters)
            {
                QMutexLocker lock(&filtersMutex);
                QCoreApplication::processEvents(QEventLoop::AllEvents);
                reloadTheNewFilters=false;
                this->include=this->include_send;
                this->exclude=this->exclude_send;
            }
            QString fileName=fileInfo.fileName();
            if(fileInfo.isDir() && !fileInfo.isSymLink())
            {
                bool excluded=false,included=(include.size()==0);
                int filters_index=0;
                while(filters_index<exclude.size())
                {
                    if(exclude.at(filters_index).apply_on==ApplyOn_folder || exclude.at(filters_index).apply_on==ApplyOn_fileAndFolder)
                    {
                        if(fileName.contains(exclude.at(filters_index).regex))
                        {
                            excluded=true;
                            break;
                        }
                    }
                    filters_index++;
                }
                if(excluded)
                {}
                else
                {
                    filters_index=0;
                    while(filters_index<include.size())
                    {
                        if(include.at(filters_index).apply_on==ApplyOn_folder || include.at(filters_index).apply_on==ApplyOn_fileAndFolder)
                        {
                            if(fileName.contains(include.at(filters_index).regex))
                            {
                                included=true;
                                break;
                            }
                        }
                        filters_index++;
                    }
                    if(!included)
                    {}
                    else
                        listFolder(fileInfo,destination.absoluteFilePath()+text_slash+fileInfo.fileName());
                }
            }
            else
            {
                bool excluded=false,included=(include.size()==0);
                int filters_index=0;
                while(filters_index<exclude.size())
                {
                    if(exclude.at(filters_index).apply_on==ApplyOn_file || exclude.at(filters_index).apply_on==ApplyOn_fileAndFolder)
                    {
                        if(fileName.contains(exclude.at(filters_index).regex))
                        {
                            excluded=true;
                            break;
                        }
                    }
                    filters_index++;
                }
                if(excluded)
                {}
                else
                {
                    filters_index=0;
                    while(filters_index<include.size())
                    {
                        if(include.at(filters_index).apply_on==ApplyOn_file || include.at(filters_index).apply_on==ApplyOn_fileAndFolder)
                        {
                            if(fileName.contains(include.at(filters_index).regex))
                            {
                                included=true;
                                break;
                            }
                        }
                        filters_index++;
                    }
                    if(!included)
                    {}
                    else
                        #ifndef ULTRACOPIER_PLUGIN_RSYNC
                        emit fileTransfer(fileInfo,destination.absoluteFilePath()+text_slash+fileInfo.fileName(),mode);
                        #else
                        {
                            bool sendToTransfer=false;
                            if(!rsync)
                                sendToTransfer=true;
                            else if(!QFile::exists(destination.absoluteFilePath()+"/"+fileInfo.fileName()))
                                sendToTransfer=true;
                            else if(fileInfo.lastModified()!=QFileInfo(destination.absoluteFilePath()+"/"+fileInfo.fileName()).lastModified())
                                sendToTransfer=true;
                            if(sendToTransfer)
                                emit fileTransfer(fileInfo.absoluteFilePath(),destination.absoluteFilePath()+"/"+fileInfo.fileName(),mode);
                        }
                        #endif
                }
            }
        }
        else
        {
            if(fileInfo.isDir() && !fileInfo.isSymLink())//possible wait time here
                //listFolder(source,destination,suffixPath+fileInfo.fileName()+QDir::separator());
                listFolder(fileInfo,destination.absoluteFilePath()+text_slash+fileInfo.fileName());//put unix separator because it's transformed into that's under windows too
            else
                #ifndef ULTRACOPIER_PLUGIN_RSYNC
                emit fileTransfer(fileInfo,destination.absoluteFilePath()+text_slash+fileInfo.fileName(),mode);
                #else
                {
                    bool sendToTransfer=false;
                    if(!rsync)
                        sendToTransfer=true;
                    else if(!QFile::exists(destination.absoluteFilePath()+"/"+fileInfo.fileName()))
                        sendToTransfer=true;
                    else if(fileInfo.lastModified()!=QFileInfo(destination.absoluteFilePath()+"/"+fileInfo.fileName()).lastModified())
                        sendToTransfer=true;
                    if(sendToTransfer)
                        emit fileTransfer(fileInfo.absoluteFilePath(),destination.absoluteFilePath()+"/"+fileInfo.fileName(),mode);
                }
                #endif
        }
    }
    #ifdef ULTRACOPIER_PLUGIN_RSYNC
    if(rsync)
    {
        //check the reverse path here
        QFileInfoList entryListDestination;
        if(copyListOrder)
            entryListDestination=QDir(destination.absoluteFilePath()).entryInfoList(QDir::AllEntries|QDir::NoDotAndDotDot|QDir::Hidden|QDir::System,QDir::DirsFirst|QDir::Name|QDir::IgnoreCase);//possible wait time here
        else
            entryListDestination=QDir(destination.absoluteFilePath()).entryInfoList(QDir::AllEntries|QDir::NoDotAndDotDot|QDir::Hidden|QDir::System);//possible wait time here
        int sizeEntryListDestination=entryListDestination.size();
        int index=0;
        for (int indexDestination=0;indexDestination<sizeEntryListDestination;++indexDestination)
        {
            index=0;
            while(index<sizeEntryList)
            {
                if(entryListDestination.at(indexDestination).fileName()==entryList.at(index).fileName())
                    break;
                index++;
            }
            if(index==sizeEntryList)
            {
                //then not found, need be remove
                emit addToRmForRsync(entryListDestination.at(indexDestination));
            }
         }
         return;
    }
    #endif
    if(mode==Ultracopier::Move)
    {
        ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"source: "+source.absoluteFilePath()+", sizeEntryList: "+QString::number(sizeEntryList));
        emit addToMovePath(source,destination,sizeEntryList);
    }
}
void CFileSystemObject::refreshInfo()
{
	_properties.exists = _fileInfo.exists();
	_properties.fullPath = _fileInfo.absoluteFilePath();

	if (_fileInfo.isFile())
		_properties.type = File;
	else if (_fileInfo.isDir())
	{
		// Normalization - very important for hash calculation and equality checking
		// C:/1/ must be equal to C:/1
		if (!_properties.fullPath.endsWith('/'))
			_properties.fullPath.append('/');

		_properties.type = _fileInfo.isBundle() ? Bundle : Directory;
	}
	else if (_properties.exists)
	{
#ifdef _WIN32
		qInfo() << _properties.fullPath << " is neither a file nor a dir";
#endif
	}
	else if (_properties.fullPath.endsWith('/'))
		_properties.type = Directory;

	_properties.hash = fasthash64(_properties.fullPath.constData(), _properties.fullPath.size() * sizeof(QChar), 0);


	if (_properties.type == File)
	{
		_properties.extension = _fileInfo.suffix();
		_properties.completeBaseName = _fileInfo.completeBaseName();
	}
	else if (_properties.type == Directory)
	{
		_properties.completeBaseName = _fileInfo.baseName();
		const QString suffix = _fileInfo.completeSuffix();
		if (!suffix.isEmpty())
			_properties.completeBaseName = _properties.completeBaseName % '.' % suffix;

		// Ugly temporary bug fix for #141
		if (_properties.completeBaseName.isEmpty() && _properties.fullPath.endsWith('/'))
		{
			const QFileInfo tmpInfo = QFileInfo(_properties.fullPath.left(_properties.fullPath.length() - 1));
			_properties.completeBaseName = tmpInfo.baseName();
			const QString sfx = tmpInfo.completeSuffix();
			if (!sfx.isEmpty())
				_properties.completeBaseName = _properties.completeBaseName % '.' % sfx;
		}
	}
	else if (_properties.type == Bundle)
	{
		_properties.extension = _fileInfo.suffix();
		_properties.completeBaseName = _fileInfo.completeBaseName();
	}

	_properties.fullName = _properties.type == Directory ? _properties.completeBaseName : _fileInfo.fileName();
	_properties.isCdUp = _properties.fullName == QLatin1String("..");
	// QFileInfo::canonicalPath() / QFileInfo::absolutePath are undefined for non-files
	_properties.parentFolder = parentForAbsolutePath(_properties.fullPath);

	if (!_properties.exists)
		return;

	_properties.creationDate = (time_t) _fileInfo.created().toTime_t();
	_properties.modificationDate = _fileInfo.lastModified().toTime_t();
	_properties.size = _properties.type == File ? _fileInfo.size() : 0;

	if (isDir())
		_dir.setPath(fullAbsolutePath());
	else
		_dir = QDir();
}