示例#1
0
文件: textdoc.cpp 项目: AMDmi3/qucs
// ---------------------------------------------------
void TextDoc::setName (const QString& Name_)
{
  DocName = Name_;
  setLanguage (DocName);

  QFileInfo Info (DocName);
  if (App)
    App->DocumentTab->setTabLabel (this, Info.fileName ());

  DataSet = Info.baseName (true) + ".dat";
  DataDisplay = Info.baseName (true) + ".dpl";
  if(Info.extension(false) == "m" || Info.extension(false) == "oct")
    SimTime = "1";
}
示例#2
0
void Controller::loadAlbums()
{
    QDir dir;
    dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
    dir.setSorting(QDir::Name);
    dir.setCurrent(m_pParser->getDirectory());

    QFileInfoList list = dir.entryInfoList();
    for(int i = 0; i < list.count(); ++i)
    {
         QFileInfo fileInfo = list.at(i);
         m_pParser->setFile(fileInfo.baseName());
         m_listAlbums.insert(fileInfo.baseName(),new Album(m_pParser->getAlbumFromFile(fileInfo.baseName())));
    }
}
示例#3
0
文件: main.cpp 项目: Vanuan/iviLink
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);
        }
        else
        if(file.baseName().toLower()=="makefile")
        {
            qDebug()<<"Parsing "<<file.baseName();
            processMakeFile(file.absoluteFilePath(),force_update);
        }
    }

}
示例#4
0
BrowserIcon::BrowserIcon(QFileInfo f, QString url, QWidget *parent) :
    QPushButton(QIcon::fromTheme(f.baseName()), "", parent) {
  setIconSize(QSize(ICONSIZE, ICONSIZE));
  setFixedSize(QSize(ICONSIZE,ICONSIZE));

  exec = findExec(f, url);
}
示例#5
0
PrinterAPI::PrinterAPI() : QObject(COLLECTOR)
{
	qDebug() << "PrinterAPI loaded";
	setObjectName("printer");
	printer = QString("File");
	cmd = QString("");
	color = true;
	useICC = false;
	mph = false;
	mpv = false;
	ucr = true;
	copies = true;



	QString tf(ScCore->primaryMainWindow()->doc->pdfOptions().fileName);
	if (tf.isEmpty())
	{
		QFileInfo fi = QFileInfo(ScCore->primaryMainWindow()->doc->DocName);
		tf = fi.path()+"/"+fi.baseName()+".pdf";
	}
	file = tf;


	int num = 0;
	if (ScCore->primaryMainWindow()->HaveDoc)
		num = ScCore->primaryMainWindow()->doc->Pages->count();

	for (int i = 0; i<num; i++)
	{
		pages.append(i+1);
	}
	
	separation = "No";
}
void SubComponentManager::parseDirectories()
{
    if (!m_filePath.isEmpty()) {
        const QString file = m_filePath.toLocalFile();
        QFileInfo dirInfo = QFileInfo(QFileInfo(file).path());
        if (dirInfo.exists() && dirInfo.isDir())
            parseDirectory(dirInfo.canonicalFilePath());

        foreach (const QString &subDir, QDir(QFileInfo(file).path()).entryList(QDir::Dirs | QDir::NoDot | QDir::NoDotDot)) {
            parseDirectory(dirInfo.canonicalFilePath() + "/" + subDir, true, subDir.toUtf8());
        }
    }

    foreach (const Import &import, m_imports) {
        if (import.isFileImport()) {
            QFileInfo dirInfo = QFileInfo(m_filePath.resolved(import.file()).toLocalFile());
            if (dirInfo.exists() && dirInfo.isDir())
                parseDirectory(dirInfo.canonicalFilePath(), true, dirInfo.baseName().toUtf8());
        } else {
            QString url = import.url();
            url.replace(QLatin1Char('.'), QLatin1Char('/'));
            QFileInfo dirInfo = QFileInfo(url);
            foreach (const QString &path, importPaths()) {
                QString fullUrl  = path + QLatin1Char('/') + url;
                dirInfo = QFileInfo(fullUrl);
                if (dirInfo.exists() && dirInfo.isDir()) {
                    //### todo full qualified names QString nameSpace = import.uri();
                    parseDirectory(dirInfo.canonicalFilePath(), false);
                }
            }
        }
    }
示例#7
0
void IconApplet::showConfigurationInterface()
{
    KPropertiesDialog *dialog = m_dialog.data();
    m_configTarget = m_url;
    if (m_hasDesktopFile) {
        const QFileInfo fi(m_url.toLocalFile());
        if (!fi.isWritable()) {
            const QString suggestedName = fi.baseName();
            m_configTarget = KService::newServicePath(false, suggestedName);
            KIO::Job *job = KIO::file_copy(m_url, m_configTarget);
            job->exec();
        }
    }

    if (dialog) {
        KWindowSystem::setOnDesktop(dialog->winId(), KWindowSystem::currentDesktop());
        dialog->show();
        KWindowSystem::activateWindow(dialog->winId());
    } else {
        dialog = new KPropertiesDialog(m_configTarget, 0 /*no parent widget*/);
        m_dialog = dialog;
        connect(dialog, SIGNAL(applied()), this, SLOT(acceptedPropertiesDialog()));
        connect(dialog, SIGNAL(canceled()), this, SLOT(cancelledPropertiesDialog()));
        dialog->setAttribute(Qt::WA_DeleteOnClose, true);
        dialog->setWindowTitle(i18n("%1 Icon Settings", m_configTarget.fileName()));
        dialog->show();
    }
}
示例#8
0
文件: setup.cpp 项目: icefox/kinkatta
/***************************************************************************
 * Returns a list of all the registered users of kinkatta. By this, it means all
 * users that have a settings file under ~/.kde/share/apps/kinkatta/
 ***************************************************************************/
QStringList setup::registeredUsers(){
	QString buddy = "";
	QString extension = "";
	QFileInfo fileInfo;
	QStringList l;

	QString homeDirr = KINKATTA_DIR;
	if(!QFile::exists(homeDirr)) {
		return l; //no registered users, return empty StringList
	}

  QDir home(homeDirr);
  home.setFilter( QDir::Files | QDir::NoSymLinks );

  if ( home.exists() ){
   for (unsigned int i = 0; i < home.count(); i++){
			fileInfo.setFile(home[i]);
      buddy = fileInfo.baseName().lower();
			extension = fileInfo.extension( FALSE );
      if ( (extension == "xml") && buddy != "settings"){ //settings.xml is the global settings file
				if(l.contains(buddy) == 0)  //make them unique
					l.append(buddy);
      }
    }
  }
	return l;
}
示例#9
0
QVariant ImageList::data(const QModelIndex &index, int role) const
{
    Image *img = at(index.row());
    QFileInfo fi = QFileInfo(img->getPath());

    if (role == Qt::DisplayRole) {
        switch (index.column()) {
        case 0:
            return fi.baseName();
        case 1:
            return fi.suffix().toLower();
        case 2:
            return QString("%1 kB").arg(fi.size() / 1024.0, 0, 'f', 2);
        case 3:
            if (img->isLoaded()) return img->getSourceMat().channels();
        case 4:
            if (img->isLoaded()) return img->getSourceMat().cols;
        case 5:
            if (img->isLoaded()) return img->getSourceMat().rows;
        }
    }
    else if (role ==Qt::TextAlignmentRole) {
        switch (index.column()) {
        case 4:
            return Qt::AlignRight;
        default:
            return Qt::AlignLeft;
        }
    }

    return QVariant();
}
示例#10
0
void Select_Icon_Window::Set_Previous_Icon_Path( const QString& path )
{
	// Analise path...
	if( path[0] == ':' ) // AQEMU Default Icons
	{
		if( path.contains("linux", Qt::CaseInsensitive) ) ui.RB_Icon_Linux->setChecked( true );
		else if( path.contains("windows", Qt::CaseInsensitive) ) ui.RB_Icon_Windows->setChecked( true );
		else ui.RB_Icon_Other->setChecked( true );
	}
	else if( path.indexOf(QDir::toNativeSeparators(Settings.value("AQEMU_Data_Folder", "").toString() + "/os_icons/")) == 0 ) // AQEMU Icons Folder
	{
		ui.RB_All_System_Icons->setChecked( true );
		
		QFileInfo fl = QFileInfo( path );
		
		for( int ix = 0; ix < ui.All_Icons_List->count(); ++ix )
		{
			if( ui.All_Icons_List->item(ix)->text() == fl.baseName() )
			{
				ui.All_Icons_List->setCurrentRow( ix );
				
				// This hack :)
				ui.All_Icons_List->setViewMode( QListView::ListMode );
				ui.All_Icons_List->setViewMode( QListView::IconMode );
				return;
			}
		}
	}
	else // Other Path
	{
		ui.RB_User_Icons->setChecked( true );
		ui.Edit_Other_Icon_Path->setText( path );
	}
}
AbstractMainWindow::AbstractMainWindow(int _screenIndex, QWidget *parent) :
    QWidget(parent),
    screenIndex(_screenIndex)
{
    /*
     * Enlist all image files from /usr/share/backgrounds or
     * the directory set from ini file
     * and map them as -
     * baseName --> absolutePath
     */
    AbstractMainWindow::imageFileMap.insert(DEF_IMG_BASE_NAME,
                                            DEF_IMG_ABS_PATH);
    QDirIterator it(AbstractMainWindow::settings.value(KEY_IMG_DIR,DEF_IMG_DIR).toString(),
                    QStringList() << "*.jpg" << "*.png" << "*.jpeg",
                    QDir::Files, QDirIterator::Subdirectories);
    while(it.hasNext())
    {
        //qDebug()<<it.next();//mandatory to iterate :-<
        QString tmp = it.next();
        QFileInfo info = it.fileInfo();
        AbstractMainWindow::imageFileMap.insert(info.baseName(),
                                                info.absoluteFilePath());
    }
    qDebug()<<"Total " << imageFileMap.count() << " images found";

    /*
     * Set Object name and Geometry according to the monitor index
     */
    this->setObjectName(QString("LoginWindow_%1").arg(screenIndex));
    this->setGeometry(QApplication::desktop()->screenGeometry(screenIndex));
}
示例#12
0
/**
 *  \brief Loads the fonts in font files within the given directory structure
 *
 *   Recursively scans all directories under directory looking for TrueType
 *   (.ttf) and OpenType (.otf) font files or TrueType font collections (.ttc)
 *   and loads the fonts to make them available to the application.
 *
 *  \param directory      The directory to scan
 *  \param registeredFor  The user of the font. Used with releaseFonts() to
 *                        unload the font if no longer in use (by any users)
 *  \param maxDirs        The maximum number of subdirectories to scan
 */
void MythFontManager::LoadFonts(const QString &directory,
                                const QString &registeredFor, int *maxDirs)
{
    if (directory.isEmpty() || directory == "/" || registeredFor.isEmpty())
        return;
    (*maxDirs)--;
    if (*maxDirs < 1)
    {
        LOG(VB_GENERAL, LOG_WARNING, LOC +
            "Reached the maximum directory depth "
            "for a font directory structure. Terminating font scan.");
        return;
    }

    // Load the font files from this directory
    LoadFontsFromDirectory(directory, registeredFor);
    // Recurse through subdirectories
    QDir dir(directory);
    QFileInfoList files = dir.entryInfoList();
    QFileInfo info;
    for (QFileInfoList::const_iterator it = files.begin();
         ((it != files.end()) && (*maxDirs > 0)); ++it)
    {
        info = *it;
        // Skip '.' and '..' and other files starting with "." by checking
        // baseName()
        if (!info.baseName().isEmpty() && info.isDir())
            LoadFonts(info.absoluteFilePath(), registeredFor, maxDirs);
    }
}
示例#13
0
文件: modes.cpp 项目: alinelena/aten
// Export all currently loaded models in the referenced format
void Aten::exportModels()
{
	Messenger::enter("Aten::exportModels");
	QFileInfo fileInfo;
	QString newFilename;

	// Loop over loaded models
	for (Model* m = models_.first(); m != NULL; m = m->next)
	{
		// Set current model
		setCurrentModel(m);

		// Generate new filename for model, with new suffix
		fileInfo.setFile(m->filename());
		newFilename = fileInfo.dir().absoluteFilePath(fileInfo.baseName() + "." + exportModelPlugin_->extensions().first());

		QFileInfo newFileInfo(newFilename);
		// Make sure that the new filename is not the same as the old filename
		if (fileInfo == newFileInfo)
		{
			Messenger::print("Exported file would overwrite the original (%s) - not converted.", qPrintable(m->filename()));
			continue;
		}

		if (exportModel(m, newFilename, exportModelPlugin_, FilePluginStandardImportOptions(), exportModelPluginOptions_)) Messenger::print("Model '%s' saved to file '%s' (%s)", qPrintable(m->name()), qPrintable(newFilename), qPrintable(exportModelPlugin_->name()));
		else Messenger::print("Failed to save model '%s'.", qPrintable(m->name()));
		m->enableUndoRedo();
	}
	Messenger::exit("Aten::exportModels");
}
// +-----------------------------------------------------------
ft::FtApplication::FtApplication(int argc, char* argv[]): QApplication(argc, argv)
{
    m_pMainWindow = NULL;

	// Information used to store the program settings
    QCoreApplication::setOrganizationName("Flat");
    QCoreApplication::setOrganizationDomain("https://github.com/luigivieira/Facial-Landmarks-Annotation-Tool.git");
    QCoreApplication::setApplicationName("Data");

	QString sAppFile = QCoreApplication::applicationFilePath();
	QString sDocPath = QDir::toNativeSeparators(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)) + QDir::separator();
	QFileInfo oFile = QFileInfo(sAppFile);
	QString sLogFile = QString("%1%2.log").arg(sDocPath).arg(oFile.baseName());

	m_oLogFile.open(qPrintable(sLogFile), ios::app);
	if (!m_oLogFile.is_open())
	{
		cerr << QString("Could not open the file [%1] for writing. No log will be created.").arg(sLogFile).toStdString();
		exit(-1);
	}
	
	qInstallMessageHandler(&ft::FtApplication::handleLogOutput);
	
	qDebug() << QCoreApplication::applicationFilePath().toStdString().c_str() << "started.";
}
示例#15
0
文件: Plugin.cpp 项目: Penguinum/lmms
	foreach( const QFileInfo& f, list )
	{
		QLibrary pluginLibrary( f.absoluteFilePath() );
		if( pluginLibrary.load() == false ||
			pluginLibrary.resolve( "lmms_plugin_main" ) == NULL )
		{
			continue;
		}

		QString descriptorName = f.baseName() + "_plugin_descriptor";
		if( descriptorName.left( 3 ) == "lib" )
		{
			descriptorName = descriptorName.mid( 3 );
		}

		Descriptor* pluginDescriptor = (Descriptor *) pluginLibrary.resolve( descriptorName.toUtf8().constData() );
		if( pluginDescriptor == NULL )
		{
			qWarning() << tr( "LMMS plugin %1 does not have a plugin descriptor named %2!" ).
								arg( f.absoluteFilePath() ).arg( descriptorName );
			continue;
		}

		pluginDescriptors += *pluginDescriptor;
	}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
