Beispiel #1
0
void DirectionNode::backwardDirection(qreal distance) {
  QVector3D front = direction;
  front.normalize();
  position -= distance*front;
  updateView();
}
Beispiel #2
0
	//-----------------------------------------------------------------------
	void Frustum::updateFrustumImpl(void) const
	{
		// Common calcs
		Real left, right, bottom, top;
		calcProjectionParameters(left, right, bottom, top);

		if (!mCustomProjMatrix)
		{

			// The code below will dealing with general projection 
			// parameters, similar glFrustum and glOrtho.
			// Doesn't optimise manually except division operator, so the 
			// code more self-explaining.

			Real inv_w = 1 / (right - left);
			Real inv_h = 1 / (top - bottom);
			Real inv_d = 1 / (mFarDist - mNearDist);

			// Recalc if frustum params changed
			if (mProjType == PT_PERSPECTIVE)
			{
				// Calc matrix elements
				Real A = 2 * mNearDist * inv_w;
				Real B = 2 * mNearDist * inv_h;
				Real C = (right + left) * inv_w;
				Real D = (top + bottom) * inv_h;
				Real q, qn;
				if (mFarDist == 0)
				{
					// Infinite far plane
					q = Frustum::INFINITE_FAR_PLANE_ADJUST - 1;
					qn = mNearDist * (Frustum::INFINITE_FAR_PLANE_ADJUST - 2);
				}
				else
				{
					q = - (mFarDist + mNearDist) * inv_d;
					qn = -2 * (mFarDist * mNearDist) * inv_d;
				}

				// NB: This creates 'uniform' perspective projection matrix,
				// which depth range [-1,1], right-handed rules
				//
				// [ A   0   C   0  ]
				// [ 0   B   D   0  ]
				// [ 0   0   q   qn ]
				// [ 0   0   -1  0  ]
				//
				// A = 2 * near / (right - left)
				// B = 2 * near / (top - bottom)
				// C = (right + left) / (right - left)
				// D = (top + bottom) / (top - bottom)
				// q = - (far + near) / (far - near)
				// qn = - 2 * (far * near) / (far - near)

				mProjMatrix = Matrix4::ZERO;
				mProjMatrix[0][0] = A;
				mProjMatrix[0][2] = C;
				mProjMatrix[1][1] = B;
				mProjMatrix[1][2] = D;
				mProjMatrix[2][2] = q;
				mProjMatrix[2][3] = qn;
				mProjMatrix[3][2] = -1;

				if (mObliqueDepthProjection)
				{
					// Translate the plane into view space

					// Don't use getViewMatrix here, incase overrided by 
					// camera and return a cull frustum view matrix
					updateView();
					Plane plane = mViewMatrix * mObliqueProjPlane;

					// Thanks to Eric Lenyel for posting this calculation 
					// at www.terathon.com

					// Calculate the clip-space corner point opposite the 
					// clipping plane
					// as (sgn(clipPlane.x), sgn(clipPlane.y), 1, 1) and
					// transform it into camera space by multiplying it
					// by the inverse of the projection matrix

					/* generalised version
					Vector4 q = matrix.inverse() * 
					Vector4(Math::Sign(plane.normal.x), 
					Math::Sign(plane.normal.y), 1.0f, 1.0f);
					*/
					Vector4 q;
					q.x = (Math::Sign(plane.normal.x) + mProjMatrix[0][2]) / mProjMatrix[0][0];
					q.y = (Math::Sign(plane.normal.y) + mProjMatrix[1][2]) / mProjMatrix[1][1];
					q.z = -1;
					q.w = (1 + mProjMatrix[2][2]) / mProjMatrix[2][3];

					// Calculate the scaled plane vector
					Vector4 clipPlane4d(plane.normal.x, plane.normal.y, plane.normal.z, plane.d);
					Vector4 c = clipPlane4d * (2 / (clipPlane4d.dotProduct(q)));

					// Replace the third row of the projection matrix
					mProjMatrix[2][0] = c.x;
					mProjMatrix[2][1] = c.y;
					mProjMatrix[2][2] = c.z + 1;
					mProjMatrix[2][3] = c.w; 
				}
			} // perspective
			else if (mProjType == PT_ORTHOGRAPHIC)
			{
				Real A = 2 * inv_w;
				Real B = 2 * inv_h;
				Real C = - (right + left) * inv_w;
				Real D = - (top + bottom) * inv_h;
				Real q, qn;
				if (mFarDist == 0)
				{
					// Can not do infinite far plane here, avoid divided zero only
					q = - Frustum::INFINITE_FAR_PLANE_ADJUST / mNearDist;
					qn = - Frustum::INFINITE_FAR_PLANE_ADJUST - 1;
				}
				else
				{
					q = - 2 * inv_d;
					qn = - (mFarDist + mNearDist)  * inv_d;
				}

				// NB: This creates 'uniform' orthographic projection matrix,
				// which depth range [-1,1], right-handed rules
				//
				// [ A   0   0   C  ]
				// [ 0   B   0   D  ]
				// [ 0   0   q   qn ]
				// [ 0   0   0   1  ]
				//
				// A = 2 * / (right - left)
				// B = 2 * / (top - bottom)
				// C = - (right + left) / (right - left)
				// D = - (top + bottom) / (top - bottom)
				// q = - 2 / (far - near)
				// qn = - (far + near) / (far - near)

				mProjMatrix = Matrix4::ZERO;
				mProjMatrix[0][0] = A;
				mProjMatrix[0][3] = C;
				mProjMatrix[1][1] = B;
				mProjMatrix[1][3] = D;
				mProjMatrix[2][2] = q;
				mProjMatrix[2][3] = qn;
				mProjMatrix[3][3] = 1;
			} // ortho
		} // !mCustomProjMatrix

		RenderSystem* renderSystem = Root::getSingleton().getRenderSystem();
		// API specific
		renderSystem->_convertProjectionMatrix(mProjMatrix, mProjMatrixRS);
		// API specific for Gpu Programs
		renderSystem->_convertProjectionMatrix(mProjMatrix, mProjMatrixRSDepth, true);


		// Calculate bounding box (local)
		// Box is from 0, down -Z, max dimensions as determined from far plane
		// If infinite view frustum just pick a far value
		Real farDist = (mFarDist == 0) ? 100000 : mFarDist;
		// Near plane bounds
		Vector3 min(left, bottom, -farDist);
		Vector3 max(right, top, 0);

		if (mCustomProjMatrix)
		{
			// Some custom projection matrices can have unusual inverted settings
			// So make sure the AABB is the right way around to start with
			Vector3 tmp = min;
			min.makeFloor(max);
			max.makeCeil(tmp);
		}

		if (mProjType == PT_PERSPECTIVE)
		{
			// Merge with far plane bounds
			Real radio = farDist / mNearDist;
			min.makeFloor(Vector3(left * radio, bottom * radio, -farDist));
			max.makeCeil(Vector3(right * radio, top * radio, 0));
		}
		mBoundingBox.setExtents(min, max);

		mRecalcFrustum = false;

		// Signal to update frustum clipping planes
		mRecalcFrustumPlanes = true;
	}
