Esempio n. 1
0
	NewSoundDialog::NewSoundDialog(QWidget *parent, const SoundController *soundController) :
		QDialog(parent),
		soundController(soundController),
		sceneSound(nullptr)
	{
		this->setWindowTitle("New Sound");
		this->resize(530, 160);

		setupNameFields();
		setupSoundFilenameFields();
		setupSoundTypeFields();

		QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
		buttonBox->setGeometry(QRect(30, 120, 475, 22));
		buttonBox->setOrientation(Qt::Horizontal);
		buttonBox->setStandardButtons(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);

		QObject::connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
		QObject::connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
	}
Esempio n. 2
0
  /**
   * This method creates all the dialog boxes required for the
   * scatter plot window.  Called from the ScatterPlotWindow
   * constructor.
   * 
   */
  void ScatterPlotWindow::createDialogs(){
    QDialogButtonBox *configButtonBox;
    QLabel *label;
    QLabel *label2;
    QLabel *label3;

    p_configDialog = new QDialog();
    p_configDialog->setWindowTitle("Setup Scatter Plot");
    p_configDialog->setModal(true);

    configButtonBox = new QDialogButtonBox(p_configDialog);
    configButtonBox->setGeometry(QRect(30, 200, 341, 32));
    configButtonBox->setOrientation(Qt::Horizontal);
    configButtonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok);

    p_cube1Label = new QLabel(p_configDialog);
    p_cube1Label->setText("Cube 1:");
    p_cube1Label->setGeometry(QRect(10, 70, 75, 27));

    p_cube1BandComboBox = new QComboBox(p_configDialog);
    p_cube1BandComboBox->setGeometry(QRect(250, 70, 60, 22));

    p_numBinsOne = new QLineEdit(p_configDialog);
    p_numBinsOne->setGeometry(QRect(320, 70, 40, 22));
    p_numBinsOne->setText("255");

    p_numBinsTwo = new QLineEdit(p_configDialog);
    p_numBinsTwo->setGeometry(QRect(320, 130, 40, 22));
    p_numBinsTwo->setText("255");

    p_cube2BandComboBox = new QComboBox(p_configDialog);
    p_cube2BandComboBox->setGeometry(QRect(250, 130, 60, 22));

    p_cube1ComboBox = new QComboBox(p_configDialog);
    p_cube1ComboBox->setGeometry(QRect(55, 70, 181, 25));
    QObject::connect(p_cube1ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(fillBands()));

    p_cube2ComboBox = new QComboBox(p_configDialog);
    p_cube2ComboBox->setGeometry(QRect(55, 130, 181, 25));
    QObject::connect(p_cube2ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(fillBands()));

    p_cube2Label = new QLabel(p_configDialog);
    p_cube2Label->setText("Cube 2:");
    p_cube2Label->setGeometry(QRect(10, 130, 75, 27));

    label = new QLabel(p_configDialog);
    label->setObjectName(QString::fromUtf8("label"));
    label->setText("Band");
    label->setGeometry(QRect(260, 40, 81, 20));

    label2 = new QLabel(p_configDialog);
    label2->setObjectName(QString::fromUtf8("label2"));
    label2->setText("Select 2 Cubes (may be the same cube.)");
    label2->setGeometry(QRect(10, 40, 230, 20));

    label3 = new QLabel(p_configDialog);
    label3->setText("# Bins");
    label3->setGeometry(QRect(320,40,70,20));


    QObject::connect(configButtonBox, SIGNAL(accepted()), this, SLOT(showScatterPlot()));
    QObject::connect(configButtonBox, SIGNAL(accepted()), p_configDialog, SLOT(accept()));
    QObject::connect(configButtonBox, SIGNAL(rejected()), this, SLOT(cancel()));

    // -------- End of p_configDialog

    QDialogButtonBox *minMaxButtonBox;
    QLabel *label_5;
    QLabel *label_4;
    QLabel *label_6;
    QLabel *label_2;
    QLabel *label_3;
    QLabel *label_0;
    p_minMaxDialog = new QDialog();

    p_minMaxDialog->resize(283, 300);
    minMaxButtonBox = new QDialogButtonBox(p_minMaxDialog);
    minMaxButtonBox->setGeometry(QRect(20, 250, 211, 32));
    minMaxButtonBox->setOrientation(Qt::Horizontal);
    minMaxButtonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok);

    p_yMaxEdit = new QLineEdit(p_minMaxDialog);
    p_yMaxEdit->setGeometry(QRect(100, 200, 113, 25));
    p_yMaxEdit->setText(QString::number(p_MaxTwo));
    p_yMinEdit = new QLineEdit(p_minMaxDialog);
    p_yMinEdit->setGeometry(QRect(100, 160, 113, 25));
    p_yMinEdit->setText(QString::number(p_MinTwo));
    p_xMaxEdit = new QLineEdit(p_minMaxDialog);
    p_xMaxEdit->setGeometry(QRect(100, 90, 113, 25));
    p_xMaxEdit->setText(QString::number(p_MaxOne));
    p_xMinEdit = new QLineEdit(p_minMaxDialog);
    p_xMinEdit->setGeometry(QRect(100, 50, 113, 25));
    p_xMinEdit->setText(QString::number(p_MinOne));
    label_5 = new QLabel(p_minMaxDialog);
    label_5->setGeometry(QRect(25, 170, 56, 17));
    label_4 = new QLabel(p_minMaxDialog);
    label_4->setGeometry(QRect(120, 130, 56, 17));
    
    label_6 = new QLabel(p_minMaxDialog);
    label_6->setGeometry(QRect(25, 210, 56, 17));
    label_2 = new QLabel(p_minMaxDialog);
    label_2->setGeometry(QRect(25, 60, 56, 17));
    label_3 = new QLabel(p_minMaxDialog);
    label_3->setGeometry(QRect(25, 100, 56, 17));
    label_0 = new QLabel(p_minMaxDialog);
    label_0->setGeometry(QRect(120, 20, 56, 17));

    p_minMaxDialog->setWindowTitle("Set Display Range");
    label_5->setText("Minimum");
    label_6->setText( "Maximum");
    label_2->setText("Minimum");
    label_3->setText("Maximum");
    label_0->setText("X-Axis");
    label_4->setText("Y-Axis");
    
    QObject::connect(minMaxButtonBox, SIGNAL(accepted()), this, SLOT(setUserValues()));
    QObject::connect(minMaxButtonBox, SIGNAL(accepted()), p_minMaxDialog, SLOT(accept()));
    QObject::connect(minMaxButtonBox, SIGNAL(rejected()), p_minMaxDialog, SLOT(reject()));

    // -------- End of p_minMaxDialog
  }