bool SIMPLView_UI::savePipeline()
{
  if (isWindowModified() == true)
  {
    QString filePath;
    if (m_OpenedFilePath.isEmpty())
    {
      // When the file hasn't been saved before, the same functionality as a "Save As" occurs...
      bool didSave = savePipelineAs();
      return didSave;
    }
    else
    {
      filePath = m_OpenedFilePath;
    }

    // Fix the separators
    filePath = QDir::toNativeSeparators(filePath);

    // Write the pipeline
    pipelineViewWidget->writePipeline(filePath);

    // Set window title and save flag
    QFileInfo prefFileInfo = QFileInfo(filePath);
    setWindowTitle("[*]" + prefFileInfo.baseName() + " - SIMPLView");
    setWindowModified(false);

    // Add file to the recent files list
    QRecentFileList* list = QRecentFileList::instance();
    list->addFile(filePath);
  }

  return true;
}
示例#17
0
void CppPreprocessor::setIncludePaths(const QStringList &includePaths)
{
    m_includePaths.clear();

    for (int i = 0; i < includePaths.size(); ++i) {
        const QString &path = includePaths.at(i);

#ifdef Q_OS_DARWIN
        if (i + 1 < includePaths.size() && path.endsWith(QLatin1String(".framework/Headers"))) {
            const QFileInfo pathInfo(path);
            const QFileInfo frameworkFileInfo(pathInfo.path());
            const QString frameworkName = frameworkFileInfo.baseName();

            const QFileInfo nextIncludePath = includePaths.at(i + 1);
            if (nextIncludePath.fileName() == frameworkName) {
                // We got a QtXXX.framework/Headers followed by $QTDIR/include/QtXXX.
                // In this case we prefer to include files from $QTDIR/include/QtXXX.
                continue;
            }
        }
        m_includePaths.append(path);
#else
        m_includePaths.append(path);
#endif
    }
}
示例#18
0
void EvoRobotViewer::loadAllStat()
{
	FitViewer* fitViewer = statViewer->findChild<FitViewer*>( "statFitViewer" );
	if ( fitViewer ) {
		delete fitViewer;
	}

	QDir currentDir;
	QFileInfoList statFiles = currentDir.entryInfoList( QStringList() << "statS*.fit", QDir::Files, QDir::Name );

	fitViewer = new FitViewer(statFiles.size(), ga->getNumOfGenerations(), statViewer);
	fitViewer->setObjectName( "statFitViewer" );
	QString title = QString("Stat monitor");
	fitViewer->setLabels(title, QString("Generation"), QString("Fitness"));

	QColor colors[10] = { QColor(Qt::red), QColor(Qt::green), QColor(Qt::blue), QColor(Qt::cyan),
						QColor(Qt::magenta), QColor(Qt::darkYellow), QColor(Qt::gray), QColor(255, 140, 0, 255),
						QColor(153, 50, 204, 255), QColor(Qt::black) };
	for(int i=0; i<statFiles.size(); i++ ) {
		QFileInfo statFile = statFiles[i];
		QColor col = colors[i%10];
		fitViewer->setChunkProperties( i, QString("Seed:").append(statFile.baseName().split("S").last()), col, true );
		fitViewer->loadRawData( i, statFile.fileName(), 0 );
	}
	fitViewer->sortchunks();
	QGridLayout* lay = qobject_cast<QGridLayout*>( statViewer->layout() );
	lay->addWidget( fitViewer, 1, 0, 1, 2 );
	lay->setRowStretch( 1, 2 );
	fitViewer->show();
}
SpreadSheetTableConnector::SpreadSheetTableConnector(const Ilwis::Resource &resource, bool load, const Ilwis::IOOptions &options) :  IlwisObjectConnector(resource, load, options)
{
    QFileInfo odsinfo = resource.toLocalFile();
    QString sheetName;
    QString suffix =  odsinfo.suffix();
    if ( suffix == "" && options.contains("format")){
        suffix = options["format"].toString();
    }
    if ( !knownSuffix(suffix)){
        int index  = odsinfo.absoluteFilePath().lastIndexOf("/");
        int index2 = odsinfo.absoluteFilePath().lastIndexOf(".");
        if ( index2 == -1 || index2 < index){
            sheetName = odsinfo.absoluteFilePath().mid(index + 1);
            odsinfo = QFileInfo(odsinfo.absolutePath());
        }else if ( index2 != -1){
            suffix = options["format"].toString();
            QString correctName = odsinfo.absolutePath() + "/" + odsinfo.baseName() + "." + suffix;
            QString correctUrl = QUrl::fromLocalFile(correctName).toString();
            sourceRef().setUrl(correctUrl);
            sourceRef().setUrl(correctUrl,true);
        }
    }
    if ( suffix.toLower() == "ods"){
        _spreadsheet.reset( new ODSFormat());
    } else if ( suffix.toLower() == "xls"){
        _spreadsheet.reset( new XLSFormat());
    } else if ( suffix.toLower() == "xlsx"){
        _spreadsheet.reset( new XLSXFormat());
    }

}
示例#20
0
CloudImageProvider::CloudImageProvider(QObject *parent) : QObject(parent),
    QQuickImageProvider(QQuickImageProvider::Image , QQmlImageProviderBase::ForceAsynchronousImageLoading)
