void ensureBackend() {
    if (!renderer) {
      renderer = QtCamViewfinderRenderer::create(conf, q_ptr);
      if (!renderer) {
	qCritical() << "Failed to create a viewfinder renderer";
	return;
      }

      renderer->resize(q_ptr->size());
      QObject::connect(renderer, SIGNAL(updateRequested()), q_ptr, SLOT(updateRequested()));
      QObject::connect(renderer, SIGNAL(renderAreaChanged()), q_ptr, SIGNAL(renderAreaChanged()));
      QObject::connect(renderer, SIGNAL(videoResolutionChanged()), q_ptr, SIGNAL(videoResolutionChanged()));
    }
  }
Example #2
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    ui->serverList->setScrollData(ui->serverScroller, ui->serverScroller->viewport());
    ui->serverScroller->setServerList(ui->serverList);

    // scale the toolbar on hidpi
    ui->serverToolbar->setFixedHeight(dpiScale(32)+8);
    SetToolButtonSize(ui->servers_update, dpiScale(32)+4);
    SetToolButtonSize(ui->servers_updateShown, dpiScale(32)+4);
    SetToolButtonSize(ui->servers_updateCurrent, dpiScale(32)+4);
    SetToolButtonSize(ui->servers_setupFilters, dpiScale(32)+4);

    svupdater = new ServerUpdater(0, ui->serverList);
    connect(svupdater, SIGNAL(started()), this, SLOT(sUpdateStarted()));
    connect(svupdater, SIGNAL(succeeded()), this, SLOT(sUpdateSucceeded()));
    connect(svupdater, SIGNAL(masterSucceeded()), this, SLOT(sUpdateSucceededMaster()));
    connect(svupdater, SIGNAL(failed(int)), this, SLOT(sUpdateFailed(int)));

    connect(ui->serverList, SIGNAL(updateRequested(quint32,quint16)), this, SLOT(sUpdateRequested(quint32,quint16)));

    initOptionsTab();

    setMinimumWidth(1024);
    setMinimumHeight(480);
}
Example #3
0
QUndoCommand* Navigator::mouseMoveEvent(QMouseEvent* e)
{
  switch (m_currentAction) {
    case Rotation: {
      QPoint delta = e->pos() - m_lastMousePosition;
      rotate(m_renderer->scene().center(), delta.y(), delta.x(), 0);
      e->accept();
      break;
    }
    case Translation: {
      Vector2f fromScreen(m_lastMousePosition.x(), m_lastMousePosition.y());
      Vector2f toScreen(e->localPos().x(), e->localPos().y());
      translate(m_renderer->scene().center(), fromScreen, toScreen);
      e->accept();
      break;
    }
    case ZoomTilt: {
      QPoint delta = e->pos() - m_lastMousePosition;
      // Tilt
      rotate(m_renderer->scene().center(), 0, 0, delta.x());
      // Zoom
      zoom(m_renderer->scene().center(), delta.y());
      e->accept();
      break;
    }
    default:;
  }

  m_lastMousePosition = e->pos();

  if (e->isAccepted())
    emit updateRequested();

  return nullptr;
}
Example #4
0
CoverArtLabel::CoverArtLabel( QWidget *parent, intf_thread_t *_p_i )
              : QLabel( parent ), p_intf( _p_i )
{
    setContextMenuPolicy( Qt::ActionsContextMenu );
    CONNECT( this, updateRequested(), this, askForUpdate() );

    setMinimumHeight( 128 );
    setMinimumWidth( 128 );
    setMaximumHeight( 128 );
    setScaledContents( false );
    setAlignment( Qt::AlignCenter );

    QList< QAction* > artActions = actions();
    QAction *action = new QAction( qtr( "Download cover art" ), this );
    CONNECT( action, triggered(), this, askForUpdate() );
    addAction( action );

    input_item_t *p_item = THEMIM->currentInputItem();
    if( p_item )
    {
        showArtUpdate( THEMIM->getIM()->decodeArtURL( p_item ) );
    }
    else
        showArtUpdate( "" );
}
Example #5
0
void SSGQuickLayer::scheduleUpdate()
{
    if (m_grab)
        return;
    m_grab = true;
    if (m_dirtyTexture)
        emit updateRequested();
}
Example #6
0
void QSGDefaultLayer::scheduleUpdate()
{
    if (m_grab)
        return;
    m_grab = true;
    if (m_dirtyTexture)
        emit updateRequested();
}
Example #7
0
QUndoCommand* Navigator::keyPressEvent(QKeyEvent* e)
{
  Vector3f ref = m_renderer->scene().center();
  switch (e->key()) {
    case Qt::Key_Left:
    case Qt::Key_H:
    case Qt::Key_A:
      if (e->modifiers() == Qt::NoModifier ||
          e->modifiers() == Qt::KeypadModifier)
        rotate(ref, 0, -5, 0);
      else if (e->modifiers() == Qt::ShiftModifier)
        rotate(ref, 0, 0, -5);
      else if (e->modifiers() == Qt::ControlModifier)
        translate(ref, -5, 0);
      e->accept();
      break;
    case Qt::Key_Right:
    case Qt::Key_L:
    case Qt::Key_D:
      if (e->modifiers() == Qt::NoModifier ||
          e->modifiers() == Qt::KeypadModifier)
        rotate(ref, 0, 5, 0);
      else if (e->modifiers() == Qt::ShiftModifier)
        rotate(ref, 0, 0, 5);
      else if (e->modifiers() == Qt::ControlModifier)
        translate(ref, 5, 0);
      e->accept();
      break;
    case Qt::Key_Up:
    case Qt::Key_K:
    case Qt::Key_W:
      if (e->modifiers() == Qt::NoModifier ||
          e->modifiers() == Qt::KeypadModifier)
        rotate(ref, -5, 0, 0);
      else if (e->modifiers() == Qt::ShiftModifier)
        zoom(ref, -2);
      else if (e->modifiers() == Qt::ControlModifier)
        translate(ref, 0, -5);
      e->accept();
      break;
    case Qt::Key_Down:
    case Qt::Key_J:
    case Qt::Key_S:
      if (e->modifiers() == Qt::NoModifier ||
          e->modifiers() == Qt::KeypadModifier)
        rotate(ref, 5, 0, 0);
      else if (e->modifiers() == Qt::ShiftModifier)
        zoom(ref, 2);
      else if (e->modifiers() == Qt::ControlModifier)
        translate(ref, 0, 5);
      e->accept();
      break;
    default:
      e->ignore();
  }
  emit updateRequested();
  return nullptr;
}
Example #8
0
QUndoCommand * Navigator::wheelEvent(QWheelEvent *e)
{
  /// @todo Use scale for orthographic projections
  // Zoom
  zoom(m_renderer->scene().center(), e->delta() * 0.1);

  e->accept();
  emit updateRequested();
  return NULL;
}
Example #9
0
QUndoCommand * Navigator::mouseDoubleClickEvent(QMouseEvent *e)
{
  // Reset
  if (e->button() == Qt::MiddleButton) {
    if (m_glWidget) {
      m_glWidget->resetCamera();
      e->accept();
      emit updateRequested();
    }
  }
  return NULL;
}
Example #10
0
void GLWidget::addTool(QtGui::ToolPlugin *tool)
{
  if (m_tools.contains(tool))
    return;

  connect(tool, SIGNAL(updateRequested()), SLOT(requestUpdate()));
  tool->setParent(this);
  tool->setGLWidget(this);
  tool->setActiveWidget(this);
  tool->setMolecule(m_molecule);
  tool->setGLRenderer(&m_renderer);
  m_tools << tool;
}
void Parametertuner::handleList(const config_server::ParameterListConstPtr& list)
{
	QMutexLocker locker(&m_mutex);
	m_list = list;
	m_updateCounter++;
	if(m_updateCounter >= 20)
	{
		emit updateRequested();
		m_updateCounter = 0;
	}
	else
	{
		m_updateTimer.stop();
		m_updateTimer.start();
	}
}
Example #12
0
void MapWidget::init() {
	_canvas.setBackgroundColor(palette().color(QPalette::Window));
	connect(&_canvas, SIGNAL(bufferUpdated()), this, SLOT(bufferUpdated()));
	connect(&_canvas, SIGNAL(projectionChanged(Seiscomp::Gui::Map::Projection*)),
	        this, SLOT(projectionChanged(Seiscomp::Gui::Map::Projection*)));
	connect(&_canvas, SIGNAL(customLayer(QPainter*)),
	        this, SLOT(drawCustomLayer(QPainter*)));
	connect(&_canvas, SIGNAL(updateRequested()), this, SLOT(update()));

	_isDragging = false;
	_isMeasuring = false;
	_isMeasureDragging = false;
	_filterMap = SCScheme.map.bilinearFilter;
	_canvas.setBilinearFilter(_filterMap);

	setMouseTracking(true);
	setFocusPolicy(Qt::StrongFocus);
	//setAttribute(Qt::WA_PaintOnScreen);

	try { _zoomSensitivity = SCApp->configGetDouble("map.zoom.sensitivity"); }
	catch ( ... ) { _zoomSensitivity = 0.5; }

	_zoomControls = new QWidget(this);
	QToolButton *zoomIn = new QToolButton;
	QToolButton *zoomOut = new QToolButton;
	QVBoxLayout *zoomLayout = new QVBoxLayout;
	_zoomControls->setLayout(zoomLayout);
	zoomLayout->addWidget(zoomIn);
	zoomLayout->addWidget(zoomOut);

	zoomIn->setIcon(QIcon(":/map/icons/zoomin.png"));
	zoomOut->setIcon(QIcon(":/map/icons/zoomout.png"));

	_zoomControls->move(0,0);
	_zoomControls->hide();

	connect(zoomIn, SIGNAL(pressed()), this, SLOT(zoomIn()));
	connect(zoomOut, SIGNAL(pressed()), this, SLOT(zoomOut()));

	_measureBNADialog = NULL;
	_forceGrayScale = false;
}
void Parametertuner::initPlugin(qt_gui_cpp::PluginContext& context)
{
	QWidget* w = new QWidget();
	m_ui.setupUi(w);

	connect(m_ui.joystick_button, SIGNAL(toggled(bool)), this, SLOT(handleJoystickButton()));
	connect(m_ui.save_button, SIGNAL(clicked(bool)), this, SLOT(save()));
	connect(m_ui.reset_button, SIGNAL(clicked(bool)), this, SLOT(reset()));

	m_sub_paramList = getNodeHandle().subscribe("/config_server/parameter_list", 1, &Parametertuner::handleList, this);
	m_sub_joystick = getNodeHandle().subscribe("/joy", 1, &Parametertuner::handleJoystickInput, this);
	connect(this, SIGNAL(updateRequested()), this, SLOT(update()), Qt::QueuedConnection);
	connect(this, SIGNAL(moveSelectionRequested(int)), this, SLOT(moveSelection(int)), Qt::QueuedConnection);
	connect(this, SIGNAL(ValueChangeRequested(int)), this, SLOT(ChangeValue(int)), Qt::QueuedConnection);

	m_ui.parameter_root_widget->setColumnCount(2);
	m_ui.parameter_root_widget->setColumnWidth(0, 200);

	context.addWidget(w);
}
Example #14
0
void
PictureZoneEditor::showPropertiesDialog(EditableZoneSet::Zone const& zone)
{
	PropertySet saved_properties;
	zone.properties()->swap(saved_properties);
	*zone.properties() = saved_properties;

	PictureZonePropDialog dialog(zone.properties(), this);
	
	// We can't connect to the update() slot directly, as since some time,
	// Qt ignores such update requests on inactive windows.  Updating
	// it through a proxy slot does work though.
	connect(&dialog, SIGNAL(updated()), SLOT(updateRequested()));

	if (dialog.exec() == QDialog::Accepted) {
		m_zones.setDefaultProperties(*zone.properties());
		m_zones.commit();
	} else {
		zone.properties()->swap(saved_properties);
		update();
	}
}
Example #15
0
void PlaybinSession::readySession()
{
    d->playbin = gst_element_factory_make("playbin", NULL);
    if (d->playbin != 0) {
        // Pre-set video element, even if no video
        d->sinkWidget = new VideoWidget;
        connect( d->sinkWidget->videoSurface(), SIGNAL(formatsChanged()), this, SLOT(updateSinkFormat()) );
        connect( d->sinkWidget->videoSurface(), SIGNAL(updateRequested()), this, SLOT(repaintLastFrame()) );
        g_object_set(G_OBJECT(d->playbin), "video-sink", d->sinkWidget->element(), NULL);

        // Sort out messages
        d->bus = gst_element_get_bus(d->playbin);
        d->busHelper = new BusHelper(d->bus, this);
        connect(d->busHelper, SIGNAL(message(Message)), SLOT(busMessage(Message)));

        // Initial volume
        g_object_get(G_OBJECT(d->playbin), "volume", &d->volume, NULL);

        // URI for media
        g_object_set(G_OBJECT(d->playbin), "uri", d->url.toString().toLocal8Bit().constData(), NULL);
    }
}
void Parametertuner::initPlugin(qt_gui_cpp::PluginContext& context)
{
	// Initialize config_server library with the correct node handle.
	// We cannot use getPrivateNodeHandle() here, as it returns something like
	// /parametertuner/Parametertuner_1 as namespace, which is not unique -.-
	// Instead, use the global node handle with the ROS node name, which is
	// unique up to the rqt process (which is what we want).
	m_nh = ros::NodeHandle(getNodeHandle(), ros::this_node::getName());
	config_server::ParameterClient::initialize(m_nh);

	QWidget* w = new QWidget();

	m_ui.setupUi(w);
	
	qRegisterMetaType<std::string>("std::string");

	connect(m_ui.joystick_button, SIGNAL(toggled(bool)), this, SLOT(handleJoystickButton()));
	connect(m_ui.reset_button, SIGNAL(clicked(bool)), this, SLOT(reset()));
	connect(m_ui.save_button, SIGNAL(clicked(bool)), this, SLOT(save()));

	connect(this, SIGNAL(updateRequested()), this, SLOT(update()), Qt::QueuedConnection);
	m_sub_paramList = getNodeHandle().subscribe("/config_server/parameter_list", 1, &Parametertuner::handleList, this);
	m_sub_joystick = getNodeHandle().subscribe("/joy", 1, &Parametertuner::handleJoystickInput, this);

	connect(this, SIGNAL(moveSelectionRequested(int)), this, SLOT(moveSelection(int)), Qt::QueuedConnection);
	connect(this, SIGNAL(valueChangeRequested(int)), this, SLOT(changeValue(int)), Qt::QueuedConnection);
	connect(this, SIGNAL(expansionRequested(int)), this, SLOT(handleExpansion(int)), Qt::QueuedConnection);

	m_ui.parameter_root_widget->setColumnCount(2);
	m_ui.parameter_root_widget->setColumnWidth(0, 260);

	context.addWidget(w);
	
	m_updateCounter = 0;
	m_updateTimer = m_nh.createWallTimer(ros::WallDuration(1.0), boost::bind(&Parametertuner::handleUpdateTimer, this), true, false);
}
void Parametertuner::handleList(const config_server::ParameterListConstPtr& list)
{
	QMutexLocker locker(&m_mutex);
	m_list = list;
	updateRequested();
}
Example #18
0
/**
 * Request that this object is updated with the latest values from the autopilot
 */