Esempio n. 3
0
void FilterChoice::initUI()
{
  QDialogButtonBox *buttonBox;
  QLabel *label;
  QLabel *label_2;

  this->setWindowTitle("FilterChoice");
  this->setMinimumSize(623, 374);
  buttonBox = new QDialogButtonBox(this);
  buttonBox->setGeometry(QRect(260, 310, 341, 32));
  buttonBox->setOrientation(Qt::Horizontal);
  buttonBox->setStandardButtons(QDialogButtonBox::Cancel);
  QPushButton* applyButton = buttonBox->addButton(QString::fromStdString("Apply"), QDialogButtonBox::ApplyRole);
  _deleteButton = buttonBox->addButton(QString::fromStdString("Delete"), QDialogButtonBox::ActionRole);
  _deleteButton->setGeometry(QRect(310, 310, 98, 27));
  _deleteButton->setEnabled(false);
  
  QObject::connect(applyButton, SIGNAL(clicked()), this, SLOT(validate()));
  QObject::connect(buttonBox, SIGNAL(rejected()), this, SLOT(cancel()));
  QObject::connect(_deleteButton, SIGNAL(clicked()), this, SLOT(deleteFilter()));
  
  label = new QLabel(this);
  label->setText("Blur:");
  label->setGeometry(QRect(70, 80, 66, 17));
  label_2 = new QLabel(this);
  label_2->setText("Policy");
  label_2->setGeometry(QRect(60, 150, 66, 17));
  _labelNumber = new QLabel(this);
  _labelNumber->setText("Number of pixels:");
  _labelNumber->setGeometry(QRect(30, 220, 241, 17));
  _number = new QSpinBox(this);
  _number->setValue(3);
  _number->setMinimum(1);
  _number->setGeometry(QRect(170, 210, 60, 27));
  
  QObject::connect(_number, SIGNAL(valueChanged(const QString&)), this, SLOT(dataChanged(const QString&)));
  
  /* INIT FILTER */
  _filterView = new QTableWidget(3, 3, this);
  _filterView->setGeometry(QRect(300, 20, 311, 281));
  _filterView->verticalHeader()->hide();
  _filterView->horizontalHeader()->hide();
  _filterView->setDragEnabled(false);
  _filterView->setCornerButtonEnabled(false);
  
  int numPixels = _number->value();
  for(int i = 0; i < numPixels; i++)
  {
    _filterView->setColumnWidth(i, _filterView->rowHeight(0));
    for(int j = 0; j < numPixels; j++)
    {
      QTableWidgetItem* item = new QTableWidgetItem("1");
      item->setTextAlignment(Qt::AlignHCenter);
      item->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled);
      _filterView->setItem(i, j, item);
    }
  }
  
  /* BLUR CHOICE */
  _blurChoices = new QComboBox(this);
  _blurChoices->setGeometry(QRect(140, 80, 141, 27));
  
  QStringList blurs = QStringList();
  blurs.push_back("Uniform");
  blurs.push_back("Gaussian");
  blurs.push_back("Prewitt");
  blurs.push_back("Roberts");
  blurs.push_back("Sobel");
  blurs.push_back("SquareLaplacien");
  
  _filters.push_back(Filter::uniform(3));
  _filters.push_back(Filter::gaussian(1));
  _filters.push_back(Filter::prewitt(3));
  _filters.push_back(Filter::roberts());
  _filters.push_back(Filter::sobel());
  _filters.push_back(Filter::squareLaplacien());
  
  //Personal filters
  QFile file("filters.xml");
  if(file.exists())
  {
    QDomDocument doc("");
    file.open(QIODevice::ReadOnly);
	  doc.setContent(&file);
	  file.close();
    
    QDomElement root = doc.documentElement();
    QDomNode child = root.firstChild();
	  while(!child.isNull())
	  {
      QDomElement e = child.toElement();
	    // We know how to treat appearance and geometry
      blurs.push_back(e.attribute("name"));
      
      int nbFilters = e.attribute("nbFilters").toInt();
      
      std::vector<Filter*> temp;
      QDomNode grandChild = e.firstChild();
      for(int i = 0; i < nbFilters && !grandChild.isNull(); i++)
      {
        QDomElement grandChildElement = grandChild.toElement();
        if(!grandChildElement.isNull())
        {
          Filter* f = new Filter(grandChildElement.attribute("width").toInt(), grandChildElement.attribute("height").toInt());
          // We know how to treat color
          if (grandChildElement.tagName() == "values")
          {
            std::string str = grandChildElement.text().toStdString();
            std::string word;
            std::stringstream stream(str);
            int w = 0, h = 0;
            while(getline(stream, word, ' '))
            {
              (*f)[w][h] = QString::fromStdString(word).toInt();
                            
              if(h == f->height() - 1)
              {
                h = 0;
                w++;
              }
              else
                h++;
            }
          }
          temp.push_back(f);
        }
        grandChild = grandChild.nextSibling();
      }
      _filters.push_back(temp);
      
      child = child.nextSibling();
	  }
  }
  _blurChoices->addItems(blurs);
  QObject::connect(_blurChoices, SIGNAL(currentIndexChanged(int)), this, SLOT(currentBlurChanged(int)));
  
  /* POLICIES CHOICE */
  _policyChoices = new QComboBox(this);
  _policyChoices->setGeometry(QRect(140, 150, 141, 27));
  
  QStringList policies = QStringList();
  policies.push_back("Black");
  policies.push_back("Mirror");
  policies.push_back("Nearest");
  policies.push_back("Spherical");
  _policyChoices->addItems(policies);
}