//    QDeclarativeImageProvider(QDeclarativeImageProvider::Image)
{
    // This space intentionally left blank.

    mgr = new QNetworkAccessManager;
    connect(mgr,SIGNAL(finished(QNetworkReply*)),this,SLOT(loadfinished(QNetworkReply*)));

    // load cache
    // fetch workdir+"/imgcache" directory
    QDir dir;
    dir.mkpath(workDir+"/imgcache/");
    dir.setPath(workDir+"/imgcache/");
    dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
    dir.setSorting(QDir::Size | QDir::Reversed);

    QFileInfoList list = dir.entryInfoList();
    //std::cout << "     Bytes Filename" << std::endl;
    for (int i = 0; i < list.size(); ++i) {
        QFileInfo fileInfo = list.at(i);
        if (fileInfo.suffix() == "jpg") {
//            qWarning()<<"load ["<< fileInfo.baseName()<<"]="+fileInfo.absoluteFilePath();
            cache[fileInfo.baseName()] = QImage(fileInfo.absoluteFilePath());
        }

    }
}
示例#21
0
/* Helper function for getSystemTimeZoneID() that compares the
   zoneinfo_file_path (regular) file with files in the zoneinfo_dir_path until
   it finds a match.  The matching file's name is used to determine the time
   zone ID. */
