void SettingsWindow::connectSlots()
{
    connect (m_ok,     SIGNAL (clicked()),         this, SLOT (apply()));
    connect (m_reset,  SIGNAL (clicked()),         this, SLOT (reset()));
    connect (m_cancel, SIGNAL (clicked()),         this, SLOT (cancel()));
    connect (DS(),     SIGNAL (teamChanged (int)), this, SLOT (updateTeam (int)));
    connect (DS(),     SIGNAL (protocolChanged()), this, SLOT (readSettings()));

    connect (m_useCustomAddress, SIGNAL (toggled    (bool)),
             m_robotAddress,       SLOT (setEnabled (bool)));
    connect (m_baseButton,       SIGNAL (clicked()),
             this,                SLOT  (onSelectorClicked()));
    connect (m_highlightButton,  SIGNAL (clicked()),
             this,                SLOT  (onSelectorClicked()));
    connect (m_backgroundButton, SIGNAL (clicked()),
             this,                SLOT  (onSelectorClicked()));
    connect (m_foregroundButton, SIGNAL (clicked()),
             this,                SLOT  (onSelectorClicked()));
    connect (m_baseEdit,         SIGNAL (textChanged    (QString)),
             this,                SLOT  (onColorChanged (QString)));
    connect (m_highlightEdit,    SIGNAL (textChanged    (QString)),
             this,                SLOT  (onColorChanged (QString)));
    connect (m_backgroundEdit,   SIGNAL (textChanged    (QString)),
             this,                SLOT  (onColorChanged (QString)));
    connect (m_foregroundEdit,   SIGNAL (textChanged    (QString)),
             this,                SLOT  (onColorChanged (QString)));
}
AdvancedSettings::AdvancedSettings()
{
    ui.setupUi (this);
    resize (0, 0);

    /* Main dialog buttons */
    connect (ui.ApplyButton, SIGNAL (clicked()), this, SLOT (onApplyClicked()));
    connect (ui.ResetButton, SIGNAL (clicked()), this, SLOT (onResetClicked()));
    connect (ui.CancelButton, SIGNAL (clicked()), this, SLOT (onCancelClicked()));

    /* Appearance tab */
    connect (ui.BaseButton, SIGNAL (clicked()), this, SLOT (onSelectorClicked()));
    connect (ui.HighlightButton, SIGNAL (clicked()), this,
             SLOT (onSelectorClicked()));
    connect (ui.BackgroundButton, SIGNAL (clicked()), this,
             SLOT (onSelectorClicked()));
    connect (ui.ForegroundButton, SIGNAL (clicked()), this,
             SLOT (onSelectorClicked()));
    connect (ui.BaseEdit, SIGNAL (textChanged (QString)), this,
             SLOT (onColorChanged (QString)));
    connect (ui.HighlightEdit, SIGNAL (textChanged (QString)), this,
             SLOT (onColorChanged (QString)));
    connect (ui.BackgroundEdit, SIGNAL (textChanged (QString)), this,
             SLOT (onColorChanged (QString)));
    connect (ui.ForegroundEdit, SIGNAL (textChanged (QString)), this,
             SLOT (onColorChanged (QString)));

    readSettings();
}
void TextComponent::setOpacity(unsigned char opacity)
{
	mColor = (mColor & 0xFFFFFF00) | opacity;
	onColorChanged();

	GuiComponent::setOpacity(opacity);
}
Esempio n. 4
0
void QtPrototypeWindow::onPickColorButtonClicked()
{
    QColorDialog* dialog = new QColorDialog();
    dialog->setCurrentColor(QColor(m_currentColor.getIntR(), m_currentColor.getIntG(), m_currentColor.getIntB()));
    dialog->setAttribute(Qt::WA_DeleteOnClose);
    dialog->show();
    connect(dialog, SIGNAL(currentColorChanged(QColor)), this, SLOT(onColorChanged(QColor)));
}
void TextComponent::setColor(unsigned int color)
{
	mColor = color;

	unsigned char opacity = mColor & 0x000000FF;
	GuiComponent::setOpacity(opacity);

	onColorChanged();
}
Esempio n. 6
0
ThothWindow::ThothWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::ThothWindow)
{
    ui->setupUi(this);
    // ALERT! Use the following code to get keyboard focus at your OpenGL widget
    ui->contextGL->setFocusPolicy(Qt::StrongFocus);
    ui->contextGL->setFocus();
    message = new QLabel(this);
    popUp = new QLabel(this);
    mode = new QLabel(this);
    picked = new QLabel(this);

    ui->statusBar->addWidget(popUp);
    ui->statusBar->addPermanentWidget(picked);
    ui->statusBar->addPermanentWidget(mode);
    ui->statusBar->addPermanentWidget(message);
    mode->setText("Selecting");
    message->setText("No model selected");
    ui->statusBar->showMessage("Ready", 5000);
    //Tree file.

    //treeview of tabs
    TreeFile *m_build = new TreeFile(ui->treeViewBuild, "Build");
    m_buildModel = m_build->getQFileSystemModel();
    TreeFile *m_decorate = new TreeFile(ui->treeViewDecorate, "Decorate");
    m_decorateModel = m_decorate->getQFileSystemModel();
    TreeFile *m_furnish = new TreeFile(ui->treeViewFurnish, "Furnish");
    m_furnishModel = m_furnish->getQFileSystemModel();
    connect(ui->actionSave_project, SIGNAL(triggered()), this, SLOT(actionSave_project_triggered()));
    QTimer *tim = new QTimer(this);
    connect(tim, SIGNAL(timeout()), ui->contextGL, SLOT(updateGL()));
    tim->start(TICK_PER_SECOND);
    connect(tim, SIGNAL(timeout()), ui->contextGL, SLOT(checkActiveModel()));
    connect(ui->SldR, SIGNAL(valueChanged(int)), SLOT(onColorChanged()));
    connect(ui->SldG, SIGNAL(valueChanged(int)), SLOT(onColorChanged()));
    connect(ui->SldB, SIGNAL(valueChanged(int)), SLOT(onColorChanged()));
    onColorChanged();
    connect(CScenary::getInstance(), SIGNAL(setNameModel(string)), SLOT(getModelName(string)));
    connect(RenderManager::GetInstance(), SIGNAL(sendChangeTab()), SLOT(changeTab()));
    RenderManager::GetInstance()->GetRenderMode(EDITOR_2D)->SetCameraProjection(INIT_WIDTH, INIT_HEIGHT);
    connect(this, SIGNAL(changeMouseMove(bool)), RenderManager::GetInstance()->GetRenderMode(EXPLORER), SLOT(setMouseMove(bool)));
    connect(this, SIGNAL(changeCursor(Qt::CursorShape)), ui->contextGL, SLOT(changeCursor(Qt::CursorShape)));
    connect(ui->ColorButton, SIGNAL(clicked(bool)), SLOT(on_colorButton_clicked()));
    connect(this, SIGNAL(newModel(ModelInfo, int)), RenderManager::GetInstance()->GetRenderMode(EXPLORER), SLOT(changeModelTexture(ModelInfo, int)));
    connect(ui->actionOpen_project, SIGNAL(triggered()), this, SLOT(actionOpen_project_triggered()));
    connect(CScenary::getInstance(), SIGNAL(setNameModel(string)), SLOT(getModelName(string)));
    connect(RenderManager::GetInstance(), SIGNAL(sendChangeTab()), SLOT(changeTab()));
    connect(CScenary::getInstance(), SIGNAL(activeFloorChanged(int)), ui->floorBox, SLOT(setValue(int)));
    connect(RenderManager::GetInstance()->GetRenderMode(EDITOR_2D), SIGNAL(changedMode(string)), SLOT(getModeName(string)));
    connect(RenderManager::GetInstance()->GetRenderMode(EDITOR_2D), SIGNAL(pickedInfo(string)), SLOT(getPicked(string)));
    connect(RenderManager::GetInstance()->GetRenderMode(EXPLORER), SIGNAL(pickedInfo(string)), SLOT(getPicked(string)));
    connect(RenderManager::GetInstance()->GetRenderMode(EXPLORER), SIGNAL(setMessage(string, int)), SLOT(getMessage(string, int)));
    connect(RenderManager::GetInstance()->GetRenderMode(EDITOR_2D), SIGNAL(setMessage(string, int)), SLOT(getMessage(string, int)));
    connect(CScenary::getInstance(), SIGNAL(setMessage(string, int)), SLOT(getMessage(string, int)));
}
ColorSelect::ColorSelect(QColor color, QWidget *parent) :
    QDialog(0,  Qt::WindowTitleHint),
    m_color(color),
    ui(new Ui::ColorSelect)
{
    this->setModal(true);
    ui->setupUi(this);
    this->layout()->setSizeConstraint(QLayout::SetFixedSize);
    ui->spinBoxR->setValue(m_color.red());
    ui->spinBoxG->setValue(m_color.green());
    ui->spinBoxB->setValue(m_color.blue());
    connect(ui->spinBoxR, SIGNAL(valueChanged(int)), this, SLOT(onColorChanged()));
    connect(ui->spinBoxG, SIGNAL(valueChanged(int)), this, SLOT(onColorChanged()));
    connect(ui->spinBoxB, SIGNAL(valueChanged(int)), this, SLOT(onColorChanged()));
    onColorChanged();

}
int MoodBox::BrushSettingsBar::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = ToolSettingsBar::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: changeSelectedColor((*reinterpret_cast< const QColor(*)>(_a[1]))); break;
        case 1: onColorSelected((*reinterpret_cast< qint32(*)>(_a[1]))); break;
        case 2: onColorChanged((*reinterpret_cast< qint32(*)>(_a[1])),(*reinterpret_cast< const QColor(*)>(_a[2]))); break;
        case 3: onSizeSelected((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 4: onAlphaSelected((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 5: onPaletteSelected((*reinterpret_cast< const Palette(*)>(_a[1]))); break;
        case 6: on_paletteManagerButton_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 7: onPaletteManagerFinished(); break;
        default: ;
        }
        _id -= 8;
    }
    return _id;
}
Esempio n. 9
0
PopupColorPaletteWidget::PopupColorPaletteWidget( ScribbleArea *parent ) :
    QWidget ( parent, Qt::Window ),
    m_pContainer ( parent )
{
    QVBoxLayout *mainLayout = new QVBoxLayout( this );

    setVisible( false );

    this->setFixedWidth(200);
    m_pColorBox = new ColorBox();
    mainLayout->addWidget(m_pColorBox);
    m_pColorBox->adjustSize();

    QGraphicsDropShadowEffect* effect = new QGraphicsDropShadowEffect();
    effect->setXOffset(2);
    effect->setYOffset(2);
    effect->setBlurRadius(5);
    setGraphicsEffect(effect);

    setAutoFillBackground(true);
    setWindowTitle("Color palette");
    setWindowFlags( ( (windowFlags()
                       | Qt::CustomizeWindowHint)
                      & ~Qt::WindowMaximizeButtonHint
                      & ~Qt::WindowMinimizeButtonHint) );

    // --- bottom buttons layout ---
    QHBoxLayout *buttonsLayout = new QHBoxLayout();
    mainLayout->addLayout(buttonsLayout);
    closeButton = new QPushButton(this);
    closeButton->setText("close/toggle");
    buttonsLayout->addWidget(closeButton);

    // --- connections ---
    connect( closeButton , SIGNAL( clicked() ) , m_pContainer , SLOT( togglePopupPalette() ) );
    connect( m_pColorBox, SIGNAL( colorChanged(QColor) ), this, SLOT( onColorChanged(QColor) ) );
}
Esempio n. 10
0
ToolInstance::ToolInstance(QString filename, ToolInformation information, mcrl2::gui::qt::PersistentFileDialog* fileDialog, QWidget *parent) :
  QWidget(parent),
  m_filename(filename),
  m_info(information),
  m_fileDialog(fileDialog)
{
  m_ui.setupUi(this);

  connect(this, SIGNAL(colorChanged(QColor)), this, SLOT(onColorChanged(QColor)));

  connect(&m_process, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(onStateChange(QProcess::ProcessState)));
  connect(&m_process, SIGNAL(readyReadStandardOutput()), this, SLOT(onStandardOutput()));
  connect(&m_process, SIGNAL(readyReadStandardError()), this, SLOT(onStandardError()));
  connect(m_ui.btnRun, SIGNAL(clicked()), this, SLOT(onRun()));
  connect(m_ui.btnAbort, SIGNAL(clicked()), this, SLOT(onAbort()));
  connect(m_ui.btnSave, SIGNAL(clicked()), this, SLOT(onSave()));
  connect(m_ui.btnClear, SIGNAL(clicked()), m_ui.edtOutput, SLOT(clear()));

  QFileInfo fileInfo(filename);

  m_process.setWorkingDirectory(fileInfo.absoluteDir().absolutePath());
  m_ui.lblDirectoryValue->setText(fileInfo.absoluteDir().absolutePath());
  m_ui.lblFileValue->setText(fileInfo.fileName());

  if (m_info.hasOutput())
  {
    QDir dir = fileInfo.absoluteDir();
    QString newfile = fileInfo.baseName().append(".%1").arg(m_info.output);
    int filenr = 0;
    while(dir.exists(newfile))
    {
      filenr++;
      newfile = fileInfo.baseName().append("_%1.%2").arg(filenr).arg(m_info.output);
    }
    m_pckFileOut = new FilePicker(m_fileDialog, m_ui.pckFileOut);
    m_ui.pckFileOut->layout()->addWidget(m_pckFileOut);
    m_pckFileOut->setText(newfile);
  }
  else
  {
    m_pckFileOut = NULL;
    m_ui.lblFileOut->setVisible(false);
    m_ui.pckFileOut->setVisible(false);
  }

  if (m_info.hasSecondInput())
  {
    m_pckFileIn = new FilePicker(m_fileDialog, m_ui.pckFileIn, false);
    m_ui.pckFileIn->layout()->addWidget(m_pckFileIn);
  }
  else
  {
    m_pckFileIn = NULL;
    m_ui.lblFileIn->setVisible(false);
    m_ui.pckFileIn->setVisible(false);
  }

  QFormLayout *formLayout = new QFormLayout();
  formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
  for (int i = 0; i < m_info.options.count(); i++)
  {
    ToolOption option = m_info.options.at(i);
    QWidget *nameOpt = NULL;
    QCheckBox* cbOpt = NULL;
    QVBoxLayout *lytOpt = new QVBoxLayout();

    if (option.argument.type == EnumArgument)
    {
      nameOpt = new QLabel("<b>"+option.nameLong+": </b>");
    }
    else
    {
      cbOpt = new QCheckBox(option.nameLong + ": ", this);
      cbOpt->setChecked(option.standard);
      QFont font(cbOpt->font());
      font.setBold(true);
      cbOpt->setFont(font);
      nameOpt = cbOpt;
    }

    formLayout->addRow(nameOpt, lytOpt);

    QLabel *lblOpt = new QLabel(option.description, this);
    lblOpt->setAlignment(Qt::AlignJustify | Qt::AlignTop);
    lblOpt->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
    lblOpt->setWordWrap(true);
    lytOpt->addWidget(lblOpt);

    if (!option.hasArgument())
    {
      m_optionValues.append(new OptionValue(option, cbOpt));
    }
    else
    {
      switch (option.argument.type)
      {
        case StringArgument:
        case LevelArgument:
        case IntegerArgument:
        case RealArgument:
        case BooleanArgument:
          {
            QHBoxLayout *lytArg = new QHBoxLayout();
            lytArg->setSpacing(6);

            QWidget *edtArg = NULL;

            switch (option.argument.type)
            {
              case LevelArgument:
                {
                  QLineEdit *edtLdt = new QLineEdit("verbose", this);
                  m_optionValues.append(new OptionValue(option, cbOpt, edtLdt));
                  edtArg = edtLdt;
                }
                break;
              case IntegerArgument:
                {
                  QSpinBox *edtSpb = new QSpinBox(this);
                  edtSpb->setRange(std::numeric_limits<int>::min(), std::numeric_limits<int>::max());
                  if (option.argument.optional)
                  {
                    QCheckBox *cbOptional = new QCheckBox(this);
                    lytArg->addWidget(cbOptional);
                    m_optionValues.append(new OptionValue(option, cbOpt, edtSpb, cbOptional));
                  }
                  else
                  {
                    m_optionValues.append(new OptionValue(option, cbOpt, edtSpb));
                  }
                  edtArg = edtSpb;
                }
                break;
              case RealArgument:
                {
                  QDoubleSpinBox *edtSpb = new QDoubleSpinBox(this);
                  edtSpb->setRange(std::numeric_limits<double>::min(), std::numeric_limits<double>::max());
                  if (option.argument.optional)
                  {
                    QCheckBox *cbOptional = new QCheckBox(this);
                    lytArg->addWidget(cbOptional);
                    m_optionValues.append(new OptionValue(option, cbOpt, edtSpb, cbOptional));
                  }
                  else
                  {
                    m_optionValues.append(new OptionValue(option, cbOpt, edtSpb));
                  }
                  edtArg = edtSpb;
                }
                break;
              case BooleanArgument:
                {
                  QCheckBox *edtChb = new QCheckBox("Yes", this);
                  m_optionValues.append(new OptionValue(option, cbOpt, edtChb));
                  edtArg = edtChb;
                }
                break;
              case StringArgument:
              default:
                {
                  QLineEdit *edtLdt = new QLineEdit(this);
                  m_optionValues.append(new OptionValue(option, cbOpt, edtLdt));
                  edtArg = edtLdt;
                }
                break;
            }
            edtArg->setMinimumWidth(300);

            lytArg->addWidget(edtArg);

            if (!option.argument.optional && option.argument.type != BooleanArgument)
            {
              QLabel *lblReq = new QLabel("*", this);
              lytArg->addWidget(lblReq);
            }

            QSpacerItem *spacer = new QSpacerItem(100, 20, QSizePolicy::Expanding);
            lytArg->addItem(spacer);
            lytOpt->addLayout(lytArg);
          }
          break;
        case FileArgument:
          {
            QHBoxLayout *lytArg = new QHBoxLayout();
            lytArg->setSpacing(6);

            FilePicker *edtArg = new FilePicker(m_fileDialog, this, false);
            lytArg->addWidget(edtArg);
            m_optionValues.append(new OptionValue(option, cbOpt, edtArg));

            if (!option.argument.optional)
            {
              QLabel *lblReq = new QLabel("*", this);
              lytArg->addWidget(lblReq);
            }

            QSpacerItem *spacer = new QSpacerItem(100, 20, QSizePolicy::Expanding);
            lytArg->addItem(spacer);
            lytOpt->addLayout(lytArg);
          }
          break;
        case EnumArgument:
          {
            QFormLayout *lytValues = new QFormLayout();
            lytValues->setSpacing(6);

            QButtonGroup *grpValues = new QButtonGroup(this);

            for (int j = 0; j < option.argument.values.count(); j++)
            {
              ToolValue val = option.argument.values.at(j);
              QRadioButton *rbVal = new QRadioButton(val.nameLong, this);
              rbVal->setChecked(val.standard);
              grpValues->addButton(rbVal);

              QLabel *lblVal = new QLabel(val.description, this);
              lblVal->setWordWrap(true);

              lytValues->addRow(rbVal, lblVal);
            }
            m_optionValues.append(new OptionValue(option, cbOpt, grpValues));

            lytOpt->addLayout(lytValues);
          }
          break;
        default:
          break;
      }
    }
  }
  m_ui.scrollWidget->setLayout(formLayout);
}
Esempio n. 11
0
void View::onSetColor(const ci::ColorA &v) {
	if (mColor == v) return;
	mColor = v;
	onColorChanged(v);
}
Esempio n. 12
0
bool Prop2D::propPoll(double dt) {
	if( prop2DPoll(dt) == false ) return false;
    if(remote_vel.isZero()==false) { // for cloud syncing
        loc += remote_vel*dt;
    }

	// animation of index
	if(anim_curve){
		int previndex = index;
		bool finished = false;
		index = anim_curve->getIndex( accum_time - anim_start_at, &finished );
		if( index != previndex ){
			onIndexChanged(previndex);
		}
		if(finished) {
			onAnimFinished();
		}
	}
	// animation of scale
	if( seek_scl_time != 0 ){
		double elt = accum_time - seek_scl_started_at;
		if( elt > seek_scl_time ){
			scl = seek_scl_target;
			seek_scl_time = 0;
		} else {
			double rate = elt / seek_scl_time;
			scl.x = seek_scl_orig.x + ( seek_scl_target.x - seek_scl_orig.x ) * rate;
			scl.y = seek_scl_orig.y + ( seek_scl_target.y - seek_scl_orig.y ) * rate;
		}
	}
	// animation of rotation
	if( seek_rot_time != 0 ){
		double elt = accum_time - seek_rot_started_at;
		if( elt > seek_rot_time ){
			rot = seek_rot_target;
			seek_rot_time = 0;
		} else {
			double rate = elt / seek_rot_time;
			rot = seek_rot_orig + ( seek_rot_target - seek_rot_orig ) * rate;
		}
	}
	// animation of color
	if( seek_color_time != 0 ){
		double elt = accum_time - seek_color_started_at;
		if( elt > seek_color_time ){
			color = seek_color_target;
            if(seek_color_time!=0){
                onColorChanged();
            }
			seek_color_time = 0;
		} else {
			double rate = elt / seek_color_time;
			color = Color( seek_color_orig.r + ( seek_color_target.r - seek_color_orig.r ) * rate,
				seek_color_orig.g + ( seek_color_target.g - seek_color_orig.g ) * rate,
				seek_color_orig.b + ( seek_color_target.b - seek_color_orig.b ) * rate,
				seek_color_orig.a + ( seek_color_target.a - seek_color_orig.a ) * rate );
            onColorChanged();
		}
	}

	// children
	for(int i=0;i<children_num;i++){
		Prop2D *p = children[i];
		p->basePoll(dt);
	}

	return true;
}
Esempio n. 13
0
// constructor: warm up all stuff
MainWindow::MainWindow(QWidget *parent) :
  QMainWindow(parent),
  ui(new Ui::MainWindow)
//,audioInfo(QAudioDeviceInfo::defaultInputDevice())
{
  // draws the ui
  ui->setupUi(this);

  // test for saving settings
  QCoreApplication::setOrganizationName("Agostinho");

  /** some settings attempt
   */
  QSettings settings; /*!<aloha */
  settings.setValue("alo","maria");

  // defines sample size equals to spectrum size
  sample.resize(SPECSIZE);

  // threads are as separate processes running within the same
  // program. for fft calculation, it is better to move it
  // to another thread to make the calcs faster.
  // moreover, it will not slow down the ui
//  fftThread = new QThread(this);

  calculator = new FFTCalc();
 // calculator->moveToThread(fftThread);

  // launches the new media player
  player = new QMediaPlayer();

  // starts a new playlist
  playlist = new QMediaPlaylist();

  // starts the playlist model
  playlistModel = new PlaylistModel(this);

  // tell playlistmodel where is the playlist
  playlistModel->setPlaylist(playlist);

  // attach the listView to the playlistModel
  ui->listViewPlaylist->setModel(playlistModel);

  // set current index to the first element
  ui->listViewPlaylist->setCurrentIndex(playlistModel->index(playlist->currentIndex(), 0));

  loadPlaylist();

  // attachs the playlist to the player
  player->setPlaylist(playlist);

  // playlist plays in loop mode. It restarts after last song has finished playing.
  playlist->setPlaybackMode(QMediaPlaylist::Loop);

  // this allow the user to select the media it wants to play
  connect(ui->listViewPlaylist, SIGNAL(doubleClicked(QModelIndex)),
          this, SLOT(goToItem(QModelIndex)));

  // if some metadata changed for media, display it somewhere
  // it seems not work on windows
  // but works for linux :)
  connect(player,SIGNAL(metaDataChanged()),
          this, SLOT(metaDataChanged()));

  // the media status changed (new stream has arrived)
  connect(player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
          this, SLOT(mediaStatusChanged(QMediaPlayer::MediaStatus)));

  // the user selected a new position on music to play
  // perharps using some scrollbar
  connect(this,SIGNAL(positionChanged(qint64)),
          player,SLOT(setPosition(qint64)));

  connect(player,SIGNAL(volumeChanged(int)),
                        ui->control,SLOT(onVolumeChanged(int)));

  connect(player,SIGNAL(stateChanged(QMediaPlayer::State)),
          SLOT(mediaStateChanged(QMediaPlayer::State)));
  // that is the audio probe object that "listen to"
  // the music. It will help with fft stuff
  probe = new QAudioProbe();

  // fft is delivered using a QVector<double> but
  // signal/slot scheme does not recognizes this type by default
  // therefore, we have to register it
  qRegisterMetaType< QVector<double> >("QVector<double>");

  // here goes the control unit event handlers
  connect(ui->control, SIGNAL(playPause()), this, SLOT(playPause()));
  connect(ui->control, SIGNAL(prev()), this, SLOT(prev()));
  connect(ui->control, SIGNAL(next()), this, SLOT(next()));
  connect(this, SIGNAL(playPauseChanged(bool)),
          ui->control,SLOT(onPlayerStateChanged(bool)));

  // when the music position changes on player, it has to be
  // informed to the control unit to redraw it ui
  connect(player, SIGNAL(positionChanged(qint64)),
          ui->control,SLOT(onElapsedChanged(qint64)));

  // fft goes here...
  // if a new audio buffer is ok, we have to make some
  // calcs (fft) to display the spectrum
  connect(probe, SIGNAL(audioBufferProbed(QAudioBuffer)),
          this, SLOT(processBuffer(QAudioBuffer)));

  // when fft is available, we deliver it to
  // the visualization widget
  connect(this,  SIGNAL(spectrumChanged(QVector<double>&)),
          ui->visualizer,SLOT(loadSamples(QVector<double>&)));

  // communicate the left and right audio levels...
  // ...mean levels
  connect(this,  SIGNAL(levels(double,double)),
          ui->visualizer,SLOT(loadLevels(double,double)));

  // when fft is available, we deliver it to
  // the visualization widget
  //connect(this,  SIGNAL(spectrumChanged(QVector<double>&)),
  //       ui->glVisualizer,SLOT(loadSamples(QVector<double>&)));

  // communicate the left and right audio levels...
  // ...mean levels
  //connect(this,  SIGNAL(levels(double,double)),
  //       ui->glVisualizer,SLOT(loadLevels(double,double)));

  // if the user selected a new position on stream to play
  // we have to tell it to the player
  connect(ui->control, SIGNAL(elapsedSelected(qint64)),
          player, SLOT(setPosition(qint64)));

  // changing audio volume
  connect(ui->control, SIGNAL(volumeSelected(int)),
          player, SLOT(setVolume(int)));

  // calculator is the thead that calcs the ffts we need to display
  // every time a new spectrum is available, the calculator
  // emits a calculatedSpectrum signal
  connect(calculator, SIGNAL(calculatedSpectrum(QVector<double>)),
          this, SLOT(spectrumAvailable(QVector<double>)));

  connect(ui->library,SIGNAL(addMediaToPlayList(QString)),
          SLOT(onAddMediaToPlayList(QString)));

  // tells the probe what to probe
  probe->setSource(player);

  // load directories to library
  connect(ui->actionLoadDirectory,SIGNAL(triggered()),this,SLOT(onAddFolderToLibrary()));

  // load a single file to library
  connect(ui->actionLoadFile,SIGNAL(triggered()),this,SLOT(loadMedia()));

  // it connects the signals emiteds via the visualizer to the buttons (ui->control) and the lightCycle(ui->widgetInfo)
  connect(ui->visualizer,SIGNAL(trocaCor(QColor)),ui->control,SLOT(onColorChanged(QColor)));
  connect(ui->visualizer,SIGNAL(trocaCor(QColor)),ui->widgetInfo,SLOT(changedColor(QColor)));

  //this->setStyleSheet(QString("QMainWindow {background-color: black}"));
}
Esempio n. 14
0
void NodeBackDrop::initialize(const QString& name,bool requestedByLoad,QVBoxLayout *dockContainer)
{
    
    _imp->menu = new QMenu(_imp->graph);
    
    QString tooltip("The node backdrop is useful to group nodes and identify them in the node graph. You can also "
                    "move all the nodes inside the backdrop.");
    _imp->settingsPanel = new DockablePanel(_imp->graph->getGui(), //< pointer to the gui
                                            this, //< pointer to the knob holder (this)
                                            dockContainer, //< pointer to the layout that will contain this settings panel
                                            DockablePanel::FULLY_FEATURED, //< use a fully featured header with editable text
                                            false, //< don't use scroll areas for tabs
                                            name, //< initial name
                                            Qt::convertFromPlainText(tooltip,Qt::WhiteSpaceNormal), //< help tooltip
                                            false, //< no default page
                                            "BackDrop", //< default page name
                                            dockContainer->parentWidget());
    
    
    ///initialize knobs here
    initializeKnobsPublic();
    
    QObject::connect(_imp->settingsPanel,SIGNAL(nameChanged(QString)),this,SLOT(onNameChanged(QString)));
    QObject::connect(_imp->settingsPanel,SIGNAL(colorChanged(QColor)),this,SLOT(onColorChanged(QColor)));
    dockContainer->addWidget(_imp->settingsPanel);
    
    if (!requestedByLoad) {
        _imp->graph->getGui()->putSettingsPanelFirst(_imp->settingsPanel);
        _imp->graph->getGui()->addVisibleDockablePanel(_imp->settingsPanel);
    } else {
        _imp->settingsPanel->setClosed(true);
    }
    
    
    
    setZValue(-10);
    
    _imp->header = new QGraphicsRectItem(this);
    _imp->header->setZValue(-9);
    
    _imp->name = new QGraphicsTextItem(name,this);
    _imp->name->setDefaultTextColor(QColor(0,0,0,255));
    _imp->name->setZValue(-8);
    
    _imp->label = new QGraphicsTextItem("",this);
    _imp->label->setDefaultTextColor(QColor(0,0,0,255));
    _imp->label->setZValue(-7);
    
    
    _imp->resizeHandle = new QGraphicsPolygonItem(this);
    _imp->resizeHandle->setZValue(-7);
    
    
    ///initialize knobs gui now
    _imp->settingsPanel->initializeKnobs();
    
    float r,g,b;
    appPTR->getCurrentSettings()->getDefaultBackDropColor(&r, &g, &b);
    QColor color;
    color.setRgbF(r, g, b);
    _imp->setColorInternal(color);
    
    _imp->setNameInternal(name);


    
}