当前位置: 首页>>代码示例>>C++>>正文


C++ QDir::count方法代码示例

本文整理汇总了C++中QDir::count方法的典型用法代码示例。如果您正苦于以下问题:C++ QDir::count方法的具体用法?C++ QDir::count怎么用?C++ QDir::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QDir的用法示例。


在下文中一共展示了QDir::count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initPackages

int packagesPage::initPackages()
{
    QDir packagesDir;

    if (!packagesDir.cd(packagesListDirPath))
    {
		setStatus(tr("Ooops , Couldn't find the packages info directory : ")+packagesListDirPath, ERROR);
        return 1;
    }
    
    cerr << packagesListDirPath.toStdString() << endl  << flush;

    QString repoName("");
    QVector<meskPackage> repoPackages;
    //packages.clear();

    for ( unsigned int repo =0; repo < packagesDir.count(); repo++)
    {
        repoName = packagesDir.entryList().at(repo);

        if (repoName == "." || repoName == "..")
        {
            continue;
        }

        packagesDir.cd(repoName);

        for ( unsigned int package = 0; package < packagesDir.count(); package++)
        {
            if (packagesDir.entryList().at(package) == "." ||
                packagesDir.entryList().at(package) == "..")
            {
                continue;
            }

            meskPackage mpackage = parsePackageFile(packagesDir.absoluteFilePath(packagesDir.entryList().at(package)));
            repoPackages.push_back(mpackage);
        }

        packages.push_back(qMakePair(repoName, repoPackages));

        repoName = "";
        repoPackages.clear();

        packagesDir.cdUp();
    }

    fixCriticals();

    return 0;
}
开发者ID:aaly,项目名称:Mesk-Installer,代码行数:51,代码来源:packagesPage.cpp

示例2: loadThemes

void AppearanceSettings::loadThemes()
{
    QStringList themeNames;
    QStringList installPaths = Qtopia::installPaths();
    qDeleteAll(m_themes);
    m_themes.clear();
    for (int i=0; i<installPaths.size(); i++) {
        QString path(installPaths[i] + "etc/themes/");
        QDir dir;
        if (!dir.exists(path)) {
            qLog(UI) << "Theme style configuration path not found" << path.toLocal8Bit().data();
            continue;
        }

        // read theme.conf files
        dir.setPath(path);
        dir.setNameFilters(QStringList("*.conf")); // No tr

        for (uint j=0; j<dir.count(); j++) {
            QString name = dir[j].mid(0, dir[j].length() - 5); // cut ".conf"
            Theme *theme = Theme::create(path + dir[j], name);
            if (theme) {
                m_themes << theme;
                themeNames << theme->name();
            }
        }
    }
    themeNames << m_moreThemes;

    QStringListModel *model;
    model = qobject_cast<QStringListModel *>(m_themeCombo->model());
    model->setStringList(themeNames);
}
开发者ID:Artox,项目名称:qtmoko,代码行数:33,代码来源:appearance.cpp

示例3: new_path_selected

void Viewer::new_path_selected(){

    try{
        update_base_paths();
        QDir currDir = path_annotations;
        if ( currDir.exists() == false ) {
            error_manager( 1 );
            return;
        }
        if ( currDir.count() == 2 ) {
            error_manager( 3 );
            return;
        }
        update_path_array();

        QString filterStr = QString( "*.txt" );
        currDir.setNameFilters( QStringList() << ( filterStr ) );
        QStringList fileList = currDir.entryList();
        frames_total = fileList.size();
        ui->myLabel_Img_TotalNumb->setText( QString::number( frames_total ) );
        ui->myGroupBox->setEnabled( true );
        update_all( frames_start );
        is_sequence_loaded = true;

    }
    catch ( ... ) {
        error_manager( 1 );
    }

}
开发者ID:api55,项目名称:hand_2d_gt_viewer,代码行数:30,代码来源:viewer_gui.cpp

示例4: scanForTemplates

