Beispiel #1
0
bool ColorSet::initColorSetFromFile(QString filename){
	QFile f(filename);
	if (!f.open(QIODevice::ReadOnly | QIODevice::Text))
	{
		qDebug() << "Open ColorSetFile failed." << endl;
		return false;
	}

	QTextStream txtInput(&f);
	QString lineStr;
	while (!txtInput.atEnd())
	{

		txtInput >> lineStr ;
		bool ok = false;
		QColor newColor;
		newColor.setNamedColor(lineStr);
		//= QColor(lineStr.mid(0, 2).trimmed().toInt(&ok, 16), lineStr.mid(2, 2).trimmed().toInt(&ok, 16), lineStr.mid(4, 2).trimmed().toInt(&ok, 16), 255);
		colorSet.push_back(newColor);
		qDebug() << lineStr << lineStr.mid(0, 2).trimmed().toInt(&ok, 16)<<lineStr.mid(2, 2).trimmed().toInt(&ok, 16)<<lineStr.mid(4, 2).trimmed().toInt(&ok, 16) << endl;
	}

	f.close();

}
void CalibrationWindow::on_loadcaliButton_clicked()
{
    QString fileName = QFileDialog::getOpenFileName(this,
         tr("打开校准数据"),
         "",
         tr("数据文件 (*.cal)"));
    if (!fileName.isNull())
    {
        //fileName是文件名
        QFile f(fileName);
        if(!f.open(QIODevice::ReadOnly | QIODevice::Text))
        {
            printf("Open failed.");
            return;
        }
        QTextStream txtInput(&f);
        for (int i=0;i<JOINTNUM;i++)
        {
            txtInput>>zeros[i]>>thresholds[i]>>motionRanges[i];
        }
        f.close();
        //zeros

        dataprocessor.setZeros(zeros);
        setParameters(thresholds,motionRanges);

        //update text
        for (int i=0;i<JOINTNUM;i++)
        {
            zerosEdits[i]->setText(QString("%1:%2").arg(jointNames[i]).arg(zeros[i]));
            thresholdEdits[i]->setText(QString("%1").arg(thresholds[i]));
            rangeEdits[i]->setText(QString("%1").arg(motionRanges[i]));
        }
    }
Beispiel #3
0
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 << " ";
            }
        }
    }
Beispiel #4
0
setting::setting(QWidget *parent)
	: QWidget(parent)
{
	ui.setupUi(this);

	QFile f(".\\bin\\test.txt");
	if (!f.open(QIODevice::ReadOnly | QIODevice::Text))
	{
		QMessageBox::information(NULL, tr("Warnning!!"), tr("初始配置文件读取失败!!!"), QMessageBox::Ok);
		
	}

	QTextStream txtInput(&f);
	
	if (!txtInput.atEnd())
	{
		lineStrSet = txtInput.readLine();
	}
	if (!txtInput.atEnd())
	{
		lineStrEM = txtInput.readLine();
	}

	f.close();



	//Binning判断选择的Binning到底是是哪个
    Binning1 = false;
	Binning2 = false;
	Binning4 = false;
	Binning8 = false;
	Binning16 = false;
	BinningCustom = false;
	Parameters = false;
	KineticMode1 = false;  //选择的连拍模式
	KineticMode2 = false;
	EMenable = false; //默认EM关闭
	EMAdvancedenable = false; //默认EMAdvanced关闭
	if(Qt::Unchecked == ui.checkBox_EMEnable->checkState())
	{
//		ui.label_Num2->setText("EM2");
		EMenable = false;
		ui.spinBox_EMRange->setVisible(false);
		ui.pushButton_EMAdvanced->setVisible(false);
	}
	QObject::connect(ui.spinBox_EMRange,SIGNAL(valueChanged(int)),this,SLOT(spinBoxEMValue(int)));

}
Beispiel #5
0
QVector<Point *> * DataProcess::getFixPointsFromFile(QString filename)
{
	QVector<Point *> *fpoints = new QVector<Point *>();
	QFile f(filename);
	if (f.open(QIODevice::ReadOnly | QIODevice::Text))
	{
		QTextStream txtInput(&f);
		QString lineStr;
		while (!txtInput.atEnd())
		{
			lineStr = txtInput.readLine();
			QStringList list = lineStr.split("\t");
			//+		lineStr	7943777265	SMP	1	1561.08	297.82	Fixation	88.avi	QString
				Point *point=new Point(list.at(0).toInt(), list.at(1).toInt());
				fpoints->push_back(point);
			}
		}
	 f.close();
	 return fpoints;
}
Beispiel #6
0
QVector<QPoint>* DataProcess::getPreprocessedPoints(QString filename)
{
	QVector<QPoint> *points=new QVector<QPoint>();
	QFile f(filename);
	if (f.open(QIODevice::ReadOnly | QIODevice::Text))
	{
		QTextStream txtInput(&f);
		QString lineStr;
		while (!txtInput.atEnd())
		{
			lineStr = txtInput.readLine();
			if (!lineStr.startsWith("##"))
			{
				break;
			}
		}
		lineStr = txtInput.readLine();
		while (!txtInput.atEnd())
		{
			lineStr = txtInput.readLine();
			QStringList list = lineStr.split("\t");
			//+		lineStr	7943777265	SMP	1	1561.08	297.82	Fixation	88.avi	QString

			try{
				float x = list.at(3).toFloat();
				float y = list.at(4).toFloat();

				QPoint point(x, y);
				points->push_back(point);
			}
			catch (QString e)
			{
				//do nothing
			}
		}
		f.close();
	}
	
	fixpoints->push_back(points);
	return points;
}
Beispiel #7
0
bool Register::user_exist(QString username){
    QFile f("..\\quesion\\user\\user.txt");
    if(!f.open(QIODevice::ReadOnly))
    {
        qDebug()<< "no vertification file!";
    }

    QTextStream txtInput(&f);
    QString lineStr;
    while(!txtInput.atEnd())
    {
        lineStr = txtInput.readLine();
        if(username==lineStr) {
             return true;
        }
        else{
            lineStr = txtInput.readLine();
        }
    }
    f.close();
    return false;
}