コード例 #1
0
ファイル: dialog.cpp プロジェクト: NitreJohn/FlowFree
void Dialog::clear()
{
    QFile file("info.ifo");
    int temp = 0;
    if(file.open(QIODevice::ReadOnly | QIODevice::Text))
    {
        QTextStream txtInput(&file);
        int temp1;
        while(!txtInput.atEnd())
        {
            txtInput >> temp1;
            temp++;
        }
        file.close();
        QFile file2("info.ifo");
        if(file2.open(QIODevice::WriteOnly | QIODevice::Text))
        {
            QTextStream txtOutput(&file2);
            temp--;
            for(int i = 0; i < temp; ++i)
            {
                qDebug() << temp;
                txtOutput << 0 << " ";
            }
        }
    }
コード例 #2
0
ファイル: setting_1.cpp プロジェクト: wanghao-xznu/untitled2
void Setting_1::on_pushButton_clicked()//back 保存按钮
{
    system("rm bilang.cfg");//文件名为 a.txt 可以用“C:/a.txt”之类
    QFile file("bilang.cfg");
    file.open(QIODevice::WriteOnly);
    for(int i=0;i<5;i++){
        for(int j=0;j<6;j++){
        QTextStream txtOutput(&file);
        QString n1(arr_setting[i][j]);
        //n1=n1.toInt();
        txtOutput << n1<<endl;
        }
    }
    file.close();
    //this->close();
    if(g_setting==NULL)
    {
    g_setting = new Setting;
    g_setting->show();
    g_setting->exec();
    }
    else
    {
        delete g_setting;
        g_setting = new Setting;
        g_setting->show();
        g_setting->exec();

    }
}
コード例 #3
0
//!----------------------------------------------------------------------------------------------------
//!
//! \brief GuidewareTrackingWindow::startNaigation
//!
void GuidewareTrackingWindow::startNaigation(){
    //! -----------------------------------------------------------------------
    collaborativeState = "on"; //on/off
    collaborativeName = this->patientHandling->getName();
    collaborativeType = "navi"; //standby/normal/reconstruct/reconstructed
    collaborativePath = this->patientHandling->getCTImagePath() + "navi";

    QFile f(this->configuratonFilePath);
    if(!f.open(QIODevice::WriteOnly | QIODevice::Text))
    {
        cout << "Open failed." << endl;
    }

    QTextStream txtOutput(&f);
    QString s1(collaborativeState);
    QString s2(collaborativeName);
    QString s3(collaborativeType);
    QString s4(collaborativePath);

    txtOutput << "state:" << s1 << endl;
    txtOutput << "name:" << s2 << endl;
    txtOutput << "type:" << s3 << endl;
    txtOutput << "path:" << s4 << endl;

    f.close();
    //! -----------------------------------------------------------------------
}
コード例 #4
0
//!----------------------------------------------------------------------------------------------------
//!
//! \brief GuidewareTrackingWindow::changeStateToReconstruct
//!
void GuidewareTrackingWindow::changeStateToReconstruct(){
    collaborativeState = "on";
    collaborativeName = this->patientHandling->getName();
    collaborativeType = "reconstruct";
    collaborativePath = this->patientHandling->getCTImagePath() + "reconstruct";

    QFile f(this->configuratonFilePath);
    if(!f.open(QIODevice::WriteOnly | QIODevice::Text))
    {
        cout << "Open failed." << endl;
    }

    QTextStream txtOutput(&f);
    QString s1(collaborativeState);
    QString s2(collaborativeName);
    QString s3(collaborativeType);
    QString s4(collaborativePath);

    txtOutput << "state:" << s1 << endl;
    txtOutput << "name:" << s2 << endl;
    txtOutput << "type:" << s3 << endl;
    txtOutput << "path:" << s4 << endl;

    f.close();
}
コード例 #5
0
ファイル: qrautorun.cpp プロジェクト: Qters/QrCommon
bool QrAutoRunPrivate::writePlist()
{
    QFile file(plistPath());
    if(! file.open(QIODevice::WriteOnly | QIODevice::Text)) {
        qDbug() << "auto run, fail to write plist.";
        return false;
    }

    QTextStream txtOutput(&file);
    txtOutput << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl;
    txtOutput << "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">" << endl;
    txtOutput << "<plist version=\"1.0\">" << endl;
    txtOutput << "<dict>" << endl;
    txtOutput << "	<key>Label</key>" << endl;
    txtOutput << QString("	<string>%1</string>").arg(appName) << endl;
    txtOutput << "	<key>ProgramArguments</key>" << endl;
    txtOutput << "	<array>" << endl;
    txtOutput << QString("		<string>%1</string>").arg(appPath) << endl;
    txtOutput << "	</array>" << endl;
    txtOutput << "	<key>ProcessType</key>" << endl;
    txtOutput << "	<string>Interactive</string>" << endl;
    txtOutput << "	<key>RunAtLoad</key>" << endl;
    txtOutput << "	<true/>" << endl;
    txtOutput << "	<key>KeepAlive</key>" << endl;
    txtOutput << "	<false/>" << endl;
    txtOutput << "</dict>" << endl;
    txtOutput << "</plist>" << endl;
    file.close();

    return true;
}
コード例 #6
0
ファイル: log.cpp プロジェクト: benseal/aquatest
void Log::save(QString fileName) {
    QFile f(fileName);
    if(!f.open(QIODevice::WriteOnly | QIODevice::Text))
    {
        qDebug() << "Open file " << fileName << " failed\n";
        return;
    }
    QTextStream txtOutput(&f);
    txtOutput << this->m_data << endl;
    f.close();
    return;
}
コード例 #7
0
void CalibrationWindow::on_savecaliButton_clicked()
{
    QString fileName = QFileDialog::getSaveFileName(this,
         tr("保存校准数据"),
         "",
         tr("数据文件 (*.cal)"));
    if (!fileName.isNull())
    {
        //fileName是文件名
        QFile f(fileName);
        if(!f.open(QIODevice::WriteOnly | QIODevice::Text))
        {
            printf("Open failed.");
            return;
        }
        QTextStream txtOutput(&f);
        for (int i=0;i<JOINTNUM;i++)
        {
            txtOutput<<zeros[i]<<' '<<thresholds[i]<<' '<<motionRanges[i]<<endl;
        }
        f.close();
    }
}
コード例 #8
0
ファイル: dynamicdata.cpp プロジェクト: net4nt/TyLauncher
void DynamicData::saveUserSaveFile(const QString &content)
{
    QString fileName = userSettingsFileName();
    QFile file(fileName);
    if (!QFile::exists(fileName)){
        TyLogWarning("%s is not exists!", fileName.toUtf8().data());
        QFileInfo fileInfo(file);
        QDir dir;
        if (!dir.exists(fileInfo.path())){
            dir.mkpath(fileInfo.path());
            TyLogWarning("make path: \"%s\".", fileInfo.path().toUtf8().data());
        }
    }
    if(!file.open(QFile::WriteOnly)){
        TyLogFatal("%s", QObject::tr("Can not save the file %1:\n %2.").arg(fileName).arg(file.errorString()).toUtf8().data());
        return;
    }
    QTextStream txtOutput(&file);
    txtOutput.setCodec("UTF-8");
    txtOutput << content;
    file.close();
    TyLogInfo("Success Save UserSaveFile to %s.", fileName.toUtf8().data());
}
コード例 #9
0
//!----------------------------------------------------------------------------------------------------
//!
//! \brief GuidewareTrackingWindow::update
//!
void GuidewareTrackingWindow::update(){

    //! collaborativePath
    collaborativeState = "on"; //on/off
    collaborativeName = this->patientHandling->getName();
    collaborativeType = "standby"; //standby/normal/reconstruct
    collaborativePath = "None";

    QFile f(this->configuratonFilePath);
    if(!f.open(QIODevice::WriteOnly | QIODevice::Text))
    {
        cout << "Open failed." << endl;
    }

    QTextStream txtOutput(&f);
    QString s1(collaborativeState);
    QString s2(collaborativeName);
    QString s3(collaborativeType);
    QString s4(collaborativePath);

    txtOutput << "state:" << s1 << endl;
    txtOutput << "name:" << s2 << endl;
    txtOutput << "type:" << s3 << endl;
    txtOutput << "path:" << s4 << endl;

    f.close();

    //! show patient infomation
    this->surgeryIDLineEdit->setText(QString::number(this->patientHandling->getIdNumber(), 10));
    this->patientNameLineEdit->setText(this->patientHandling->getName());
    // this->surgeryDateLineEdit->setText(this->patientHandling->);

    //! display on the left top window
    //this->GuidewireAndVesselMergeDisplay(this->patientHandling->fetchLatestCTImageForDisplay());
    //this->GuidewireAndVesselMergeDisplay(this->patientHandling->fetchLatestCTImageForDisplay()->getImage());
    this->displayTaskTimer->start(200);
}
コード例 #10
0
ファイル: MainWindow.cpp プロジェクト: micwik/ArnBrowser
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    _ui( new Ui::MainWindow)
{
    _ui->setupUi( this);

    _isConnect          = false;
    _wasContact         = false;
    _wasConnect         = false;
    _isLoginCancel      = false;
    _runPostLoginCancel = false;
    _isLoginDialog      = false;
    _loginContextCode   = 0;

    QLabel*  curItemPathLabel = new QLabel;
    curItemPathLabel->setText("Path:");
    _curItemPathStatus = new QLineEdit;
    _curItemPathStatus->setReadOnly( true);
    _curItemPathStatus->setStyleSheet("QLineEdit{background: lightgrey;}");
    _ui->statusBar->addPermanentWidget( curItemPathLabel);
    _ui->statusBar->addPermanentWidget( _curItemPathStatus);

    _timerChatButEff = new QTimer( this);
    _timerChatButEff->setInterval(20);
    connect( _timerChatButEff, SIGNAL(timeout()), this, SLOT(doChatButtonEffect()));
    _countChatButEff = 0;
    _chatButEff = new QGraphicsColorizeEffect;
    _chatButEff->setColor( QColor(254,89,6));
    _ui->chatButton->setGraphicsEffect( _chatButEff);
    setChatButEff( false);

    _appSettings = new QSettings("MicTron", "ArnBrowser");
    _settings    = new SettingsHandler( _appSettings);
    _settings->readSettings();

    //// Error log from Arn system
    ArnM::setConsoleError( false);
    connect( &ArnM::instance(), SIGNAL(errorLogSig(QString,uint,void*)),
             this, SLOT(errorLog(QString)));

    //// Prepare connect to Arn server
    _connector = new Connector( this);
    _arnClient = new ArnClient( this);
    _arnClient->setDemandLogin( false);
    // _arnClient->setReceiveTimeout(5);  // Base time for receiver timeout
    connect( _arnClient, SIGNAL(connectionStatusChanged(int,int)), this, SLOT(doClientStateChanged(int)));
    connect( _arnClient, SIGNAL(loginRequired(int)), this, SLOT(doStartLogin(int)));
    connect( _arnClient, SIGNAL(replyInfo(int,QByteArray)), SLOT(doRinfo(int,QByteArray)));
    connect( _arnClient, SIGNAL(killRequested()), this, SLOT(onKillRequest()));
    connect( _arnClient, SIGNAL(chatReceived(QString,int)), this, SLOT(onChatReceived(QString,int)));

    //// Setup model
    _arnModel = new ArnModel( _connector, this);
    _arnModel->setClient( _arnClient);
    _arnModel->start();
    connect( _arnModel, SIGNAL(hiddenRow(int,QModelIndex,bool)),
             this, SLOT(updateHidden(int,QModelIndex,bool)));

    setWindowTitle(tr("Arn Browser  ") + ver);
    _ui->arnView->setEnabled( false);

    readSettings();
    QString  host = _appSettings->value("connect/host").toString();
    int      port = _appSettings->value("connect/port").toInt();
    if (host.isNull())
        host = "localhost";  // Default host
    if (port == 0)
        port = Arn::defaultTcpPort;
    _ui->hostEdit->setText( host);    // Default host
    _ui->portEdit->setValue( port);
    _ui->connectStat->hide();

    _chatServWin = new ChatServWindow( _appSettings, this);
    connect( _chatServWin, SIGNAL(txtOutput(QString)), this, SLOT(doChatAdd(QString)));
    connect( _chatServWin, SIGNAL(abortKillRequest()), this , SLOT(doAbortKillRequest()));

#if QT_VERSION >= 0x050000 && QT_VERSION < 0x050300
    _ui->portEdit->setRange( 1, 1065535);  // Fix early Qt5 layout bug giving to little space
#endif

    connect( _ui->arnView, SIGNAL(clicked(QModelIndex)), this, SLOT(onItemClick(QModelIndex)));
    connect( _ui->arnView, SIGNAL(customContextMenuRequested(QPoint)),
             this, SLOT(onContextMenuRequested(QPoint)));

    setConnectOffGui();
    // Test chat button
    //_ui->chatButton->setVisible(true);
    //setChatButEff( true);
}