void CFirstPersonCamera::setPosition(const glm::vec3& position)
{
    m_position = position;
    updateView();
}
Beispiel #4
0
bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule )
{
    MODULE* newModule;
    PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB, false );

    if( frame == NULL )     // happens if no board editor opened
        return false;

    if( aModule == NULL )
    {
        if( ! frame->GetBoard() || ! frame->GetBoard()->m_Modules )
            return false;

        aModule = SelectFootprint( frame->GetBoard() );
    }

    if( aModule == NULL )
        return false;

    SetCurItem( NULL );

    Clear_Pcb( false );

    GetBoard()->m_Status_Pcb = 0;
    newModule = new MODULE( *aModule );
    newModule->SetParent( GetBoard() );
    newModule->SetLink( aModule->GetTimeStamp() );

    aModule = newModule;

    GetBoard()->Add( newModule );

    newModule->ClearFlags();

    // Clear references to net info, because the footprint editor
    // does know any thing about nets handled by the current edited board.
    // Morever the main board can change or the net info relative to this main board
    // can change while editing this footprint in the footprint editor
    for( D_PAD* pad = newModule->Pads(); pad; pad = pad->Next() )
        pad->SetNetCode( NETINFO_LIST::UNCONNECTED );

    SetCrossHairPosition( wxPoint( 0, 0 ) );
    PlaceModule( newModule, NULL );
    newModule->SetPosition( wxPoint( 0, 0 ) ); // cursor in GAL may not be initialized at the moment

    // Put it on FRONT layer,
    // because this is the default in ModEdit, and in libs
    if( newModule->GetLayer() != F_Cu )
        newModule->Flip( newModule->GetPosition() );

    // Put it in orientation 0,
    // because this is the default orientation in ModEdit, and in libs
    Rotate_Module( NULL, newModule, 0, false );
    GetScreen()->ClrModify();
    Zoom_Automatique( false );

    if( IsGalCanvasActive() )
        updateView();

    return true;
}
void BaseView::dayPassed( const QDate & )
{
  updateView();
}
void PlaylistWidget::deactivate()
{
    p->isActive = false;
    updateView();
}
void PlaylistWidget::setDescription(QString value)
{
    p->description = value;
    updateView();
}
VisualizationWidget::VisualizationWidget( QWidget* parent /*= 0*/ )
	: QWidget(parent)
{
	this->setupUi(this);

	_interactorStyle = VtkCustomInteractorStyle::New();
	vtkWidget->GetRenderWindow()->GetInteractor()->SetInteractorStyle(_interactorStyle);

	_vtkPickCallback = VtkPickCallback::New();
	vtkSmartPointer<vtkCellPicker> picker = vtkSmartPointer<vtkCellPicker>::New();
	picker->AddObserver(vtkCommand::EndPickEvent, _vtkPickCallback);
	vtkWidget->GetRenderWindow()->GetInteractor()->SetPicker(picker);

	vtkRenderWindow* renderWindow = vtkWidget->GetRenderWindow();
	renderWindow->StereoCapableWindowOn();
	renderWindow->SetStereoTypeToCrystalEyes();
	_vtkRender = vtkRenderer::New();
	renderWindow->AddRenderer(_vtkRender);
	_interactorStyle->SetDefaultRenderer(_vtkRender);

	QSettings settings;

#ifdef OGS_USE_VRPN
	VtkTrackedCamera* cam = new VtkTrackedCamera(this);
	_vtkRender->SetActiveCamera(cam);
	connect( cam, SIGNAL(viewUpdated()), this, SLOT(updateView()) );

	//QSpaceNavigatorClient* spacenav = QSpaceNavigatorClient::Instance();
	//spacenav->init("spacenav@localhost", 1000 / 15, SpaceNavigatorClient::Z);
	//cam->setFocalPoint(0, 5.0, 0.5);
	//cam->updateView();
	//spacenav->setTranslationFactor(2.0);
	//connect( spacenav, SIGNAL(translated(double, double, double)), cam, SLOT(setTrackingData(double, double, double)) );
	//connect( spacenav, SIGNAL(translated(double, double, double)), cam, SLOT(translate(double, double, double)) );

	QVrpnArtTrackingClient* art = QVrpnArtTrackingClient::Instance(this);
	if (settings.contains("Tracking/artDeviceName"))
	{
		QString deviceName = settings.value("Tracking/artDeviceName").toString();
		QString deviceNameAt = settings.value("Tracking/artDeviceNameAt").toString();
		art->StartTracking(QString(deviceName + "@" + deviceNameAt).toStdString().c_str(),
		                   settings.value("Tracking/artUpdateInterval").toInt());
	}
	else
		art->StartTracking("[email protected]");
	connect( art, SIGNAL(positionUpdated(double, double, double)),
	         cam, SLOT(setTrackingData(double, double, double)) );

	// Connect the vtk event to the qt slot
	_qtConnect = vtkEventQtSlotConnect::New();
	_qtConnect->Connect(vtkWidget->GetRenderWindow()->GetInteractor(),
	                    vtkCommand::EndInteractionEvent,
	                    cam,
	                    SLOT(updatedFromOutside()));

#endif // OGS_USE_VRPN

	_vtkRender->SetBackground(0.0,0.0,0.0);

	// Create an orientation marker using vtkAxesActor
	vtkSmartPointer<vtkAxesActor> axesActor = vtkSmartPointer<vtkAxesActor>::New();
	vtkOrientationMarkerWidget* markerWidget = vtkOrientationMarkerWidget::New();
	markerWidget->SetOrientationMarker(axesActor);
	//markerWidget->SetViewport(0.0, 0.0, 0.15, 0.3); // size
	markerWidget->SetInteractor(vtkWidget->GetRenderWindow()->GetInteractor());
	markerWidget->EnabledOn();
	markerWidget->InteractiveOff();

	_isShowAllOnLoad = settings.value("resetViewOnLoad", true).toBool();

	// Set alternate cursor shapes
	connect(_interactorStyle, SIGNAL(cursorChanged(Qt::CursorShape)),
	        this, SLOT(setCursorShape(Qt::CursorShape)));
}
Beispiel #9
0
	void ScrollView::setSize(const IntSize& _size)
	{
		Base::setSize(_size);

		updateView();
	}