static QString findZoneinfoFile(QString zoneinfo_file_path,
                                QString zoneinfo_dir_path)
{
    QString zone_id("UNDEF");
    QDir zoneinfo_dir(zoneinfo_dir_path);
    QFileInfoList dirlist = zoneinfo_dir.entryInfoList();
    QFileInfo info;
    QString basename;
    QFileInfo zoneinfo_file_info(zoneinfo_file_path);

    for (QFileInfoList::const_iterator it = dirlist.begin();
         it != dirlist.end(); ++it)
    {
        info = *it;
         // Skip '.' and '..' and other files starting with "." and
         // skip localtime (which is often a link to zoneinfo_file_path)
        basename = info.baseName();
        if (basename.isEmpty() || (basename == "localtime")) {
            continue;
        }
        if (info.isDir())
        {
            zone_id = findZoneinfoFile(zoneinfo_file_path,
                                       info.absoluteFilePath());
            if (zone_id != "UNDEF")
                return zone_id;
        }
        else if (compare_zone_files(zoneinfo_file_info, info))
        {
            zone_id = info.absoluteFilePath();
            break;
        }
    }
    return zone_id;
}
示例#22
0
const QStringList Configuration::getAllAvailableSpellCheckDictNames()
{
    QStringList dicts;
    QString dirPath = QString( "%1/%2" ).arg( defaultSpellCheckRootDir ).arg( SPELL_CHECK_DIC_DIRECTORY_NAME );
    QDir dictDir( dirPath );

    if ( !dictDir.exists() ) {
        return dicts;
    }

    QStringList filter;
    filter << "*.aff";
    QFileInfoList fileInfoList = dictDir.entryInfoList( filter, QDir::Files, QDir::Name );

    for ( int i = 0; i < fileInfoList.size(); i++ ) {
        QFileInfo fileInfo = fileInfoList.at( i );
        QString dictFilePath = QString( "%1/%2.dic" ).arg( fileInfo.absolutePath() ).arg( fileInfo.baseName() );

        if ( QFile::exists( dictFilePath ) ) {
            dicts << fileInfo.baseName();
        }
    }

    return dicts;
}
示例#23
0
文件: sdccprobe.cpp 项目: qt-labs/qbs
static QString guessSdccArchitecture(const QFileInfo &compiler)
{
    const auto baseName = compiler.baseName();
    if (baseName == QLatin1String("sdcc"))
        return QStringLiteral("mcs51");
    return {};
}
void AdminDatabase::fillList()
{
	m_listView->clear();
	const QFileInfoList *files = m_dumpDir->entryInfoList("*.sql");
	
	if ( files )
	{
		QFileInfoListIterator it( *files );
		QFileInfo * fi = 0;
		while( (fi=it.current()) != 0 )
		{
			++it;
			KListViewItem *item = new KListViewItem(m_listView);
			
			item->setText(0, fi->baseName().section('.', 0,0) );
			
			QFile tmp(fi->absFilePath());
			tmp.open(IO_ReadOnly);
			QTextStream stream( &tmp );
			item->setText(1, stream.readLine().section("--",1,1));
			tmp.close();
			item->setText(2, fi->created().toString(Qt::ISODate));
		}
		
	}
}
示例#25
0
文件: textdoc.cpp 项目: AMDmi3/qucs
// ---------------------------------------------------
QString TextDoc::getModuleName (void)
{
  switch (language) {
  case LANG_VHDL:
    {
      VHDL_File_Info VInfo (text ());
      return VInfo.EntityName;
    }
  case LANG_VERILOG:
    {
      Verilog_File_Info VInfo (text ());
      return VInfo.ModuleName;
    }
  case LANG_VERILOGA:
    {
      VerilogA_File_Info VInfo (text ());
      return VInfo.ModuleName;
    }
  case LANG_OCTAVE:
    {
      QFileInfo Info (DocName);
      return Info.baseName (true);
    }
  default:
    return "";
  }
}
示例#26
0
    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;
    }
