void UpdateReferenceDialog::setObjref(Objref_ptr objref)
{
    if (m_objref)
    {
        disconnect(this,
                SIGNAL(updateReference(const CORBA::Object_var&)),
                m_objref.get(),
                SLOT(setReference(const CORBA::Object_var&)));

        disconnect(m_objref.get(),
                SIGNAL(updatedReference(const CORBA::Object_var&)),
                m_status,
                SLOT(setReference(const CORBA::Object_var&)));
    }

    m_objref = objref;

    if (m_objref)
    {
        m_status->setInterface(objref->interface());
        m_reference->setInterface(objref->interface());

        m_status->setReference(objref->reference());

        connect(this,
                SIGNAL(updateReference(const CORBA::Object_var&)),
                m_objref.get(),
                SLOT(setReference(const CORBA::Object_var&)));

        connect(m_objref.get(),
                SIGNAL(updatedReference(const CORBA::Object_var&)),
                m_status,
                SLOT(setReference(const CORBA::Object_var&)));
    }
}
Example #2
0
void
ProgressPanel::startTask(const NodePtr& node,
                         const int firstFrame,
                         const int lastFrame,
                         const int frameStep,
                         const bool canPause,
                         const bool canCancel,
                         const QString& message,
                         const boost::shared_ptr<ProcessHandler>& process)
{
    assert( QThread::currentThread() == qApp->thread() );
    if (!node) {
        return;
    }
    assert( (canPause && firstFrame != INT_MIN && lastFrame != INT_MAX) || !canPause );

    ProgressTaskInfoPtr task;
    {
        QMutexLocker k(&_imp->tasksMutex);
        task = _imp->findTask(node);
    }
    if (task) {
        task->cancelTask(false, 1);
        removeTaskFromTable(task);
    }


    QMutexLocker k(&_imp->tasksMutex);

    task.reset( new ProgressTaskInfo(this,
                                     node,
                                     firstFrame,
                                     lastFrame,
                                     frameStep,
                                     canPause,
                                     canCancel,
                                     message, process) );


    if ( canPause || node->getEffectInstance()->isOutput() ) {
        task->createItems();
        QTimer::singleShot( NATRON_DISPLAY_PROGRESS_PANEL_AFTER_MS, this, SLOT(onShowProgressPanelTimerTriggered()) );
    }

    if (process) {
        connectProcessSlots( task.get(), process.get() );
    }
    if (!process) {
        if ( node->getEffectInstance()->isOutput() ) {
            OutputEffectInstance* isOutput = dynamic_cast<OutputEffectInstance*>( node->getEffectInstance().get() );
            if (isOutput) {
                boost::shared_ptr<RenderEngine> engine = isOutput->getRenderEngine();
                assert(engine);
                QObject::connect( engine.get(), SIGNAL(frameRendered(int,double)), task.get(), SLOT(onRenderEngineFrameComputed(int,double)) );
                QObject::connect( engine.get(), SIGNAL(renderFinished(int)), task.get(), SLOT(onRenderEngineStopped(int)) );
                QObject::connect( task.get(), SIGNAL(taskCanceled()), engine.get(), SLOT(abortRendering_non_blocking()) );
            }
        }
    }
Example #3
0
 void MainWindow::onNewGame()
 {
   m_needDestroy = false;
   m_gameConfiguring = true;
   std::shared_ptr<void> finalizer(nullptr, [&](void*) { m_gameConfiguring = false; });
   NewGameDialog dialog;
   if (dialog.exec() != QDialog::Accepted)
     return;
   
   const GameConfig& config = dialog.gameConfig();
   
   if (!config.isInititialized())
     return;
   
   auto rival = std::move(dialog.rival());
   
   connect(Kg::difficulty(),
       SIGNAL(currentLevelChanged(const KgDifficultyLevel*)),
       rival.get(),
       SLOT(onDifficultyChanged(const KgDifficultyLevel*)));
   
   m_menu.m_undoAction->setEnabled(rival->canUndo());
   
   connect(rival.get(), SIGNAL(needDestroy()), this, SLOT(onNeedDestroy()));
   
   m_model = std::unique_ptr<BoardModel>(new BoardModel(config, createStepQueue(config)));
   connect(m_menu.m_undoAction, SIGNAL(triggered(bool)), m_model.get(), SLOT(undo()));
   connect(m_model.get(), SIGNAL(statusUpdated(const QString&)), statusBar(), SLOT(showMessage(const QString&)));
   
   {
   std::unique_ptr<IBoardView> view(new BoardView(this));
   
   connect(this, SIGNAL(preferencesUpdated()), view->getObject(), SLOT(update()));
   
   setCentralWidget(qobject_cast<QWidget*>(view->getObject()));
   
   m_model->setView(std::move(view));
   }
   
   m_model->setRival(std::move(rival));
   
   m_menu.m_endAction->setEnabled(true);
   
   if (m_needDestroy)
     endGame();
 }
Example #4
0
void NetworkRemote::AcceptConnection() {
  if (!signals_connected_) {
    signals_connected_ = true;

    // Setting up the signals, but only once
    connect(incoming_data_parser_.get(), SIGNAL(SendClementineInfo()),
            outgoing_data_creator_.get(), SLOT(SendClementineInfo()));
    connect(incoming_data_parser_.get(), SIGNAL(SendFirstData(bool)),
            outgoing_data_creator_.get(), SLOT(SendFirstData(bool)));
    connect(incoming_data_parser_.get(), SIGNAL(SendAllPlaylists()),
            outgoing_data_creator_.get(), SLOT(SendAllPlaylists()));
    connect(incoming_data_parser_.get(), SIGNAL(SendAllActivePlaylists()),
            outgoing_data_creator_.get(), SLOT(SendAllActivePlaylists()));
    connect(incoming_data_parser_.get(), SIGNAL(SendPlaylistSongs(int)),
            outgoing_data_creator_.get(), SLOT(SendPlaylistSongs(int)));

    connect(app_->playlist_manager(), SIGNAL(ActiveChanged(Playlist*)),
            outgoing_data_creator_.get(), SLOT(ActiveChanged(Playlist*)));
    connect(app_->playlist_manager(), SIGNAL(PlaylistChanged(Playlist*)),
            outgoing_data_creator_.get(), SLOT(PlaylistChanged(Playlist*)));
    connect(app_->playlist_manager(), SIGNAL(PlaylistAdded(int,QString,bool)),
            outgoing_data_creator_.get(), SLOT(PlaylistAdded(int,QString,bool)));
    connect(app_->playlist_manager(), SIGNAL(PlaylistRenamed(int,QString)),
            outgoing_data_creator_.get(), SLOT(PlaylistRenamed(int,QString)));
    connect(app_->playlist_manager(), SIGNAL(PlaylistClosed(int)),
            outgoing_data_creator_.get(), SLOT(PlaylistClosed(int)));
    connect(app_->playlist_manager(), SIGNAL(PlaylistDeleted(int)),
            outgoing_data_creator_.get(), SLOT(PlaylistDeleted(int)));

    connect(app_->player(), SIGNAL(VolumeChanged(int)), outgoing_data_creator_.get(),
            SLOT(VolumeChanged(int)));
    connect(app_->player()->engine(), SIGNAL(StateChanged(Engine::State)),
            outgoing_data_creator_.get(), SLOT(StateChanged(Engine::State)));

    connect(app_->playlist_manager()->sequence(),
            SIGNAL(RepeatModeChanged(PlaylistSequence::RepeatMode)),
            outgoing_data_creator_.get(),
            SLOT(SendRepeatMode(PlaylistSequence::RepeatMode)));
    connect(app_->playlist_manager()->sequence(),
            SIGNAL(ShuffleModeChanged(PlaylistSequence::ShuffleMode)),
            outgoing_data_creator_.get(),
            SLOT(SendShuffleMode(PlaylistSequence::ShuffleMode)));

    connect(incoming_data_parser_.get(), SIGNAL(GetLyrics()),
            outgoing_data_creator_.get(), SLOT(GetLyrics()));

    connect(incoming_data_parser_.get(),
            SIGNAL(SendSongs(pb::remote::RequestDownloadSongs,RemoteClient*)),
            outgoing_data_creator_.get(),
            SLOT(SendSongs(pb::remote::RequestDownloadSongs,RemoteClient*)));
    connect(incoming_data_parser_.get(),
            SIGNAL(ResponseSongOffer(RemoteClient*, bool)),
            outgoing_data_creator_.get(),
            SLOT(ResponseSongOffer(RemoteClient*, bool)));

    connect(incoming_data_parser_.get(),
            SIGNAL(SendLibrary(RemoteClient*)),
            outgoing_data_creator_.get(),
            SLOT(SendLibrary(RemoteClient*)));
  }
Example #5
0
Game::Game() {
    players.push_back(unique_ptr<Player>(new Player("Player 1")));
    players.push_back(unique_ptr<Player>(new Player("Player 2")));

    // init View here
    userInterface.reset(new View());
    shared_ptr<View> v = std::dynamic_pointer_cast<View>(userInterface);

    // connect View to Presenter
    connect(v.get(), SIGNAL(New_game(int)), this, SLOT(new_game(int)));
    connect(v.get(), SIGNAL(Save_game(std::string)), this, SLOT(save_game(std::string)));
    connect(v.get(), SIGNAL(Load_game(std::string)), this, SLOT(load_game(std::string)));
    connect(v.get(), SIGNAL(Host_game(std::string)), this, SLOT(host_game(std::string)));
    connect(v.get(), SIGNAL(Join_game(std::string)), this, SLOT(join_game(std::string)));
    connect(v.get(), SIGNAL(Leave()), this, SLOT(leave()));
    connect(v.get(), SIGNAL(Put_stone(int,int)), this, SLOT(put_stone(int,int)));
    connect(v.get(), SIGNAL(Rotate(IView::quadrant,IView::turn)), this, SLOT(rotate(IView::quadrant,IView::turn)));

    // connect Presenter to View
    connect(this, SIGNAL(draw_stone(int,int,IView::color)),v.get(),SLOT(Draw_stone(int,int,IView::color)));
    connect(this, SIGNAL(set_control_settings(IView::control_setting)),v.get(),SLOT(Set_control_settings(IView::control_setting)));
    connect(this, SIGNAL(message(string)), v.get(), SLOT(Show_message(string)));
}
void DatasetScalar::examineDataset()
{
    int nx = m_properties.get( Fn::Property::NX ).toInt();
    int ny = m_properties.get( Fn::Property::NY ).toInt();
    int nz = m_properties.get( Fn::Property::NZ ).toInt();

    float min = std::numeric_limits<float>::max();
    float max = 0;

    int size = nx * ny * nz;
    for ( int i = 0; i < size; ++i )
    {
        min = qMin( min, m_data[i] );
        max = qMax( max, m_data[i] );
    }

    m_properties.set( Fn::Property::SIZE, static_cast<int>( size * sizeof(float) ) );
    m_properties.set( Fn::Property::MIN, min );
    m_properties.set( Fn::Property::MAX, max );
    m_properties.set( Fn::Property::SELECTED_MIN, min, min, max, true );
    m_properties.set( Fn::Property::SELECTED_MAX, max, min, max, true );
    m_properties.set( Fn::Property::LOWER_THRESHOLD, min + (max-min)/1000., min, max, true );
    m_properties.set( Fn::Property::UPPER_THRESHOLD, max, min, max, true );

    connect( m_properties.getProperty( Fn::Property::SELECTED_MIN ), SIGNAL( valueChanged( float ) ),
              m_properties.getProperty( Fn::Property::LOWER_THRESHOLD ), SLOT( setMax( float ) ) );
    connect( m_properties.getProperty( Fn::Property::SELECTED_MAX ), SIGNAL( valueChanged( float ) ),
              m_properties.getProperty( Fn::Property::UPPER_THRESHOLD ), SLOT( setMin( float ) ) );

    connect( m_properties.getProperty( Fn::Property::SELECTED_MIN ), SIGNAL( valueChanged( float ) ),
              m_properties.getProperty( Fn::Property::SELECTED_MAX ), SLOT( setMin( float ) ) );
    connect( m_properties.getProperty( Fn::Property::SELECTED_MAX ), SIGNAL( valueChanged( float ) ),
              m_properties.getProperty( Fn::Property::SELECTED_MIN ), SLOT( setMax( float ) ) );

    if ( m_qform( 1, 1 ) < 0 || m_sform( 1, 1 ) < 0 )
    {
        qDebug() << m_properties.get( Fn::Property::NAME ).toString() << ": RADIOLOGICAL orientation detected. Flipping voxels on X-Axis";
        flipX();
    }
}
Example #7
0
void Transcribe::guiReady(QObject* root) {
  m_main_window = qobject_cast<QWindow*>(root);
  m_text_area = m_main_window->findChild<QObject*>("text_area");

  // Set the icon, which, strangely enough, cannot be done from QML
  m_main_window->setIcon(QIcon("://window_icon"));

#ifndef Q_OS_ANDROID
  // Restore window state
  QSettings settings;
  settings.beginGroup(CFG_GROUP_SCREEN);
  if (settings.value(CFG_SCREEN_IS_MAXIMIZED, false).toBool()) {
    m_main_window->setVisibility(QWindow::Maximized);
  } else {
    m_main_window->resize(settings.value(CFG_SCREEN_SIZE,
                                         QSize(640, 480)).toSize());
    m_main_window->setPosition(settings.value(CFG_SCREEN_POS,
                                              QPoint(200, 200)).toPoint());
    settings.endGroup();\
  }
#endif

  // Install the key filter and connect its signals
  KeyCatcher* catcher = new KeyCatcher(root);
  connect(catcher,        SIGNAL(keyTyped()),
          &m_keeper,      SLOT(keyTyped()));
  connect(catcher,        SIGNAL(saveFile()),
          this,           SLOT(saveText()));
  connect(catcher,        SIGNAL(seekAudio(int)),
          m_player.get(), SLOT(skipSeconds(int)));
  connect(catcher,        SIGNAL(togglePlayPause()),
          m_player.get(), SLOT(togglePlayPause()));
  connect(catcher,        SIGNAL(togglePlayPause(bool)),
          m_player.get(), SLOT(togglePlayPause(bool)));
  connect(catcher,        SIGNAL(boost(bool)),
          m_player.get(), SLOT(boost(bool)));
  root->installEventFilter(catcher);
#ifdef Q_OS_ANDROID
  // On Android, we might connect the signals when using the virtual keyboard
  // in addition to the signals from the physical keyboard.
  connect(qApp->inputMethod(), SIGNAL(visibleChanged()),
          this,                SLOT(connectVirtualKeyboard()));
  connectVirtualKeyboard();
#endif

  // Connect GUI events to their callbacks
  connect(m_main_window,  SIGNAL(audioPositionChanged(int)),
          m_player.get(), SLOT(setPosition(int)));
  connect(m_main_window,  SIGNAL(playingStateChanged(bool)),
          m_player.get(), SLOT(togglePlayPause(bool)));
  connect(m_main_window,  SIGNAL(seekAudio(int)),
          m_player.get(), SLOT(skipSeconds(int)));
  connect(m_main_window,  SIGNAL(boostAudio(bool)),
          m_player.get(), SLOT(boost(bool)));
  connect(m_main_window, SIGNAL(saveText()),
          this,          SLOT(saveText()));
#ifdef Q_OS_ANDROID
  connect(m_main_window, SIGNAL(shareText()),
          this,          SLOT(shareText()));
  connect(m_main_window, SIGNAL(deleteText()),
          this,          SLOT(deleteText()));
#endif
  connect(m_main_window, SIGNAL(pickFiles()),
          this,          SLOT(pickFiles()));
  connect(m_main_window, SIGNAL(historySelected(int)),
          this,          SLOT(restoreHistory(int)));
  connect(m_main_window, SIGNAL(signalQuit()),
          this,          SLOT(close()));
  connect(m_main_window, SIGNAL(numWordsDirty()),
          this,          SLOT(countWords()));
}
void IndirectFitAnalysisTab::connectFitBrowserAndPlotPresenter() {
  connect(m_plotPresenter.get(), SIGNAL(selectedFitDataChanged(std::size_t)),
          this, SLOT(setBrowserWorkspace(std::size_t)));
  connect(m_fitPropertyBrowser, SIGNAL(functionChanged()), this,
          SLOT(updateAttributeValues()));
  connect(m_plotPresenter.get(), SIGNAL(selectedFitDataChanged(std::size_t)),
          this, SLOT(updateAttributeValues()));
  connect(m_plotPresenter.get(), SIGNAL(selectedFitDataChanged(std::size_t)),
          this, SLOT(updateParameterValues()));
  connect(m_plotPresenter.get(), SIGNAL(plotSpectrumChanged(std::size_t)), this,
          SLOT(setBrowserWorkspaceIndex(std::size_t)));
  // Update attributes before parameters as the parameters may depend on the
  // attribute values
  connect(m_plotPresenter.get(), SIGNAL(plotSpectrumChanged(std::size_t)), this,
          SLOT(updateAttributeValues()));
  connect(m_plotPresenter.get(), SIGNAL(plotSpectrumChanged(std::size_t)), this,
          SLOT(updateParameterValues()));

  connect(m_fitPropertyBrowser, SIGNAL(startXChanged(double)),
          m_plotPresenter.get(), SLOT(setStartX(double)));
  connect(m_fitPropertyBrowser, SIGNAL(endXChanged(double)),
          m_plotPresenter.get(), SLOT(setEndX(double)));
  connect(m_fitPropertyBrowser, SIGNAL(updatePlotSpectrum(int)),
          m_plotPresenter.get(), SLOT(updatePlotSpectrum(int)));
  connect(m_fitPropertyBrowser, SIGNAL(workspaceIndexChanged(int)), this,
          SLOT(setBrowserWorkspaceIndex(int)));
  connect(m_fitPropertyBrowser, SIGNAL(workspaceIndexChanged(int)), this,
          SLOT(updateAttributeValues()));
  connect(m_fitPropertyBrowser, SIGNAL(workspaceIndexChanged(int)), this,
          SLOT(updateParameterValues()));

  connect(m_plotPresenter.get(), SIGNAL(startXChanged(double)), this,
          SLOT(setBrowserStartX(double)));
  connect(m_plotPresenter.get(), SIGNAL(endXChanged(double)), this,
          SLOT(setBrowserEndX(double)));
  connect(m_plotPresenter.get(), SIGNAL(fwhmChanged(double)), this,
          SLOT(updateFitBrowserParameterValues()));
  connect(m_plotPresenter.get(), SIGNAL(backgroundChanged(double)), this,
          SLOT(updateFitBrowserParameterValues()));

  connect(m_fitPropertyBrowser, SIGNAL(xRangeChanged(double, double)),
          m_plotPresenter.get(), SLOT(updateGuess()));
  connect(m_plotPresenter.get(), SIGNAL(fwhmChanged(double)),
          m_plotPresenter.get(), SLOT(updateGuess()));
  connect(m_plotPresenter.get(), SIGNAL(backgroundChanged(double)),
          m_plotPresenter.get(), SLOT(updateGuess()));

  connect(m_fitPropertyBrowser,
          SIGNAL(parameterChanged(const Mantid::API::IFunction *)),
          m_plotPresenter.get(), SLOT(updateRangeSelectors()));
  connect(m_fitPropertyBrowser,
          SIGNAL(parameterChanged(const Mantid::API::IFunction *)),
          m_plotPresenter.get(), SLOT(updateGuess()));

  connect(m_fitPropertyBrowser, SIGNAL(functionChanged()),
          m_plotPresenter.get(), SLOT(updatePlots()));
  connect(m_fitPropertyBrowser, SIGNAL(functionChanged()),
          m_plotPresenter.get(), SLOT(updateGuess()));

  connect(m_fitPropertyBrowser, SIGNAL(plotGuess()), m_plotPresenter.get(),
          SLOT(enablePlotGuessInSeparateWindow()));
}
Example #9
0
MainWindow::MainWindow(QWidget* parent)
		: QMainWindow(parent)
		, config_()
		, model_()
		, synthesis_(new Synthesis)
		, ui_(new Ui::MainWindow)
		, dataEntryWindow_(new DataEntryWindow)
		, intonationWindow_(new IntonationWindow)
		, intonationParametersWindow_(new IntonationParametersWindow)
		, postureEditorWindow_(new PostureEditorWindow)
		, prototypeManagerWindow_(new PrototypeManagerWindow)
		, specialTransitionEditorWindow_(new TransitionEditorWindow)
		, ruleManagerWindow_(new RuleManagerWindow)
		, ruleTesterWindow_(new RuleTesterWindow)
		, synthesisWindow_(new SynthesisWindow)
		, transitionEditorWindow_(new TransitionEditorWindow)
{
	ui_->setupUi(this);

	ui_->logTextEdit->setMaximumBlockCount(MAX_LOG_BLOCK_COUNT);
	specialTransitionEditorWindow_->setSpecial();

	connect(ui_->quitAction, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));
	connect(ui_->aboutAction, SIGNAL(triggered()), this, SLOT(about()));

	coutStreamBuffer_.reset(new LogStreamBuffer(std::cout, false, ui_->logTextEdit));
	cerrStreamBuffer_.reset(new LogStreamBuffer(std::cerr, true, ui_->logTextEdit));
	LogStreamBuffer::registerQDebugMessageHandler();

	connect(prototypeManagerWindow_.get(), SIGNAL(editTransitionButtonClicked(unsigned int, unsigned int)),
		transitionEditorWindow_.get(), SLOT(handleEditTransitionButtonClicked(unsigned int, unsigned int)));

	connect(prototypeManagerWindow_.get(), SIGNAL(editSpecialTransitionButtonClicked(unsigned int, unsigned int)),
		specialTransitionEditorWindow_.get(), SLOT(handleEditTransitionButtonClicked(unsigned int, unsigned int)));

	connect(dataEntryWindow_.get(), SIGNAL(categoryChanged()) , postureEditorWindow_.get(), SLOT(unselectPosture()));
	connect(dataEntryWindow_.get(), SIGNAL(parameterChanged()), postureEditorWindow_.get(), SLOT(unselectPosture()));
	connect(dataEntryWindow_.get(), SIGNAL(symbolChanged())   , postureEditorWindow_.get(), SLOT(unselectPosture()));

	connect(dataEntryWindow_.get(), SIGNAL(parameterChanged()), ruleManagerWindow_.get(), SLOT(loadRuleData()));
	connect(dataEntryWindow_.get(), SIGNAL(parameterChanged()), synthesisWindow_.get(), SLOT(setupParameterTable()));

	connect(postureEditorWindow_.get(), SIGNAL(postureChanged()), ruleManagerWindow_.get(), SLOT(unselectRule()));
	connect(postureEditorWindow_.get(), SIGNAL(postureCategoryChanged()), dataEntryWindow_.get(), SLOT(updateCategoriesTable()));

	connect(prototypeManagerWindow_.get(), SIGNAL(equationChanged()), transitionEditorWindow_.get(), SLOT(updateEquationsTree()));
	connect(prototypeManagerWindow_.get(), SIGNAL(equationChanged()), transitionEditorWindow_.get(), SLOT(updateTransition()));
	connect(prototypeManagerWindow_.get(), SIGNAL(equationChanged()), specialTransitionEditorWindow_.get(), SLOT(updateEquationsTree()));
	connect(prototypeManagerWindow_.get(), SIGNAL(equationChanged()), specialTransitionEditorWindow_.get(), SLOT(updateTransition()));
	connect(prototypeManagerWindow_.get(), SIGNAL(equationChanged()), ruleManagerWindow_.get(), SLOT(setupRuleSymbolEquationsTable()));
	connect(prototypeManagerWindow_.get(), SIGNAL(equationChanged()), ruleManagerWindow_.get(), SLOT(setupEquationsTree()));

	connect(prototypeManagerWindow_.get(), SIGNAL(transitionChanged()), transitionEditorWindow_.get(), SLOT(clear()));
	connect(prototypeManagerWindow_.get(), SIGNAL(transitionChanged()), ruleManagerWindow_.get(), SLOT(setupRuleTransitionsTable()));
	connect(prototypeManagerWindow_.get(), SIGNAL(transitionChanged()), ruleManagerWindow_.get(), SLOT(setupTransitionsTree()));

	connect(prototypeManagerWindow_.get(), SIGNAL(specialTransitionChanged()), specialTransitionEditorWindow_.get(), SLOT(clear()));
	connect(prototypeManagerWindow_.get(), SIGNAL(specialTransitionChanged()), ruleManagerWindow_.get(), SLOT(setupRuleSpecialTransitionsTable()));
	connect(prototypeManagerWindow_.get(), SIGNAL(specialTransitionChanged()), ruleManagerWindow_.get(), SLOT(setupSpecialTransitionsTree()));

	connect(transitionEditorWindow_.get(), SIGNAL(equationReferenceChanged()), prototypeManagerWindow_.get(), SLOT(setupEquationsTree()));
	connect(transitionEditorWindow_.get(), SIGNAL(transitionChanged()),        prototypeManagerWindow_.get(), SLOT(unselectTransition()));

	connect(specialTransitionEditorWindow_.get(), SIGNAL(equationReferenceChanged()), prototypeManagerWindow_.get(), SLOT(setupEquationsTree()));
	connect(specialTransitionEditorWindow_.get(), SIGNAL(transitionChanged()),        prototypeManagerWindow_.get(), SLOT(unselectSpecialTransition()));

	connect(ruleManagerWindow_.get(), SIGNAL(categoryReferenceChanged()), dataEntryWindow_.get(), SLOT(updateCategoriesTable()));

	connect(ruleManagerWindow_.get(), SIGNAL(transitionReferenceChanged())       , prototypeManagerWindow_.get(), SLOT(setupTransitionsTree()));
	connect(ruleManagerWindow_.get(), SIGNAL(specialTransitionReferenceChanged()), prototypeManagerWindow_.get(), SLOT(setupSpecialTransitionsTree()));
	connect(ruleManagerWindow_.get(), SIGNAL(equationReferenceChanged())         , prototypeManagerWindow_.get(), SLOT(setupEquationsTree()));

	connect(synthesisWindow_.get(), SIGNAL(textSynthesized()), intonationWindow_.get(), SLOT(loadIntonationFromEventList()));
	connect(synthesisWindow_.get(), SIGNAL(audioStarted()), intonationWindow_.get(), SLOT(handleAudioStarted()));
	connect(synthesisWindow_.get(), SIGNAL(audioFinished()), intonationWindow_.get(), SLOT(handleAudioFinished()));
	connect(synthesisWindow_.get(), SIGNAL(synthesisFinished()), intonationWindow_.get(), SLOT(handleSynthesisFinished()));
	connect(intonationWindow_.get(), SIGNAL(synthesisRequested()), synthesisWindow_.get(), SLOT(synthesizeWithManualIntonation()));
	connect(intonationWindow_.get(), SIGNAL(synthesisToFileRequested(QString)), synthesisWindow_.get(), SLOT(synthesizeToFileWithManualIntonation(QString)));
}
Example #10
0
void
Task::UiUpdater::updateUI(FilterUiInterface* ui)
{
	// This function is executed from the GUI thread.
	
	OptionsWidget* const opt_widget = m_ptrFilter->optionsWidget();
	opt_widget->postUpdateUI();
	ui->setOptionsWidget(opt_widget, ui->KEEP_OWNERSHIP);
	
	ui->invalidateThumbnail(m_pageId);
	
	if (m_batchProcessing) {
		return;
	}

	std::auto_ptr<ImageViewBase> image_view(
		new ImageView(m_outputImage, m_downscaledOutputImage)
	);
	QPixmap const downscaled_output_pixmap(image_view->downscaledPixmap());

	std::auto_ptr<ImageViewBase> dewarping_view(
		new DewarpingView(
			m_origImage, m_downscaledOrigImage, m_xform.transform(),
			PolygonUtils::convexHull(
				(m_xform.resultingPreCropArea() + m_xform.resultingPostCropArea()).toStdVector()
			),
			m_virtContentRect, m_pageId, m_params.dewarpingMode(),
			m_params.distortionModel(), opt_widget->depthPerception()
		)
	);
	QPixmap const downscaled_orig_pixmap(dewarping_view->downscaledPixmap());
	QObject::connect(
		opt_widget, SIGNAL(depthPerceptionChanged(double)),
		dewarping_view.get(), SLOT(depthPerceptionChanged(double))
	);
	QObject::connect(
		dewarping_view.get(), SIGNAL(distortionModelChanged(dewarping::DistortionModel const&)),
		opt_widget, SLOT(distortionModelChanged(dewarping::DistortionModel const&))
	);

	std::auto_ptr<QWidget> picture_zone_editor;
	if (m_pictureMask.isNull()) {
		picture_zone_editor.reset(
			new ErrorWidget(tr("Picture zones are only available in Mixed mode."))
		);
	} else {
		picture_zone_editor.reset(
			new PictureZoneEditor(
				m_origImage, downscaled_orig_pixmap, m_pictureMask,
				m_xform.transform(), m_xform.resultingPostCropArea(),
				m_pageId, m_ptrSettings
			)
		);
		QObject::connect(
			picture_zone_editor.get(), SIGNAL(invalidateThumbnail(PageId const&)),
			opt_widget, SIGNAL(invalidateThumbnail(PageId const&))
		);
	}

	// We make sure we never need to update the original <-> output
	// mapping at run time, that is without reloading.
	// In OptionsWidget::dewarpingChanged() we make sure to reload
	// if we are on the "Fill Zones" tab, and if not, it will be reloaded
	// anyway when another tab is selected.
	boost::function<QPointF(QPointF const&)> orig_to_output;
	boost::function<QPointF(QPointF const&)> output_to_orig;
	if (m_params.dewarpingMode() != DewarpingMode::OFF && m_params.distortionModel().isValid()) {
		boost::shared_ptr<DewarpingPointMapper> mapper(
			new DewarpingPointMapper(
				m_params.distortionModel(), m_params.depthPerception().value(),
				m_xform.transform(), m_virtContentRect
			)
		);
		orig_to_output = boost::bind(&DewarpingPointMapper::mapToDewarpedSpace, mapper, _1);
		output_to_orig = boost::bind(&DewarpingPointMapper::mapToWarpedSpace, mapper, _1);
	} else {
		typedef QPointF (QTransform::*MapPointFunc)(QPointF const&) const;
		orig_to_output = boost::bind((MapPointFunc)&QTransform::map, m_xform.transform(), _1);
		output_to_orig = boost::bind((MapPointFunc)&QTransform::map, m_xform.transformBack(), _1);
	}

	std::auto_ptr<QWidget> fill_zone_editor(
		new FillZoneEditor(
			m_outputImage, downscaled_output_pixmap,
			orig_to_output, output_to_orig, m_pageId, m_ptrSettings
		)
	);
	QObject::connect(
		fill_zone_editor.get(), SIGNAL(invalidateThumbnail(PageId const&)),
		opt_widget, SIGNAL(invalidateThumbnail(PageId const&))
	);

	std::auto_ptr<QWidget> despeckle_view;
	if (m_params.colorParams().colorMode() == ColorParams::COLOR_GRAYSCALE) {
		despeckle_view.reset(
			new ErrorWidget(tr("Despeckling can't be done in Color / Grayscale mode."))
		);
	} else {
		despeckle_view.reset(
			new DespeckleView(
				m_despeckleState, m_despeckleVisualization, m_debug
			)
		);
		QObject::connect(
			opt_widget, SIGNAL(despeckleLevelChanged(DespeckleLevel, bool*)),
			despeckle_view.get(), SLOT(despeckleLevelChanged(DespeckleLevel, bool*))
		);
	}

	std::auto_ptr<TabbedImageView> tab_widget(new TabbedImageView);
	tab_widget->setDocumentMode(true);
	tab_widget->setTabPosition(QTabWidget::East);
	tab_widget->addTab(image_view.release(), tr("Output"), TAB_OUTPUT);
	tab_widget->addTab(picture_zone_editor.release(), tr("Picture Zones"), TAB_PICTURE_ZONES);
	tab_widget->addTab(fill_zone_editor.release(), tr("Fill Zones"), TAB_FILL_ZONES);
	tab_widget->addTab(dewarping_view.release(), tr("Dewarping"), TAB_DEWARPING);
	tab_widget->addTab(despeckle_view.release(), tr("Despeckling"), TAB_DESPECKLING);
	tab_widget->setCurrentTab(opt_widget->lastTab());

	QObject::connect(
		tab_widget.get(), SIGNAL(tabChanged(ImageViewTab)),
		opt_widget, SLOT(tabChanged(ImageViewTab))
	);

	ui->setImageWidget(tab_widget.release(), ui->TRANSFER_OWNERSHIP, m_ptrDbg.get());
}
Example #11
0
void MainWindow::createGUIWidgets(const QString modelFilePath ) {

    cameras_ = Cameras::getInstance();

    connect(cameras_.get(), SIGNAL(cameraAdded(int, QString)),
            this, SLOT(addItemToCameraListWidget(int, QString)));

    connect(cameras_.get(), SIGNAL(cameraNameModified(int, QString)),
            this, SLOT(modifyCameraNameInListWidget(int, QString)));

    connect(cameras_.get(), SIGNAL(cameraDeleted(int)),
            this, SLOT(deleteItemInCameraListWidget(int)));

    connect(cameras_.get(), SIGNAL(setSelectedCameraPropertiesInMainWindow(int, float, QString)),
            this, SLOT(updateSelectedCameraProperties(int, float, QString)));

    connect(this, SIGNAL(cameraListDoubleClicked(int)),
            cameras_.get(), SLOT(setSelectedCamera(int)));

    //ListWidget
    lblCamerasList_ = new QLabel("Cameras");
    lstWidgetCameras_ = new QListWidget();
    connect(lstWidgetCameras_, SIGNAL(doubleClicked(QModelIndex)),
            this, SLOT(onlstWidgetCamerasDoubleClicked(QModelIndex)));

    //Selected Camera Info Widgets
    lblCameraName_ = new QLabel("Name");
    lnEditCameraName_ = new QLineEdit();
    lblCameraName_->setBuddy(lnEditCameraName_);
    lnEditCameraName_->setEnabled(false);
    connect(lnEditCameraName_, SIGNAL(textEdited(QString)),
            cameras_.get(), SLOT(setSelectedCameraName(QString)));

    cameraNameLayout_ = new QHBoxLayout();
    cameraNameLayout_->addWidget(lblCameraName_);
    cameraNameLayout_->addWidget(lnEditCameraName_);

    lblFOV_ = new QLabel("FOVx");
    lblFOVValue_ = new QLabel("0");
    sliderCameraFOVx_ = new QSlider(Qt::Horizontal);
    sliderCameraFOVx_->setValue(0);
    sliderCameraFOVx_->setEnabled(false);
    connect(sliderCameraFOVx_, SIGNAL(valueChanged(int)),
            lblFOVValue_, SLOT(setNum(int)));

    connect(sliderCameraFOVx_, SIGNAL(sliderMoved(int)),
            cameras_.get(), SLOT(setSelectedCameraFOV(int)));

    connect(sliderCameraFOVx_, SIGNAL(sliderPressed()),
            cameras_.get(), SLOT(setMemento()));

    fovLayout_ = new QHBoxLayout();
    fovLayout_->addWidget(lblFOV_);
    fovLayout_->addWidget(lblFOVValue_);
    fovLayout_->addWidget(sliderCameraFOVx_);

    lblAspectRatio_ = new QLabel("Aspect Ratio");
    spnBoxCameraAspectRatio_ = new QDoubleSpinBox();
    spnBoxCameraAspectRatio_->setEnabled(false);
    spnBoxCameraAspectRatio_->setSingleStep(0.1);
    connect(spnBoxCameraAspectRatio_, SIGNAL(valueChanged(double)),
            cameras_.get(), SLOT(setSelectedCameraAspectRatio(double)));

    aspectRatioLayout_ = new QHBoxLayout();
    aspectRatioLayout_->addWidget(lblAspectRatio_);
    aspectRatioLayout_->addWidget(spnBoxCameraAspectRatio_);

    selectedCameraInfoLayout_ = new QVBoxLayout();
    selectedCameraInfoLayout_->addLayout(cameraNameLayout_);
    selectedCameraInfoLayout_->addLayout(fovLayout_);
    selectedCameraInfoLayout_->addLayout(aspectRatioLayout_);

    //Buttons Widgets
    btnUndo_ = new QPushButton();
    btnUndo_->resize(64, 64);
    btnUndo_->setIcon(QPixmap(":/assets/images/undo.png", 0, Qt::AutoColor));
    btnUndo_->setIconSize(QSize(32, 32));
    connect(btnUndo_, SIGNAL(clicked()),
            cameras_.get(), SLOT(getMemento()));

    btnDeleteCamera_ = new QPushButton();
    btnDeleteCamera_->resize(64, 64);
    btnDeleteCamera_->setIcon(QPixmap(":/assets/images/delete.png", 0, Qt::AutoColor));
    btnDeleteCamera_->setIconSize(QSize(32, 32));
    connect(btnDeleteCamera_, SIGNAL(pressed()),
            cameras_.get(), SLOT(deleteSelectedCamera()));

    btnCameraDragAndDrop_ = new QPushButton();
    btnCameraDragAndDrop_->resize(64, 64);
    btnCameraDragAndDrop_->setIcon(QPixmap(":/assets/images/camera.png", 0, Qt::AutoColor));
    btnCameraDragAndDrop_->setIconSize(QSize(32, 32));
    connect(btnCameraDragAndDrop_, SIGNAL(pressed()),
            this, SLOT(onBtnCameraDragAndDropPressed()));

    buttonsLayout_ = new QHBoxLayout();
    buttonsLayout_->addStretch();
    buttonsLayout_->addWidget(btnDeleteCamera_);
    buttonsLayout_->addWidget(btnUndo_);
    buttonsLayout_->addWidget(btnCameraDragAndDrop_);

    //Checkbox Widget
    chkBoxCamera180FOV_ = new QCheckBox("Show Full Coverage");
    chkBoxCamera180FOV_->setChecked(false);

    //MainWindow OpenGL Widgets
    QGLFormat format;
    format.setVersion(3,3);
    format.setProfile(QGLFormat::CoreProfile);
    format.setSampleBuffers(true);
    format.setSamples(4);

    glMainView_ = new MainView(format, modelFilePath);
    glCameraView_ = new CameraView(glMainView_);

    dockWidgetCameraView_ = new QDockWidget();
    dockWidgetCameraView_->setAllowedAreas(Qt::NoDockWidgetArea);
    dockWidgetCameraView_->setFeatures(QDockWidget::DockWidgetMovable |
                                       QDockWidget::DockWidgetFloatable);
    dockWidgetCameraView_->setWidget(glCameraView_);
    dockWidgetCameraView_->setWindowTitle("Selected Camera View");
    connect(dockWidgetCameraView_, SIGNAL(topLevelChanged(bool)),
            this, SLOT(cameraViewWidgetUndocked(bool)));

    //Left Layout
    leftMainWidget_ = new QWidget();
    leftMainLayout_ = new QVBoxLayout(leftMainWidget_);
    leftMainLayout_->addWidget(lblCamerasList_);
    leftMainLayout_->addWidget(lstWidgetCameras_);
    leftMainLayout_->addLayout(buttonsLayout_);
    leftMainLayout_->addLayout(selectedCameraInfoLayout_);
    leftMainLayout_->addWidget(chkBoxCamera180FOV_);
    leftMainLayout_->addStretch(10);
    leftMainLayout_->addWidget(dockWidgetCameraView_);
    const float LEFT_MAIN_LAYOUT_WIDTH_FACTOR = 1 / 3.75f;
    leftMainWidget_->setFixedWidth(this->width() * LEFT_MAIN_LAYOUT_WIDTH_FACTOR);

    mainLayout_ = new QHBoxLayout();
    mainLayout_->addWidget(leftMainWidget_);
    mainLayout_->addWidget(glMainView_);

    centralWidget_ = new QWidget();
    centralWidget_->setLayout(mainLayout_);

    this->setCentralWidget(centralWidget_); //now all QObjects created using "new" in this class are owned by MainWindow

    connect(chkBoxCamera180FOV_, SIGNAL(toggled(bool)),
            glMainView_, SLOT(toggelShowCamera180FOVView(bool)));
}
Example #12
0
void
ProgressPanel::startTask(const NodePtr& node,
                         const TimeValue firstFrame,
                         const TimeValue lastFrame,
                         const TimeValue frameStep,
                         const bool canPause,
                         const bool canCancel,
                         const QString& message,
                         const ProcessHandlerPtr& process)
{
    assert( QThread::currentThread() == qApp->thread() );
    if (!node) {
        return;
    }
    assert( (canPause && firstFrame != INT_MIN && lastFrame != INT_MAX) || !canPause );

    ProgressTaskInfoPtr task;
    {
        QMutexLocker k(&_imp->tasksMutex);
        task = _imp->findTask(node);
    }
    if (task) {
        task->cancelTask(false, 1);
        removeTaskFromTable(task);
    }


    QMutexLocker k(&_imp->tasksMutex);

    task.reset( new ProgressTaskInfo(this,
                                     node,
                                     firstFrame,
                                     lastFrame,
                                     frameStep,
                                     canPause,
                                     canCancel,
                                     message, process) );


    if ( canPause || node->getEffectInstance()->isOutput() ) {
        task->createItems();
        QTimer::singleShot( NATRON_DISPLAY_PROGRESS_PANEL_AFTER_MS, this, SLOT(onShowProgressPanelTimerTriggered()) );
    }

    if (process) {
        connectProcessSlots( task.get(), process.get() );
    }
    if (!process) {
        if ( node->getEffectInstance()->isOutput() ) {

            if ( getGui() && !getGui()->isGUIFrozen() && appPTR->getCurrentSettings()->isAutoTurboEnabled() ) {
                getGui()->onFreezeUIButtonClicked(true);
            }

            RenderEnginePtr engine = node->getRenderEngine();
            assert(engine);
            QObject::connect( engine.get(), SIGNAL(frameRendered(int,double)), task.get(), SLOT(onRenderEngineFrameComputed(int,double)) );
            QObject::connect( engine.get(), SIGNAL(renderFinished(int)), task.get(), SLOT(onRenderEngineStopped(int)) );
            QObject::connect( task.get(), SIGNAL(taskCanceled()), engine.get(), SLOT(abortRendering_non_blocking()) );

        }
    }
    _imp->tasks[node] = task;
} // ProgressPanel::startTask
CmpTreeDialog::CmpTreeDialog(QWidget* parent, Execution* execution, bool with_labels,
                             const Execution& ex1, const Execution& ex2)
    : QDialog{parent} {

  qDebug() << "new CmpTreeDialog";

  auto main_layout = new QHBoxLayout();
  layout = new QGridLayout(this);
  auto nc_layout = new QVBoxLayout();
  auto status_layout = new QVBoxLayout();

  main_layout->addLayout(status_layout);

  auto scrollArea = new QAbstractScrollArea(this);

  m_Canvas.reset(new TreeCanvas(execution, layout, scrollArea->viewport()));

  layout->addWidget(scrollArea, 0, 0, 1, 1);
  layout->addWidget(m_Canvas->scaleBar(), 0, 1, Qt::AlignHCenter);

  scrollArea->viewport()->setLayout(nc_layout);

  connect(scrollArea->horizontalScrollBar(), SIGNAL(valueChanged(int)),
            m_Canvas.get(), SLOT(scroll(void)));
  connect(scrollArea->verticalScrollBar(), SIGNAL(valueChanged(int)),
            m_Canvas.get(), SLOT(scroll(void)));

  nc_layout->addWidget(m_Canvas.get());

  auto menuBar = new QMenuBar(this);
  auto nodeMenu = menuBar->addMenu(tr("&Node"));
  auto analysisMenu = menuBar->addMenu(tr("&Analysis"));

  addActions(nodeMenu, analysisMenu);

    // Don't add the menu bar on Mac OS X
  #ifndef Q_WS_MAC
    layout->setMenuBar(menuBar);
  #endif

  statusBar = new QStatusBar(this);

  QWidget* stw = new QWidget();
  statusBar->addPermanentWidget(stw);
  statusBar->showMessage("Ready");
  layout->addWidget(statusBar);

  auto hbl = new QHBoxLayout();
  hbl->setContentsMargins(0,0,0,0);
  hbl->addWidget(new NodeWidget(MERGING));

  auto mergedLabel = new QLabel("0");
  hbl->addWidget(mergedLabel);

  stw->setLayout(hbl);

  m_Cmp_result = treecomparison::compare(m_Canvas.get(), ex1, ex2, with_labels);

  /// sort the pentagons by nodes diff:
  m_Cmp_result->sortPentagons();

  mergedLabel->setNum(m_Cmp_result->get_no_pentagons());

  setAttribute( Qt::WA_DeleteOnClose );

  m_Canvas->setCurrentNode(m_Canvas->getExecution()->nodeTree().getRoot());

  resize(500, 400);
  show();
}