void Manager::scanForTemplates() {
	KILE_DEBUG_MAIN << "===scanForTemplates()===================";
	QStringList dirs = QStandardPaths::locateAll(QStandardPaths::DataLocation, "templates", QStandardPaths::LocateDirectory);
	QDir templates;
	KileTemplate::Info ti;
	KileDocument::Extensions *extensions = m_kileInfo->extensions();

	m_TemplateList.clear();
	for(QStringList::iterator i = dirs.begin(); i != dirs.end(); ++i) {
		templates = QDir(*i, "template_*");
		for (uint j = 0; j < templates.count(); ++j) {
			ti.path = templates.path() + '/' + templates[j];
			QFileInfo fileInfo(ti.path);
			ti.name = fileInfo.completeBaseName().mid(9); //remove "template_", do it this way to avoid problems with user input!
			ti.type = extensions->determineDocumentType(QUrl::fromUserInput(ti.path));
			ti.icon = QStandardPaths::locate(QStandardPaths::DataLocation, "pics/type_" + ti.name + extensions->defaultExtensionForDocumentType(ti.type) + ".kileicon");
			if (m_TemplateList.contains(ti)) {
				KILE_DEBUG_MAIN << "\tignoring: " << ti.path;
			}
			else {
				m_TemplateList.append(ti);
				KILE_DEBUG_MAIN << "\tadding: " << ti.name << " " << ti.path;
			}
		}
	}
}
开发者ID:KDE,项目名称:kile,代码行数:26,代码来源:templates.cpp

示例5: getSaveImageName

//Generate a proper file name according to application type.
QString QxMainWindow::getSaveImageName(const QString& strImagePath, const quint32 uCode, const quint32 uIndex, QxDecodeOptionDlg::ApplicationType appType)
{
	QString strImageName;
	if (appType == QxDecodeOptionDlg::Caffe)
	{
		strImageName = strImagePath + "/" + QString::number(uCode) + "-" + QString::number(uIndex);
	}
	else if (appType == QxDecodeOptionDlg::CNTK)
	{
		strImageName = strImagePath + "/" + QString::number(uCode) + "-" + QString::number(uIndex);
	}
	else if (appType == QxDecodeOptionDlg::TensorFlow)
	{
		strImageName = strImagePath + "/" + QString::number(uCode) + "-" + QString::number(uIndex);
	}
	else  //DIGITS
	{
		// First, check whether the subfolder for this class exists.
		strImageName = strImagePath + "/" + QString::number(uCode);
		if (!g_dirManager.exists(strImageName))
		{
			g_dirManager.mkdir(strImageName);
		}
		g_dirManager.setPath(strImageName);
		g_dirManager.setFilter(QDir::Files);
		//For example, if there are already 5 images in the folder, the new image will be named 6 (plus image suffix).
		strImageName = strImageName + "/" + QString::number(g_dirManager.count()+1);
	}

	return strImageName;
}
开发者ID:yixiu00001,项目名称:GntDecoder,代码行数:32,代码来源:QxMainWindow.cpp

示例6: initLanguages

int languagesPage::initLanguages()
{
	setStatus(tr("Loading languages"), BUSY);

    QDir languagesDir;
    QString languagesDirDirPath = getApplicationFile("/Translations/");
    languagesDir.cd(languagesDirDirPath);

    if (!languagesDir.exists())
    {
		setStatus(tr("Ooops , Couldn't find the languages directory : ")+languagesDirDirPath, ERROR);
		setStatus(tr("Assuming english language"), INFORMATION);
        return 1;
    }

    for ( unsigned int lang =0; lang < languagesDir.count(); lang++)
    {
        QString translation = languagesDir.entryList().at(lang);

        if (translation == "." || translation == "..")
        {
            continue;
        }

        if (translation.contains(".qm"))
        {
            languagesListWidget->addItem(new QListWidgetItem(translation.mid(0, translation.indexOf(".qm"))));
        }


    }
    return 0;
}
开发者ID:aaly,项目名称:MPF,代码行数:33,代码来源:languagesPage.cpp

示例7:

ReportDir::ReportDir
(
QWidget* parent,
const char* name
)
:
Inherited( parent, name )
{
	setCaption(tr("Select Report"));
	//
	// list names of existing reports - this is just listing the directories in the report results directory
	QDir dir;
	dir.setFilter(QDir::Dirs);
	dir.setPath(QSREPORT_DIR);
	//
	for(unsigned i = 0; i < dir.count(); i++)
	{
		QString s = dir[i];
		if(s != QString::null)
		{
			if(s.left(1) != ".")
			{
				List->insertItem(s);
			};
		}
	};
	//
}
开发者ID:jiajw0426,项目名称:easyscada,代码行数:28,代码来源:ReportDir.cpp

示例8: testInstall

void TestDataTest::testInstall()
{
    QTemporaryDir dir;
    QDir installDir(dir.path());
    QDir curDir;

    const QString indexFilePattern = QStringLiteral(".%1.index");

    QVERIFY(TestDataUtil::installFolder(QLatin1String("mbox"), dir.path(), QStringLiteral("mbox1")));
    QVERIFY(installDir.exists(QLatin1String("mbox1")));
    QVERIFY(installDir.exists(indexFilePattern.arg(QLatin1String("mbox1"))));

    QVERIFY(TestDataUtil::installFolder(QLatin1String("mbox-tagged"), dir.path(), QStringLiteral("mbox2")));
    QVERIFY(installDir.exists(QLatin1String("mbox2")));
    QVERIFY(installDir.exists(indexFilePattern.arg(QLatin1String("mbox2"))));

    QVERIFY(TestDataUtil::installFolder(QLatin1String("maildir"), dir.path(), QStringLiteral("md1")));
    QVERIFY(installDir.exists(QLatin1String("md1")));
    QVERIFY(installDir.exists(QLatin1String("md1/new")));
    QVERIFY(installDir.exists(QLatin1String("md1/cur")));
    QVERIFY(installDir.exists(QLatin1String("md1/tmp")));
    QVERIFY(installDir.exists(indexFilePattern.arg(QLatin1String("md1"))));

    curDir = installDir;
    curDir.cd(QStringLiteral("md1"));
    curDir.cd(QStringLiteral("cur"));
    curDir.setFilter(QDir::Files);
    QCOMPARE((int)curDir.count(), 4);

    QVERIFY(TestDataUtil::installFolder(QLatin1String("maildir-tagged"), dir.path(), QStringLiteral("md2")));
    QVERIFY(installDir.exists(QLatin1String("md2")));
    QVERIFY(installDir.exists(QLatin1String("md2/new")));
    QVERIFY(installDir.exists(QLatin1String("md2/cur")));
    QVERIFY(installDir.exists(QLatin1String("md2/tmp")));
    QVERIFY(installDir.exists(indexFilePattern.arg(QLatin1String("md2"))));

    curDir = installDir;
    curDir.cd(QStringLiteral("md2"));
    curDir.cd(QStringLiteral("cur"));
    curDir.setFilter(QDir::Files);
    QCOMPARE((int)curDir.count(), 4);
}
开发者ID:KDE,项目名称:kdepim-runtime,代码行数:42,代码来源:testdatatest.cpp

示例9: delTmpDir

void MainForm::delTmpDir()
{
    QDir dir;
    dir.setPath(workingDir + "output_files");
    dir.setFilter(QDir::Files | QDir::NoSymLinks);
    for (uint i = 0; i < dir.count(); i++) {
        if (dir[i].endsWith("jpg") || dir[i].endsWith("bmp"))
            dir.remove(dir[i]);
    }
    dir.rmdir(workingDir + "output_files");

}
开发者ID:andrei-b,项目名称:YAGF,代码行数:12,代码来源:mainform.cpp

示例10: elements

QStringList GRASS_EXPORT QgsGrass::elements( QString mapsetPath, QString element )
{
  QgsDebugMsg( QString( "mapsetPath = %1" ).arg( mapsetPath ) );

  QStringList list;

  if ( mapsetPath.isEmpty() ) return list;

  QDir d = QDir( mapsetPath + "/" + element );
  d.setFilter( QDir::Files );

  for ( unsigned int i = 0; i < d.count(); i++ )
  {
    list.append( d[i] );
  }
  return list;
}
开发者ID:cugxiangzhenwei,项目名称:QGIS_174_VS2008,代码行数:17,代码来源:qgsgrass.cpp

