Example #1
0
bool DesignNetFormManager::startInit()
{
	setupActions();

	d->m_modeWidget = new QWidget();
	d->m_modeWidget->setObjectName(QLatin1String("DesignNetModeWidget"));
	d->m_designMode = DesignNetMode::instance();

	d->m_mainWindow = new DesignNetMainWindow();
	d->m_mainWindow->initialize();
	d->m_mainWindow->addCenterToolBar(createEditorToolBar());
	QVBoxLayout *layout = new QVBoxLayout;
	layout->setMargin(0);
	layout->setSpacing(0);

	
	Core::MiniSplitter *splitter = new Core::MiniSplitter(Qt::Vertical);
	splitter->addWidget(d->m_mainWindow);

	DesignNetMode *designNetMode = DesignNetMode::instance();
	QWidget *outputPane = new Core::OutputPanePlaceHolder(designNetMode, splitter);
	outputPane->setObjectName(QLatin1String("DesignerOutputPanePlaceHolder"));
	splitter->addWidget(outputPane);
	layout->addWidget(splitter);
	d->m_modeWidget->setLayout(layout);
	d->m_designNetContext = new DesignNetContext(d->m_context, splitter, this);
	Core::ICore::addContextObject(d->m_designNetContext);

	QStringList strSuffix;
	strSuffix << QLatin1String("txt");
	designNetMode->registerDesignWidget(d->m_modeWidget, strSuffix, d->m_context);
	return true;
}
Example #2
0
void
ElementalCompWnd::init()
{
    pImpl_ = new ElementalCompWndImpl;
    Core::MiniSplitter * splitter = new Core::MiniSplitter;
    if ( splitter ) {
        if ( ( pImpl_->processedSpectrum_ = new adplot::SpectrumWidget(this) ) ) {
            splitter->addWidget( pImpl_->processedSpectrum_ );
            connect( pImpl_->processedSpectrum_, &adplot::SpectrumWidget::onSelected, this, &ElementalCompWnd::selectedOnProcessed );
        }

        if ( ( pImpl_->referenceSpectrum_ = new adplot::SpectrumWidget(this) ) )
            splitter->addWidget( pImpl_->referenceSpectrum_ );

        pImpl_->processedSpectrum_->setMinimumHeight( 80 );
        pImpl_->referenceSpectrum_->setMinimumHeight( 80 );        
		pImpl_->processedSpectrum_->axisWidget( QwtPlot::yLeft )->scaleDraw()->setMinimumExtent( 60 );
		pImpl_->referenceSpectrum_->axisWidget( QwtPlot::yLeft )->scaleDraw()->setMinimumExtent( 60 );
		pImpl_->processedSpectrum_->axisWidget( QwtPlot::yRight )->scaleDraw()->setMinimumExtent( 60 );
		pImpl_->referenceSpectrum_->axisWidget( QwtPlot::yRight )->scaleDraw()->setMinimumExtent( 60 );

        // pImpl_->referenceSpectrum_->setAxisScaleEngine( QwtPlot::yLeft, new QwtLogScaleEngine );

        pImpl_->processedSpectrum_->link( pImpl_->referenceSpectrum_ );
        //pImpl_->referenceSpectrum_->link( pImpl_->processedSpectrum_ );

        splitter->setOrientation( Qt::Vertical );
    }
  
    QBoxLayout * toolBarAddingLayout = new QVBoxLayout( this );
    toolBarAddingLayout->setMargin(0);
    toolBarAddingLayout->setSpacing(0);
    toolBarAddingLayout->addWidget( splitter );
}
void
MSCalibrationWnd::init( const adportable::Configuration& c, const std::wstring& apppath )
{
    Q_UNUSED( c );

    pImpl_.reset( new MSCalibrationWndImpl );
    Core::MiniSplitter * splitter = new Core::MiniSplitter;
    if ( splitter ) {
        // spectrum on top
        pImpl_->processedSpectrum_ = new adwplot::SpectrumWidget(this);

        splitter->addWidget( pImpl_->processedSpectrum_ );

        // summary table
        adportable::Configuration config;
        adportable::Module module;

        module.library_filename( QTWIDGETS_NAME );

        config.module( module );
        config.interface( L"qtwidgets::MSCalibSummaryWidget" );

        pImpl_->calibSummaryWidget_ = adplugin::manager::widget_factory( config, apppath.c_str() ); //, L"qtwidget::MSCalibrateSummaryWidget" );
        if ( pImpl_->calibSummaryWidget_ ) {
            
            adplugin::LifeCycleAccessor accessor( pImpl_->calibSummaryWidget_ );
            adplugin::LifeCycle * p = accessor.get(); // dynamic_cast< adplugin::LifeCycle * >(pImpl_->calibSummaryWidget_);
            if ( p )
                p->OnInitialUpdate();

            connect( this, SIGNAL( fireSetData( const adcontrols::MSCalibrateResult&, const adcontrols::MassSpectrum& ) ),
                pImpl_->calibSummaryWidget_, SLOT( setData( const adcontrols::MSCalibrateResult&, const adcontrols::MassSpectrum& ) ) );
            splitter->addWidget( pImpl_->calibSummaryWidget_ );
        }

        splitter->setOrientation( Qt::Vertical );
    }
Example #4
0
void
MSProcessingWnd::init()
{
    pImpl_ = std::make_shared< MSProcessingWndImpl >();

    Core::MiniSplitter * splitter = new Core::MiniSplitter;
    if ( splitter ) {

        if ( ( pImpl_->ticPlot_ = new adwplot::ChromatogramWidget(this) ) ) {
            pImpl_->ticPlot_->setMinimumHeight( 80 );
			connect( pImpl_->ticPlot_, SIGNAL( onSelected( const QRectF& ) ), this, SLOT( selectedOnChromatogram( const QRectF& ) ) );
            pImpl_->ticPlot_->register_tracker( [=]( const QPointF& pos, QwtText& text ){ return pImpl_->ticTracker( pos, text ); } );
        }
	
        if ( ( pImpl_->profileSpectrum_ = new adwplot::SpectrumWidget(this) ) ) {
            pImpl_->profileSpectrum_->setMinimumHeight( 80 );
            using adwplot::SpectrumWidget;
            connect( pImpl_->profileSpectrum_, static_cast< void(SpectrumWidget::*)(const QRectF&) >(&SpectrumWidget::onSelected), this, &MSProcessingWnd::selectedOnProfile );
            pImpl_->profile_marker_ = std::make_shared< adwplot::PeakMarker >();
            pImpl_->profile_marker_->attach( pImpl_->profileSpectrum_ );
            pImpl_->profile_marker_->visible( true );
            pImpl_->profile_marker_->setYAxis( QwtPlot::yLeft );
        }

        if ( ( pImpl_->processedSpectrum_ = new adwplot::SpectrumWidget(this) ) ) {
            pImpl_->processedSpectrum_->setMinimumHeight( 80 );
            using adwplot::SpectrumWidget;
            connect( pImpl_->processedSpectrum_, static_cast< void(SpectrumWidget::*)(const QRectF&) >(&SpectrumWidget::onSelected), this, &MSProcessingWnd::selectedOnProcessed );
            adwplot::Zoomer * zoomer = &pImpl_->processedSpectrum_->zoomer();
            connect( zoomer, &adwplot::Zoomer::zoomed, this, &MSProcessingWnd::handleZoomedOnSpectrum );

            pImpl_->processed_marker_ = std::make_shared< adwplot::PeakMarker >();
            pImpl_->processed_marker_->attach( pImpl_->processedSpectrum_ );
            pImpl_->processed_marker_->visible( true );
            pImpl_->processed_marker_->setYAxis( QwtPlot::yLeft );
        }
		pImpl_->ticPlot_->axisWidget( QwtPlot::yLeft )->scaleDraw()->setMinimumExtent( 80 );
		pImpl_->profileSpectrum_->axisWidget( QwtPlot::yLeft )->scaleDraw()->setMinimumExtent( 80 );
		pImpl_->processedSpectrum_->axisWidget( QwtPlot::yLeft )->scaleDraw()->setMinimumExtent( 80 );

        pImpl_->pwplot_->setMinimumHeight( 80 );
		pImpl_->pwplot_->axisWidget( QwtPlot::yLeft )->scaleDraw()->setMinimumExtent( 80 );
        pImpl_->pwplot_->xBottomTitle( "Frequency (MHz)" );
        pImpl_->pwplot_->yLeftTitle( "Power" );
        connect( pImpl_->pwplot_, SIGNAL( onSelected( const QRectF& ) ), this, SLOT( selectedOnPowerPlot( const QRectF& ) ) );

		splitter->addWidget( pImpl_->ticPlot_ );
        splitter->addWidget( pImpl_->profileSpectrum_ );
        splitter->addWidget( pImpl_->processedSpectrum_ );
        splitter->addWidget( pImpl_->pwplot_ );
        splitter->setOrientation( Qt::Vertical );

        splitter->setChildrenCollapsible( true );
        pImpl_->pwplot_->hide();

        pImpl_->profileSpectrum_->link( pImpl_->processedSpectrum_ );
        pImpl_->processedSpectrum_->link( pImpl_->profileSpectrum_ );
        

        pImpl_->processedSpectrum_->setContextMenuPolicy( Qt::CustomContextMenu );
		connect( pImpl_->processedSpectrum_, SIGNAL( customContextMenuRequested( QPoint ) )
                 , this, SLOT( handleCustomMenuOnProcessedSpectrum( const QPoint& ) ) );
    }
Example #5
0
QWidget *
MainWindow::createContents( Core::IMode * mode )
{
    setTabPosition( Qt::AllDockWidgetAreas, QTabWidget::East );
    setDocumentMode( true );
    setDockNestingEnabled( true );

    QBoxLayout * editorHolderLayout = new QVBoxLayout;
	editorHolderLayout->setMargin( 0 );
	editorHolderLayout->setSpacing( 0 );

    if ( tableView_ ) {
		tableView_->setContextMenuPolicy( Qt::CustomContextMenu );
        connect( tableView_.get(), SIGNAL( dropped( const QList<QUrl>& ) ), this, SLOT( handleDropped( const QList<QUrl>& ) ) );
    }

    QWidget * editorAndFindWidget = new QWidget;
    if ( editorAndFindWidget ) {
        editorAndFindWidget->setLayout( editorHolderLayout );
        editorAndFindWidget->setLayout( editorHolderLayout );

        editorHolderLayout->addWidget( tableView_.get() );
    }

    Core::MiniSplitter * documentAndRightPane = new Core::MiniSplitter;
    if ( documentAndRightPane ) {
        documentAndRightPane->addWidget( editorAndFindWidget );
        documentAndRightPane->addWidget( new Core::RightPanePlaceHolder( mode ) );
        documentAndRightPane->setStretchFactor( 0, 1 );
        documentAndRightPane->setStretchFactor( 1, 0 );
    }

    Utils::StyledBar * toolBar1 = createTopStyledBar();
    Utils::StyledBar * toolBar2 = createMidStyledBar();

	if ( QDockWidget * dock = new QDockWidget( "Chemistry Toolbar" ) ) {
        dock->setObjectName( QLatin1String( "Chemistry Toolbar" ) );
        // dock->setWidget( toolBar );
        dock->setFeatures( QDockWidget::NoDockWidgetFeatures );
        dock->setAllowedAreas( Qt::BottomDockWidgetArea );
        dock->setTitleBarWidget( new QWidget( dock ) );
        dock->setProperty( "managed_dockwidget", QLatin1String( "true" ) );
        addDockWidget( Qt::BottomDockWidgetArea, dock );
        setToolBarDockWidget( dock );
    }

	//---------- centraol widget ------------
	QWidget * centralWidget = new QWidget;
	setCentralWidget( centralWidget );

	QVBoxLayout * centralLayout = new QVBoxLayout( centralWidget );
	centralLayout->setMargin( 0 );
	centralLayout->setSpacing( 0 );
    centralLayout->addWidget( toolBar1 );
    centralLayout->addWidget( documentAndRightPane );
	centralLayout->addWidget( toolBar2 );

	// Right-side window with editor, output etc.
	Core::MiniSplitter * mainWindowSplitter = new Core::MiniSplitter;
    QWidget * outputPane = new Core::OutputPanePlaceHolder( mode, mainWindowSplitter );
    outputPane->setObjectName( QLatin1String( "ChemistryOutputPanePlaceHolder" ) );
	mainWindowSplitter->addWidget( this );
    mainWindowSplitter->addWidget( outputPane );
	mainWindowSplitter->setStretchFactor( 0, 10 );
	mainWindowSplitter->setStretchFactor( 1, 0 );
	mainWindowSplitter->setOrientation( Qt::Vertical );

	// Navigation and right-side window
	Core::MiniSplitter * splitter = new Core::MiniSplitter;
	splitter->addWidget( new Core::NavigationWidgetPlaceHolder( mode ) );
    splitter->addWidget( mainWindowSplitter );
    splitter->setStretchFactor( 0, 0 );
    splitter->setStretchFactor( 1, 1 );
    splitter->setObjectName( QLatin1String( "ChemistryModeWidget" ) );

	createDockWidgets();

	return splitter;
}