Beispiel #10
0
MainWindow::MainWindow()
    : m_currentView(0),
      m_currentRootObject(0),
      m_transparent(false)
{
    QVBoxLayout *layout = new QVBoxLayout;

    QGroupBox *groupBox = new QGroupBox(tr("Type"));
    QVBoxLayout *vbox = new QVBoxLayout;
    m_radioView = new QRadioButton(tr("QQuickView in a window container (direct)"));
    m_radioWidget = new QRadioButton(tr("QQuickWidget (indirect through framebuffer objects)"));
    vbox->addWidget(m_radioWidget);
    vbox->addWidget(m_radioView);
    m_radioWidget->setChecked(true);
    m_state = Unknown;
    connect(m_radioWidget, &QRadioButton::toggled, this, &MainWindow::updateView);
    connect(m_radioView, &QRadioButton::toggled, this, &MainWindow::updateView);
    groupBox->setLayout(vbox);

    layout->addWidget(groupBox);

    m_checkboxMultiSample = new QCheckBox(tr("Multisample (4x)"));
    connect(m_checkboxMultiSample, &QCheckBox::toggled, this, &MainWindow::updateView);
    layout->addWidget(m_checkboxMultiSample);

    m_labelStatus = new QLabel;
    layout->addWidget(m_labelStatus);

    qmlRegisterType<FbItem>("fbitem", 1, 0, "FbItem");

    QWidget *quickContainer = new QWidget;
    layout->addWidget(quickContainer);
    layout->setStretchFactor(quickContainer, 8);
    m_containerLayout = new QVBoxLayout;
    quickContainer->setLayout(m_containerLayout);

    // Add an overlay widget to demonstrate that it will _not_ work with
    // QQuickView, whereas it is perfectly fine with QQuickWidget.
    QPalette semiTransparent(QColor(255,0,0,128));
    semiTransparent.setBrush(QPalette::Text, Qt::white);
    semiTransparent.setBrush(QPalette::WindowText, Qt::white);

    m_overlayLabel = new QLabel("This is a\nsemi-transparent\n overlay widget\nwhich is placed\non top\n of the Quick\ncontent.", this);
    m_overlayLabel->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
    m_overlayLabel->setAutoFillBackground(true);
    m_overlayLabel->setPalette(semiTransparent);
    QFont f = font();
    f.setPixelSize(QFontInfo(f).pixelSize()*2);
    f.setWeight(QFont::Bold);
    m_overlayLabel->setFont(f);
    m_overlayLabel->hide();

    m_checkboxOverlayVisible = new QCheckBox(tr("Show widget overlay"));
    connect(m_checkboxOverlayVisible, &QCheckBox::toggled, m_overlayLabel, &QWidget::setVisible);
    layout->addWidget(m_checkboxOverlayVisible);

    m_checkboxTransparent = new QCheckBox(tr("Transparent background in QQuickWidget"));
    connect(m_radioWidget, &QCheckBox::toggled, m_checkboxTransparent, &QWidget::setEnabled);
#ifdef Q_OS_LINUX
    connect(m_checkboxTransparent, &QCheckBox::toggled, this, &MainWindow::onTransparentChanged);
    layout->addWidget(m_checkboxTransparent);
#endif

    setLayout(layout);

    updateView();
}
ResourceView::ResourceView( KCal::CalendarResources *calendar, QWidget *parent )
  : CalendarViewExtension( parent ), mCalendar( calendar )
{
  QVBoxLayout *topLayout = new QVBoxLayout( this );
  topLayout->setSpacing( KDialog::spacingHint() );

  QHBoxLayout *buttonBox = new QHBoxLayout();
  buttonBox->setSpacing( KDialog::spacingHint() );
  topLayout->addLayout( buttonBox );

  mListView = new QTreeWidget( this );
  mListView->setWhatsThis(
    i18nc( "@info:whatsthis",
           "This list shows all the calendars currently known to KOrganizer. "
           "Use the associated checkboxes to make a calendar active or inactive. "
           "Use the context menu to add, remove or edit calendars in the list."
           "<p>Events, journal entries and to-dos are retrieved and stored "
           "from their respective calendars. Calendars can be accessed from "
           "groupware servers, local files, etc...</p>"
           "<p>If you have more than one active calendar, you will be "
           "prompted for which calendar to store new items into, unless "
           "configured to always store to the default calendar.</p>" ) );
  mListView->setRootIsDecorated( false );
  mListView->setHeaderLabel( i18n( "Calendars" ) );
  mListView->header()->hide();
  topLayout->addWidget( mListView );

  mSelectedParent = 0;

  connect( mListView, SIGNAL(itemDoubleClicked(QTreeWidgetItem *,int)),
           SLOT(editResource()) );
  connect( mListView, SIGNAL(itemClicked(QTreeWidgetItem *,int)),
           SLOT(slotItemClicked(QTreeWidgetItem *,int)) );
  connect( mListView, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
           SLOT(currentChanged()) );

  mListView->setContextMenuPolicy( Qt::CustomContextMenu );
  connect( mListView, SIGNAL(customContextMenuRequested(const QPoint &)),
           SLOT(showContextMenu(const QPoint &)) );

  QLabel *calLabel = new QLabel( i18n( "Calendars" ), this );
  buttonBox->addWidget( calLabel );
  buttonBox->addStretch( 1 );

  mAddButton = new QToolButton( this );
  mAddButton->setIcon( KIcon( "list-add" ) );
  buttonBox->addWidget( mAddButton );
  mAddButton->setToolTip( i18nc( "@info:tooltip", "Add calendar" ) );
  mAddButton->setWhatsThis(
    i18nc( "@info:whatsthis",
           "Press this button to add a new calendar to KOrganizer. "
           "<p>Events, journal entries and to-dos are retrieved and stored "
           "from their respective calendars. Calendars can be accessed from "
           "groupware servers, local files, etc...</p>"
           "<p>If you have more than one active calendar, you will be "
           "prompted for which calendar to store new items into, unless "
           "configured to always store to the default calendar.</p>" ) );
  mEditButton = new QToolButton( this );
  mEditButton->setIcon( KIcon( "document-properties" ) );
  buttonBox->addWidget( mEditButton );
  mEditButton->setToolTip( i18nc( "@info:tooltip", "Edit calendar settings" ) );
  mEditButton->setWhatsThis(
    i18nc( "@info:whatsthis",
           "Press this button to edit the calendar currently "
           "selected in the list above." ) );
  mDeleteButton = new QToolButton( this );
  mDeleteButton->setIcon( KIcon( "edit-delete" ) );
  buttonBox->addWidget( mDeleteButton );
  mDeleteButton->setToolTip( i18nc( "@info:tooltip", "Remove calendar" ) );
  mDeleteButton->setWhatsThis(
    i18nc( "@info:whatsthis",
           "Press this button to delete the calendar currently "
           "selected in the list above." ) );
  mDeleteButton->setDisabled( true );
  mEditButton->setDisabled( true );

  connect( mAddButton, SIGNAL( clicked() ), SLOT( slotAddButtonClicked() ) );
  connect( mDeleteButton, SIGNAL( clicked() ), SLOT( removeResource() ) );
  connect( mEditButton, SIGNAL( clicked() ), SLOT( editResource() ) );

  setMinimumHeight( 50 );
  mListView->setSortingEnabled( true );

  updateView();
}
Beispiel #12
0
void MainWindow::onTransparentChanged(bool enabled)
{
    m_transparent = enabled;
    updateView();
}
Beispiel #13
0
CWindowMain::CWindowMain(QWidget *parent)
    : QMainWindow(parent),
      m_executThread(NULL)
{
    m_widgetBFGenerate  = new CWidgetBFGenerate(this);
    m_widgetBFList      = new CWidgetBFList(this);
    m_widgetBFView      = new CWidgetBFView(this);
    m_widgetConsol      = new CWidgetConsol(this);
    m_widgetConsol->setVisible(false);
    m_widgetPanelMode   = new CWidgetPanelMode(this);
    m_widgetTreeSat     = new CWidgetTreeSat(this);

    QWidget *wBFViewBFGenerate = new QWidget();
    QVBoxLayout *boxBFViewBFGenerate = new QVBoxLayout();
    boxBFViewBFGenerate->addWidget(m_widgetBFGenerate);
    boxBFViewBFGenerate->addWidget(m_widgetBFView);
    boxBFViewBFGenerate->setMargin(0);
    boxBFViewBFGenerate->setSpacing(0);
    boxBFViewBFGenerate->setStretch(1,100);
    wBFViewBFGenerate->setLayout(boxBFViewBFGenerate);

    QSplitter *spListBFTreeAlg = new QSplitter(Qt::Vertical);
    spListBFTreeAlg->addWidget(m_widgetBFList);
    spListBFTreeAlg->addWidget(m_widgetTreeSat);

    QSplitter *spTreeView = new QSplitter(Qt::Horizontal);
    spTreeView->addWidget(spListBFTreeAlg);
    spTreeView->addWidget(wBFViewBFGenerate);
    spTreeView->setStretchFactor(1,100);

    QSplitter *spMain = new QSplitter(Qt::Vertical);
    spMain->addWidget(spTreeView);
    spMain->addWidget(m_widgetConsol);
    spMain->setStretchFactor(0,100);

    QWidget *widgetCenter = new QWidget(this);
    setCentralWidget(widgetCenter);

    QHBoxLayout *hbox = new QHBoxLayout();
    centralWidget()->setLayout(hbox);

    hbox->addWidget(m_widgetPanelMode);
    hbox->addWidget(spMain);
    hbox->setMargin(0);
    hbox->setSpacing(0);
    hbox->setStretch(1,100);

    m_actOpen = new QAction(QIcon(":/ico/main_open.png"),tr("&Открыть"),this);
    m_actOpen->setShortcut(QKeySequence::Open);
    connect(m_actOpen,SIGNAL(triggered()),this,SLOT(on_open()));

    m_actSave = new QAction(QIcon(":/ico/main_save.png"),tr("&Сохранить"),this);
    m_actSave->setShortcut(QKeySequence::Save);
    connect(m_actSave,SIGNAL(triggered()),this,SLOT(on_save()));

    m_actSaveAs = new QAction(QIcon(":/ico/main_save_as.png"),tr("&Сохранить как"),this);
    m_actSaveAs->setShortcut(QKeySequence::SaveAs);
    connect(m_actSaveAs,SIGNAL(triggered()),this,SLOT(on_save_as()));

    m_actQuit = new QAction(QIcon("://ico/main_quit.png"),tr("Выйти"),this);
    m_actQuit->setShortcut(QKeySequence::Close);
    m_actQuit->setStatusTip(tr("Выйти из приложения"));
    connect(m_actQuit, SIGNAL(triggered()), this, SLOT(close()));

    mainMenu = menuBar()->addMenu(tr("Файл"));
    mainMenu->addAction(m_actOpen);
    mainMenu->addAction(m_actSave);
    mainMenu->addAction(m_actSaveAs);
    mainMenu->addSeparator();
    mainMenu->addAction(m_actQuit);

    mainMenu = menuBar()->addMenu(tr("Вид"));
    mainMenu->addAction(m_widgetBFGenerate->actVisible());
    mainMenu->addAction(m_widgetConsol->actVisible());

    // m_widgetPanelMode
    connect(m_widgetPanelMode,SIGNAL(run()),
            m_widgetTreeSat,SLOT(on_runChecked()));

    connect(m_widgetPanelMode,SIGNAL(run()),
            m_widgetBFGenerate,SLOT(on_resetTriggered()));

    connect(m_widgetPanelMode,SIGNAL(runLog()),
            m_widgetTreeSat,SLOT(on_runLogChecked()));

    connect(m_widgetPanelMode,SIGNAL(runLog()),
            m_widgetBFGenerate,SLOT(on_resetTriggered()));

    connect(m_widgetPanelMode,SIGNAL(terminate()),
            this,SIGNAL(terminated()));

    connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)),
            m_widgetBFList,SLOT(setVisible(bool)));
    connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)),
            m_widgetBFList,SLOT(on_disabledHide(bool)));

    connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)),
            m_widgetBFGenerate,SLOT(setVisible(bool)));
    connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)),
            m_widgetBFGenerate->actVisible(),SLOT(setChecked(bool)));
    connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)),
            m_widgetBFGenerate->actVisible(),SLOT(setEnabled(bool)));

    connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)),
            m_widgetTreeSat,SLOT(setVisible(bool)));
    connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)),
            m_widgetTreeSat,SLOT(on_disabledHide(bool)));

    // m_widgetBFView
    connect(m_widgetBFView,SIGNAL(message(QString)),
            this,SIGNAL(messageAppend(QString)));

    connect(m_widgetBFView,SIGNAL(getLogSelectSat(bool)),
            m_widgetTreeSat,SLOT(on_returnLogSelectSat(bool)));

    // m_widgetBFList
    connect(m_widgetBFList,SIGNAL(generate()),
            m_widgetBFGenerate,SLOT(on_generate()));

    connect(m_widgetBFList,SIGNAL(selected(QString,CBoolFormula*)),
            m_widgetBFGenerate,SLOT(on_set(QString,CBoolFormula*)));

    connect(m_widgetBFList,SIGNAL(selected(QString,CBoolFormula*)),
            m_widgetTreeSat,SLOT(on_set(QString,CBoolFormula*)));

    connect(m_widgetBFList,SIGNAL(selected(QString,CBoolFormula*)),
            m_widgetBFView,SLOT(on_set(QString,CBoolFormula*)));

    connect(m_widgetBFList,SIGNAL(message(QString)),
            this,SIGNAL(messageAppend(QString)));

    // m_widgetBFGenerate
    connect(m_widgetBFGenerate,SIGNAL(append(QString,CBoolFormula*)),
            m_widgetBFList,SIGNAL(appendgen(QString,CBoolFormula*)));

    connect(m_widgetBFGenerate,SIGNAL(append(QString,CBoolFormula*)),
            m_widgetPanelMode,SLOT(on_resetTriggered()));

    connect(m_widgetBFGenerate,SIGNAL(execut(QList<CExecutObject*>)),
            this,SLOT(on_execut(QList<CExecutObject*>)));

    connect(m_widgetBFGenerate,SIGNAL(replace(QString,CBoolFormula*)),
            m_widgetBFList,SIGNAL(replace(QString,CBoolFormula*)));

    connect(m_widgetBFGenerate,SIGNAL(replace(QString,CBoolFormula*)),
            m_widgetPanelMode,SLOT(on_resetTriggered()));

    connect(m_widgetBFGenerate,SIGNAL(remove(QString)),
            m_widgetBFList,SIGNAL(remove(QString)));

    connect(m_widgetBFGenerate,SIGNAL(terminated()),
            this,SIGNAL(terminated()));

    // m_widgetTreeSat
    connect(m_widgetTreeSat,SIGNAL(execut(QList<CExecutObject*>)),
            this,SLOT(on_execut(QList<CExecutObject*>)));

    connect(m_widgetTreeSat,SIGNAL(logSelectSat(QString)),
            m_widgetBFView,SIGNAL(setText(QString)));

    // main
    connect(this,SIGNAL(messageAppend(QString)),
            m_widgetConsol,SLOT(messageAppend(QString)));

    connect(this,SIGNAL(messageSet(QString)),
            m_widgetConsol,SLOT(messageSet(QString)));

    connect(this,SIGNAL(executingOperation(QString)),
            m_widgetConsol,SLOT(executingOperation(QString)));

    connect(this,SIGNAL(append(QString,CBoolFormula*)),
            m_widgetBFList,SIGNAL(append(QString,CBoolFormula*)));

    connect(this,SIGNAL(locked()),m_widgetPanelMode,SLOT(on_locked()));
    connect(this,SIGNAL(unlocked()),m_widgetPanelMode,SLOT(on_unlocked()));

    connect(this,SIGNAL(locked()),m_widgetBFGenerate,SLOT(on_locked()));
    connect(this,SIGNAL(unlocked()),m_widgetBFGenerate,SLOT(on_unlocked()));

    connect(this,SIGNAL(updateView()),m_widgetBFView,SLOT(on_viewUpdate()));

    m_widgetPanelMode->on_checkedRand();  // set checked Random bool formula state for start application
}
Beispiel #14
0
void DirectionNode::leftDirection(qreal distance) {
  QVector3D side = QVector3D::crossProduct(direction, up);
  side.normalize();
  position -= distance * side;
  updateView();
}
Beispiel #15
0
void DDateEdit::showPopup()
{
    if ( d->readOnly )
    {
        return;
    }

    QRect desk          = KGlobalSettings::desktopGeometry( this );
    QPoint popupPoint   = mapToGlobal( QPoint( 0,0 ) );
    int dateFrameHeight = d->popup->sizeHint().height();

    if ( popupPoint.y() + height() + dateFrameHeight > desk.bottom() )
    {
        popupPoint.setY( popupPoint.y() - dateFrameHeight );
    }
    else
    {
        popupPoint.setY( popupPoint.y() + height() );
    }

    int dateFrameWidth = d->popup->sizeHint().width();

    if ( popupPoint.x() + dateFrameWidth > desk.right() )
    {
        popupPoint.setX( desk.right() - dateFrameWidth );
    }

    if ( popupPoint.x() < desk.left() )
    {
        popupPoint.setX( desk.left() );
    }

    if ( popupPoint.y() < desk.top() )
    {
        popupPoint.setY( desk.top() );
    }

    if ( d->date.isValid() )
    {
        d->popup->setDate( d->date );
    }
    else
    {
        d->popup->setDate( QDate::currentDate() );
    }

    d->popup->popup( popupPoint );

    // The combo box is now shown pressed. Make it show not pressed again
    // by causing its (invisible) list box to emit a 'selected' signal.
    // First, ensure that the list box contains the date currently displayed.
    QDate date = parseDate();
    assignDate( date );
    updateView();
    // Now, simulate an Enter to unpress it
    QAbstractItemView* lb = view();

    if (lb)
    {
        lb->setCurrentIndex( lb->model()->index( 0, 0 ) );
        QKeyEvent* keyEvent = new QKeyEvent(QEvent::KeyPress, Qt::Key_Enter, Qt::NoModifier);
        QApplication::postEvent(lb, keyEvent);
    }
}
Beispiel #16
0
	void ScrollView::setCoord(const IntCoord& _coord)
	{
		Base::setCoord(_coord);

		updateView();
	}