示例11: deleteOldFiles

void SpaceChecker::deleteOldFiles()
{
//  QDir videoDir("/sdcard/DCIM/DashCam/Video");
  QDir videoDir;//("/Users/ratmandu/Pictures");
  videoDir.setPath("/Users/ratmandu");
  if (videoDir.count() > 1) {
    // delete oldest file
    videoDir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
    videoDir.setSorting(QDir::Time | QDir::Reversed);

    QFileInfoList list = videoDir.entryInfoList();
    for (int i = 0; i < list.size(); i++) {
      QFileInfo fileinfo = list.at(i);
      qDebug() << fileinfo.absoluteFilePath() << fileinfo.size() << fileinfo.lastModified();
    }
  }
}
开发者ID:thatisazam,项目名称:android-dashcam,代码行数:17,代码来源:spacechecker.cpp

示例12: main

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    QDir Directorio;
    Directorio.setPath("C:/Users/Elisabete/Downloads/Logica");


    int cont;
    cont = Directorio.count();
    // Searching files in the directory

    for(int i = 2; i < cont; i++){

        qDebug() << Directorio[i];
    }


    return a.exec();
}
开发者ID:SANDEISON,项目名称:QT,代码行数:19,代码来源:main.cpp

示例13: setMapsets

void QgsGrassSelect::setMapsets()
{
  QgsDebugMsg( "setMapsets()" );

  emapset->clear();
  emap->clear();
  elayer->clear();

  if ( elocation->count() < 1 )
    return;

  // Location directory
  QString ldpath = egisdbase->text() + "/" + elocation->currentText();
  QDir ld = QDir( ldpath );

  int idx = 0;
  int sel = -1;

  // Go through all subdirs and add all subdirs from vector/
  for ( unsigned int i = 0; i < ld.count(); i++ )
  {
    if ( QgsGrass::isMapset( ldpath + "/" + ld[i] ) )
    {
      emapset->addItem( ld[i] );
      if ( ld[i] == lastMapset )
      {
        sel = idx;
      }
      idx++;
    }
  }
  if ( sel >= 0 )
  {
    emapset->setCurrentIndex( sel );
  }
  if ( emap->isHidden() )
  {
    buttonBox->button( QDialogButtonBox::Ok )->setDefault( emapset->count() > 0 );
  }

  setMaps();
}
开发者ID:Ariki,项目名称:QGIS,代码行数:42,代码来源:qgsgrassselect.cpp

示例14: mapsets

QStringList GRASS_EXPORT QgsGrass::mapsets( QString locationPath )
{
  QgsDebugMsg( QString( "locationPath = %1" ).arg( locationPath ) );

  QStringList list;

  if ( locationPath.isEmpty() ) return list;

  QDir d = QDir( locationPath );
  d.setFilter( QDir::NoDotAndDotDot | QDir::Dirs );

  for ( unsigned int i = 0; i < d.count(); i++ )
  {
    if ( QFile::exists( locationPath + "/" + d[i] + "/WIND" ) )
    {
      list.append( d[i] );
    }
  }
  return list;
}
开发者ID:cugxiangzhenwei,项目名称:QGIS_174_VS2008,代码行数:20,代码来源:qgsgrass.cpp

示例15: locations

QStringList GRASS_EXPORT QgsGrass::locations( QString gisbase )
{
  QgsDebugMsg( QString( "gisbase = %1" ).arg( gisbase ) );

  QStringList list;

  if ( gisbase.isEmpty() ) return list;

  QDir d = QDir( gisbase );
  d.setFilter( QDir::NoDotAndDotDot | QDir::Dirs );

  for ( unsigned int i = 0; i < d.count(); i++ )
  {
    if ( QFile::exists( gisbase + "/" + d[i]
                        + "/PERMANENT/DEFAULT_WIND" ) )
    {
      list.append( QString( d[i] ) );
    }
  }
  return list;
}
开发者ID:cugxiangzhenwei,项目名称:QGIS_174_VS2008,代码行数:21,代码来源:qgsgrass.cpp


注:本文中的QDir::count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。