コード例 #1
0
void NfcSharing::fileShareContentChanged(QString paths) {
	NfcShareFilesContent request;
    QList<QUrl> urls;
    QDir dir;

    QStringList list = paths.split(",");

    qDebug() << "XXXX Current Path" << dir.currentPath() << endl;
    qDebug() << "XXXX Home    Path" << dir.homePath() << endl;
    qDebug() << "XXXX Temp    Path" << dir.tempPath() << endl;

      QString publicPath(dir.currentPath().append("/app/public/"));

    for (int i = 0; i < list.size(); ++i) {

    	QUrl url(QString("file://").append(publicPath).append(list.at(i)));
        urls.append(url);

        QFileInfo fi(url.toLocalFile());

        qDebug() << "XXXX To Local File" << url.toLocalFile() << endl;
        qDebug() << "XXXX File String" << list.at(i) << endl;
        qDebug() << "XXXX File URL" << url << endl;
        qDebug() << "XXXX Absolute File Path" << fi.absoluteFilePath() << endl;
        qDebug() << "XXXX Absolute Path" << fi.absolutePath() << endl;
    }

    request.setFileUrls(urls);

    NfcShareSetContentError::Type rc = _nfcShareManager->setShareContent(request);

    qDebug() << "XXXX File setShareContent rc=" << rc << endl;
}
コード例 #2
0
ファイル: CADHelper.cpp プロジェクト: yuechuanbingzhi163/GDES
bool recorverCadFile()
{
	QDir lsDir;
	//QString cadPath = lsDir.homePath();
	//cadPath.append("/AppData/Roaming/Autodesk/AutoCAD 2010/R18.0/chs/Support");
	QString cadPath = getCADPath("RoamableRootFolder",CURRENT_USER);
	cadPath.append("/Support");
	lsDir.setPath(cadPath);

	//filepath == "C:\Users\Username\AppData\Roaming\Autodesk\AutoCAD 2010\R18.0\chs\Support"
	QString filepath = lsDir.filePath("acad.CUIX");
	//filepath == "C:\Users\Username\AppData\Roaming\Autodesk\AutoCAD 2010\R18.0\chs\Support\hd.txt"

	//获取当前程序(.exe)所在的路径
	QString CurrentPath = lsDir.currentPath();

	QString fromDir = CurrentPath;
	fromDir.append("/Datas/CAD/acad.CUIX");
	//文件来自:当前程序所在位置+"/Datas/JL/hd.txt"

	QString toDir = filepath;
	if(!copyFileToPath(fromDir,toDir,true)) return false;

	filepath = lsDir.filePath("acad.mnr");
	CurrentPath = lsDir.currentPath();
	fromDir = CurrentPath;
	fromDir.append("/Datas/CAD/acad.mnr");
	toDir = filepath;
	return copyFileToPath(fromDir,toDir,true);
}
コード例 #3
0
ファイル: edit_select.cpp プロジェクト: laiyinping/meshlab
void EditSelectPlugin::mouseReleaseEvent(QMouseEvent * event, MeshModel &m, GLArea * gla)
{
    qDebug()<<"mouseReleaseEvent";
	gla->update();
	prev=cur;
	cur=event->pos();
	isDragging = false;
	
	//output current selected faces and verts
    QDir dir;
    //ÉèÖÃÊä³öÎļþ
    std::string ofs=dir.currentPath().toStdString();
    ofs.append("/selected_faces.txt");
    ofstream oo(ofs.c_str());
    CMeshO& cm=m.cm;
    for (int i = 0; i < cm.fn; i++) {
        if(cm.face[i].IsS()){
            // oo<<i+1<<endl; //we output the index+1, so it can be directly used in matlab
            oo<<i<<endl; //we want to use it directly in meshlab now!
            qDebug()<<i;
        }
    }
    oo.close();
    ofs=dir.currentPath().toStdString();
    ofs.append("/selected_verts.txt");
    oo.open(ofs.c_str());
    for (int i = 0; i < cm.vn; i++) {
        if(cm.vert[i].IsS()){
            oo<<i<<endl; //we want to use it directly in meshlab now!
            qDebug()<<i;
        }
    }
    oo.close();
}
コード例 #4
0
ファイル: ronghe.cpp プロジェクト: ice200117/oceanrs
void RongHe::on_pushButton_clicked()
{
    QString path;
        QDir dir;
        path=dir.currentPath();

    //    QStringList files = QFileDialog::getOpenFileNames(
    //                            this,
    //                            "Select one or more files to open",
    //                            "/home",
    //                            tr("All Files (*);;HDF5 Files (*.h5)"));


        QDir::setCurrent(path+"\\SST");

        QProcess::startDetached("InverseDistance.exe",QStringList());
        QDir::setCurrent(path);

        /*//测试Demo窗体,解注释即可查看效果
        Demo *demoDlg = new Demo() ;
        QDesktopWidget* desktop = QApplication::desktop();
        int x,y;
        x=(desktop->width() - demoDlg->width())/2;
        y=(desktop->height() - demoDlg->height())/2-20;
        demoDlg->setGeometry(x,y,1,429);
        demoDlg->setModal(true);
        demoDlg->show();
        */

}
コード例 #5
0
void postoperation::send()   //连接到服务器,执行发送
{
    ui->pbsendfile->setEnabled(false);
    bytesWritten = 0;
    //初始化已发送字节为0

    QDir dir;
    QString path = dir.currentPath();
    path += "/setting";
    QDir dir2(path);
    QString settingname;
    if(dir2.exists())
    {
        dir2.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
        dir2.setSorting(QDir::Size | QDir::Reversed);
        QFileInfoList list = dir2.entryInfoList();
        QFileInfo fileInfo = list.at(0);
        settingname = fileInfo.fileName();
        qDebug()<<settingname;
    }
    QString filename = path + "/" +settingname;
    QFile file(filename);
    if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
    {
        QMessageBox::information(this,tr("提示"),tr("无法打开文件"),QMessageBox::Ok);
        qDebug()<<"Can't open the file!"<<endl;
    }
    QTextStream  in(&file);
    QString ipaddress;
    ipaddress = in.readLine();
    qDebug()<<ipaddress;
    tcpClient->connectToHost(QHostAddress(ipaddress),6111);//连接
}
コード例 #6
0
ファイル: forecast.cpp プロジェクト: ice200117/oceanrs
void Forecast::on_pushButton_2_clicked()
{
    // Open multi image.
    QString path;
    QDir dir;
    path=dir.currentPath();
    QStringList files = QFileDialog::getOpenFileNames(
                            this,
                            "Select one or more files to open",
                            path,
                            "Images (*.png *.png *.jpg *.bmp)");

    if(files.count()>0) {
        files.sort();
        //displayYuBao(files);
        Display *fc = new Display();
        fc->init(files);
        QDesktopWidget* desktop = QApplication::desktop();
        int x,y;
        x=(desktop->width() - fc->width())/2;
        y=(desktop->height() - fc->height())/2-20;
        fc->setGeometry(x,y,fc->width(),fc->height());
        fc->setModal(true);
        fc->show();

        mw->m_display_windows_list.append(fc);
    }

}
コード例 #7
0
ファイル: forecast.cpp プロジェクト: ice200117/oceanrs
void Forecast::on_pushButton_clicked()
{
    QString path;
    QDir dir;
    path=dir.currentPath();

    //Show file select Dialog.
    if(select_window!=NULL) {
        delete select_window;
    }
    select_window = new SelectFile();
    select_window->init(SWWYL);

    QDesktopWidget* desktop = QApplication::desktop();
    int x,y;
    x=(desktop->width() - select_window->width())/2;
    y=(desktop->height() - select_window->height())/2;
    select_window->setGeometry(x,y,1,429);
//    select_window->setModal(true);
    select_window->show();

    // MPlayer 播放视频
//    QProcess::execute("C:\\MPlayer_Windows\\mplayer\\MPlayer.exe "+path+"\\yubao\\wenyanliu\\nwp_3dvar.mp4");
//    QProcess::execute("C:\\wmplayer\\wmplayer.exe "+path+"\\yubao\\wenyanliu\\nwp_3dvar.mp4");


}
コード例 #8
0
ファイル: dialog.cpp プロジェクト: hkutangyu/QTDemo
void Dialog::onNewFrame(QImage qImg, vector<Rect_<int> > faces)
{
    //QList<QImage>::iterator it = qImg.begin();
    QSize labelSize = QSize(ui->label->geometry().width(),ui->label->geometry().height());
    //qDebug() << labelSize << "\n";
    if(qImg.isNull())
    {
        qDebug() << "qImg is null\n";
    }
    else
    {
        if(faces.size() > 0 && is_detect){
            // Get current working path
            emit SetProcessFlag(false);
            QString path;
            QDir dir;
            path=dir.currentPath();
            QDateTime date_time = QDateTime::currentDateTime();
            QString str = date_time.toString("yyyyMMddhhmmss");
            QString fileName = path+"/FaceImages/"+str+".png";
            qImg.save(fileName,"png");
            is_detect = false;
            mts.doWrite("FaceDetect#"+this->receiverName+"#doFaceDetect#"+fileName);
            emit closeCamera();
            //this->showMinimized();
            move(1920,1080);

        }
        if(!is_detect){
            qImg.fill(QColor(0,0,0,0));
        }
        ui->label->setPixmap(QPixmap::fromImage(qImg).scaled(labelSize,Qt::KeepAspectRatio, Qt::FastTransformation));

    }
}
コード例 #9
0
cacic_hardware::cacic_hardware()
{
    QDir dir;
    logManager = QLogger::QLoggerManager::getInstance();
    logManager->addDestination(dir.currentPath() + "/Logs/cacicLog.log","Gercols (hardware)",QLogger::InfoLevel);
    logManager->addDestination(dir.currentPath() + "/Logs/cacicLog.log","Gercols (hardware)",QLogger::ErrorLevel);
}
コード例 #10
0
void fl_procPC_adjust_preference()
{
	atlasConfig cfginfo;
//	QString fileName = "atlas_config.txt";
//    QString fileName = "/Users/longf/work/v3d_internal/long_fuhui/atlas_builder/pointcloud_atlas_builder_plugin/atlas_config.txt";	
    
    QDir curdir; 
//    v3d_msg(curdir.currentPath());
//    
//    printf("%s", curdir.currentPath().toStdString().c_str());
    
//    QString fileName = curdir.currentPath() + "/plugins/atlas_builder/atlas_config.txt";
    QString fileName = curdir.currentPath() + V3DFOLDER;
    
    
	if (!loadPointCloudAtlasConfigFile(qPrintable(fileName.trimmed()), cfginfo))
	{
		v3d_msg("Fail to load the configuration file atlas_config.txt");
		return;
	}
	
	fl_func_procIO_adjust_preference(fileName, cfginfo);
    

}
コード例 #11
0
ファイル: baidumap.cpp プロジェクト: xtliuke/XTFly
BaiduMap::BaiduMap(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::BaiduMap)
{
    ui->setupUi(this);
    mWebView = ui->webView;
    QDir dir;
    mWebView->load(QUrl(QString("file:///"+dir.currentPath()+"/BaiduMap.html")));
}
コード例 #12
0
ファイル: ronghe.cpp プロジェクト: ice200117/oceanrs
void RongHe::on_pushButton_3_clicked()
{
        QString path;
        QDir dir;
        path=dir.currentPath();
        QDir::setCurrent(path+"\\rain");

        QProcess::execute("rain.exe");
        QDir::setCurrent(path);
}
コード例 #13
0
ファイル: ronghe.cpp プロジェクト: ice200117/oceanrs
void RongHe::on_pushButton_10_clicked()
{
    QString path;
    QDir dir;
    path=dir.currentPath();
    QDir::setCurrent(path+"\\Merge3p\\testd\\swh\\SWH");

    QProcess::execute("数据融合.exe");
    QDir::setCurrent(path);
}
コード例 #14
0
ファイル: configfile.cpp プロジェクト: lctagnes/gitpro
CCfgFile::CCfgFile()
{
    QString strPath;
    QDir dir;
    strPath = dir.currentPath();

    m_setting = new QSettings(strPath + CONFIG_FILE_NAME, QSettings::IniFormat);
    ReadFile();
    VerifyData();
}
コード例 #15
0
//===============================================densePointCloudReconstruction============================================//
bool TextureGenrator::densePointCloudReconstruction(){

	int start = 0; 
	int end = 0;

	m_parent->textEditConsole->append("正在进行稠密点云重建,请稍候...");
	 //run PMVS for dense reconstruction
	QString path = "TempData" + tr(".nvm.cmvs/00/");
	start = clock();
	// find all the files
	QDir dir;
	dir.setPath(path);
	dir.setFilter(QDir::Files | QDir::NoSymLinks | QDir::NoDotAndDotDot);
	QStringList filter;
	filter<<"option-*";
	QFileInfoList fileList = dir.entryInfoList(filter);
	int nOpts = fileList.size();
	m_parent->progressBar->setRange(0,nOpts);
	m_parent->progressBar->setValue(0);

	for(int i=0; i< nOpts; i++){
		// option files
		QString optFile = fileList.at(i).filePath();
		QStringList fields= optFile.split("/");

		// commad line arguments
		QString cmdArgu = path +" " + fields.takeLast();
		m_parent->textEditConsole->append( QString("%1 th reconstruction ").arg(i));
		m_parent->textEditConsole->append( dir.currentPath()+ "/"  + optFile);
		if(!shellExecute("pmvs2.exe", cmdArgu.toStdString().c_str()))return false;

		m_parent->progressBar->setValue(i+1);
		QApplication::processEvents();
	} 
	end = clock();
	m_parent->textEditConsole->append(QString("稠密重建完成,用时 %1 s\n").arg((double)(end-start)/CLOCKS_PER_SEC));
	m_parent->textEditConsole->append("重建结果保存在 " + dir.currentPath()+ "/" + path);
	update();

	return true;
}
コード例 #16
0
ファイル: sqldb.cpp プロジェクト: xiangzhuanglujy/Recoder
Sqldb::Sqldb(QObject *parent) :
    QObject(parent)
{
    db=QSqlDatabase::addDatabase("QSQLITE");
    QDir dir;
    QString path=QString("%1/database.db").arg(dir.currentPath());
    qDebug()<<path;
    db.setDatabaseName(path);
    if(!db.open())
    {
        QMessageBox::critical(NULL,tr("Tips"),tr("connect error"));
    }
}
コード例 #17
0
// Recursively traverse an eZ Publish directory
static void traverse( const QDir &dir, Translator &fetchedTor, ConversionData cd, UpdateOptions options, bool *fail )
{
    if ( options & Verbose )
        printOut( QObject::tr( "   Checking subdirectory '%1'" ).arg( qPrintable(dir.path()) ) );

    if ( !dir.exists() )
        return;

    const QFileInfoList list = dir.entryInfoList();
    QFileInfo fi;
    for ( int i = 0; i < list.size(); ++i )
    {
        fi = list.at( i );
        if ( fi.fileName().startsWith( "." ) )
        {
            // Do nothing
        }
        else if ( fi.isDir() )
        {
            QDir subdir = dir;
            subdir.setCurrent( subdir.path() + QDir::separator() + fi.fileName() );
            traverse( subdir.currentPath(), fetchedTor, cd, options, fail );
            subdir.setCurrent( dir.path() );
        }
        else
        {
            if ( fi.fileName().endsWith(QLatin1String(".php"), Qt::CaseInsensitive) )
            {
                if ( options & Verbose )
                    printOut( QObject::tr( "      Checking '%1'" ).arg( qPrintable(fi.fileName()) ) );
                if ( !fetchedTor.load(fi.fileName(), cd, QLatin1String("php")) )
                {
                    qWarning( "%s", qPrintable( cd.error() ) );
                    *fail = true;
                }
            }
            else if ( fi.fileName().endsWith(QLatin1String(".tpl"), Qt::CaseInsensitive) )
            {
                if ( options & Verbose )
                    printOut( QObject::tr( "      Checking '%1'" ).arg( qPrintable(fi.fileName()) ) );
                if ( !fetchedTor.load(fi.fileName(), cd, QLatin1String("tpl")) )
                {
                    qWarning( "%s", qPrintable( cd.error() ) );
                    *fail = true;
                }
            }
        }
    }
}
コード例 #18
0
QScriptValue ScriptEngine:: extractZip(const QString &zipName)
{
    if (safeScripts) {
        warn("extractZip(zipName)", "Safe scripts is on.");
        return "";
    }
    Zip zip;
    if (!zip.open(zipName)) {
        return myengine.undefinedValue();
    }
    QDir directory;
    QString current=directory.currentPath();
    zip.extractTo(current);
    return zipName;
}
コード例 #19
0
ファイル: progress.cpp プロジェクト: qhw/deal_bmp
void Progress::setPathName(QString filename)
{
  ui.lbFileName->setText(filename);
  if(flag == 0)
  {
    QDir dir;
    QString path = dir.currentPath();
    this->fileName = filename;
    int pos = filename.lastIndexOf("/");
    filename.remove(0,pos + 1);
    this->pathName =path +"/" + filename;
  }else
  {
      this->pathName = filename;
  }
}
コード例 #20
0
ファイル: ronghe.cpp プロジェクト: ice200117/oceanrs
void RongHe::on_pushButton_7_clicked()
{
    // Open multi image.
   QString path;
   QDir dir;
   path=dir.currentPath();
   QStringList files = QFileDialog::getOpenFileNames(
                           this,
                           "Select one or more files to open",
                           path,
                           "Images (*.png *.png *.jpg *.bmp)");

   if(files.count()>0){
       files.sort();
       displayFeng(files);
   }
}
コード例 #21
0
ファイル: frmlog.cpp プロジェクト: hominlinx/cppbed
// 当前路径下读入INI
void frmLog::loadIni()
{
	QDir dir;  
	QString path = dir.currentPath() + "//" + CONFIG_INI;
	QSettings ini(path, QSettings::IniFormat);

	if (ini.value("MaxLogLine").isValid())
		mMaxLog = ini.value("MaxLogLine").toInt();
	else
		mMaxLog = 50000;
	if (ini.value("MaxMonitorLine").isValid())
		mMaxMonitor = ini.value("MaxMonitorLine").toInt();
	else
		mMaxMonitor = 50000;

	applyChangeToUI();
}
コード例 #22
0
void postoperation::startTransfer()  //实现文件大小等信息的发送
{
    QDir dir;
    QString path = dir.currentPath();
    path += "/database";
    QDir dir2(path);
    QString dbname;
    if(dir2.exists())
    {
        dir2.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
        dir2.setSorting(QDir::Size | QDir::Reversed);
        QFileInfoList list = dir2.entryInfoList();
        QFileInfo fileInfo = list.at(0);
        dbname = fileInfo.fileName();
        qDebug()<<dbname;
    }
    fileName = path + "/" +dbname;

    qDebug()<<fileName;

    localFile = new QFile(fileName);
    if(!localFile->open(QFile::ReadOnly))
    {
        qDebug() << "open file error!";
        return;
    }
    totalBytes = localFile->size();
    //文件总大小
    QDataStream sendOut(&outBlock,QIODevice::WriteOnly);
    sendOut.setVersion(QDataStream::Qt_4_7);
    QString currentFileName = fileName.right(fileName.size() - fileName.lastIndexOf('/')-1);
    sendOut << qint64(0) << qint64(0) << currentFileName;
    //依次写入总大小信息空间,文件名大小信息空间,文件名---仅是文件名不含路径,没必要含路径
    totalBytes += outBlock.size();
    //这里的总大小是文件名大小等信息和实际文件大小的总和
    sendOut.device()->seek(0);
    sendOut<<totalBytes<<qint64((outBlock.size() - sizeof(qint64)*2));
    //totalBytes是文件总大小,即两个quint64的大小+文件名+文件实际内容的大小
    //qint64((outBlock.size() - sizeof(qint64)*2))得到的是文件名大小
    bytesToWrite = totalBytes - tcpClient->write(outBlock);
    //发送完头数据后剩余数据的大小,即文件实际内容的大小
    qDebug()<<"已连接"<<endl;
    outBlock.resize(0);
    qDebug()<<"#####"<<totalBytes;
}
コード例 #23
0
ファイル: singleserver.cpp プロジェクト: ipse666/cueplayer
void SingleServer::readArgs()
{
	QDir currentdir;
	QRegExp rxPath("^/.*");
	QRegExp rxFilename3("^(mms://|http://|ftp://).*");
	QStringList file;

	QString arg = trUtf8(clientConnection->readLine());

	if (rxPath.indexIn(arg) != -1 ||
		rxFilename3.indexIn(arg) != -1)
		file << arg;
	else
		file << currentdir.currentPath() << "/" << arg;
	emit sendArgs(file);
	clientConnection->flush();
	clientConnection->disconnectFromServer();
}
コード例 #24
0
ファイル: publisherpage.cpp プロジェクト: gjhiggins/vcoincore
void PublisherPage::show()
{
    QWebEngineView *view = new QWebEngineView;
    QDir dir;
    QString cwd = dir.currentPath();
    QString html = "qrc:///vpub/index.html";
    QString fpath = "/src/qt/res/vpub/index.html";
    QString res = cwd + fpath;
    QFile file(res);
    // QFile file("file:////res/pbt/index.html");
    if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        html = QString("<html><body><p>Cannot read file in ") + res + QString("</p></body></html>");
    } else {
        html = QTextStream(&file).readAll();
    };
    view->setHtml(html, QUrl());
    view->show();
}
コード例 #25
0
ファイル: qsqlmanager.cpp プロジェクト: lswzzzzz/ExcelExport
QSQLManager* QSQLManager::getInstance()
{
    if(instance == nullptr){
        instance = new QSQLManager();
        QString path;
        QDir dir;
        path=dir.currentPath();
        bool isCreate = QFile::exists(path+"/"+dbname);
        if(!instance->openDatabase()){
            addConsoleInfo("打开数据库失败");
        }
        if(!isCreate){
            if(!instance->createTable()){
                addConsoleInfo("创建数据表失败");
            }
        }
    }
    return instance;
}
コード例 #26
0
ファイル: config.cpp プロジェクト: stained/voicelog
void RecordingTab::FindFile()
{
    QDir *dir = new QDir;

    QString currentPath = dir->currentPath() + "/recordings";

    QFileDialog *fileDialog = new QFileDialog(this, "Select a path to save recordings", currentPath);
    fileDialog->setFileMode(QFileDialog::DirectoryOnly);
    fileDialog->setViewMode(QFileDialog::List);
    fileDialog->setFixedSize(500, 300);

    QStringList fileNames;

    if (fileDialog->exec())
    {
        fileNames = fileDialog->selectedFiles();
        editRecPath->setText(QString(fileNames[0]));
    }

}
コード例 #27
0
ファイル: capcan.cpp プロジェクト: hominlinx/cppbed
void capCan::httpFinished()
{
    disconnect(reply, SIGNAL(finished()),this, SLOT(httpFinished()));
	chaos = reply->error();
    if (chaos != 0) return;
	reply->deleteLater();
	/*
	if (chaos)
	{
		QMessageBox::warning(this, QString::fromLocal8Bit("错误"),
                             QString::fromLocal8Bit("无法检测升级!"),
                             QMessageBox::Ok);
		this->close();
		return;
	}
	*/
	// 比较版本
#ifdef Q_OS_WIN
	QString ver = replyStr.section("capCan Windows:",1).trimmed();
#else
	QString ver = replyStr.section("canCan Linux:",2).trimmed();
#endif
    QString path;
    QDir dir;
    path = dir.currentPath();

	int ver_h, ver_m, ver_l;
	ver_h = ver.section(".",0,0).toInt();
	ver_m = ver.section(".",1,1).toInt();
	ver_l = ver.section(".",2,2).toInt();
	mAppVersion = TVersion(VERSION_H, VERSION_M, VERSION_L); 
	TVersion remoteVersion = TVersion(ver_h, ver_m, ver_l); 
	if (remoteVersion > mAppVersion)
	{
        path = path + "//" + upgradeProcess;
        QProcess::startDetached(path, QStringList()<<EXE_UPGRADE_URL);
        this->close();
	}
}
コード例 #28
0
/**
 * @brief Copies model binary to the temporary folder.
 * @param temp_path     System temporary folder.
 * @return              0 if success.
 */