void UAVObject::requestUpdate()
{
    emit updateRequested(this);
}
Example #19
0
void QSGDefaultLayer::markDirtyTexture()
{
    m_dirtyTexture = true;
    if (m_live || m_grab)
        emit updateRequested();
}
Example #20
0
void SSGQuickLayer::markDirtyTexture()
{
    m_dirtyTexture = true;
    if (m_live || m_grab)
        emit updateRequested();
}
ListingTable::ListingTable(PartCategory* partCat, Filter* filter, QWidget* parent)
		: QTableView(parent), partCat(partCat), model(new PartTableModel(partCat, filter, this)), ignoreSectionResize(false)
{
	setModel(model);

	QHeaderView* hheader = horizontalHeader();

	verticalHeader()->hide();

	hheader->setStretchLastSection(true);
    hheader->setCascadingSectionResizes(false);
    hheader->setMovable(true);


    setSelectionBehavior(SelectRows);

    setDragEnabled(true);
    setDragDropMode(DragOnly);

    setAutoScroll(true);
    setSortingEnabled(true);

    sortByColumn(0, Qt::AscendingOrder);

    setContextMenuPolicy(Qt::CustomContextMenu);
    hheader->setContextMenuPolicy(Qt::CustomContextMenu);

	connect(this, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(partActivatedSlot(const QModelIndex&)));
	connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(contextMenuRequested(const QPoint&)));
	connect(hheader, SIGNAL(customContextMenuRequested(const QPoint&)),
			this, SLOT(headerContextMenuRequested(const QPoint&)));


	System* sys = System::getInstance();
	EditStack* editStack = sys->getEditStack();

	connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(aboutToQuit()));

	connect(partCat, SIGNAL(recordEdited(unsigned int, PartCategory::DataMap)), this, SLOT(updateData()));
	connect(partCat, SIGNAL(recordCreated(unsigned int, PartCategory::DataMap)), this, SLOT(updateData()));
	connect(partCat, SIGNAL(recordsRemoved(QList<unsigned int>)), this, SLOT(updateData()));

	connect(editStack, SIGNAL(undone(EditCommand*)), this, SLOT(updateData()));
	connect(editStack, SIGNAL(redone(EditCommand*)), this, SLOT(updateData()));

	connect(selectionModel(), SIGNAL(currentRowChanged(const QModelIndex&, const QModelIndex&)),
			this, SLOT(currentChanged(const QModelIndex&, const QModelIndex&)));
	connect(selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
    		this, SLOT(selectionChangedSlot(const QItemSelection&, const QItemSelection&)));
	connect(model, SIGNAL(updateRequested()), this, SLOT(updateData()));


	QSettings s;

	s.beginGroup(QString("gui_geometry_%1").arg(partCat->getTableName()));

	if (!s.contains("lt_state")  ||  !restoreState(s.value("lt_state").toByteArray())) {
		unsigned initialTotalWidth = 1000;
		int nc = model->columnCount();

		for (unsigned int i = 0 ; i < nc-1 ; i++) {
			setColumnWidth(i, initialTotalWidth / nc);
		}
	}

	s.endGroup();
}
void Parametertuner::handleUpdateTimer()
{
	m_updateTimer.stop(); // Required!
	emit updateRequested();
}