MainWindow::MainWindow()
{
	openAction = new QAction(tr("&Open"), this);
	saveAction = new QAction(tr("&Save"), this);
	exitAction = new QAction(tr("E&xit"), this);
	equalAction = new QAction(tr("&Equalization"), this);
	otsuAction = new QAction(tr("&otsu"), this);
	isodataAction = new QAction(tr("&Isodata"), this);
	manualAction = new QAction(tr("&Manual"), this);
	gammaAction = new QAction(tr("&Gamma"), this);
	stretchingAction = new QAction(tr("&Stretching"), this);
	sigmaAction = new QAction(tr("&Sigma"), this);
	medianAction = new QAction(tr("&Median"), this);
	lineAction = new QAction(tr("&Lines"), this);
	pixelAction = new QAction(tr("&Pixels"), this);
	gaussianAction = new QAction(tr("&Gaussian"), this);
	sobelAction = new QAction(tr("&Sobel"), this);	
	horizontalAction = new QAction(tr("&Line Intensity"), this);
	cannyAction = new QAction(tr("&Canny"),this);
	sumAction = new QAction(tr("&Add"),this);
	resAction = new QAction(tr("&Substract"),this);
	multAction = new QAction(tr("&Multiply"),this);
	divAction = new QAction(tr("&Divide"),this);
	avgAction = new QAction(tr("A&verage"),this);
	andAction = new QAction(tr("&And"),this);
	orAction = new QAction(tr("&Or"),this);
	xorAction = new QAction(tr("&Xor"),this);
	notAction = new QAction(tr("&Not"),this);
	minAction = new QAction(tr("M&in"),this);
	maxAction = new QAction(tr("M&ax"),this);
	kmeansAction = new QAction(tr("&Kmeans"),this);

	saveAction->setEnabled(false);

	connect(openAction, SIGNAL(triggered()), this, SLOT(open()));
	connect(saveAction, SIGNAL(triggered()), this, SLOT(save()));
	connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
	connect(equalAction, SIGNAL(triggered()), this, SLOT(equalization()));
	connect(otsuAction, SIGNAL(triggered()), this, SLOT(otsuThresh()));
	connect(isodataAction, SIGNAL(triggered()), this, SLOT(isodataSlot()));
	connect(manualAction, SIGNAL(triggered()), this, SLOT(manual()));
	connect(gammaAction,SIGNAL(triggered()),this,SLOT(gamma()));
	connect(stretchingAction,SIGNAL(triggered()),this,SLOT(stretching()));
	connect(sigmaAction, SIGNAL(triggered()), this, SLOT(sigma()));
	connect(medianAction, SIGNAL(triggered()), this, SLOT(median()));
	connect(lineAction, SIGNAL(triggered()), this, SLOT(line()));
	connect(pixelAction, SIGNAL(triggered()), this, SLOT(pixel()));
	connect(gaussianAction, SIGNAL(triggered()), this, SLOT(gaussian()));
	connect(sobelAction, SIGNAL(triggered()), this, SLOT(sobelEdges()));
	connect(horizontalAction,SIGNAL(triggered()),this,SLOT(horizontal()));
	connect(cannyAction,SIGNAL(triggered()),this,SLOT(cannySlot()));
	connect(sumAction,SIGNAL(triggered()),this,SLOT(sum()));
	connect(resAction,SIGNAL(triggered()),this,SLOT(res()));
	connect(multAction,SIGNAL(triggered()),this,SLOT(mult()));
	connect(divAction,SIGNAL(triggered()),this,SLOT(div()));
	connect(avgAction,SIGNAL(triggered()),this,SLOT(avg()));
	connect(andAction,SIGNAL(triggered()),this,SLOT(andSlot()));
	connect(orAction,SIGNAL(triggered()),this,SLOT(orSlot()));
	connect(xorAction,SIGNAL(triggered()),this,SLOT(xorSlot()));
	connect(notAction,SIGNAL(triggered()),this,SLOT(notSlot()));
	connect(minAction,SIGNAL(triggered()),this,SLOT(minSlot()));
	connect(maxAction,SIGNAL(triggered()),this,SLOT(maxSlot()));
	connect(kmeansAction,SIGNAL(triggered()),this,SLOT(kmeansSlot()));
	
	fileMenu = menuBar()->addMenu(tr("&File"));
	equalizationMenu = menuBar()->addMenu(tr("&Equalization"));
	thresholdMenu = menuBar()->addMenu(tr("&Thresholding"));
	contrastMenu = menuBar()->addMenu(tr("&Contrast"));
	noiseMenu = menuBar()->addMenu(tr("&Noise"));
	edgeMenu = menuBar()->addMenu(tr("E&dge"));
	operationMenu = menuBar()->addMenu(tr("&Operation"));
	boolMenu = operationMenu->addMenu(tr("&Boolean"));
	arithMenu = operationMenu->addMenu(tr("&Arithmetic"));
	relMenu = operationMenu->addMenu(tr("&Relational"));
	segmentationMenu = menuBar()->addMenu(tr("&Segmentation"));
	
	equalizationMenu->setEnabled(false);
	thresholdMenu->setEnabled(false);
	contrastMenu->setEnabled(false);
	noiseMenu->setEnabled(false);
	edgeMenu->setEnabled(false);
	operationMenu->setEnabled(false);
	segmentationMenu->setEnabled(false);
	
	fileMenu->addAction(openAction);
	fileMenu->addAction(saveAction);
	fileMenu->addSeparator();
	fileMenu->addAction(exitAction);

	equalizationMenu->addAction(equalAction);
	
	thresholdMenu->addAction(otsuAction);
	thresholdMenu->addAction(isodataAction);
	thresholdMenu->addAction(manualAction);
	
	contrastMenu->addAction(gammaAction);
	contrastMenu->addAction(stretchingAction);
	
	noiseMenu->addAction(sigmaAction);
	noiseMenu->addAction(medianAction);
	noiseMenu->addAction(lineAction);
	noiseMenu->addAction(pixelAction);
	noiseMenu->addAction(gaussianAction);
	
	edgeMenu->addAction(sobelAction);
	edgeMenu->addAction(horizontalAction);
	edgeMenu->addAction(cannyAction);

	boolMenu->addAction(andAction);
	boolMenu->addAction(orAction);
	boolMenu->addAction(xorAction);
	boolMenu->addAction(notAction);
	
	arithMenu->addAction(sumAction);
	arithMenu->addAction(resAction);
	arithMenu->addAction(multAction);
	arithMenu->addAction(divAction);
	arithMenu->addAction(avgAction);
	
	relMenu->addAction(minAction);
	relMenu->addAction(maxAction);
	
	segmentationMenu->addAction(kmeansAction);
	//-----

	viewer = new ImageViewer(this);
	
	QScrollArea * scrollArea = new QScrollArea;
	scrollArea->setWidget(viewer);
	scrollArea->setFixedWidth(600);
    scrollArea->setWidgetResizable(true);
    
 	boxW = new QSpinBox();
 	boxW->setEnabled(false);
 	boxW->setMaximum(65535);
 	
 	boxC = new QSpinBox();
 	boxC->setEnabled(false);
 	boxC->setMaximum(65535);
	
	histoViewer = new ImageViewer(this);
	QScrollArea * histoArea = new QScrollArea;
	histoArea->setWidget(histoViewer);
	histoArea->setFixedSize(268,278);
    histoArea->setWidgetResizable(false);
	
	QVBoxLayout * rightLayout = new QVBoxLayout;
	rightLayout->addWidget(new QLabel("Window:",this));
	rightLayout->addWidget(boxW);
	rightLayout->addWidget(new QLabel("Level:",this));
	rightLayout->addWidget(boxC);
	rightLayout->addWidget(histoArea);
	
	connect(boxW,SIGNAL(valueChanged(int)),this,SLOT(changeW(int)));
	connect(boxC,SIGNAL(valueChanged(int)),this,SLOT(changeC(int)));
	
	QWidget * rightSide = new QWidget;
	rightSide->setLayout(rightLayout);
	
	QHBoxLayout *mainLayout = new QHBoxLayout;
	mainLayout->addWidget(scrollArea);
	mainLayout->addWidget(rightSide);	

	
	QWidget * centralWidget = new QWidget();
	centralWidget->setLayout(mainLayout);
	
	
	setCentralWidget(centralWidget);

	setWindowTitle(tr("DICOM Image Processor"));
    setFixedSize(QSize(900,600));
}
Example #2
0
void CloudDialog::createWidgets()
{
  QLabel * label = 0;
  bool isConnected = false;

  m_amazonProviderWidget = new AmazonProviderWidget(this);
  m_blankProviderWidget = new BlankProviderWidget(this);
  m_vagrantProviderWidget = new VagrantProviderWidget(this);

  // BLANK PAGE
  QWidget * blankPageWidget = new QWidget();

  // LOGIN PAGE

  QHBoxLayout * mainLoginLayout = new QHBoxLayout;
  mainLoginLayout->setContentsMargins(QMargins(0,0,0,0));
  mainLoginLayout->setSpacing(5);

  QWidget * loginPageWidget = new QWidget;
  loginPageWidget->setLayout(mainLoginLayout);

  // LEFT LOGIN LAYOUT

  m_leftLoginLayout = new QVBoxLayout();
  mainLoginLayout->addLayout(m_leftLoginLayout);

  label = new QLabel;
  label->setObjectName("H2");
  label->setText("Cloud Resources");
  m_leftLoginLayout->addWidget(label,0,Qt::AlignTop | Qt::AlignLeft);

  m_cloudResourceComboBox = new QComboBox();
  m_leftLoginLayout->addWidget(m_cloudResourceComboBox,0,Qt::AlignTop | Qt::AlignLeft);
 
  //m_cloudResourceComboBox->addItem(NO_PROVIDER);
  if(showVagrant()) m_cloudResourceComboBox->addItem(VAGRANT_PROVIDER);
  m_cloudResourceComboBox->addItem(AMAZON_PROVIDER);

  isConnected = connect(m_cloudResourceComboBox, SIGNAL(currentIndexChanged(const QString &)),
    this, SLOT(cloudResourceChanged(const QString &)));
  OS_ASSERT(isConnected); 

  // LOGIN STACKED WIDGET

  m_loginStackedWidget = new  QStackedWidget();
  m_leftLoginLayout->addWidget(m_loginStackedWidget);

  m_loginStackedWidget->addWidget(m_blankProviderWidget->m_loginWidget);
  m_loginStackedWidget->addWidget(m_vagrantProviderWidget->m_loginWidget);
  m_loginStackedWidget->addWidget(m_amazonProviderWidget->m_loginWidget);

  m_loginStackedWidget->setCurrentIndex(m_blankProviderIdx);

  // RIGHT LOGIN LAYOUT
  
  m_rightLoginLayout = new QVBoxLayout();
  mainLoginLayout->addLayout(m_rightLoginLayout);

  m_legalAgreement = new QLabel;
  m_legalAgreement->hide();
  m_legalAgreement->setWordWrap(true);

  AWSSettings awsSettings;
  m_legalAgreement->setText(awsSettings.userAgreementText().c_str());

  QScrollArea * scrollArea = new QScrollArea();
  scrollArea->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
  scrollArea->setFixedWidth(TEXT_WIDTH + 15);
  scrollArea->setMinimumHeight(TEXT_HEIGHT);
  scrollArea->setStyleSheet("background-color:transparent;");
  scrollArea->setWidget(m_legalAgreement);
  scrollArea->setWidgetResizable(true);
  scrollArea->setAlignment(Qt::AlignTop);
  scrollArea->setFrameShape(QFrame::NoFrame);
  m_rightLoginLayout->addWidget(scrollArea);

  m_iAcceptCheckBox = new QCheckBox("I Agree");
  m_iAcceptCheckBox->hide();
  m_rightLoginLayout->addWidget(m_iAcceptCheckBox,0,Qt::AlignTop | Qt::AlignLeft);

  m_rightLoginLayout->addSpacing(5);

  isConnected = connect(m_iAcceptCheckBox, SIGNAL(clicked(bool)),
    this, SLOT(iAcceptClicked(bool)));
  OS_ASSERT(isConnected);

  m_rightLoginLayout->addSpacing(5);
    
  // SETTINGS PAGE

  m_mainSettingsLayout = new QVBoxLayout;
  m_mainSettingsLayout->setContentsMargins(QMargins(0,0,0,0));
  m_mainSettingsLayout->setSpacing(5);

  QWidget * settingsPageWidget = new QWidget;
  settingsPageWidget->setLayout(m_mainSettingsLayout);

  // SETTINGS STACKED WIDGET

  m_settingsStackedWidget = new  QStackedWidget();
  m_mainSettingsLayout->addWidget(m_settingsStackedWidget);

  QWidget * widget = new QWidget();

  QHBoxLayout * hLayout = new QHBoxLayout;
  hLayout->setContentsMargins(QMargins(0,0,0,0));
  hLayout->setSpacing(5);
  widget->setLayout(hLayout);

  hLayout->addWidget(m_blankProviderWidget->m_leftSettingsWidget);
  hLayout->addWidget(m_blankProviderWidget->m_rightSettingsWidget);

  m_settingsStackedWidget->addWidget(widget);

  widget = new QWidget();

  hLayout = new QHBoxLayout;
  hLayout->setContentsMargins(QMargins(0,0,0,0));
  hLayout->setSpacing(5);
  widget->setLayout(hLayout);

  hLayout->addWidget(m_vagrantProviderWidget->m_leftSettingsWidget);
  hLayout->addWidget(m_vagrantProviderWidget->m_rightSettingsWidget);

  m_settingsStackedWidget->addWidget(widget);

  widget = new QWidget();

  hLayout = new QHBoxLayout;
  hLayout->setContentsMargins(QMargins(0,0,0,0));
  hLayout->setSpacing(5);
  widget->setLayout(hLayout);

  hLayout->addWidget(m_amazonProviderWidget->m_leftSettingsWidget);
  hLayout->addWidget(m_amazonProviderWidget->m_rightSettingsWidget);

  m_settingsStackedWidget->addWidget(widget);

  m_settingsStackedWidget->setCurrentIndex(m_blankProviderIdx);

  // PAGE STACKED WIDGET

  m_pageStackedWidget = new  QStackedWidget();
  upperLayout()->addWidget(m_pageStackedWidget);

  m_blankPageIdx = m_pageStackedWidget->addWidget(blankPageWidget);
  m_loginPageIdx = m_pageStackedWidget->addWidget(loginPageWidget);
  m_settingsPageIdx = m_pageStackedWidget->addWidget(settingsPageWidget);

  m_pageStackedWidget->setCurrentIndex(m_loginPageIdx);

  // BUTTONS
  this->okButton()->setText("Save");
  this->backButton()->setText("Continue");
  this->backButton()->setEnabled(false);
  this->backButton()->show();

  // OS SETTINGS

  #ifdef Q_OS_MAC
    setWindowFlags(Qt::FramelessWindowHint);
  #elif defined(Q_OS_WIN32)
    setWindowFlags(Qt::WindowCloseButtonHint | Qt::MSWindowsFixedSizeDialogHint);
  #endif

  cloudResourceChanged(m_cloudResourceComboBox->currentText());
}
MedicalWindow::MedicalWindow()
{
	QMenuBar * menuBar = this->menuBar();
	
	openAction = new QAction(tr("&Open"), this);
	saveAction = new QAction(tr("&Save"), this);
	exitAction = new QAction(tr("E&xit"), this);

	saveAction->setEnabled(false);

	connect(openAction, SIGNAL(triggered()), this, SLOT(open()));
	connect(saveAction, SIGNAL(triggered()), this, SLOT(save()));
	connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit()));

	fileMenu = menuBar->addMenu(tr("&File"));
		
	fileMenu->addAction(openAction);
	fileMenu->addAction(saveAction);
	fileMenu->addSeparator();
	fileMenu->addAction(exitAction);
	
	segmentation = new QAction(tr("&Segmentation"),this);
	
	segmentationMenu = menuBar->addMenu(tr("&Brain"));
	
	segmentationMenu->addAction(segmentation);
	
	connect(segmentation, SIGNAL(triggered()), this, SLOT(segmentateBrain()));
	
	viewer = new ImageViewer(this);
	
	QScrollArea * scrollArea = new QScrollArea;
	scrollArea->setWidget(viewer);
	scrollArea->setFixedWidth(500);
    scrollArea->setWidgetResizable(true);
    	
 	lcdW = new QLCDNumber();
 	lcdC = new QLCDNumber();
 	
 	sliderW = new QSlider(Qt::Horizontal);
 	sliderC = new QSlider(Qt::Horizontal);
 	
	QVBoxLayout * rightLayout = new QVBoxLayout;
	rightLayout->addWidget(new QLabel("Window:",this));
	rightLayout->addWidget(lcdW);
	rightLayout->addWidget(sliderW);
	rightLayout->addWidget(new QLabel("Level:",this));
	rightLayout->addWidget(lcdC);
	rightLayout->addWidget(sliderC);
	
	connect(sliderW,SIGNAL(valueChanged(int)),lcdW,SLOT(display(int)));
	connect(sliderC,SIGNAL(valueChanged(int)),lcdC,SLOT(display(int)));
	
	connect(sliderW,SIGNAL(valueChanged(int)),this,SLOT(changeW(int)));
	connect(sliderC,SIGNAL(valueChanged(int)),this,SLOT(changeC(int)));
	
	QWidget * rightSide = new QWidget;
	rightSide->setLayout(rightLayout);
	
	QHBoxLayout *mainLayout = new QHBoxLayout;
	mainLayout->addWidget(scrollArea);
	mainLayout->addWidget(rightSide);	

	
	QWidget * centralWidget = new QWidget();
	centralWidget->setLayout(mainLayout);

	setCentralWidget(centralWidget);

	setWindowTitle(tr("DICOM Image Processor"));
    setFixedSize(QSize(800,600));
}
Example #4
0
MainWindow::MainWindow() {
    setupUi(this);
    m_dirty = false;

    m_logWindow->setVisible(false);
    m_imageView->setFocus();
    m_imageView->setHandler(this);

    ParamGroup *g, *gg;

    new ParamChoice(this, "output", "edges", "edges|fill|fill+edges", &output);
    new ParamChoice(this, "input_gamma", "linear-rgb", "srgb|linear-rgb", &input_gamma);

    g = new ParamGroup(this, "structure_tensor");
    new ParamChoice(g, "st_type", "scharr-lab", "central-diff|sobel-rgb|sobel-lab|sobel-L|scharr-rgb|scharr-lab|gaussian-deriv|etf-full|etf-xy", &st_type);
    new ParamDouble(g, "sigma_c", 2.28, 0, 20, 0.1, &sigma_c);
    new ParamDouble(g, "precision_sigma_c", sqrt(-2*log(0.05)), 1, 10, 1, &precision_sigma_c);
    new ParamInt   (g, "etf_N", 3, 0, 10, 1, &etf_N);

    g = new ParamGroup(this, "bilateral_filter", false, &enable_bf);
    new ParamChoice(g, "type", "xy", "oa|xy|fbl|full", &filter_type);
    new ParamInt   (g, "n_e",     1, 0, 20, 1, &n_e);
    new ParamInt   (g, "n_a",     4, 0, 20, 1, &n_a);
    new ParamDouble(g, "sigma_dg", 3, 0, 20, 0.05, &sigma_dg);
    new ParamDouble(g, "sigma_dt", 3, 0, 20, 0.05, &sigma_dt);
    new ParamDouble(g, "sigma_rg", 4.25, 0, 100, 0.05, &sigma_rg);
    new ParamDouble(g, "sigma_rt", 4.25, 0, 100, 0.05, &sigma_rt);
    new ParamDouble(g, "bf_alpha", 0, 0, 10000, 1, &bf_alpha);
    new ParamDouble(g, "precision_g", 2, 1, 10, 1, &precision_g);
    new ParamDouble(g, "precision_t", 2, 1, 10, 1, &precision_t);

    g = new ParamGroup(this, "dog");
    ParamGroup* dog_group = g;
    connect(g, SIGNAL(dirty()), SLOT(dogChanged()));

    new ParamChoice(g, "type", "flow-based", "isotropic|flow-based", &dog_type);
    new ParamDouble(g, "sigma_e", 1.4, 0, 20, 0.005, &sigma_e);
    new ParamDouble(g, "dog_k", 1.6, 1, 10, 0.01, &dog_k);
    new ParamDouble(g, "precision_e", 3, 1, 5, 0.1, &precision_e);
    new ParamDouble(g, "sigma_m", 4.4, 0, 20, 1, &sigma_m);
    new ParamDouble(g, "precision_m", 2, 1, 5, 0.1, &precision_m);
    new ParamDouble(g, "step_m", 1, 0.01, 2, 0.1, &step_m);

    new ParamChoice(g, "adj_func", "smoothstep", "smoothstep|tanh", &dog_adj_func);
    new ParamBool  (g, "dog_reparam", true, &dog_reparam);
    gg = new ParamGroup(g, "", true);
    dog_tau_g = gg;
    dog_eps_ptr = new ParamDouble(gg, "epsilon", 3.50220, -100, 100, 0.005, &dog_eps);
    dog_tau_ptr = new ParamDouble(gg, "tau", 0.95595, 0, 2, 0.005, &dog_tau);
    dog_phi_ptr = new ParamDouble(gg, "phi", 0.3859, 0, 1e32, 0.1, &dog_phi);

    gg = new ParamGroup(g, "", false);
    dog_p_g = gg;
    dog_p_ptr     = new ParamDouble(gg, "p", 21.7, 0, 1e6, 1, &dog_p);
    dog_eps_p_ptr = new ParamDouble(gg, "epsilon_p", 79.5, -1e32, 1e32, 0.5, &dog_eps_p);
    dog_phi_p_ptr = new ParamDouble(gg, "phi_p", 0.017, -1e32, 1e32, 0.05, &dog_phi_p);

    new ParamChoice(g, "dog_fgauss", "euler", "euler|rk2-nn|rk2|rk4", &dog_fgauss);

    g = new ParamGroup(this, "quantization", false, &quantization);
    new ParamChoice(g, "quant_type", "adaptive", "fixed|adaptive", &quant_type);
    new ParamInt   (g, "nbins", 8, 1, 255, 1, &nbins);
    new ParamDouble(g, "phi_q", 2, 0, 100, 0.025, &phi_q);
    new ParamDouble(g, "lambda_delta", 0, 0, 100, 1, &lambda_delta);
    new ParamDouble(g, "omega_delta", 2, 0, 100, 1, &omega_delta);
    new ParamDouble(g, "lambda_phi", 0.9, 0, 100, 1, &lambda_phi);
    new ParamDouble(g, "omega_phi", 1.6, 0, 100, 1, &omega_phi);

    g = new ParamGroup(this, "warp_sharp", false, &warp_sharp);
    new ParamDouble(g, "sigma_w", 1.5, 0, 20, 1, &sigma_w);
    new ParamDouble(g, "precision_w", 2, 1, 5, 0.1, &precision_w);
    new ParamDouble(g, "phi_w", 2.7, 0, 100, 0.025, &phi_w);

    g = new ParamGroup(this, "final_smooth", true, &final_smooth);
    new ParamChoice(g, "type", "flow-nearest", "3x3|5x5|flow-nearest|flow-linear", &final_type);
    new ParamDouble(g, "sigma_a", 1.0, 0, 10, 1, &sigma_a);

    QScrollArea *sa = new QScrollArea(this);
    QWidget *parea = new QWidget(sa);
    sa->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding);
    sa->setFixedWidth(300);
    sa->setWidget(parea);
    sa->setFrameStyle(QFrame::NoFrame);
    sa->setFocusPolicy(Qt::NoFocus);
    sa->setWidgetResizable(true);
    sa->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    m_vbox1->addWidget(sa);

    m_paramui = new ParamUI(parea, this);
    QVBoxLayout *pbox = new QVBoxLayout(parea);
    pbox->setContentsMargins(4,4,4,4);
    pbox->addWidget(m_paramui);
    pbox->addStretch(0);

    connect(m_select, SIGNAL(currentIndexChanged(int)), this, SLOT(onIndexChanged(int)));

    m_player = new VideoPlayer(this, ":/test.png");
    connect(m_player, SIGNAL(videoChanged(int)), this, SLOT(onVideoChanged(int)));
    connect(m_player, SIGNAL(currentFrameChanged(int)), this, SLOT(setDirty()));
    connect(m_player, SIGNAL(outputChanged(const QImage&)), m_imageView, SLOT(setImage(const QImage&)));
    connect(this, SIGNAL(imageChanged(const QImage&)), m_player, SLOT(setOutput(const QImage&)));

    m_videoControls->setFrameStyle(QFrame::NoFrame);
    m_videoControls->setAutoHide(true);
    connect(m_videoControls, SIGNAL(stepForward()), m_player, SLOT(stepForward()));
    connect(m_videoControls, SIGNAL(stepBack()), m_player, SLOT(stepBack()));
    connect(m_videoControls, SIGNAL(currentFrameTracked(int)), m_player, SLOT(setCurrentFrame(int)));
    connect(m_videoControls, SIGNAL(playbackChanged(bool)), m_player, SLOT(setPlayback(bool)));
    connect(m_videoControls, SIGNAL(trackingChanged(bool)), this, SLOT(setDirty()));

    connect(m_player, SIGNAL(videoChanged(int)), m_videoControls, SLOT(setFrameCount(int)));
    connect(m_player, SIGNAL(playbackChanged(bool)), m_videoControls, SLOT(setPlayback(bool)));
    connect(m_player, SIGNAL(currentFrameChanged(int)), m_videoControls, SLOT(setCurrentFrame(int)));
}
Example #5
0
void Expectations::createExpPanel()
{
    Utilities::clearLayout(expLayout_);

    // Name
    QLabel* nameLabel = new QLabel("Nom :");
    name_ = new QLineEdit(exp_->name());
    QHBoxLayout* h1 = new QHBoxLayout;
    h1->addWidget(nameLabel);
    h1->addWidget(name_);
    h1->insertStretch(-1);
    expLayout_->addLayout(h1);

    // Uvs the student wishes to do
    QLabel* wantedUvsLabel = new QLabel("Uvs voulues :");
    QScrollArea* wantedUvsScroll = new QScrollArea;
    QWidget* w1 = new QWidget;
    wantedUvsScroll->setWidget(w1);
    wantedUvsScroll->setFixedWidth(110);
    wantedUvsScroll->setWidgetResizable(true);
    wantedUvsLayout_ = new QVBoxLayout;
    w1->setLayout(wantedUvsLayout_);
    QHBoxLayout* h2 = new QHBoxLayout;
    h2->addWidget(wantedUvsLabel);
    h2->addWidget(wantedUvsScroll);

    // Uvs the student does not wish to do
    QLabel* unwantedUvsLabel = new QLabel("Uvs non voulues :");
    QScrollArea* unwantedUvsScroll = new QScrollArea;
    QWidget* w2 = new QWidget;
    unwantedUvsScroll->setWidget(w2);
    unwantedUvsScroll->setFixedWidth(110);
    unwantedUvsScroll->setWidgetResizable(true);
    unwantedUvsLayout_ = new QVBoxLayout;
    w2->setLayout(unwantedUvsLayout_);
    QHBoxLayout* h3 = new QHBoxLayout;
    h3->addWidget(unwantedUvsLabel);
    h3->addWidget(unwantedUvsScroll);

    // Degrees the students wishes to enroll in
    QGroupBox* wantedDegrees = new QGroupBox("Formations envisagées");
    degreesBox_ = new QComboBox;
    const QList<Degree*> &degrees = UTManager::instance().degrees();
    degreesBox_->insertItem(0,"Choix " + degrees.first()->type());
    int count = 1;
    for(int i = 0; i < degrees.size(); i++)
    {
        if(!degrees.at(i)->parent())
        {
            degreesBox_->insertItem(count,degrees.at(i)->title());
            count++;
        }
    }
    QObject::connect(degreesBox_,SIGNAL(activated(QString)),this,SLOT(selectDegree(QString)));
    degreeLayout_ = new QHBoxLayout;
    degreeLayout_->addWidget(degreesBox_);
    degreeLayout_->insertStretch(-1);
    QPushButton* addDegreeButton = new QPushButton("Ajouter");
    QObject::connect(addDegreeButton,SIGNAL(clicked()),this,SLOT(addWantedDegree()));
    QHBoxLayout* h5 = new QHBoxLayout;
    h5->addWidget(addDegreeButton);
    h5->insertStretch(-1);
    QVBoxLayout* v1 = new QVBoxLayout;
    v1->addLayout(degreeLayout_);
    v1->addLayout(h5);
    wantedDegrees->setLayout(v1);
    for(int i = 0; i < exp_->degrees().size(); i++)
    {
        const Degree* degree = exp_->degrees()[i];
        QHBoxLayout* degreesLayout = new QHBoxLayout;
        getParentDegree(degreesLayout, degree);
        degreesLayout->insertStretch(-1);
        v1->addLayout(degreesLayout);
    }
    QHBoxLayout* deleteDegreeLayout = new QHBoxLayout;
    deleteDegree_ = new QComboBox;

    deleteDegree_->insertItem(0, "Choix du cursus");
    for(int i = 0; i < exp_->degrees().size(); i++)
    {
        deleteDegree_->insertItem(i + 1, exp_->degrees().at(i)->title());
    }

    QPushButton* deleteDegreeButton = new QPushButton("Supprimer le cursus");
    QObject::connect(deleteDegreeButton,SIGNAL(clicked()),this,SLOT(deleteDegree()));

    deleteDegreeLayout->addWidget(deleteDegree_);
    deleteDegreeLayout->insertStretch(-1);
    deleteDegreeLayout->addWidget(deleteDegreeButton);

    v1->addLayout(deleteDegreeLayout);

    v1->insertStretch(-1);

    QHBoxLayout* h4 = new QHBoxLayout;
    h4->addLayout(h2);
    h4->addLayout(h3);
    h4->insertStretch(-1);
    h4->addWidget(wantedDegrees);
    expLayout_->addLayout(h4);


    // Add semester
    QGroupBox* addSemesterBox = new QGroupBox;
    QVBoxLayout* v2 = new QVBoxLayout;
    addSemesterBox->setLayout(v2);
        // semester
    QLabel* seasonLabel = new QLabel("Semestre :");
    seasonBox_ = new QComboBox;
    seasonBox_->addItem("P");
    seasonBox_->addItem("A");
    QHBoxLayout* h6 = new QHBoxLayout;
    h6->addWidget(seasonLabel);
    h6->addWidget(seasonBox_);
        // date
    QLabel* yearLabel = new QLabel("Année :");
    yearBox_ = new QSpinBox;
    yearBox_->setValue(14);
    // button add
    QPushButton* addSemester = new QPushButton("Ajouter le semestre");
    QObject::connect(addSemester,SIGNAL(clicked()),this,SLOT(addSemester()));
    h6->addWidget(yearLabel);
    h6->addWidget(yearBox_);
    h6->addWidget(addSemester);
    h6->insertStretch(-1);

    v2->addLayout(h6);

    for(int i = 0; i < exp_->semesters().size(); i++)
    {
        QLabel* semester = new QLabel(exp_->semesters().at(i)->title());
        QHBoxLayout* h = new QHBoxLayout;
        h->addWidget(semester);
        h->insertStretch(-1);
        v2->addLayout(h);
    }

    semestersBox_ = new QComboBox;
    for(int i = 0; i < exp_->semesters().size(); i++)
    {
        semestersBox_->addItem(exp_->semesters().at(i)->title());
    }
    QPushButton* deleteSemester = new QPushButton("Supprimer le semestre");
    QObject::connect(deleteSemester,SIGNAL(clicked()),this,SLOT(deleteSemester()));
    QHBoxLayout* h7 = new QHBoxLayout;
    h7->addWidget(semestersBox_);
    h7->addWidget(deleteSemester);
    h7->insertStretch(-1);
    v2->addLayout(h7);


    expLayout_->addWidget(addSemesterBox);

    expLayout_->insertStretch(-1);

    updateWantedUvs();
    updateUnwantedUvs();
    loadSemesters();
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    //ui->setupUi(this);

    setFixedHeight(768); //1024
    setFixedWidth(768);

    //Define page structure
    QWidget * page = new QWidget(this);
    page->setFixedWidth(this->width());
    page->setFixedHeight(this->height());
    page->setStyleSheet("background-color:white;");
    QVBoxLayout * pageLayout = new QVBoxLayout();


    //Define the fixed header
    QWidget * header = new QWidget(page);
    header->setFixedWidth(page->width());
    QGridLayout * headerLayout = new QGridLayout();
    headerLayout->setHorizontalSpacing(2);
    headerLayout->setVerticalSpacing(2);

    QLabel * numTable = new QLabel();
    QPixmap numTableIm(":/Images/images/NumTable.png");
   // numTable->setStyleSheet("margin-right: 5px");
    numTable->setPixmap(numTableIm);
    numTable->setFixedSize(numTableIm.rect().size());

    QLabel * banner = new QLabel(header);
    QPixmap bannerIm(":/Images/images/Banner.png");
    banner->setPixmap(bannerIm);
    banner->setFixedSize(bannerIm.rect().size());

    QPushButton * pain = new QPushButton("");
    QPixmap painIm(":/Images/images/Pain.png");
    QIcon painIcon(painIm);
    pain->setIcon(painIcon);
    pain->setIconSize(painIm.rect().size());
    pain->setFixedSize(painIm.rect().size());

    QPushButton * eau = new QPushButton("");
    QPixmap eauIm(":/Images/images/eau.png");
    QIcon eauIcon(eauIm);
    eau->setIcon(eauIcon);
    eau->setIconSize(eauIm.rect().size());
    eau->setFixedSize(eauIm.rect().size());

    QPushButton * serveur = new QPushButton("");
    QPixmap serveurIm(":/Images/images/Serveur.png");
    QIcon serveurIcon(serveurIm);
    serveur->setIcon(serveurIcon);
    serveur->setIconSize(serveurIm.rect().size());
    serveur->setFixedSize(serveurIm.rect().size());


    headerLayout->addWidget(numTable, 0, 0, 2, 0);
    headerLayout->addWidget(banner, 0, 1, 2, 1);
    headerLayout->addWidget(serveur,0, 2, 2, 2);
    headerLayout->addWidget(pain, 0, 3);
    headerLayout->addWidget(eau, 1, 3);
    header->setLayout(headerLayout);


    //Define the widget containing all the meals (Tabs)
    QTabWidget * repasFrame = new QTabWidget(page);

    //For one Meal, define the widget containing all the bands
    QWidget * area = new QWidget(repasFrame);
    QScrollArea * sArea = new QScrollArea(area);
    QPalette * palette = new QPalette();
    palette->setColor(QPalette::Background, Qt::white);
    sArea->setPalette(*palette);
    sArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    sArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    sArea->setFixedWidth(page->width() -20);
    sArea->setFixedHeight(page->height() - header->height() - 125);

    bands = new QWidget();
    bands->setFixedWidth(page->width() -25);
   // bands->setMinimumHeight(page->height() - header->height() - 125);
    bands->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored);
    bandsLayout = new QVBoxLayout(bands);
    Headband* menus = HeadbandFactory::buildMenus(bands);
    bandList.append(menus);
    bandsLayout->addWidget(menus);
    usefulLabel = new QLabel();
    bandsLayout->addWidget(usefulLabel);
    bands->setLayout(bandsLayout);
    sArea->setWidget(bands);


    repasFrame->setFixedWidth(page->width());
    repasFrame->setFixedHeight(page->height() - header->height());
    repasFrame->addTab(area, "Repas 1");
    repasFrame->addTab(new QLabel(), "+");


    //Define the confirmation button
    QPushButton * confirmButton = new QPushButton("");
    QPixmap confirmIm(":/Images/images/Confirm.jpg");
    QIcon confirmIcon(confirmIm);
    confirmButton->setIcon(confirmIcon);
    confirmButton->setIconSize(confirmIm.rect().size());
    confirmButton->setFixedSize(confirmIm.rect().size());


    //Define the 'languette' and its 'etiquette'
    QList<QList<QObject*> > bigDataList;
    languetteContainer = new LanguetteContainer(bigDataList);
    languetteContainer->setFixedSize(760, 855);
    Etiquette * etiquette = new Etiquette(languetteContainer, confirmButton, page);


    //Link final page layouts
    pageLayout->addWidget(header);
    pageLayout->addWidget(repasFrame);
    pageLayout->addWidget(etiquette);
    pageLayout->addWidget(confirmButton);
    pageLayout->addWidget(languetteContainer);
    page->setLayout(pageLayout);


    //connect all slots
    connect(etiquette, SIGNAL(updateLanguetteInfo()), this, SLOT(recapLanguette()));
    connect(menus, SIGNAL(itemSelect(Headband_Item*)), this, SLOT(changeMenu(Headband_Item*)));
    connect(confirmButton, SIGNAL(clicked()), this, SLOT(confirmMeal()));
    connect(pain, SIGNAL(clicked()), this, SLOT(callBread()));
    connect(eau, SIGNAL(clicked()), this, SLOT(callWater()));
    connect(serveur, SIGNAL(clicked()), this, SLOT(callServer()));

    setCentralWidget(page);
}