Exemple #1
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), ui(new Ui::MainWindow),
      mRenderCanvas(0), mImageDataRawPtr(0), mCurrUSMRadius(1),
      mCurrUSMSharpness(0)
{
    arrayRegisterId = qRegisterMetaType<af::array>();
    ui->setupUi(this);
    setWindowTitle(tr("WildFire Image Editor"));
    removeToolBar(ui->mainToolBar);
    ui->zoomXLineEdit->setValidator(new QIntValidator());
    ui->zoomYLineEdit->setValidator(new QIntValidator());
    ui->zoomWidthLineEdit->setValidator(new QIntValidator());
    ui->zoomHeightLineEdit->setValidator(new QIntValidator());
    // setup render window
    mRenderCanvas = new ImageCanvas();
    this->setCentralWidget(mRenderCanvas);
    connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(loadImage()));
    //connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(saveImage()));
    connect(ui->actionExit, SIGNAL(triggered()), QApplication::instance(), SLOT(quit()));
    connect(ui->contrastSlider, SIGNAL(valueChanged(int)), this, SLOT(contrastChanged(int)));
    connect(ui->brightnessSlider, SIGNAL(valueChanged(int)), this, SLOT(brightnessChanged(int)));
    connect(ui->usmRadiusSlider, SIGNAL(valueChanged(int)), this, SLOT(usmRadiusChanged(int)));
    connect(ui->usmSharpSlider, SIGNAL(valueChanged(int)), this, SLOT(usmChanged(int)));
    connect(ui->zoomPushButton, SIGNAL(clicked()), this, SLOT(zoomParamsChanged()));
    connect(ui->zoomResetPushButton, SIGNAL(clicked()), this, SLOT(zoomReset()));
    connect(ui->blendBgPushButton, SIGNAL(clicked()), this, SLOT(setBackgroundImageForBlend()));
    connect(ui->blendFgPushButton, SIGNAL(clicked()), this, SLOT(setForegroudImageForBlend()));
    connect(ui->blendMskPushButton, SIGNAL(clicked()), this, SLOT(setMaskImageForBlend()));
    connect(ui->blendBackRadioButton, SIGNAL(clicked()), this, SLOT(showBackground()));
    connect(ui->blendFrontRadioButton, SIGNAL(clicked()), this, SLOT(showForeground()));
    connect(ui->blendMskRadioButton, SIGNAL(clicked()), this, SLOT(showMask()));
    connect(ui->blendRadioButton, SIGNAL(clicked()), this, SLOT(showBlendedImage()));
    af::setDevice(0);
    af::info();
}
Exemple #2
0
	foreach (QObject *object, children())
	{
		QToolBar *toolBar = qobject_cast<QToolBar *>(object);
		if (toolBar)
		{
			removeToolBar(toolBar);
			delete toolBar;
		}
	}
Exemple #3
0
void MainWidget::updateToolBarState(const Qt::ToolBarArea area)
{
    if (debug) qDebug() << PDEBUG;
    if (debug) qDebug() << PDEBUG << ":" << "Toolbar area" << area;

    removeToolBar(ui->toolBar);
    if (area != Qt::NoToolBarArea) {
        addToolBar(area, ui->toolBar);
        ui->toolBar->show();
    }
}
Exemple #4
0
int QtTrader::loadPlugin (QString name)
{
  if (name.isEmpty())
    return 0;

  IGUIPlugin *pPlugin = 0;
  pPlugin = dynamic_cast<IGUIPlugin*>(((PluginFactory*)PluginFactory::getPluginFactory())->loadPlugin(name));

  if(pPlugin){
      Widget* pWidget = pPlugin->create();
      // if the plugin returns a widget, set it to main window
      if(pWidget != NULL)
      {
        //remove old central Widget
        Widget *cw = (Widget *) centralWidget();
        if (cw)
        {
          QToolBar *tb = cw->toolbar();
          if (tb)
          {
            removeToolBar(cw->toolbar());
            delete tb;
          }

          delete cw;
        }
        //And then set up the new one
        setCentralWidget(pWidget);
        connect(pWidget, SIGNAL(signalMessage(QString)), this, SLOT(statusMessage(QString)));
        connect(pWidget, SIGNAL(signalTitle(QString)), this, SLOT(setWindowTitle(QString)));

        QToolBar *pToolBar = pWidget->toolbar();
        if (pToolBar){
          addToolBar(pToolBar);
        }
    }
  }
  return 1;
}
bool QMainWindow::event( QEvent * e )
{
    if ( e->type() == Event_ChildRemoved ) {
	QChildEvent * c = (QChildEvent *) e;
	if ( c->child() == 0 ||
	     c->child()->testWFlags( WType_TopLevel ) ) {
	    // nothing
	} else if ( c->child() == d->sb ) {
	    d->sb = 0;
	    triggerLayout();
	} else if ( c->child() == d->mb ) {
	    d->mb = 0;
	    triggerLayout();
	} else if ( c->child() == d->mc ) {
	    d->mc = 0;
	    triggerLayout();
	} else {
	    removeToolBar( (QToolBar *)(c->child()) );
	    triggerLayout();
	}
    }
    return QWidget::event( e );
}