Example #1
0
ShaderDialog::ShaderDialog(QWidget* parent) : QDialog(parent)
{
   m_dialog.setupUi(this);
   m_labels[0]  = m_dialog.label0;
   m_labels[1]  = m_dialog.label1;
   m_labels[2]  = m_dialog.label2;
   m_labels[3]  = m_dialog.label3;
   m_sliders[0] = m_dialog.slider0;
   m_sliders[1] = m_dialog.slider1;
   m_sliders[2] = m_dialog.slider2;
   m_sliders[3] = m_dialog.slider3;
   m_checkBoxes[0] = m_dialog.checkBox0;
   m_checkBoxes[1] = m_dialog.checkBox1;

   for (int i = 0; i < s_maxSliders; ++i) {
       connect(m_sliders[i], SIGNAL(valueChanged(int)), 
          this, SLOT(installShaderParameters(int)));
   }
   for (int i = 0; i < s_maxCheckBoxes; ++i) {
       connect(m_checkBoxes[i], SIGNAL(stateChanged(int)), 
          this, SLOT(installShaderParameters(int)));
   }

   ShaderLibrary& library(ShaderLibrary::instance());
   QStringList shaderNames(library.availableShaders());
   m_dialog.shaderCombo->addItems(shaderNames);

   hideOptionControls();
   int index(m_dialog.shaderCombo->findText(Preferences::DefaultShader()));
   if (index >= 0) {
      m_dialog.shaderCombo->setCurrentIndex(index);
      on_shaderCombo_currentIndexChanged(index);
   }
}
Example #2
0
void ShaderDialog::setupShaderTab()
{
   // This is determined by s_maxSliders
   m_labels[0]  = m_dialog.label0;
   m_labels[1]  = m_dialog.label1;
   m_labels[2]  = m_dialog.label2;
   m_labels[3]  = m_dialog.label3;
   m_labels[4]  = m_dialog.label4;
   m_labels[5]  = m_dialog.label5;

   // This is determined by s_maxSliders
   m_sliders[0] = m_dialog.slider0;
   m_sliders[1] = m_dialog.slider1;
   m_sliders[2] = m_dialog.slider2;
   m_sliders[3] = m_dialog.slider3;
   m_sliders[4] = m_dialog.slider4;
   m_sliders[5] = m_dialog.slider5;

   // This is determined by s_maxCheckBoxes
   m_checkBoxes[0] = m_dialog.checkBox0;
   m_checkBoxes[1] = m_dialog.checkBox1;
   m_checkBoxes[2] = m_dialog.checkBox2;
   m_checkBoxes[3] = m_dialog.checkBox3;
   m_checkBoxes[4] = m_dialog.checkBox4;
   m_checkBoxes[5] = m_dialog.checkBox5;

   // This is determined by s_maxLightBoxes
   m_lightBoxes[0] = m_dialog.lightBox0;
   m_lightBoxes[1] = m_dialog.lightBox1;
   m_lightBoxes[2] = m_dialog.lightBox2;
   m_lightBoxes[3] = m_dialog.lightBox3;
   m_lightBoxes[4] = m_dialog.lightBox4;
   m_lightBoxes[5] = m_dialog.lightBox5;

   for (int i = 0; i < s_maxSliders; ++i) {
       connect(m_sliders[i], SIGNAL(valueChanged(int)), 
          this, SLOT(installShaderParameters(int)));
   }

   for (int i = 0; i < s_maxCheckBoxes; ++i) {
       connect(m_checkBoxes[i], SIGNAL(stateChanged(int)), 
          this, SLOT(installShaderParameters(int)));
   }

   for (int i = 0; i < s_maxLightBoxes; ++i) {
       connect(m_lightBoxes[i], SIGNAL(stateChanged(int)), 
          this, SLOT(installShaderParameters(int)));
   }

   QStringList shaderNames(m_shaderLibrary.availableShaders());
   m_dialog.shaderCombo->addItems(shaderNames);

   int index(m_dialog.shaderCombo->findText(Preferences::DefaultShader()));
   if (index < 0) index = m_dialog.shaderCombo->findText(ShaderLibrary::NoShader);

   m_dialog.shaderCombo->setCurrentIndex(index);
   on_shaderCombo_currentIndexChanged(index);
}
Example #3
0
ShaderDialog::ShaderDialog(ShaderLibrary& library, QWidget* parent) : QDialog(parent),
   m_shaderLibrary(library)
{
   m_dialog.setupUi(this);

   // This is determined by s_maxSliders
   m_labels[0]  = m_dialog.label0;
   m_labels[1]  = m_dialog.label1;
   m_labels[2]  = m_dialog.label2;
   m_labels[3]  = m_dialog.label3;
   m_labels[4]  = m_dialog.label4;
   m_labels[5]  = m_dialog.label5;

   // This is determined by s_maxSliders
   m_sliders[0] = m_dialog.slider0;
   m_sliders[1] = m_dialog.slider1;
   m_sliders[2] = m_dialog.slider2;
   m_sliders[3] = m_dialog.slider3;
   m_sliders[4] = m_dialog.slider4;
   m_sliders[5] = m_dialog.slider5;

   // This is determined by s_maxCheckBoxes
   m_checkBoxes[0] = m_dialog.checkBox0;
   m_checkBoxes[1] = m_dialog.checkBox1;
   m_checkBoxes[2] = m_dialog.checkBox2;
   m_checkBoxes[3] = m_dialog.checkBox3;
   m_checkBoxes[4] = m_dialog.checkBox4;
   m_checkBoxes[5] = m_dialog.checkBox5;

   // This is determined by s_maxLightBoxes
   m_lightBoxes[0] = m_dialog.lightBox0;
   m_lightBoxes[1] = m_dialog.lightBox1;
   m_lightBoxes[2] = m_dialog.lightBox2;
   m_lightBoxes[3] = m_dialog.lightBox3;
   m_lightBoxes[4] = m_dialog.lightBox4;
   m_lightBoxes[5] = m_dialog.lightBox5;

   for (int i = 0; i < s_maxSliders; ++i) {
       connect(m_sliders[i], SIGNAL(valueChanged(int)), 
          this, SLOT(installShaderParameters(int)));
   }

   for (int i = 0; i < s_maxCheckBoxes; ++i) {
       connect(m_checkBoxes[i], SIGNAL(stateChanged(int)), 
          this, SLOT(installShaderParameters(int)));
   }

   for (int i = 0; i < s_maxLightBoxes; ++i) {
       connect(m_lightBoxes[i], SIGNAL(stateChanged(int)), 
          this, SLOT(installShaderParameters(int)));
   }

   QStringList shaderNames(m_shaderLibrary.availableShaders());
   m_dialog.shaderCombo->addItems(shaderNames);

   int index(m_dialog.shaderCombo->findText(Preferences::DefaultShader()));
   if (index < 0) index = m_dialog.shaderCombo->findText(ShaderLibrary::NoShader);

   m_dialog.shaderCombo->setCurrentIndex(index);
   on_shaderCombo_currentIndexChanged(index);

   if (m_shaderLibrary.filtersAvailable()) {
      m_dialog.shaderFilterTabWidget->removeTab(1);
      return;
   }

   // Rest is filters
   connect(m_dialog.antialias, SIGNAL(clicked(bool)), 
      this, SLOT(installFilterParameters(bool)));
   connect(m_dialog.border, SIGNAL(clicked(bool)), 
      this, SLOT(installFilterParameters(bool)));
   connect(m_dialog.ambientOcclusion, SIGNAL(clicked(bool)), 
      this, SLOT(installFilterParameters(bool)));

   connect(m_dialog.aoRadius, SIGNAL(valueChanged(int)), 
      this, SLOT(installFilterParameters(int)));
   connect(m_dialog.aoStrength, SIGNAL(valueChanged(int)), 
      this, SLOT(installFilterParameters(int)));
   connect(m_dialog.aoStrength, SIGNAL(valueChanged(int)), 
      this, SLOT(installFilterParameters(int)));

   setFilterParameters(Preferences::DefaultFilterParameters());
   // Hide the effects page for now
   m_dialog.shaderFilterTabWidget->removeTab(1);
}