示例#27
0
  tlp::node addFileNode(const QFileInfo &infos, tlp::Graph *g) {
    tlp::node n = g->addNode();
    _absolutePaths->setNodeValue(n,tlp::QStringToTlpString(infos.absoluteFilePath()));
    _baseNames->setNodeValue(n,tlp::QStringToTlpString(infos.baseName()));
    _createdDates->setNodeValue(n,tlp::QStringToTlpString(infos.created().toString()));
    _fileNames->setNodeValue(n,tlp::QStringToTlpString(infos.fileName()));
    _isDir->setNodeValue(n,infos.isDir());
    _isExecutable->setNodeValue(n,infos.isExecutable());
    _isReadable->setNodeValue(n,infos.isReadable());
    _isSymlink->setNodeValue(n,infos.isSymLink());
    _isWritable->setNodeValue(n,infos.isWritable());
    _lastModifiedDates->setNodeValue(n,tlp::QStringToTlpString(infos.lastModified().toString()));
    _lastReadDates->setNodeValue(n,tlp::QStringToTlpString(infos.lastRead().toString()));
    _owners->setNodeValue(n,tlp::QStringToTlpString(infos.owner()));
    _permissions->setNodeValue(n,(int)(infos.permissions()));
    _suffixes->setNodeValue(n,tlp::QStringToTlpString(infos.suffix()));
    _sizes->setNodeValue(n,infos.size());

    if (_useIcons) {
      std::string extension = infos.suffix().toStdString();

      if (infos.isDir()) {
        _fontAwesomeIcon->setNodeValue(n, tlp::TulipFontAwesome::FolderO);
        tlp::ColorProperty *viewColor = graph->getProperty<tlp::ColorProperty>("viewColor");
        viewColor->setNodeValue(n, dirColor);
      }
      else if (std::find(commonTextFilesExt.begin(), commonTextFilesExt.end(), extension) != commonTextFilesExt.end()) {
        _fontAwesomeIcon->setNodeValue(n, tlp::TulipFontAwesome::FileTextO);
      }
      else if (std::find(commonArchiveFilesExt.begin(), commonArchiveFilesExt.end(), extension) != commonArchiveFilesExt.end()) {
        _fontAwesomeIcon->setNodeValue(n, tlp::TulipFontAwesome::FileArchiveO);
      }
      else if (std::find(commonAudioFilesExt.begin(), commonAudioFilesExt.end(), extension) != commonAudioFilesExt.end()) {
        _fontAwesomeIcon->setNodeValue(n, tlp::TulipFontAwesome::FileAudioO);
      }
      else if (std::find(commonImageFilesExt.begin(), commonImageFilesExt.end(), extension) != commonImageFilesExt.end()) {
        _fontAwesomeIcon->setNodeValue(n, tlp::TulipFontAwesome::FileImageO);
      }
      else if (std::find(commonVideoFilesExt.begin(), commonVideoFilesExt.end(), extension) != commonVideoFilesExt.end()) {
        _fontAwesomeIcon->setNodeValue(n, tlp::TulipFontAwesome::FileVideoO);
      }
      else if (std::find(commonDevFilesExt.begin(), commonDevFilesExt.end(), extension) != commonDevFilesExt.end()) {
        _fontAwesomeIcon->setNodeValue(n, tlp::TulipFontAwesome::FileCodeO);
      }
      else if (extension == "pdf") {
        _fontAwesomeIcon->setNodeValue(n, tlp::TulipFontAwesome::FilePdfO);
      }
      else if (extension == "doc" || extension == "docx") {
        _fontAwesomeIcon->setNodeValue(n, tlp::TulipFontAwesome::FileWordO);
      }
      else if (extension == "xls" || extension == "xlsx") {
        _fontAwesomeIcon->setNodeValue(n, tlp::TulipFontAwesome::FileExcelO);
      }
      else if (extension == "ppt" || extension == "pptx") {
        _fontAwesomeIcon->setNodeValue(n, tlp::TulipFontAwesome::FilePowerpointO);
      }
    }

    return n;
  }