Beispiel #17
0
bool DDateEdit::eventFilter( QObject* object, QEvent* event )
{
    if ( object == lineEdit() )
    {
        // We only process the focus out event if the text has changed
        // since we got focus
        if ( (event->type() == QEvent::FocusOut) && d->textChanged )
        {
            lineEnterPressed();
            d->textChanged = false;
        }
        else if ( event->type() == QEvent::KeyPress )
        {
            // Up and down arrow keys step the date
            QKeyEvent* keyEvent = (QKeyEvent*)event;

            if ( keyEvent->key() == Qt::Key_Return )
            {
                lineEnterPressed();
                return true;
            }

            int step = 0;

            if ( keyEvent->key() == Qt::Key_Up )
            {
                step = 1;
            }
            else if ( keyEvent->key() == Qt::Key_Down )
            {
                step = -1;
            }

            if ( step && !d->readOnly )
            {
                QDate date = parseDate();

                if ( date.isValid() )
                {
                    date = date.addDays( step );

                    if ( assignDate( date ) )
                    {
                        updateView();
                        emit dateChanged( date );
                        return true;
                    }
                }
            }
        }
    }
    else
    {
        // It's a date picker event
        switch ( event->type() )
        {
            case QEvent::MouseButtonDblClick:
            case QEvent::MouseButtonPress:
            {
                QMouseEvent* mouseEvent = (QMouseEvent*)event;

                if ( !d->popup->rect().contains( mouseEvent->pos() ) )
                {
                    QPoint globalPos = d->popup->mapToGlobal( mouseEvent->pos() );

                    if ( QApplication::widgetAt( globalPos ) == this )
                    {
                        // The date picker is being closed by a click on the
                        // DDateEdit widget. Avoid popping it up again immediately.
                        d->discardNextMousePress = true;
                    }
                }

                break;
            }
            default:
                break;
        }
    }

    return false;
}
Beispiel #18
0
	void ScrollView::setVisibleHScroll(bool _value)
	{
		mVisibleHScroll = _value;
		updateView();
	}
