コード例 #1
0
ファイル: CTextBuffer.cpp プロジェクト: ymuv/cameraAlerts
void CTextBuffer::append(
        const CTextPattern& pattern,
        CTextPattern::tCeserialData data,
        bool isAlert)
{
    auto& list = mMap[pattern.mPattern];

    bool isAdded = false;
    if (list.empty())
    {
        CBufferData dataForAppend(data, isAlert);
        list.append(dataForAppend);
        isAdded = true;
        addToDB(dataForAppend, pattern);
    }
    else if (fabs(list.last().mData - data) > std::numeric_limits<double>::epsilon())
    {
        if (pattern.mDiffNotSave  < std::numeric_limits<NText::CTextPattern::tCeserialData>::epsilon())
        {
            CBufferData dataForAppend(data, isAlert);
            list.append(dataForAppend);
            isAdded = true;
            addToDB(dataForAppend, pattern);
        }
        else if (fabs(list.last().mData - data) >= pattern.mDiffNotSave)
        {
            CBufferData dataForAppend(data, isAlert);
            list.append(dataForAppend);
            isAdded = true;
            addToDB(dataForAppend, pattern);
        }
    }
    if (!isAdded && isAlert && !list.empty())
    {
        list.last().mId = CBufferData::getNextId();
        list.last().updateData(data);
    }
    else
    {
        //TODO: not tested yet
        list.last().updateData(data);
    }

    if (list.size() > mMaxBufferLastSize)
    {
        list.pop_front();
    }
}
コード例 #2
0
ファイル: mainwindow.cpp プロジェクト: kn65op/inzynierka
void MainWindow::on_submitButton_clicked()
{
   if (image_loaded)
   {
       if (checkSegmentation())
       {
           addToDB();
       }
   }
   return;
   static int file_nr = 0;
    m_netwManager = new QNetworkAccessManager(this);
    connect(m_netwManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(slot_netwManagerFinished(QNetworkReply*)));


   // QUrl urlSave("http://usteni.gliczarow.info.pl/webcam.jpeg?1293535363894");
    QUrl urlSave("http://192.168.0.214/now.jpg?snap=pre?ww=1600?wh=1200");

   QNetworkRequest request(urlSave);
   m_netwManager->get(request);

   QString name    = ui->nameField->text();
   QString surname = ui->surnameField->text();
//   QString group   = ui->groupField->text();
//   QString faculty = ui->facultyField->text();
   stringstream ss;
   ss << file_nr++;
   QString file_no = ss.str().c_str();
//   QString filename = group + "-" + name + "-" + surname + "-" + faculty + file_no + ".jpg";
   QString catalog  = "capture/";
//   path = catalog + filename;

   //cvSaveImage(path.toStdString().c_str(), image);

   /* moje
    eye.init(path);
   QPixmap img = QPixmap(path);
   ui->imageLabel->setPixmap(img.scaled(700, 525));
   image_loaded = true;
*/
  /* eye.pupil(ui->binaryEdit->text().toInt());
   eye.iris();
   eye.masking();

   if(db.insertUser(ui->nameField->text(), ui->surnameField->text(), ui->groupField->text(), ui->facultyField->text(), eye.get_mask())) {
     ui->resultLabel->setText("User was added!");
     qDebug("Zapisano do bazy.");
   } else {
     qDebug("Wyst¹pi³ b³¹d przy zapisywaniu.");
   }*/
}
コード例 #3
0
ファイル: ccviewer.cpp プロジェクト: NUAAXQ/trunk
ccViewer::ccViewer(QWidget *parent, Qt::WindowFlags flags)
	: QMainWindow(parent, flags)
	, m_glWindow(0)
	, m_selectedObject(0)
	, m_3dMouseInput(0)
{
	ui.setupUi(this);

#ifdef Q_OS_LINUX
	 //we reset the whole stylesheet but we keep the StatusBar style
	setStyleSheet("");	
	setStyleSheet("QStatusBar{background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 rgb(200,200,200), stop:1 rgb(255,255,255));}");
#endif
	
	setWindowTitle(QString("ccViewer V%1").arg(CC_VIEWER_VERSION.title));

	//insert GL window in a vertical layout
	{
		QVBoxLayout* verticalLayout = new QVBoxLayout(ui.GLframe);
		verticalLayout->setSpacing(0);
		const int margin = 10;
		verticalLayout->setContentsMargins(margin, margin, margin, margin);

		bool stereoMode = QSurfaceFormat::defaultFormat().stereo();

		QWidget* glWidget = 0;
		CreateGLWindow(m_glWindow, glWidget, stereoMode);
		assert(m_glWindow && glWidget);

		verticalLayout->addWidget(glWidget);
	}

	updateGLFrameGradient();

	m_glWindow->setRectangularPickingAllowed(false); //multiple entities picking not supported

	//UI/display synchronization
	ui.actionFullScreen->setChecked(false);
	ui.menuSelected->setEnabled(false);
	reflectLightsState();
	reflectPerspectiveState();
	reflectPivotVisibilityState();

#ifdef CC_3DXWARE_SUPPORT
	enable3DMouse(true);
#else
	ui.actionEnable3DMouse->setEnabled(false);
#endif

	//Signals & slots connection
	connect(m_glWindow,								SIGNAL(filesDropped(QStringList)),			this,		SLOT(addToDB(QStringList)));
	connect(m_glWindow,								SIGNAL(entitySelectionChanged(ccHObject*)),	this,		SLOT(selectEntity(ccHObject*)));
	connect(m_glWindow,								SIGNAL(exclusiveFullScreenToggled(bool)),	this,		SLOT(onExclusiveFullScreenToggled(bool)));
	//connect(m_glWindow,							SIGNAL(entitiesSelectionChanged(std::unordered_set<int>)),	this,		SLOT(selectEntities(std::unordered_set<int>))); //not supported!
	//connect(m_glWindow,							SIGNAL(newLabel(ccHObject*),						this,		SLOT(handleNewEntity(ccHObject*))); //nothing to do in ccViewer!

	//"Options" menu
	connect(ui.actionDisplayParameters,				SIGNAL(triggered()),						this,	SLOT(showDisplayParameters()));
	connect(ui.actionEditCamera,					SIGNAL(triggered()),						this,	SLOT(doActionEditCamera()));
	//"Display > Standard views" menu
	connect(ui.actionSetViewTop,					SIGNAL(triggered()),						this,	SLOT(setTopView()));
	connect(ui.actionSetViewBottom,					SIGNAL(triggered()),						this,	SLOT(setBottomView()));
	connect(ui.actionSetViewFront,					SIGNAL(triggered()),						this,	SLOT(setFrontView()));
	connect(ui.actionSetViewBack,					SIGNAL(triggered()),						this,	SLOT(setBackView()));
	connect(ui.actionSetViewLeft,					SIGNAL(triggered()),						this,	SLOT(setLeftView()));
	connect(ui.actionSetViewRight,					SIGNAL(triggered()),						this,	SLOT(setRightView()));
	connect(ui.actionSetViewIso1,					SIGNAL(triggered()),						this,	SLOT(setIsoView1()));
	connect(ui.actionSetViewIso2,					SIGNAL(triggered()),						this,	SLOT(setIsoView2()));

	//"Options > Perspective" menu
	connect(ui.actionSetOrthoView,					SIGNAL(triggered()),						this,	SLOT(setOrthoView()));
	connect(ui.actionSetCenteredPerspectiveView,	SIGNAL(triggered()),						this,	SLOT(setCenteredPerspectiveView()));
	connect(ui.actionSetViewerPerspectiveView,		SIGNAL(triggered()),						this,	SLOT(setViewerPerspectiveView()));
	//"Options > Rotation symbol" menu
	connect(ui.actionSetPivotAlwaysOn,				SIGNAL(triggered()),						this,	SLOT(setPivotAlwaysOn()));
	connect(ui.actionSetPivotRotationOnly,			SIGNAL(triggered()),						this,	SLOT(setPivotRotationOnly()));
	connect(ui.actionSetPivotOff,					SIGNAL(triggered()),						this,	SLOT(setPivotOff()));
	//"Options > 3D mouse" menu
	connect(ui.actionEnable3DMouse,					SIGNAL(toggled(bool)),						this,	SLOT(enable3DMouse(bool)));
	//"Display > Lights & Materials" menu
	connect(ui.actionToggleSunLight,				SIGNAL(toggled(bool)),						this,	SLOT(toggleSunLight(bool)));
	connect(ui.actionToggleCustomLight,				SIGNAL(toggled(bool)),						this,	SLOT(toggleCustomLight(bool)));
	//"Options" menu
	connect(ui.actionGlobalZoom,					SIGNAL(triggered()),						this,	SLOT(setGlobalZoom()));
	connect(ui.actionEnableStereo,					SIGNAL(toggled(bool)),						this,	SLOT(toggleStereoMode(bool)));
	connect(ui.actionFullScreen,					SIGNAL(toggled(bool)),						this,	SLOT(toggleFullScreen(bool)));
	connect(ui.actionLockRotationVertAxis,			SIGNAL(triggered()),						this,	SLOT(toggleRotationAboutVertAxis()));

	//"Options > Selected" menu
	connect(ui.actionShowColors,					SIGNAL(toggled(bool)),						this,	SLOT(toggleColorsShown(bool)));
	connect(ui.actionShowNormals,					SIGNAL(toggled(bool)),						this,	SLOT(toggleNormalsShown(bool)));
	connect(ui.actionShowMaterials,					SIGNAL(toggled(bool)),						this,	SLOT(toggleMaterialsShown(bool)));
	connect(ui.actionShowScalarField,				SIGNAL(toggled(bool)),						this,	SLOT(toggleScalarShown(bool)));
	connect(ui.actionShowColorRamp,					SIGNAL(toggled(bool)),						this,	SLOT(toggleColorbarShown(bool)));
	connect(ui.actionZoomOnSelectedEntity,			SIGNAL(triggered()),						this,	SLOT(zoomOnSelectedEntity()));
	connect(ui.actionDelete,						SIGNAL(triggered()),						this,	SLOT(doActionDeleteSelectedEntity()));


	//"Shaders" menu
	connect(ui.actionNoFilter,						SIGNAL(triggered()),						this,	SLOT(doDisableGLFilter()));

	//"Help" menu
	connect(ui.actionAbout,							SIGNAL(triggered()),						this,	SLOT(doActionAbout()));
	connect(ui.actionHelpShortctus,					SIGNAL(triggered()),						this,	SLOT(doActionDisplayShortcuts()));

	loadPlugins();
}