示例#28
0
void IMT_MRGui::on_actionOpen_meas_dat_triggered()
{

  _readmatlab = false;

  QString path( QFileDialog::getOpenFileName( this, tr("Open File"),
                                             _pathsetting->get_measdatpath(),
                                             tr("*.dat") ) );
  QFileInfo pathinfo;
  QString filename;

  if ( ! path.isNull() ) {
    pathinfo.setFile(path);
    filename = pathinfo.fileName();

    _pathsetting->set_measdatpath(pathinfo.absolutePath());

    _outfilename = pathinfo.baseName();   //set filename for outputfile

    setTitleText(_outfilename);
    gui_readSiemens(path, false);
  }

  _dicom=false;

}
示例#29
0
文件: rmap.cpp 项目: 87maxi/oom
void RouteMapDock::populateTable(int /*flag*/)/*{{{*/
{
	_listModel->clear();
	QDir routes;
	routes.setFilter(QDir::Files | QDir::NoSymLinks);
	if(!routes.cd(routePath))
		return;
	QFileInfoList files = routes.entryInfoList();
	for(int it = 0; it < files.size(); ++it)
	{
		QFileInfo f = files.at(it);
		QString note = oom->noteForRouteMapping(f.filePath());
		QList<QStandardItem*> rowData;
		QStandardItem *chk = new QStandardItem(f.filePath());
		QStandardItem *tname = new QStandardItem(f.baseName());
		tname->setToolTip(note);
		chk->setToolTip(note);
		rowData.append(chk);
		rowData.append(tname);
		_listModel->blockSignals(true);
		_listModel->insertRow(_listModel->rowCount(), rowData);
		_listModel->blockSignals(false);
		routeList->setRowHeight(_listModel->rowCount(), 25);
	}
	updateTableHeader();
	//routeList->resizeRowsToContents();
}/*}}}*/
示例#30
0
void WdgMem::OnAddIqFile()
{
	QStringList files = QFileDialog::getOpenFileNames(this, tr("Open IQ Wav file"), lastPath, tr("IQ Wav files (*.wav *.wave )"));
	QFileInfo info;
	QTableWidgetItem *pTwiEna;
	QTableWidgetItem *pTwiName;
	QTableWidgetItem *pTwiTime;
	for(quint32 i = 0; i < static_cast<quint32>(files.count()); i++)
	{
		info.setFile(files.at(i));
		if(info.isFile())
		{
			lastPath = info.filePath();
			FileInfo fInfo;
			fInfo.path = info.absoluteFilePath();
			fInfo.name = info.fileName();
			fInfo.time = QTime(0, 0, 10, 0);
			filesList << fInfo;
            pTwiEna  = new QTableWidgetItem;
			pTwiName = new QTableWidgetItem;
			pTwiTime = new QTableWidgetItem;
			pTwiName->setText(info.baseName());
		}
	}
}