void PlaylistWidget::setName(QString value)
{
    p->name = value;
    updateView();
}
Beispiel #20
0
	void ScrollView::setCanvasAlign(Align _value)
	{
		mContentAlign = _value;
		updateView();
	}
void PlaylistWidget::activate()
{
    p->isActive = true;
    updateView();
}
Beispiel #22
0
	void ScrollView::setCanvasSize(const IntSize& _value)
	{
		if (mWidgetClient != nullptr)
			mWidgetClient->setSize(_value); updateView();
	}
Beispiel #23
0
int main(int argc, char * argv[]){
	WINDOW * win;
	initscr();
	clear();
	noecho();
	cbreak();
	curs_set(0);

	m = newMachine();
	if(argc == 2){
		loadMachine(m,argv[1]);
	}

	win = newwin(WINDOW_SIZE_HEIGHT,WINDOW_SIZE_WIDTH,2,2);
	keypad(win,TRUE);
	refresh();
	createDefaultView(win);
	updateView(win);

	char read;
	int c = 0;
	while(c!='q'){
		c = wgetch(win);
		switch(c){
			// all these if statements are just edge cases where we wrap around
			// the table
			case KEY_UP:
				if(section == SECTION_MEMORY){
					if(highlight[section] < 16) highlight[section] = 255 - (15 - highlight[section]);
					else highlight[section]-=16;
				}
				break;
			case KEY_DOWN:
				if(section == SECTION_MEMORY){
					if(highlight[section] < 256 && highlight[section] >= 240) highlight[section] = highlight[section] - 16*15;
					else highlight[section]+=16;
				}
				break;
			case KEY_LEFT:
				if(section == SECTION_MEMORY){
					if(highlight[section]%16==0) highlight[section] += 15;
					else highlight[section]--;
				}else if(section == SECTION_REGISTERS){
					if(highlight[section] == 0) highlight[section] = 15;
					else highlight[section]--;
				}
				break;
			case KEY_RIGHT:
				if(section == SECTION_MEMORY){
					if((highlight[section]-15) % 16 ==0 ) highlight[section] -= 15;
					else highlight[section]++;
				}else if(section == SECTION_REGISTERS){
					if(highlight[section] == 15) highlight[section] = 0;
					else highlight[section]++;
				}
				break;

			// tab key
			case 9:
				// toggle section
				section++;
				section = section%3;
				break;

			case 'r':
				run(m);
				break;

			case 's':
				saveMachine(m);
				break;

			case 'c':
				resetMachine(m);
				break;

			// enter key
			case 10:
				read = readInput(win);
				if(section == SECTION_MEMORY) writeMemoryAt(m, highlight[section], read);
				else if(section == SECTION_REGISTERS) writeRegistersAt(m, highlight[section], read);
				else writePC(m, read);
				break;

			case 'n':
				step(m);
				break;

			default:
				refresh();
				break;
		}
		updateView(win);
	}

	clrtoeol();
	refresh();
	endwin();
	return 0;
}
Beispiel #24
0
void ReadMail::shiftText()
{
	plainTxt = ! plainTxt;
	updateView();
}
Beispiel #25
0
    //---------------------------------------------------------------------
    bool Frustum::projectSphere(const Sphere& sphere, 
        Real* left, Real* top, Real* right, Real* bottom) const
    {
		// See http://www.gamasutra.com/features/20021011/lengyel_06.htm
        // Transform light position into camera space

        updateView();
        Vector3 eyeSpacePos = mViewMatrix.transformAffine(sphere.getCenter());

		// initialise
		*left = *bottom = -1.0f;
		*right = *top = 1.0f;

        if (eyeSpacePos.z < 0)
        {
			updateFrustum();
			const Matrix4& projMatrix = getProjectionMatrix();
            Real r = sphere.getRadius();
			Real rsq = r * r;

            // early-exit
            if (eyeSpacePos.squaredLength() <= rsq)
                return false;

			Real Lxz = Math::Sqr(eyeSpacePos.x) + Math::Sqr(eyeSpacePos.z);
			Real Lyz = Math::Sqr(eyeSpacePos.y) + Math::Sqr(eyeSpacePos.z);

			// Find the tangent planes to the sphere
			// XZ first
			// calculate quadratic discriminant: b*b - 4ac
			// x = Nx
			// a = Lx^2 + Lz^2
			// b = -2rLx
			// c = r^2 - Lz^2
			Real a = Lxz;
			Real b = -2.0 * r * eyeSpacePos.x;
			Real c = rsq - Math::Sqr(eyeSpacePos.z);
			Real D = b*b - 4*a*c;

			// two roots?
			if (D > 0)
			{
				Real sqrootD = Math::Sqrt(D);
				// solve the quadratic to get the components of the normal
				Real Nx0 = (-b + sqrootD) / (2 * a);
				Real Nx1 = (-b - sqrootD) / (2 * a);
				
				// Derive Z from this
				Real Nz0 = (r - Nx0 * eyeSpacePos.x) / eyeSpacePos.z;
				Real Nz1 = (r - Nx1 * eyeSpacePos.x) / eyeSpacePos.z;

				// Get the point of tangency
				// Only consider points of tangency in front of the camera
				Real Pz0 = (Lxz - rsq) / (eyeSpacePos.z - ((Nz0 / Nx0) * eyeSpacePos.x));
				if (Pz0 < 0)
				{
					// Project point onto near plane in worldspace
					Real nearx0 = (Nz0 * mNearDist) / Nx0;
					// now we need to map this to viewport coords
					// use projection matrix since that will take into account all factors
					Vector3 relx0 = projMatrix * Vector3(nearx0, 0, -mNearDist);

					// find out whether this is a left side or right side
					Real Px0 = -(Pz0 * Nz0) / Nx0;
					if (Px0 > eyeSpacePos.x)
					{
						*right = std::min(*right, relx0.x);
					}
					else
					{
						*left = std::max(*left, relx0.x);
					}
				}
				Real Pz1 = (Lxz - rsq) / (eyeSpacePos.z - ((Nz1 / Nx1) * eyeSpacePos.x));
				if (Pz1 < 0)
				{
					// Project point onto near plane in worldspace
					Real nearx1 = (Nz1 * mNearDist) / Nx1;
					// now we need to map this to viewport coords
					// use projection matrix since that will take into account all factors
					Vector3 relx1 = projMatrix * Vector3(nearx1, 0, -mNearDist);

					// find out whether this is a left side or right side
					Real Px1 = -(Pz1 * Nz1) / Nx1;
					if (Px1 > eyeSpacePos.x)
					{
						*right = std::min(*right, relx1.x);
					}
					else
					{
						*left = std::max(*left, relx1.x);
					}
				}
			}


			// Now YZ 
			// calculate quadratic discriminant: b*b - 4ac
			// x = Ny
			// a = Ly^2 + Lz^2
			// b = -2rLy
			// c = r^2 - Lz^2
			a = Lyz;
			b = -2.0 * r * eyeSpacePos.y;
			c = rsq - Math::Sqr(eyeSpacePos.z);
			D = b*b - 4*a*c;

			// two roots?
			if (D > 0)
			{
				Real sqrootD = Math::Sqrt(D);
				// solve the quadratic to get the components of the normal
				Real Ny0 = (-b + sqrootD) / (2 * a);
				Real Ny1 = (-b - sqrootD) / (2 * a);

				// Derive Z from this
				Real Nz0 = (r - Ny0 * eyeSpacePos.y) / eyeSpacePos.z;
				Real Nz1 = (r - Ny1 * eyeSpacePos.y) / eyeSpacePos.z;

				// Get the point of tangency
				// Only consider points of tangency in front of the camera
				Real Pz0 = (Lyz - rsq) / (eyeSpacePos.z - ((Nz0 / Ny0) * eyeSpacePos.y));
				if (Pz0 < 0)
				{
					// Project point onto near plane in worldspace
					Real neary0 = (Nz0 * mNearDist) / Ny0;
					// now we need to map this to viewport coords
					// use projection matriy since that will take into account all factors
					Vector3 rely0 = projMatrix * Vector3(0, neary0, -mNearDist);

					// find out whether this is a top side or bottom side
					Real Py0 = -(Pz0 * Nz0) / Ny0;
					if (Py0 > eyeSpacePos.y)
					{
						*top = std::min(*top, rely0.y);
					}
					else
					{
						*bottom = std::max(*bottom, rely0.y);
					}
				}
				Real Pz1 = (Lyz - rsq) / (eyeSpacePos.z - ((Nz1 / Ny1) * eyeSpacePos.y));
				if (Pz1 < 0)
				{
					// Project point onto near plane in worldspace
					Real neary1 = (Nz1 * mNearDist) / Ny1;
					// now we need to map this to viewport coords
					// use projection matriy since that will take into account all factors
					Vector3 rely1 = projMatrix * Vector3(0, neary1, -mNearDist);

					// find out whether this is a top side or bottom side
					Real Py1 = -(Pz1 * Nz1) / Ny1;
					if (Py1 > eyeSpacePos.y)
					{
						*top = std::min(*top, rely1.y);
					}
					else
					{
						*bottom = std::max(*bottom, rely1.y);
					}
				}
			}
        }

        return (*left != -1.0f) || (*top != 1.0f) || (*right != 1.0f) || (*bottom != -1.0f);

    }
