예제 #1
0
void DisplayWidget::SetDirectory(QString filename)
{
	QDir dir(filename);

	if(!dir.isAbsolute())
		LOG_WARNING(cString::Format("Path is not absolute. Force absolute path!"));

	QStringList fileList = dir.entryList(QDir::Files);
	QStringList files;
	
	for(QStringList::iterator it = fileList.begin(); it != fileList.end(); it++)
	{
		if(it->endsWith(".xml"))
		{
			cDOM oDOM;
			QString qString = dir.absoluteFilePath(".") + "/" + *it;
			LOG_INFO(cString::Format("path %s", qString.toStdString().c_str()));
			oDOM.Load(qString.toStdString().c_str());
			cDOMElementRefList oElems;
			if(IS_OK(oDOM.FindNodes("presets/sensorPreset", oElems)))
				files.push_back(*it);
		}
	}

	m_dropDownFileChooser->addItems(files);
}
예제 #2
0
	void ScanFolderPlugin::updateScanFolders()
	{
		QStringList folders = ScanFolderPluginSettings::folders();
		
		// make sure folders end with /
		for (QStringList::iterator i = folders.begin();i !=folders.end(); i++)
		{
			if (!i->endsWith(bt::DirSeparator()))
				(*i) += bt::DirSeparator();
		}
		
		if (ScanFolderPluginSettings::actionDelete())
			tlq->setLoadedTorrentAction(DeleteAction);
		else if (ScanFolderPluginSettings::actionMove())
			tlq->setLoadedTorrentAction(MoveAction);
		else
			tlq->setLoadedTorrentAction(DefaultAction);
		
		scanner->setRecursive(ScanFolderPluginSettings::recursive());
		scanner->setFolderList(folders);
	}
예제 #3
0
void PluginManager::loadPlugins() {
	// first try to remove duplicit directories
	// (I know, I know, this is bad as it does not take care of
	// symlinks etc. but it is better than nothing)
	QStringList::iterator dirEnd = pluginDirectories_.end();
	for (QStringList::iterator dir = pluginDirectories_.begin(); dir != dirEnd; ++dir) {
		if (!dir->endsWith("/")) {
			dir->append("/");
		}
	}
	pluginDirectories_.removeDuplicates();
	
	dirEnd = pluginDirectories_.end();
	for (QStringList::iterator dir = pluginDirectories_.begin(); dir != dirEnd; ++dir) {
		QDir pluginDirectory(*dir);
		
		QStringList pluginFiles = pluginDirectory.entryList(QStringList() << "lib*plugin*");
		QStringList::iterator e = pluginFiles.end();
		for (QStringList::iterator i = pluginFiles.begin(); i != e; ++i) {
			loadPlugin(pluginDirectory.absoluteFilePath(*i));
		}
	}
}
예제 #4
0
QStringList::iterator
CLArgsPrivate::findFileNameWithExtension(const QString& extension)
{
    bool isPython = extension == QString::fromUtf8("py");

    for (QStringList::iterator it = args.begin(); it != args.end(); ++it) {
        if (isPython) {
            //Check that we do not take the python script specified for the --onload argument as the file to execute
            if ( it == args.begin() ) {
                continue;
            }
            QStringList::iterator prev = it;
            --prev;
            if ( ( *prev == QString::fromUtf8("--onload") ) || ( *prev == QString::fromUtf8("-l") ) ) {
                continue;
            }
        }
        if ( it->endsWith(QChar::fromLatin1('.') + extension) ) {
            return it;
        }
    }

    return args.end();
}