Example #1
62
/*
  *点击“关于”执行此函数
  *弹出对话框
  */
void Game_main::about()
{
    QDialog *Dblack = new QDialog();
    QVBoxLayout *vlayout = new QVBoxLayout;
    Dblack->setFixedSize(300,280);
    QLabel *label = new QLabel("Copy Right @ UESTC-CCSE wytk2008.net");
    QAbstractButton *bExit = new QPushButton("back");
    vlayout->addWidget(label);
    vlayout->addWidget(bExit);
    Dblack->setLayout(vlayout);
    Dblack->show();
    Dblack->connect(bExit,SIGNAL(clicked()),Dblack,SLOT(close()));
}
Example #2
0
void MainWindow::about() {
    QDialog *dialog = new QDialog( this );

    QPushButton *qpbClose = new QPushButton( IconLoader::Load( "window-close"), tr( "&Close" ), dialog );
        connect( qpbClose, SIGNAL( clicked()), dialog, SLOT( deleteLater()));
    QPushButton *qpbCredits = new QPushButton( IconLoader::Load( "help-about"), tr( "C&redits" ), dialog );
        connect( qpbCredits, SIGNAL( clicked()), this, SLOT( aboutCredits()));
    QPushButton *qpbLicense = new QPushButton( tr( "&License" ), dialog );
        connect( qpbLicense, SIGNAL( clicked()), this, SLOT( aboutLicense()));

    QLabel *qlAbout = new QLabel( dialog );
        qlAbout->setText( tr("<center><h1>%1 %2</h1><h3>For better use of leo.org</h3>Copyright \251 2010 %3</center>")
                        .arg( APP_NAME ).arg( APP_VERSION ).arg( APP_NAME ));


    qglDialog = new QGridLayout( dialog );
        qglDialog->addWidget( qlAbout, 0, 0, 1, 3, Qt::AlignCenter );
        qglDialog->addWidget( qpbCredits, 1, 0, Qt::AlignCenter );
        qglDialog->addWidget( qpbLicense, 1, 1, Qt::AlignCenter );
        qglDialog->addWidget( qpbClose, 1, 2, Qt::AlignCenter );

        dialog->setWindowTitle( tr( "About %1").arg( APP_NAME ));
        dialog->setLayout( qglDialog );
        dialog->setFixedSize( 312, 156 );
        dialog->exec();
}
Example #3
0
void MainWindow::aboutLicense() {
    QDialog *dialog = new QDialog( this );

    QFile file( ":/GPL" );
    if(!file.open( QIODevice::ReadOnly | QIODevice::Text ))
        qCritical( "GPL LicenseFile not found" );

    QTextStream out ( &file );
    out.setFieldAlignment ( QTextStream::AlignCenter );

    QTextEdit *qteLicense = new QTextEdit ( dialog );
        qteLicense->setText ( out.readAll ());
        qteLicense->setReadOnly ( 1 );
    QPushButton *qpbClose = new QPushButton ( IconLoader::Load( "window-close" ), tr( "&Close" ), dialog );
        connect( qpbClose, SIGNAL( clicked()), dialog, SLOT( deleteLater()));

    qglDialog = new QGridLayout( dialog );
        qglDialog->addWidget( qteLicense, 0, 0 );
        qglDialog->addWidget( qpbClose, 1, 0, Qt::AlignRight );

        dialog->setLayout( qglDialog);
        dialog->setWindowTitle( "GNU General Public License" );
        dialog->setFixedSize( 550, 400 );
        dialog->exec();
}
Example #4
0
void QSoundProcessor::open_volume_dialog()
{
    QDialog dialog;
    dialog.setWindowTitle(tr("Volume level"));
    dialog.setFixedSize(160,80);

    QVBoxLayout Lcenter;
    QGroupBox GBbox(tr("Set volume level:"));
    QHBoxLayout layout;
    QSlider slider;
    slider.setOrientation(Qt::Horizontal);
    slider.setRange(1, VOLUME_STEPS);
    slider.setTickInterval(10);
    slider.setTickPosition(QSlider::TicksBothSides);
    QLabel lable(tr("error"));
    connect(&slider, SIGNAL(valueChanged(int)), &lable, SLOT(setNum(int)));
    if(pt_audioinput)
    {
        slider.setValue( VOLUME_STEPS * pt_audioinput->volume() );
    }
    connect(&slider, SIGNAL(sliderMoved(int)), this, SLOT(set_volume(int)));
    layout.addWidget(&slider);
    layout.addWidget(&lable, 2, Qt::AlignRight);
    GBbox.setLayout(&layout);
    Lcenter.addWidget(&GBbox);
    dialog.setLayout(&Lcenter);
    dialog.exec();
}
Example #5
0
void MainWindow::about()
{
   QDialog *aboutdialog = new QDialog();
   int pSize = aboutdialog->font().pointSize();
   aboutdialog->setWindowTitle("About");
   aboutdialog->setFixedSize(pSize*27,pSize*17);

   QVBoxLayout *templayout = new QVBoxLayout();
   templayout->setMargin(5);

   QLabel *projectname = new QLabel(QString(APP_NAME) +"\t"+ QString(APP_VERSION));
   projectname->setFrameStyle(QFrame::Box | QFrame::Raised);
   projectname->setAlignment(Qt::AlignCenter);
   QLabel *projectauthors = new QLabel(QString(APP_DESIGNER) + "\n\nBMSTU\n\nNovember of 2015");
   projectauthors->setWordWrap(true);
   projectauthors->setAlignment(Qt::AlignCenter);
   QLabel *hyperlink = new QLabel("<a href='mailto:[email protected]?subject=Pointmetry'>Contact us at [email protected]");
   hyperlink->setOpenExternalLinks(true);
   hyperlink->setAlignment(Qt::AlignCenter);

   templayout->addWidget(projectname);
   templayout->addWidget(projectauthors);
   templayout->addWidget(hyperlink);

   aboutdialog->setLayout(templayout);
   aboutdialog->exec();

   delete hyperlink;
   delete projectauthors;
   delete projectname;
   delete templayout;
   delete aboutdialog;
}
void MainWindow::show_about()
{
   QDialog *aboutdialog = new QDialog(); 
   int pSize = aboutdialog->font().pointSize();
   aboutdialog->setWindowTitle("About");
   aboutdialog->setFixedSize(pSize*30,pSize*17);

   QVBoxLayout *templayout = new QVBoxLayout();
   templayout->setMargin(APP_MARGIN);

   QLabel *projectname = new QLabel(QString(APP_NAME) +"\t"+ QString(APP_VERS));
   projectname->setFrameStyle(QFrame::Box | QFrame::Raised);
   projectname->setAlignment(Qt::AlignCenter);
   QLabel *projectauthors = new QLabel("Designed by: Taranov Alex\n\nFirst release was in 2014");
   projectauthors->setWordWrap(true);
   projectauthors->setAlignment(Qt::AlignCenter);
   QLabel *hyperlink = new QLabel("<a href='mailto:[email protected]?subject=QVideoProcessing'>Contact us at [email protected]");
   hyperlink->setToolTip("Will try to open your default mail client");
   hyperlink->setOpenExternalLinks(true);
   hyperlink->setAlignment(Qt::AlignCenter);

   templayout->addWidget(projectname);
   templayout->addWidget(projectauthors);
   templayout->addWidget(hyperlink);

   aboutdialog->setLayout(templayout);
   aboutdialog->exec();

   delete hyperlink;
   delete projectauthors;
   delete projectname;
   delete templayout;
   delete aboutdialog;
}
Example #7
0
int main(int argc,char *argv[])
{
    if (argc < 1)
        return 1;
    const QString skinFile = QString::fromUtf8(argv[1]);
    QApplication app(argc,argv);
    QMainWindow mw;

    DeviceSkinParameters params;
    QString errorMessage;
    if (!params.read(skinFile, DeviceSkinParameters::ReadAll, &errorMessage)) {
	qWarning() << errorMessage;
	return 1;
    }
    DeviceSkin ds(params, &mw);
    // View Dialog
    QDialog *dialog = new QDialog();
    QHBoxLayout *dialogLayout = new QHBoxLayout();
    dialog->setLayout(dialogLayout);
    QDialogButtonBox *dialogButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
    QObject::connect(dialogButtonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
    QObject::connect(dialogButtonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
    dialogLayout->addWidget(dialogButtonBox);
    dialog->setFixedSize(params.screenSize());
    dialog->setParent(&ds, Qt::SubWindow);
    dialog->setAutoFillBackground(true);
    ds.setView(dialog);

    QObject::connect(&ds, SIGNAL(popupMenu()), &mw, SLOT(close()));
    QObject::connect(&ds, SIGNAL(skinKeyPressEvent(int,QString,bool)), &mw, SLOT(close()));
    mw.show();
    return app.exec();
}
Example #8
0
  /**
   * Creates and brings up the dialog box which allows the user to
   * re-label the plot various labes.
   * 
   */
  void ScatterPlotWindow::reLabel() {
    QDialog *dialog = new QDialog(p_scatterPlotWindow);
    dialog->setWindowTitle("Name Plot Labels");

    QWidget *buttons = new QWidget (dialog);
    QWidget *textAreas = new QWidget (dialog);
    QWidget *labels = new QWidget (dialog);
    QWidget *main = new QWidget (dialog);

    QVBoxLayout *layout = new QVBoxLayout();
    layout->addWidget(main,0);
    layout->addWidget(buttons,0);
    dialog->setLayout(layout);

    QToolButton *okButton = new QToolButton(dialog);
    connect(okButton,SIGNAL(released()),this,SLOT(setLabels()));
    connect(okButton,SIGNAL(released()),dialog,SLOT(hide()));
    okButton->setShortcut(Qt::Key_Enter);
    okButton->setText("Ok");

    QToolButton *cancelButton = new QToolButton(dialog);
    connect(cancelButton,SIGNAL(released()),dialog,SLOT(hide()));
    cancelButton->setText("Cancel");

    QLabel *plotLabel = new QLabel("Plot Title: ");
    QLabel *xAxisLabel = new QLabel("X-Axis Label: ");
    QLabel *yAxisLabel = new QLabel("Y-Axis Label: ");

    QVBoxLayout *vlayout = new QVBoxLayout();
    vlayout->addWidget(plotLabel);
    vlayout->addWidget(xAxisLabel);
    vlayout->addWidget(yAxisLabel);    
    labels->setLayout(vlayout);

    p_plotTitleText = new QLineEdit(p_plot->title().text(),dialog);
    p_xAxisText = new QLineEdit(p_plot->axisTitle(QwtPlot::xBottom).text(),dialog);
    p_yAxisText = new QLineEdit(p_plot->axisTitle(QwtPlot::yLeft).text(),dialog);

    QVBoxLayout *v2layout = new QVBoxLayout();
    v2layout->addWidget(p_plotTitleText);
    v2layout->addWidget(p_xAxisText);
    v2layout->addWidget(p_yAxisText);
    textAreas->setLayout(v2layout);

    QHBoxLayout *mainLayout = new QHBoxLayout();
    mainLayout->addWidget(labels);
    mainLayout->addWidget(textAreas);
    main->setLayout(mainLayout);

    QHBoxLayout *hlayout = new QHBoxLayout();
    hlayout->addWidget(okButton);
    hlayout->addWidget(cancelButton);
    buttons->setLayout(hlayout);

    dialog->setFixedSize(400,190);
    dialog->show();
  }
void MainControllerStandalone::on_vstPluginRequestedWindowResize(QString pluginName, int newWidht,
                                                                 int newHeight)
{
    QDialog *pluginEditorWindow = Vst::VstPlugin::getPluginEditorWindow(pluginName);
    if (pluginEditorWindow) {
        pluginEditorWindow->setFixedSize(newWidht, newHeight);
        // pluginEditorWindow->updateGeometry();
    }
}
Example #10
0
void ccRenderingTools::ShowDepthBuffer(ccGBLSensor* sensor, QWidget* parent)
{
	if (!sensor)
		return;

	const ccGBLSensor::DepthBuffer& depthBuffer = sensor->getDepthBuffer();
	if (!depthBuffer.zBuff)
		return;

	//determine min and max depths
	ScalarType minDist = 0, maxDist = 0;
	{
		const ScalarType *_zBuff = depthBuffer.zBuff;
		for (int x=0; x<depthBuffer.height*depthBuffer.width; ++x,++_zBuff)
		{
			if (x==0)
			{
				maxDist = minDist = *_zBuff;
			}
			else if (*_zBuff > 0)
			{
				maxDist = std::max(maxDist,*_zBuff);
				minDist = std::min(minDist,*_zBuff);
			}
		}
	}

	QImage bufferImage(depthBuffer.width,depthBuffer.height,QImage::Format_RGB32);
	{
		ccColorScale::Shared colorScale = ccColorScalesManager::GetDefaultScale();
		assert(colorScale);
		ScalarType coef = maxDist-minDist < ZERO_TOLERANCE ? 0 : static_cast<ScalarType>(ccColorScale::MAX_STEPS-1)/(maxDist-minDist);

		const ScalarType* _zBuff = depthBuffer.zBuff;
		for (int y=0; y<depthBuffer.height; ++y)
		{
			for (int x=0; x<depthBuffer.width; ++x,++_zBuff)
			{
				const colorType* col = (*_zBuff >= minDist ? colorScale->getColorByIndex(static_cast<unsigned>((*_zBuff-minDist)*coef)) : ccColor::black);
				bufferImage.setPixel(x,depthBuffer.height-1-y,qRgb(col[0],col[1],col[2]));
			}
		}
	}

	QDialog* dlg = new QDialog(parent);
	dlg->setWindowTitle(QString("%0 depth buffer [%1 x %2]").arg(sensor->getParent()->getName()).arg(depthBuffer.width).arg(depthBuffer.height));
	dlg->setFixedSize(bufferImage.size());
	QVBoxLayout* vboxLayout = new QVBoxLayout(dlg);
	vboxLayout->setContentsMargins(0,0,0,0);
	QLabel* label = new QLabel(dlg);
	label->setScaledContents(true);
	vboxLayout->addWidget(label);

	label->setPixmap(QPixmap::fromImage(bufferImage));
	dlg->show();
}
Example #11
0
void Game_main::whoWin()//直接判断white_win,black_win弹出窗口
{
    if(white_win)
    {
        QDialog *Dblack = new QDialog();
        QVBoxLayout *vlayout = new QVBoxLayout;
        Dblack->setFixedSize(150,140);
        QLabel *label = new QLabel("白棋胜利!");
        QAbstractButton *bExit = new QPushButton("再来一局");

        bExit->setText("再来一局");

        vlayout->addWidget(label);
        vlayout->addWidget(bExit);
        Dblack->setLayout(vlayout);
        Dblack->show();
        Dblack->connect(bExit,SIGNAL(clicked()),Dblack,SLOT(close()));
        Dblack->connect(bExit,SIGNAL(clicked()),this,SLOT(start()));

        is_over = true;


    }
    if(black_win)
    {
        QDialog *Dblack = new QDialog();
        QVBoxLayout *vlayout = new QVBoxLayout;
        Dblack->setFixedSize(150,140);
        QLabel *label = new QLabel("黑棋胜利!");
        QAbstractButton *bExit = new QPushButton("再来一局");

        bExit->setText("再来一局");

        vlayout->addWidget(label);
        vlayout->addWidget(bExit);
        Dblack->setLayout(vlayout);
        Dblack->show();
        Dblack->connect(bExit,SIGNAL(clicked()),Dblack,SLOT(close()));
        Dblack->connect(bExit,SIGNAL(clicked()),this,SLOT(start()));

        is_over =true;
    }
}
Example #12
0
void ImageViewer::progressDialog() {
    QDialog *dialog = new QDialog(this);
    dialog->setModal(false);
    dialog->setFixedSize(QSize(700, 400));
    QGridLayout *dialogLayout = new QGridLayout(dialog);
    dialogLayout->setAlignment(Qt::AlignCenter);
    dialogLayout->addWidget(new QLabel("Generating Thumbnail", dialog));
    QProgressBar *progress = new QProgressBar(dialog);
    progress->setMaximum(100);
    progress->setValue(0);
    connect(this, SIGNAL(setProgress(int)), progress, SLOT(setValue(int)));
    dialogLayout->addWidget(progress);
    dialog->setLayout(dialogLayout);
    dialog->show();
}
Example #13
0
void MainWindow::on_cmdEditButton_clicked()
{
    // Open a dialog to modify the commands
    QDialog * dialog = new QDialog(this, Qt::WindowCloseButtonHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
    QTableView * tableView = new QTableView(dialog);
    QGridLayout *layout = new QGridLayout;
    tableView->setModel(&commands);
    layout->addWidget(tableView);
    dialog->setWindowTitle(QString("Edit Commands"));
    dialog->setLayout(layout);
    // Use a bigger fixed size to hold the tableview
    //dialog->layout()->setSizeConstraint( QLayout::SetFixedSize );
    dialog->setFixedSize(600,400);
    // Call exec() so that main window will freeze
    dialog->exec();
}
Example #14
0
bool QSoundProcessor::open_device_select_dialog()
{
    QDialog dialog;
    dialog.setFixedSize(320,120);
    dialog.setWindowTitle(tr("Audio device"));

    QVBoxLayout Lcenter;
        QHBoxLayout Lbuttons;
        QPushButton Baccept(tr("Accept"));
        Baccept.setToolTip(tr("Selected device will be used"));
        connect(&Baccept, &QPushButton::clicked, &dialog, &QDialog::accept);
        QPushButton Bcancel(tr("Cancel"));
        Bcancel.setToolTip(tr("Default device will be used"));
        connect(&Bcancel, &QPushButton::clicked, &dialog, &QDialog::reject);
        Lbuttons.addWidget(&Baccept);
        Lbuttons.addWidget(&Bcancel);

        QGroupBox GBselect(tr("Select audio capture device"));
        QVBoxLayout Llocal;
            QComboBox CBdevice;
            QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
            for(int i = 0; i < devices.size(); ++i)
            {
                CBdevice.addItem(devices.at(i).deviceName(), qVariantFromValue(devices.at(i)));
            }
        Llocal.addWidget(&CBdevice);
        GBselect.setLayout(&Llocal);

    Lcenter.addWidget(&GBselect);
    Lcenter.addLayout(&Lbuttons);
    dialog.setLayout(&Lcenter);

    if(dialog.exec() == QDialog::Accepted)
    {
        m_device_info = CBdevice.currentData().value<QAudioDeviceInfo>();
        return true;
    }
    else
    {
        m_device_info = QAudioDeviceInfo::defaultInputDevice();
    }
    return false;
}
void AlbumCoverChoiceController::ShowCover(const Song& song) {
  QDialog* dialog = new QDialog(this);
  dialog->setAttribute(Qt::WA_DeleteOnClose, true);

  // Use (Album)Artist - Album as the window title
  QString title_text(song.effective_albumartist());
  if (!song.effective_album().isEmpty())
    title_text += " - " + song.effective_album();

  QLabel* label = new QLabel(dialog);
  label->setPixmap(AlbumCoverLoader::TryLoadPixmap(
      song.art_automatic(), song.art_manual(), song.url().toLocalFile()));

  // add (WxHpx) to the title before possibly resizing
  title_text += " (" + QString::number(label->pixmap()->width()) + "x" +
                QString::number(label->pixmap()->height()) + "px)";

  // if the cover is larger than the screen, resize the window
  // 85% seems to be enough to account for title bar and taskbar etc.
  QDesktopWidget desktop;
  int current_screen = desktop.screenNumber(this);
  int desktop_height = desktop.screenGeometry(current_screen).height();
  int desktop_width = desktop.screenGeometry(current_screen).width();

  // resize differently if monitor is in portrait mode
  if (desktop_width < desktop_height) {
    const int new_width = (double)desktop_width * 0.95;
    if (new_width < label->pixmap()->width()) {
      label->setPixmap(
          label->pixmap()->scaledToWidth(new_width, Qt::SmoothTransformation));
    }
  } else {
    const int new_height = (double)desktop_height * 0.85;
    if (new_height < label->pixmap()->height()) {
      label->setPixmap(label->pixmap()->scaledToHeight(
          new_height, Qt::SmoothTransformation));
    }
  }

  dialog->setWindowTitle(title_text);
  dialog->setFixedSize(label->pixmap()->size());
  dialog->show();
}
Example #16
0
void Dialog::ouvrirAbout()
{
    QDialog *APropos = new QDialog(this, Qt::WindowCloseButtonHint);
    APropos->setFixedSize(300, 200);
    APropos->setWindowTitle("A Propos de QColor Slider RGB");

    QTabWidget *tab = new QTabWidget(APropos);      //QTABWIDGET incluant un QLabel et deux QTextEdit
    tab->setGeometry(5, 5, 290, 190);

    QLabel *infos = new QLabel(APropos);
    infos->setTextFormat(Qt::RichText); //format texte RTF
    infos->setText("<P><h3>QColor Slider RGB</h3></p><p>Créer par Pierre Leroux</p><p>Compilé le 12/01/2012<p><p>Version 1.0</p>");
    infos->setAlignment(Qt::AlignCenter);

    QTextEdit *Alire = new QTextEdit(APropos);
    Alire->setText("Ce programme est fournit « EN L'ÉTAT », SANS GARANTIE D'AUCUNE SORTE, INCLUANT, SANS S'Y LIMITER, LES GARANTIES D'ABSENCE DE DÉFAUT, DE QUALITÉ MARCHANDE, D'ADÉQUATION À UN USAGE PARTICULIER.");
    Alire->setReadOnly(true);

    QTextEdit *licence = new QTextEdit(APropos);
    licence->setText("<p>This program is free software: you can redistribute it and/or modify"
                     "it under the terms of the GNU General Public License as published by"
                     "the Free Software Foundation, either version 3 of the License, or"
                     "(at your option) any later version."
                     "This program is distributed in the hope that it will be useful,"
                     "but WITHOUT ANY WARRANTY; without even the implied warranty of"
                     "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the"
                     "GNU General Public License for more details."
                     "You should have received a copy of the GNU General Public License"
                     "along with this program. If not, see http://www.gnu.org/licenses/.</p>");

    licence->setReadOnly(true);

    tab->addTab(infos, "Information");
    tab->addTab(Alire, "A lire");
    tab->addTab(licence, "GNU General Public License");

    APropos->exec();    //ouverture de la fenetre
}
void VersionControl::openInfo()
{
    QDialog* dialog = new QDialog();
    dialog->setFixedSize(400, 175);
    dialog->setWindowTitle("Versions Info");

    QLabel* labelName = new QLabel;
    labelName->setText("Version: ");

    QLabel* labelNum = new QLabel;
    labelNum->setText(versionText);

    QPushButton* closeButton = new QPushButton("Close", dialog);

    QGridLayout* layout = new QGridLayout(dialog);
    layout->addWidget(labelName, 0, 0);
    layout->addWidget(labelNum, 0, 1, 1, 2);
    layout->addWidget(closeButton, 1, 1);

    QObject::connect(closeButton, SIGNAL(clicked()), dialog, SLOT(close()));

    dialog->exec();
}
Example #18
0
bool QVideoCapture::open_resolutionDialog()
{
    if (m_cvCapture.isOpened() && deviceFlag)
    {
        //GUI CONSTRUCTION//
        QDialog dialog;
        dialog.setFixedSize(200,180);
        dialog.setWindowTitle(tr("Camcorder resolution"));

        QVBoxLayout toplevellayout;
        toplevellayout.setMargin(5);

        QVBoxLayout layout;
        layout.setMargin(5);
        QGroupBox groupbox;
        groupbox.setTitle("Resolution & framerate");
        QVBoxLayout comboboxes;
        comboboxes.setMargin(5);
        QComboBox CBresolution;
        CBresolution.addItem("640 x 360"); // 0
        CBresolution.addItem("640 x 480"); // 1
        CBresolution.addItem("800 x 600"); // 2
        CBresolution.addItem("960 x 720"); // 3
        CBresolution.addItem("1280 x 720"); // 4
        CBresolution.addItem("1920 x 1080"); // 5
        CBresolution.setSizeAdjustPolicy(QComboBox::AdjustToContents);
        CBresolution.setCurrentIndex(1);
        QLabel Lresolution("Set resolution:");
        QComboBox CBm_framerate(&dialog);
        CBm_framerate.addItem("30 fps"); // 0
        CBm_framerate.addItem("25 fps"); // 1
        CBm_framerate.addItem("20 fps"); // 2
        CBm_framerate.addItem("15 fps"); // 3
        CBm_framerate.addItem("60 fps"); // 4
        CBm_framerate.setSizeAdjustPolicy(QComboBox::AdjustToContents);
        CBm_framerate.setCurrentIndex(0);
        QLabel Lm_framerate("Set framerate:");
        comboboxes.addWidget(&Lresolution,1,Qt::AlignLeft);
        comboboxes.addWidget(&CBresolution);
        comboboxes.addWidget(&Lm_framerate,1,Qt::AlignLeft);
        comboboxes.addWidget(&CBm_framerate);
        groupbox.setLayout(&comboboxes);
        layout.addWidget(&groupbox);

        QHBoxLayout buttons;
        buttons.setMargin(5);
        QPushButton Baccept;
        Baccept.setText("Accept");
        connect(&Baccept, SIGNAL(clicked()), &dialog, SLOT(accept()));
        QPushButton Bcancel;
        Bcancel.setText("Cancel");
        connect(&Bcancel, SIGNAL(clicked()), &dialog, SLOT(reject()));
        buttons.addWidget(&Baccept);
        buttons.addWidget(&Bcancel);

        toplevellayout.addLayout(&layout);
        toplevellayout.addLayout(&buttons);
        dialog.setLayout(&toplevellayout);
        //GUI CONSTRUCTION END//

        if(dialog.exec() == QDialog::Accepted)
        {
            m_cvCapture.set( CV_CAP_PROP_FRAME_WIDTH, CBresolution.itemText(CBresolution.currentIndex()).section(" x ",0,0).toDouble() );
            m_cvCapture.set( CV_CAP_PROP_FRAME_HEIGHT, CBresolution.itemText(CBresolution.currentIndex()).section(" x ",1,1).toDouble() );
            pt_timer->setInterval( 1000/CBm_framerate.itemText(CBm_framerate.currentIndex()).section(" ",0,0).toDouble() );
        }
        return true;
    }
    return false; // will return false if device was not opened or dialog.exec() == QDialog::Rejected
}
Example #19
0
void ccRenderingTools::ShowDepthBuffer(ccGBLSensor* sensor, QWidget* parent/*=0*/, unsigned maxDim/*=1024*/)
{
	if (!sensor)
		return;

	const ccGBLSensor::DepthBuffer& depthBuffer = sensor->getDepthBuffer();
	if (depthBuffer.zBuff.empty())
		return;

	//determine min and max depths
	ScalarType minDist = 0.0f;
	ScalarType maxDist = 0.0f;
	{
		const ScalarType* _zBuff = &(depthBuffer.zBuff.front());
		double sumDist = 0.0;
		double sumDist2 = 0.0;
		unsigned count = 0;
		for (unsigned x=0; x<depthBuffer.height*depthBuffer.width; ++x,++_zBuff)
		{
			if (x == 0)
			{
				maxDist = minDist = *_zBuff;
			}
			else if (*_zBuff > 0)
			{
				maxDist = std::max(maxDist,*_zBuff);
				minDist = std::min(minDist,*_zBuff);
			}

			if (*_zBuff > 0)
			{
				sumDist += *_zBuff;
				sumDist2 += *_zBuff * *_zBuff;
				++count;
			}
		}

		if (count)
		{
			double avg = sumDist / count;
			double stdDev = sqrt(fabs(sumDist2 / count - avg*avg));
			//for better dynamics
			maxDist = std::min(maxDist, static_cast<ScalarType>(avg + 1.0 * stdDev));
		}
	}

	QImage bufferImage(depthBuffer.width, depthBuffer.height, QImage::Format_RGB32);
	{
		ccColorScale::Shared colorScale = ccColorScalesManager::GetDefaultScale();
		assert(colorScale);
		ScalarType coef = maxDist - minDist < ZERO_TOLERANCE ? 0 : static_cast<ScalarType>(ccColorScale::MAX_STEPS - 1) / (maxDist - minDist);

		const ScalarType* _zBuff = &(depthBuffer.zBuff.front());
		for (unsigned y=0; y<depthBuffer.height; ++y)
		{
			for (unsigned x=0; x<depthBuffer.width; ++x,++_zBuff)
			{
				const ccColor::Rgba& col = (*_zBuff >= minDist ? colorScale->getColorByIndex(static_cast<unsigned>((std::min(maxDist,*_zBuff)-minDist)*coef)) : ccColor::black);
				bufferImage.setPixel(x, depthBuffer.height - 1 - y, qRgb(col.r, col.g, col.b));
			}
		}
	}

	QDialog* dlg = new QDialog(parent);
	dlg->setWindowTitle(QString("%0 depth buffer [%1 x %2]").arg(sensor->getParent()->getName()).arg(depthBuffer.width).arg(depthBuffer.height));

	unsigned maxDBDim = std::max<unsigned>(depthBuffer.width, depthBuffer.height);
	unsigned scale = 1;
	while (maxDBDim > maxDim)
	{
		maxDBDim >>= 1;
		scale <<= 1;
	}
	dlg->setFixedSize(bufferImage.size()/scale);

	QVBoxLayout* vboxLayout = new QVBoxLayout(dlg);
	vboxLayout->setContentsMargins(0,0,0,0);
	QLabel* label = new QLabel(dlg);
	label->setScaledContents(true);
	vboxLayout->addWidget(label);

	label->setPixmap(QPixmap::fromImage(bufferImage));
	dlg->show();
}
Example #20
0
void DossierEditeur::ajouterInscription()
{
    try
    {
        QDialog* window = new QDialog(this);
        QGridLayout* lay = new QGridLayout;
        QPushButton* ok = new QPushButton("Ok");
        QComboBox *ListeUV= new QComboBox(this);
        QComboBox *ListeCursus= new QComboBox(this);
        QComboBox *ListeResultat= new QComboBox(this);
        QComboBox *ListeSaison= new QComboBox(this);
        QLineEdit *Annee= new QLineEdit(this);
        QLabel* UVLabel= new QLabel("UV : ",this);
        QLabel* cursusLabel= new QLabel("Cursus : ",this);
        QLabel* resultatLabel= new QLabel("Note : ",this);
        QLabel* saisonLabel= new QLabel("Saison : ",this);
        QLabel* anneeLabel = new QLabel("Année : ",this);
        window->setFixedSize(300, 400);

        UV** uvs = UVManager::getInstance().getUVs();
        for(unsigned int i=0;i<UVManager::getInstance().getNbUV(); i++)
        {
            ListeUV->addItem(uvs[i]->getCode());
        }


        for(Note n = first; n <= last; n = Note(n+1))
            ListeResultat->addItem(NoteToString(n));

        for(int i = 0; i < FormationManager::getInstance().getTaille(); i++)
            ListeCursus->addItem(FormationManager::getInstance().getElement(i).getCode());
        ListeSaison->addItem("Automne");
        ListeSaison->addItem("Printemps");

        lay->addWidget(UVLabel,0,0);
        lay->addWidget(cursusLabel,1,0);
        lay->addWidget(resultatLabel,2,0);
        lay->addWidget(saisonLabel,3,0);
        lay->addWidget(anneeLabel,4,0);
        lay->addWidget(ListeUV,0,1);
        lay->addWidget(ListeCursus,1,1);
        lay->addWidget(ListeResultat,2,1);
        lay->addWidget(ListeSaison,3,1);
        lay->addWidget(Annee,4,1);
        lay->addWidget(ok,5,1,Qt::AlignHCenter);

        window->setLayout(lay);

        connect(ok,SIGNAL(clicked()),window,SLOT(accept()));
        window->exec();

        if(window->result())
        {
            if(Annee->text().isEmpty())
                throw UTProfilerException("Ne laissez pas l'année vide !");

            UV& uv = UVManager::getInstance().getUV(ListeUV->currentText());
            Semestre s(StringToSaison(ListeSaison->currentText()),Annee->text().toUInt());
            Dossier::getInstance().ajouterInscription(uv,StringToNote(ListeResultat->currentText()),s,ListeCursus->currentText());
            QMessageBox::information(this,"Ajout d'une inscription", QString("Ajout de la catégorie ")+ListeUV->currentText()+" réussie.");
            dossier->setRowCount(Dossier::getInstance().getTaille());

            QTableWidgetItem *monItem = new QTableWidgetItem(ListeUV->currentText());
            dossier->setItem(Dossier::getInstance().getTaille() -1,0,monItem);

            monItem = new QTableWidgetItem(s.FormeContracte());
            dossier->setItem(Dossier::getInstance().getTaille() -1,1,monItem);

            monItem = new QTableWidgetItem(ListeResultat->currentText());
            dossier->setItem(Dossier::getInstance().getTaille() -1,2,monItem);

            monItem = new QTableWidgetItem(ListeCursus->currentText());
            dossier->setItem(Dossier::getInstance().getTaille() -1,3,monItem);
        }
    }
    catch(UTProfilerException& e)
    {
        QMessageBox::warning(this, "Ajout d'inscription", e.getInfo());
    }
}
Example #21
0
void DossierEditeur::afficherProfil()
{
    try
    {
        QDialog* window = new QDialog(this);
        QGridLayout* lay = new QGridLayout;
        QPushButton* ok = new QPushButton("Ok");
        window->setWindowTitle("Profil");
        window->setFixedSize(400, 400);

        QStringList Formation = Dossier::getInstance().ListeCursus();
        int j = 1;
        QTableWidget* valide = new QTableWidget(1,1,this);
        QTableWidget* non_valide = new QTableWidget(1,1,this);
        QLabel* valideLabel = new QLabel("Validé :",this);
        QLabel* NonvalideLabel = new QLabel("A Valider :",this);
        valide->horizontalHeader()->hide();
        non_valide->horizontalHeader()->hide();
        valide->verticalHeader()->hide();
        non_valide->verticalHeader()->hide();
        valide->setMaximumSize(50,25);
        non_valide->setMaximumSize(50,25);

        QTableWidgetItem* ItemValide = new QTableWidgetItem("");
        ItemValide->setBackground(Qt::red);
        valide->setItem(0,0,ItemValide);

        QTableWidgetItem* ItemNonValide = new QTableWidgetItem("");
        ItemNonValide ->setBackground(Qt::gray);
        non_valide->setItem(0,0,ItemNonValide);
        //Tableaus affichant le nombre de crédits obtenu par catégorie
        for(QList<QString>::iterator it1 = Formation.begin(); it1 < Formation.end(); ++it1)
        {
            QMap<QString, unsigned int> ListeProfil = Dossier::getInstance().ListeProfil(*it1);
            QStringList P = ListeProfil.keys();
            QTableWidget* tab = new QTableWidget(1,ListeProfil.size(),this);
            tab->setHorizontalHeaderLabels(P);
            tab->setSelectionBehavior(QAbstractItemView::SelectRows);
            tab->verticalHeader()->hide();


            int i = 0;
            for(QList<QString>::iterator it2 = P.begin(); it2 < P.end(); ++it2)
            {
                QString cr; cr.setNum(ListeProfil[*it2]);
                QString creditFormation; creditFormation.setNum(FormationManager::getInstance().getFormation(*it1).getProfil(*it2));
                QString credit = cr +QString("(")+creditFormation+QString(")");
                QTableWidgetItem* monItem = new QTableWidgetItem(credit);
                if(FormationManager::getInstance().isFinished(*it1,*it2,ListeProfil[*it2]))
                    monItem->setBackground(Qt::red);
                else
                    monItem->setBackground(Qt::gray);
                tab->setItem(0,i,monItem);
                i++;
            }
            QLabel* form = new QLabel(*it1,this);
            lay->addWidget(form,j,0,1,3,Qt::AlignLeft);
            lay->addWidget(tab,j,1,1,3,Qt::AlignJustify);
            j++;
        }

        lay->addWidget(valideLabel,0,0);
        lay->addWidget(valide,0,1);
        lay->addWidget(NonvalideLabel,0,2);
        lay->addWidget(non_valide,0,3);
        lay->addWidget(ok,j,1,Qt::AlignHCenter);
        window->setLayout(lay);

        connect(ok,SIGNAL(clicked()),window,SLOT(accept()));
        window->exec();

        if(window->result())
        {

        }

    }
    catch(UTProfilerException& e)
    {
        QMessageBox::warning(this, "Ajout d'inscription", e.getInfo());
    }
}
Example #22
0
//-----------------------------------------------------------------------------------------
QDialog *createDialog(int width, int height, void *guiobj)
{
    QDialog *dlg = new QDialog(QApplication::activeWindow());
    dlg->setFixedSize(width, height);
    return dlg;
}
Example #23
0
static bool getConfig(QWidget *parent, sigen::interface::Options *options) {
  // http://vivi.dyndns.org/vivi/docs/Qt/layout.html
  QFormLayout *fLayout = new QFormLayout(parent);
  fLayout->setLabelAlignment(Qt::AlignRight);

  // http://doc.qt.io/qt-4.8/qlineedit.html
  QLineEdit *sxy_lineEdit = addDoubleEdit("1.0", parent);
  fLayout->addRow(QObject::tr("Scale XY"), sxy_lineEdit);

  QLineEdit *sz_lineEdit = addDoubleEdit("1.0", parent);
  fLayout->addRow(QObject::tr("Scale Z"), sz_lineEdit);

  QCheckBox *interp_checkbox = new QCheckBox("Interpolation", parent);
  interp_checkbox->setCheckState(Qt::Checked);
  fLayout->addRow("", interp_checkbox);

  QLineEdit *vt_lineEdit = addIntEdit("0", parent);
  fLayout->addRow(QObject::tr("Interpolation VT"), vt_lineEdit);

  QLineEdit *dt_lineEdit = addDoubleEdit("0.0", parent);
  fLayout->addRow(QObject::tr("Interpolation DT"), dt_lineEdit);

  // http://www.qtforum.org/article/2430/qcheckbox.html
  QObject::connect(interp_checkbox, SIGNAL(toggled(bool)), vt_lineEdit, SLOT(setEnabled(bool)));
  QObject::connect(interp_checkbox, SIGNAL(toggled(bool)), dt_lineEdit, SLOT(setEnabled(bool)));

  QCheckBox *smoothing_checkbox = new QCheckBox("Smoothing", parent);
  smoothing_checkbox->setCheckState(Qt::Checked);
  fLayout->addRow("", smoothing_checkbox);

  QLineEdit *sm_lineEdit = addIntEdit("0", parent);
  fLayout->addRow(QObject::tr("Smoothing Level"), sm_lineEdit);

  QObject::connect(smoothing_checkbox, SIGNAL(toggled(bool)), sm_lineEdit, SLOT(setEnabled(bool)));

  QCheckBox *clipping_checkbox = new QCheckBox("Clipping", parent);
  clipping_checkbox->setCheckState(Qt::Checked);
  fLayout->addRow("", clipping_checkbox);

  QLineEdit *cl_lineEdit = addIntEdit("0", parent);
  fLayout->addRow(QObject::tr("Clipping Level"), cl_lineEdit);

  QObject::connect(clipping_checkbox, SIGNAL(toggled(bool)), cl_lineEdit, SLOT(setEnabled(bool)));

  QDialogButtonBox *buttonBox = new QDialogButtonBox(
      QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
      Qt::Horizontal,
      parent);

  QVBoxLayout *vLayout = new QVBoxLayout(parent);
  vLayout->addLayout(fLayout);
  vLayout->addWidget(buttonBox);

  QDialog *dialog = new QDialog(parent);
  dialog->setWindowTitle("SIGEN");
  dialog->setLayout(vLayout);
  dialog->setFixedSize(dialog->sizeHint());

  QObject::connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
  QObject::connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));

  bool retval;
  switch (dialog->exec()) {
  case QDialog::Accepted:
    retval = true;
    break;
  case QDialog::Rejected:
    retval = false;
    break;
  default:
    assert(false);
    break;
  }

  // v3d_msg(vt_lineEdit->text() + "/" + dt_lineEdit->text() + "/" + sm_lineEdit->text() + "/" + cl_lineEdit->text(), true);

  if (retval) {
    options->scale_xy = sxy_lineEdit->text().toDouble();
    options->scale_z = sz_lineEdit->text().toDouble();

    options->enable_interpolation = interp_checkbox->checkState() == Qt::Checked;
    options->volume_threshold = vt_lineEdit->text().toInt();
    options->distance_threshold = dt_lineEdit->text().toDouble();

    options->enable_smoothing = smoothing_checkbox->checkState() == Qt::Checked;
    options->smoothing_level = sm_lineEdit->text().toInt();

    options->enable_clipping = clipping_checkbox->checkState() == Qt::Checked;
    options->clipping_level = cl_lineEdit->text().toInt();
  }

  return retval;
}
Example #24
0
bool QSoundProcessor::open_format_dialog()
{
    QDialog dialog;
    dialog.setWindowTitle(tr("Audio format"));
    dialog.setFixedSize(320,320);

    QVBoxLayout central_layout;
    central_layout.setMargin(5);

    QHBoxLayout L_buttons;
    QPushButton B_apply(tr("Apply"));
    B_apply.setToolTip(tr("Apply format"));
    connect(&B_apply, SIGNAL(clicked()), &dialog, SLOT(accept()));
    QPushButton B_default(tr("Default"));
    B_default.setToolTip(tr("Set default values and close dialog"));
    connect(&B_default, SIGNAL(clicked()), this, SLOT(set_default_format()));
    connect(&B_default, SIGNAL(clicked()), &dialog, SLOT(reject()));
    QPushButton B_cancel(tr("Cancel"));
    B_cancel.setToolTip(tr("Close dialog without save"));
    connect(&B_cancel, SIGNAL(clicked()), &dialog, SLOT(reject()));
    L_buttons.addWidget(&B_apply);
    L_buttons.addWidget(&B_default);
    L_buttons.addWidget(&B_cancel);

    QTabWidget TW_controls;

    QWidget Sampleproperties_page;
        QVBoxLayout L_sampleproperties;
        L_sampleproperties.setMargin(5);

            QGroupBox GB_samplerate;
            GB_samplerate.setTitle(tr("Sample rate"));
            QVBoxLayout L_samplerate;
            QComboBox CB_samplerate;
                QList<int> samplerate = m_device_info.supportedSampleRates();
                for(int i = 0; i < samplerate.size(); i++)
                {
                    CB_samplerate.addItem( QString::number(samplerate.at(i)), qVariantFromValue(samplerate.at(i)) );
                }
            L_samplerate.addWidget(&CB_samplerate);
            GB_samplerate.setLayout(&L_samplerate);

            QGroupBox GB_samplesize;
            GB_samplesize.setTitle(tr("Sample size"));
            QVBoxLayout L_samplesize;
            QComboBox CB_samplesize;
                QList<int> samplesize = m_device_info.supportedSampleSizes();
                for(int i = 0; i < samplesize.size(); i++)
                {
                    CB_samplesize.addItem( QString::number(samplesize.at(i)) , qVariantFromValue(samplesize.at(i)) );
                }
            L_samplesize.addWidget(&CB_samplesize);
            GB_samplesize.setLayout(&L_samplesize);

            QGroupBox GB_byteorder;
            GB_byteorder.setTitle(tr("Byte order"));
            QVBoxLayout L_byteorder;
            QComboBox CB_byteorder;
            QList<QAudioFormat::Endian> byteorder = m_device_info.supportedByteOrders();
                for(int i = 0; i < byteorder.size(); i++)
                {
                    switch (byteorder.at(i))
                    {
                        case 0:
                            CB_byteorder.addItem( "BigEndian" , qVariantFromValue(byteorder.at(i)) );
                            break;
                        case 1:
                            CB_byteorder.addItem( "LittleEndian" , qVariantFromValue(byteorder.at(i)) );
                            break;
                        default:
                            CB_byteorder.addItem( QString::number(byteorder.at(i)) , qVariantFromValue(byteorder.at(i)) );
                            break;
                    }
                }
            L_byteorder.addWidget(&CB_byteorder);
            GB_byteorder.setLayout(&L_byteorder);

            QGroupBox GB_sampletype;
            GB_sampletype.setTitle(tr("Sample type"));
            QVBoxLayout L_sampletype;
            QComboBox CB_sampletype;
            QList<QAudioFormat::SampleType> sampletype = m_device_info.supportedSampleTypes();
                for(int i = 0; i < sampletype.size(); i++)
                {
                    switch (sampletype.at(i))
                    {
                        case 0:
                            CB_sampletype.addItem( "Unknown", qVariantFromValue(sampletype.at(i)) );
                            break;
                        case 1:
                            CB_sampletype.addItem( "SignedInt", qVariantFromValue(sampletype.at(i)) );
                            break;
                        case 2:
                            CB_sampletype.addItem( "UnSignedInt", qVariantFromValue(sampletype.at(i)) );
                            break;
                        case 3:
                            CB_sampletype.addItem( "Float", qVariantFromValue(sampletype.at(i)) );
                            break;
                        default:
                            CB_sampletype.addItem( QString::number(sampletype.at(i)), qVariantFromValue(sampletype.at(i)) );
                            break;
                    }
                }
            L_sampletype.addWidget(&CB_sampletype);
            GB_sampletype.setLayout(&L_sampletype);

        L_sampleproperties.addWidget(&GB_samplerate);
        L_sampleproperties.addWidget(&GB_samplesize);
        L_sampleproperties.addWidget(&GB_byteorder);
        L_sampleproperties.addWidget(&GB_sampletype);
    Sampleproperties_page.setLayout(&L_sampleproperties);

    QWidget Otherproperties_page;

        QVBoxLayout L_otherproperties;
        L_otherproperties.setMargin(5);

            QGroupBox GB_channelcount;
            GB_channelcount.setTitle(tr("Channels count"));
            QVBoxLayout L_channelcount;
            QComboBox CB_channelcount;
                QList<int> channels = m_device_info.supportedChannelCounts();
                for(int i = 0; i < channels.size(); i++)
                {
                    CB_channelcount.addItem( QString::number(channels.at(i)), qVariantFromValue(channels.at(i)) );
                }
            L_channelcount.addWidget(&CB_channelcount);
            GB_channelcount.setLayout(&L_channelcount);

            QGroupBox GB_codecname;
            GB_codecname.setTitle(tr("Audio codec"));
            QVBoxLayout L_codecname;
            QComboBox CB_codecname;
            CB_codecname.addItems( m_device_info.supportedCodecs());
            L_codecname.addWidget(&CB_codecname);
            GB_codecname.setLayout(&L_codecname);

        L_otherproperties.addWidget(&GB_channelcount);
        L_otherproperties.addWidget(&GB_codecname);
    Otherproperties_page.setLayout(&L_otherproperties);


    TW_controls.addTab(&Sampleproperties_page, tr("Sample"));
    TW_controls.addTab(&Otherproperties_page, tr("Channels/codec"));
    central_layout.addWidget(&TW_controls);
    central_layout.addLayout(&L_buttons);
    dialog.setLayout(&central_layout);

    if(dialog.exec() == QDialog::Accepted)
    {
        this->set_format_samplerate( CB_samplerate.currentData().value<int>() );
        this->set_format_samplesize( CB_samplesize.currentData().value<int>() );
        this->set_format_byteorder( CB_byteorder.currentData().value<QAudioFormat::Endian>() );
        this->set_format_sampletype( CB_sampletype.currentData().value<QAudioFormat::SampleType>() );
        this->set_format_channelcount( CB_channelcount.currentData().value<int>() );
        this->set_format_codecname( CB_codecname.currentText() );
        return true;
    }
    return false;
}
Example #25
0
bool QVideoCapture::open_settingsDialog()
{
    if (m_cvCapture.isOpened() && deviceFlag)
    {
        //DIALOG CONSTRUCTION//
        QDialog dialog;
        dialog.setFixedSize(256,320);
        dialog.setWindowTitle(tr("Camcorder settings"));

        QVBoxLayout toplevellayout;
        toplevellayout.setMargin(5);
        QTabWidget tabwidget;

        QWidget page1; // a widget for a cam general settings selection
        QHBoxLayout centralbox;
        centralbox.setMargin(5);
        QVBoxLayout sliders;
        sliders.setMargin(5);
        QVBoxLayout lineedits;
        lineedits.setMargin(5);
        QVBoxLayout names;
        names.setMargin(5);

        QSlider Sbrightness;
        Sbrightness.setOrientation(Qt::Horizontal);
        Sbrightness.setMinimum(MIN_BRIGHTNESS);
        Sbrightness.setMaximum(MAX_BRIGHTNESS);
        Sbrightness.setValue( (int)m_cvCapture.get(CV_CAP_PROP_BRIGHTNESS) );
        QLabel Lbrightness;
        Lbrightness.setNum( (int)m_cvCapture.get(CV_CAP_PROP_BRIGHTNESS) );
        connect(&Sbrightness, SIGNAL(valueChanged(int)), &Lbrightness, SLOT(setNum(int)));
        connect(&Sbrightness, SIGNAL(valueChanged(int)), this, SLOT(set_brightness(int)));
        connect(this, SIGNAL(set_default_brightness(int)), &Sbrightness, SLOT(setValue(int)));
        QLabel Nbrightness("Brightness:");

        QSlider Scontrast;
        Scontrast.setOrientation(Qt::Horizontal);
        Scontrast.setMinimum(MIN_CONTRAST);
        Scontrast.setMaximum(MAX_CONTRAST);
        Scontrast.setValue( (int)m_cvCapture.get(CV_CAP_PROP_CONTRAST) );
        QLabel Lcontrast;
        Lcontrast.setNum( (int)m_cvCapture.get(CV_CAP_PROP_CONTRAST) );
        connect(&Scontrast, SIGNAL(valueChanged(int)), &Lcontrast, SLOT(setNum(int)));
        connect(&Scontrast,SIGNAL(valueChanged(int)), this, SLOT(set_contrast(int)));
        connect(this, SIGNAL(set_default_contrast(int)), &Scontrast, SLOT(setValue(int)));
        QLabel Ncontrast("Contrast:");

        QSlider Ssaturation;
        Ssaturation.setOrientation(Qt::Horizontal);
        Ssaturation.setMinimum(MIN_SATURATION);
        Ssaturation.setMaximum(MAX_SATURATION);
        Ssaturation.setValue( (int)m_cvCapture.get(CV_CAP_PROP_SATURATION) );
        QLabel Lsaturation;
        Lsaturation.setNum( (int)m_cvCapture.get(CV_CAP_PROP_SATURATION) );
        connect(&Ssaturation, SIGNAL(valueChanged(int)), &Lsaturation, SLOT(setNum(int)));
        connect(&Ssaturation,SIGNAL(valueChanged(int)), this, SLOT(set_saturation(int)));
        connect(this, SIGNAL(set_default_saturation(int)), &Ssaturation, SLOT(setValue(int)));
        QLabel Nsaturation("Saturation:");

        QSlider SwhitebalanceU;
        SwhitebalanceU.setOrientation(Qt::Horizontal);
        SwhitebalanceU.setMinimum(MIN_WHITE_BALANCE);
        SwhitebalanceU.setMaximum(MAX_WHITE_BALANCE);
        SwhitebalanceU.setValue( (int)m_cvCapture.get(CV_CAP_PROP_WHITE_BALANCE_BLUE_U) );
        QLabel LwhitebalanceU;
        LwhitebalanceU.setNum( (int)m_cvCapture.get(CV_CAP_PROP_WHITE_BALANCE_BLUE_U) );
        connect(&SwhitebalanceU, SIGNAL(valueChanged(int)), &LwhitebalanceU, SLOT(setNum(int)));
        connect(&SwhitebalanceU,SIGNAL(valueChanged(int)), this, SLOT(set_white_balanceU(int)));
        connect(this, SIGNAL(set_default_white_balanceU(int)), &SwhitebalanceU, SLOT(setValue(int)));
        QLabel NwhitebalanceU("White_balanceU:");

        QSlider SwhitebalanceV;
        SwhitebalanceV.setOrientation(Qt::Horizontal);
        SwhitebalanceV.setMinimum(MIN_WHITE_BALANCE);
        SwhitebalanceV.setMaximum(MAX_WHITE_BALANCE);
        SwhitebalanceV.setValue( (int)m_cvCapture.get(CV_CAP_PROP_WHITE_BALANCE_RED_V) );
        QLabel LwhitebalanceV;
        LwhitebalanceV.setNum( (int)m_cvCapture.get(CV_CAP_PROP_WHITE_BALANCE_RED_V) );
        connect(&SwhitebalanceV, SIGNAL(valueChanged(int)), &LwhitebalanceV, SLOT(setNum(int)));
        connect(&SwhitebalanceV,SIGNAL(valueChanged(int)), this, SLOT(set_white_balanceV(int)));
        connect(this, SIGNAL(set_default_white_balanceV(int)), &SwhitebalanceV, SLOT(setValue(int)));
        QLabel NwhitebalanceV("White_balanceV:");

        sliders.addWidget(&Sbrightness);
        lineedits.addWidget(&Lbrightness, 2);
        names.addWidget(&Nbrightness, 1);

        sliders.addWidget(&Scontrast);
        lineedits.addWidget(&Lcontrast, 2);
        names.addWidget(&Ncontrast, 1);

        sliders.addWidget(&Ssaturation);
        lineedits.addWidget(&Lsaturation, 2);
        names.addWidget(&Nsaturation, 1);

        sliders.addWidget(&SwhitebalanceU);
        lineedits.addWidget(&LwhitebalanceU, 2);
        names.addWidget(&NwhitebalanceU, 1);

        sliders.addWidget(&SwhitebalanceV);
        lineedits.addWidget(&LwhitebalanceV, 2);
        names.addWidget(&NwhitebalanceV, 1);

        centralbox.addLayout(&names);
        centralbox.addLayout(&sliders);
        centralbox.addLayout(&lineedits);
        page1.setLayout( &centralbox );

        QWidget page2; // a widget for a cam gain/exposure selection
        QHBoxLayout centralbox2;
        centralbox2.setMargin(5);
        QVBoxLayout sliders2;
        sliders2.setMargin(5);
        QVBoxLayout lineedits2;
        lineedits2.setMargin(5);
        QVBoxLayout names2;
        names2.setMargin(5);

        QSlider Sgain;
        Sgain.setOrientation(Qt::Horizontal);
        Sgain.setMinimum(MIN_GAIN);
        Sgain.setMaximum(MAX_GAIN);
        Sgain.setValue( (int)m_cvCapture.get(CV_CAP_PROP_GAIN) );
        QLabel Lgain;
        Lgain.setNum( (int)m_cvCapture.get(CV_CAP_PROP_GAIN) );
        connect(&Sgain, SIGNAL(valueChanged(int)), &Lgain, SLOT(setNum(int)));
        connect(&Sgain,SIGNAL(valueChanged(int)), this, SLOT(set_gain(int)));
        connect(this, SIGNAL(set_default_gain(int)), &Sgain, SLOT(setValue(int)),Qt::DirectConnection);
        QLabel Ngain("Gain:");

        QSlider Sexposure;
        Sexposure.setOrientation(Qt::Horizontal);
        Sexposure.setMinimum(MIN_EXPOSURE);
        Sexposure.setMaximum(MAX_EXPOSURE);
        Sexposure.setValue( (int)m_cvCapture.get(CV_CAP_PROP_EXPOSURE) );
        QLabel Lexposure;
        Lexposure.setNum( (int)m_cvCapture.get(CV_CAP_PROP_EXPOSURE) );
        connect(&Sexposure, SIGNAL(valueChanged(int)), &Lexposure, SLOT(setNum(int)));
        connect(&Sexposure,SIGNAL(valueChanged(int)), this, SLOT(set_exposure(int)));
        connect(this, SIGNAL(set_default_exposure(int)), &Sexposure, SLOT(setValue(int)));
        QLabel Nexposure("Exposure:");

        sliders2.addWidget(&Sgain);
        lineedits2.addWidget(&Lgain, 2);
        names2.addWidget(&Ngain, 1);

        sliders2.addWidget(&Sexposure);
        lineedits2.addWidget(&Lexposure, 2);
        names2.addWidget(&Nexposure, 1);

        centralbox2.addLayout(&names2);
        centralbox2.addLayout(&sliders2);
        centralbox2.addLayout(&lineedits2);
        page2.setLayout( &centralbox2 );


        QHBoxLayout buttons;
        buttons.setMargin(5);
        QPushButton Baccept;
        Baccept.setText(tr("Accept"));
        connect(&Baccept, SIGNAL(clicked()), &dialog, SLOT(accept()));
        QPushButton Bcancel;
        Bcancel.setText(tr("Cancel"));
        connect(&Bcancel, SIGNAL(clicked()), &dialog, SLOT(reject()));
        QPushButton Bdefault;
        Bdefault.setText(tr("Default"));
        connect(&Bdefault, SIGNAL(clicked()), this, SLOT(set_default_settings()));
        buttons.addWidget(&Baccept);
        buttons.addWidget(&Bcancel);
        buttons.addWidget(&Bdefault);

        tabwidget.addTab(&page1, "Brightness/Contrast");
        tabwidget.addTab(&page2, "Gain/Exposure");
        toplevellayout.addWidget(&tabwidget);
        toplevellayout.addLayout(&buttons);
        dialog.setLayout(&toplevellayout);
        //DIALOG CONSTRUCTION END//
        dialog.exec();
        return true;
    }
Example #26
-1
void MainWindow::aboutCredits() {
    QDialog *dialog = new QDialog( this );

    QTextEdit *qteCreditsWritten = new QTextEdit( dialog );
        qteCreditsWritten->setReadOnly( 1 );
        qteCreditsWritten->setLineWrapMode( QTextEdit::NoWrap );
        qteCreditsWritten->setText( "Tim Kleinschmidt <*****@*****.**>" );

    QTextEdit *qteCreditsArtwork = new QTextEdit( dialog );
        qteCreditsArtwork->setReadOnly( 1 );
        qteCreditsArtwork->setLineWrapMode( QTextEdit::NoWrap );
        qteCreditsArtwork->setText( "Elementary Theme\n" );

    QTabWidget *qtwCredits = new QTabWidget( dialog );
        qtwCredits->addTab( qteCreditsWritten, tr( "Written by" ));
        qtwCredits->addTab( qteCreditsArtwork, tr( "Artwork by" ));
        qtwCredits->setElideMode( Qt::ElideRight );

    QPushButton *qpbClose = new QPushButton( IconLoader::Load( "window-close"), tr( "&Close" ), dialog );
        connect( qpbClose, SIGNAL( clicked()), dialog, SLOT( close()));

    qglDialog = new QGridLayout( dialog );
    qglDialog->addWidget( qtwCredits, 0, 0,Qt::AlignCenter );
    qglDialog->addWidget( qpbClose, 1, 0, Qt::AlignRight );

    dialog->setWindowTitle( tr( "Credits" ));
    dialog->setLayout( qglDialog );
    dialog->setFixedSize( 250, 200 );
    dialog->exec();
}