Beispiel #26
0
UpdatePasswordWidget::UpdatePasswordWidget(const User& user,
					   RegistrationModel *registrationModel,
					   AuthModel *authModel,
					   WContainerWidget *parent)
  : WTemplateFormView(tr("Wt.Auth.template.update-password"), parent),
    user_(user),
    registrationModel_(registrationModel),
    authModel_(authModel)
{
  registrationModel_->setValue(RegistrationModel::LoginNameField,
			       user.identity(Identity::LoginName));
  registrationModel_->setReadOnly(RegistrationModel::LoginNameField, true);

  if (user.password().empty())
    authModel_ = 0;
  else if (authModel_)
    authModel_->reset();

  if (authModel_ && authModel_->baseAuth()->emailVerificationEnabled()) {
    /*
     * This is set in the model so that the password checker can take
     * into account whether the password is derived from the email
     * address.
     */
    registrationModel_->setValue
      (RegistrationModel::EmailField,
       WT_USTRING::fromUTF8(user.email() + " " + user.unverifiedEmail()));
  }

  // Make sure it does not block validation
  registrationModel_->setVisible(RegistrationModel::EmailField, false);

  WPushButton *okButton = new WPushButton(tr("Wt.WMessageBox.Ok"));
  WPushButton *cancelButton = new WPushButton(tr("Wt.WMessageBox.Cancel"));

  if (authModel_) {
    authModel_->setValue(AuthModel::LoginNameField,
			 user.identity(Identity::LoginName));

    updateViewField(authModel_, AuthModel::PasswordField);

    authModel_->configureThrottling(okButton);

    WLineEdit *password = resolve<WLineEdit *>(AuthModel::PasswordField);
    password->setFocus(true);
  }

  updateView(registrationModel_);

  WLineEdit *password = resolve<WLineEdit *>
    (RegistrationModel::ChoosePasswordField);
  WLineEdit *password2 = resolve<WLineEdit *>
    (RegistrationModel::RepeatPasswordField);
  WText *password2Info = resolve<WText *>
    (RegistrationModel::RepeatPasswordField + std::string("-info"));

  registrationModel_->validatePasswordsMatchJS(password,
					       password2, password2Info);

  if (!authModel_)
    password->setFocus(true);

  okButton->clicked().connect(this, &UpdatePasswordWidget::doUpdate);
  cancelButton->clicked().connect(this, &UpdatePasswordWidget::close);

  bindWidget("ok-button", okButton);
  bindWidget("cancel-button", cancelButton);

}
void IOWOVoletSmartHomeView::initView()
{
    updateView();
}
void LLFloaterMarketplaceListings::onFocusReceived()
{
	updateView();
}
Beispiel #29
0
void CFirstPersonCamera::move(const glm::vec3& direction)
{
    m_position += direction;
    updateView();
}
Beispiel #30
0
void UpdatePasswordWidget::checkPassword2()
{
  updateModel("repeat-password", RegistrationModel::Password2);
  model_->validate(RegistrationModel::Password2);
  updateView("repeat-password", RegistrationModel::Password2);
}