int BinaryHandler::_set_temp_env(const QString& temp_path)
{
    QDir qdir;
    qdir.setCurrent(temp_path);

    // Set up a bin directory where to move the model binaries.
    if (!qdir.exists("bin")) {
        qdir.mkdir("bin");
    }
    QString temp_bin_path = temp_path + "/bin";
    qdir.setCurrent(temp_bin_path);

    // Assuming the model binaries reside under ../Resources/bin/ relative
    // to the app. dir.
    QDir resources(QCoreApplication::applicationDirPath());
    resources.cd(RESOURCES);
    resources.cd("bin");

    if (DEBUG_MODE) {
        fprintf(stderr, "Model resources directory: %s\n",
                resources.path().toStdString().c_str());
        fprintf(stderr, "Application directory: %s\n",
                QCoreApplication::applicationDirPath().toStdString().c_str());
        fprintf(stderr, "Current directory: '%s'\n",
                qdir.currentPath().toStdString().c_str());
    }

    QStringList files = resources.entryList(QDir::Files);
    for (auto& f : files) {
        auto dest = temp_bin_path+"/"+f;
        if (QFile::exists(dest)) {
            QFile::remove(dest);
        }
        QFile::copy(resources.path()+"/"+f, dest);
    }

    return 0;
}
コード例 #29
0
ファイル: frmlog.cpp プロジェクト: hominlinx/cppbed
// 保存Monitor
void frmLog::saveMonitor()
{
	QDir dir;
	QString path = dir.currentPath() + "//" + DIR_MONITOR;
	QString fileName;
    bool exist = dir.exists(path);

	if (!exist)	// 创建路径,如果没有的话
		dir.mkdir(path);

	QDateTime time = QDateTime::currentDateTime();//获取系统现在的时间
	fileName = path + "//mon-" + time.toString("yyyyMMdd-hhmmss") + ".txt";
	QFile file(fileName);
	if (file.open(QFile::WriteOnly | QFile::Text))
	{
		QTextStream ts(&file);
		ts.setCodec("utf-8");
		ts << ui.txtComInfo->document()->toPlainText() << endl;
	}
	file.flush();
	file.close();

}
コード例 #30
0
void LanguageDetector::init() {
    QDir kdir;
    QString langdataDir = kdir.currentPath();
    qDebug()<<"here"<<langdataDir;

    if(!langdataDir.isEmpty()){
        QString langdataPath = langdataDir + "/langdata";
        QDir langDir;
        langDir.setPath(langdataPath);
        QStringList langList = langDir.entryList();

        qDebug()<< langList;
        QString content;
        languageScoreMap = new QMap<QString, double>();
        for (int i = 2; i < langList.size(); i++){
            if (languageLeague->contains(langList[i])) {
                languageScoreMap->insert(langList[i], -1);
                LanguageScoreModel lsm = languageLeague->value(langList[i]);
                lsm.init();
                languageLeague->insert(langList[i], lsm);
            } else {
                QFile langFile(langDir.filePath(langList[i]));
                if(langFile.open(QIODevice::ReadOnly | QIODevice::Text)){
                    content = langFile.readAll();
                    LanguageScoreModel newLanguage(content, langList[i]);
                    LanguageDetector::languageLeague->insert(langList[i], newLanguage);
                    languageScoreMap->insert(langList[i], -1);
                }
                else{
                    qDebug()<<"unable to open File: "<<langList[i];
                }
            }
        }
    }
    else
        qDebug()<<"no langdata found";
}