Example #1
0
void FileWatcher::addDirectory(QString root) {
    if (directories().contains(root))
        return;

    QStringList dirs;
    QStringList files;
    if (includeSubdirectories) {
        setupSubDirectories(dirs, files, root);
        if (!dirs.isEmpty())
           addPaths(dirs);
        if (!files.isEmpty())
            addPaths(files);
    } else {
        setupDirectory(files, root);
        if (!root.isEmpty())
            addPath(root);
        if (!files.isEmpty())
            addPaths(files);
    }
    if (scanType == ImportDelete) {
        for (int i=0; i<files.size(); i++) {
            saveFile(files[i]);
        }
    }
    if (scanType == ImportKeep)
        saveFiles = files;

}
/*!
    Adds \a path to the file system watcher if \a path exists. The
    path is not added if it does not exist, or if it is already being
    monitored by the file system watcher.

    If \a path specifies a directory, the directoryChanged() signal
    will be emitted when \a path is modified or removed from disk;
    otherwise the fileChanged() signal is emitted when \a path is
    modified, renamed or removed.

    If the watch was successful, true is returned.

    Reasons for a watch failure are generally system-dependent, but
    may include the resource not existing, access failures, or the
    total watch count limit, if the platform has one.

    \note There may be a system dependent limit to the number of
    files and directories that can be monitored simultaneously.
    If this limit is been reached, \a path will not be monitored,
    and false is returned.

    \sa addPaths(), removePath()
*/
bool QFileSystemWatcher::addPath(const QString &path)
{
    if (path.isEmpty()) {
        qWarning("QFileSystemWatcher::addPath: path is empty");
        return true;
    }

    QStringList paths = addPaths(QStringList(path));
    return paths.isEmpty();
}
Example #3
0
void SearchPathsDialog::on_pbAddPath_clicked( void )
{
    static QString s_strPath = QDir::homePath();
    QStringList arrDirs( QFileDialog::getExistingDirectory( this, tr( "Choose Folder" ), s_strPath ) );
    if ( arrDirs.front() == "" )
        return;
    s_strPath = QFileInfo( arrDirs.front() + ".1" ).absolutePath();
    if ( m_pUi->cbAddSubpaths->isChecked() )
        addSubDirectories( arrDirs );
    addPaths( arrDirs );
}
Example #4
0
bool DoubleEdgePather::runPathingAlgorithm(
        const SliceMaterialRegion& region,
        PathSliceRegion* returned_paths,
        PatherProgressCallback* callback) {
  initialize();

  { // Add all inner loops to returned paths
    foreach (const FAHLoopInXYPlane& boundary, region.getInnerBoundaries()) {
      addPaths(boundary, returned_paths, callback, false);
    }
//    const QVector<FAHLoopInXYPlane>& inner_boundaries
//        = region.getInnerBoundaries();
//    for (int boundary = 0; boundary < inner_boundaries.size(); ++boundary) {
//      addPaths(inner_boundaries.at(boundary), returned_paths);
//    }
  }

  addPaths(region.getOuterBoundary(), returned_paths, callback, true);

  // Success
  return true;
}
void OpenInfraPlatform::UserInterface::Alignment2DScene::scale()
{	
	QPainterPath diagPainter, diagDashedPainter;

	clear();

	drawDiagram(diagPainter, diagDashedPainter);	
	
	addPath(diagPainter, diagramPen, transparentBrush);
	addPath(diagDashedPainter, diagramDashedPen, transparentBrush);

	addPaths();

	setSceneRect(
		bounds[0] * scalingX - 150,
		bounds[2] * scalingY - 50, 
		bounds[1] * scalingX - bounds[0] * scalingX + 200, 
		bounds[3] * scalingY - bounds[2] * scalingY + 200);
}
Example #6
0
SelectPathsWidget::SelectPathsWidget(const QStringList& paths, QWidget* parent /*= 0*/):
        QWidget(parent) {
    m_ui = new Ui::SelectPathsWidget();
    m_ui->setupUi(this);

    m_pathsModel = new QStringListModel(this);
    m_pathsModel->setStringList(m_paths);
    m_ui->pathsView->setModel(m_pathsModel);

    m_ui->pathsView->setSelectionMode(QAbstractItemView::ExtendedSelection);

    connect(m_ui->pathsView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
            this, SLOT(handleSelectionChanged()));

    m_ui->addButton->setIcon(QIcon::fromTheme(QStringLiteral("list-add")));
    m_ui->removeButton->setIcon(QIcon::fromTheme(QStringLiteral("list-remove")));

    connect(m_ui->addButton, SIGNAL(clicked()),
            this, SLOT(add()));
    connect(m_ui->removeButton, SIGNAL(clicked()),
            this, SLOT(remove()));

    addPaths(paths);
}
/*!
    Constructs a new file system watcher object with the given \a parent
    which monitors the specified \a paths list.
*/
QFileSystemWatcher::QFileSystemWatcher(const QStringList &paths, QObject *parent)
    : QObject(*new QFileSystemWatcherPrivate, parent)
{
    d_func()->init();
    addPaths(paths);
}
Example #8
0
 void LuaState::load( unsigned int threadId, bool exception, const char* init ) 
{
    TRACE_ENTERLEAVE();
    
    addPaths( "path" );
    addPaths( "cpath" );
    
    
    char script[ 1024 ];
    
    TRACE( "loading %s", m_filename.c_str() );
    setGlobal( "threadId", threadId );
    
    try
    {
        execute( "require 'leda'" );
        if ( init )
        {
            execute( init );
        }    
    }
    catch ( const  std::runtime_error& e )
    {
        if ( exception )
        {
            throw e;
        }
    }
    setArguments( );
    
    if ( m_filename.find( ".moon") != std::string::npos )
    {
        //
        //  moonscript
        //
        try
        {
            execute( "require 'moonscript'");
        }
        catch ( const std::runtime_error& e )
        {
            if ( exception )
            {
                throw e;
            }
            
            return;
        }
        
        sprintf( script, "local moonscript = require('moonscript'); "
        "moonscript.dofile('%s');", m_filename.c_str() ); 
    }
    else
    {
        //
        //  lua
        //
        sprintf( script,"dofile('%s');", m_filename.c_str() ); 
    }

    try
    {
        execute( script );
    }
    catch( const std::runtime_error& e )
    {
        if ( exception )
        {
            throw e;
        }
    }
    
   
   
}