// update service data when process moved from m0 to m
void Service::updateWithProcessReassign(Process* p, Machine* m0, Machine* m)
{

   if(m0 == 0) // process was not assigned
   {
	  if(m != 0) {
		  addLocation(m->getLocation());
		  addNeighborhood(m->getNeighborhood());
		  number_of_processes_in_location_[m->getLocation()->getId()] ++;
		  number_of_processes_in_neighborhood_[m->getNeighborhood()->getId()] ++;
	  }
      if(p->getInitialMachine() ==  m)
    	number_of_moved_processes_ --;
   }
   else
   {

	  if(m == 0)
	  {
		  removeLocation(m0->getLocation());
		  number_of_processes_in_location_[m0->getLocation()->getId()] --;
	  }
	  else
	  if(m->getLocation() != m0->getLocation())
	  {
		  addLocation(m->getLocation());
		  number_of_processes_in_location_[m->getLocation()->getId()] ++;
		  removeLocation(m0->getLocation());
		  number_of_processes_in_location_[m0->getLocation()->getId()] --;
	  }

	  if(m == 0)
	  {
		  removeNeighborhood(m0->getNeighborhood());
		  number_of_processes_in_neighborhood_[m0->getNeighborhood()->getId()] --;
	  }
	  else
	  if(m->getNeighborhood() != m0->getNeighborhood())
	  {
		  addNeighborhood(m->getNeighborhood());
		  number_of_processes_in_neighborhood_[m->getNeighborhood()->getId()] ++;
		  removeNeighborhood(m0->getNeighborhood());
		  number_of_processes_in_neighborhood_[m0->getNeighborhood()->getId()] --;
	  }

	  if(m == 0) {
		  //number_of_moved_processes_ ++;
	  }
	  else
	  if(p->getInitialMachine() == m0 && p->getInitialMachine() !=  m)
		  number_of_moved_processes_ ++;
	  else
	  if(p->getInitialMachine() ==  m && p->getInitialMachine() != m0)
		  number_of_moved_processes_ --;

   }

}
Exemplo n.º 2
0
void GlobStore::removeModule(int ix)
{
    if (ix < 0) return;

    timeModuleBox->setCurrentIndex(0);
    if (timeModuleBox->count()) updateTimeModule(0);
    timeModuleBox->removeItem(ix);

    if (!timeModuleBox->count())
        while (widgetList.count() > 1) {
            removeLocation(-1);
        }
}
Exemplo n.º 3
0
void DiscoverabilityManager::setDiscoverabilityMode(Discoverability::Mode discoverabilityMode) {
    if (static_cast<Discoverability::Mode>(_mode.get()) != discoverabilityMode) {
        
        // update the setting to the new value
        _mode.set(static_cast<int>(discoverabilityMode));
        
        if (static_cast<int>(_mode.get()) == Discoverability::None) {
            // if we just got set to no discoverability, make sure that we delete our location in DB
            removeLocation();
        } else {
            // we have a discoverability mode that says we should send a location, do that right away
            updateLocation();
        }

        emit discoverabilityModeChanged(discoverabilityMode);
    }
}
Exemplo n.º 4
0
GlobStore::GlobStore(QWidget *parent)
            : QWidget(parent)
{
    int l1;

    midiControl = new MidiControl(this);
    midiControl->ID = -2;
    midiControl->parentDockID = -2;

    activeStore = 0;
    currentRequest = 0;
    switchAtBeat = 0;

    storeSignalMapper = new QSignalMapper(this);
    connect(storeSignalMapper, SIGNAL(mapped(int)),
             this, SLOT(storeAll(int)));

    timeModeBox = new QComboBox;
    timeModeBox->addItem(tr("End of"));
    timeModeBox->addItem(tr("After"));
    connect(timeModeBox, SIGNAL(activated(int)),
             this, SLOT(updateTimeModeBox(int)));

    switchAtBeatBox = new QComboBox;
    for (l1 = 0; l1 < 16; l1++) {
        switchAtBeatBox->addItem(QString::number(l1 + 1)+" beats");
    }
    switchAtBeatBox->hide();
    connect(switchAtBeatBox, SIGNAL(activated(int)),
             this, SLOT(updateSwitchAtBeat(int)));

    timeModuleBox = new QComboBox;
    timeModuleBox->setCurrentIndex(0);
    connect(timeModuleBox, SIGNAL(activated(int)),
             this, SLOT(updateTimeModule(int)));

    QWidget *indicatorBox = new QWidget;
    QHBoxLayout *indicatorLayout = new QHBoxLayout;
    indicator = new Indicator(20, ' ');
    indicatorBox->setMinimumHeight(30);
    indicatorBox->setMinimumWidth(30);
    indicatorLayout->addWidget(indicator);
    indicatorLayout->setMargin(2);
    indicatorLayout->setSpacing(1);
    indicatorBox->setLayout(indicatorLayout);

    QHBoxLayout *timeModeLayout = new QHBoxLayout;
    timeModeLayout->addWidget(timeModeBox);
    timeModeLayout->addWidget(timeModuleBox);
    timeModeLayout->addWidget(switchAtBeatBox);
    timeModeLayout->addWidget(indicatorBox);
    timeModeLayout->setSpacing(0);
    timeModeLayout->addStretch();

    QHBoxLayout *upperRowLayout = new QHBoxLayout;
    upperRowLayout->addLayout(timeModeLayout);
    upperRowLayout->addStretch();

    QAction* removeStoreAction = new QAction(tr("&Remove"), this);
    QToolButton *removeStoreButton = new QToolButton;
    removeStoreButton->setDefaultAction(removeStoreAction);
    removeStoreButton->setFixedSize(60, 20);
    removeStoreButton->setArrowType (Qt::ArrowType(1));
    connect(removeStoreAction, SIGNAL(triggered()), this, SLOT(removeLocation()));

    QToolButton *toolButton = new QToolButton;
    toolButton->setText("Global");
    toolButton->setMinimumSize(QSize(56,32));
    midiControl->addMidiLearnMenu("GlobRestore", toolButton, 0);
    
    QFrame *topRow = new QFrame;
    QVBoxLayout *topRowLayout = new QVBoxLayout;
    topRowLayout->addWidget(toolButton);
    topRowLayout->addStretch();
    topRowLayout->setSpacing(0);
    topRowLayout->setMargin(0);
    topRow->setFrameStyle(QFrame::StyledPanel);
    topRow->setMinimumSize(QSize(48,48));;
    topRow->setLayout(topRowLayout);

    QVBoxLayout *buttonLayout = new QVBoxLayout;
    buttonLayout->addWidget(topRow);

    QVBoxLayout *columnLayout = new QVBoxLayout;
    columnLayout->addLayout(buttonLayout);
    columnLayout->addWidget(removeStoreButton);
    columnLayout->addStretch(1);

    indivButtonLayout = new QHBoxLayout;
    indivButtonLayout->setSpacing(0);
    indivButtonLayout->setMargin(0);
    indivButtonLayout->addLayout(columnLayout);
    indivButtonLayout->setSizeConstraint(QLayout::SetFixedSize);

    QHBoxLayout *secondRowLayout = new QHBoxLayout;
    secondRowLayout->addLayout(indivButtonLayout);
    secondRowLayout->addStretch(1);

    QVBoxLayout *centLayout = new QVBoxLayout;
    centLayout->addLayout(upperRowLayout);
    centLayout->addLayout(secondRowLayout);
    centLayout->addStretch(1);

    addLocation();

    setLayout(centLayout);
    schedRestoreVal = 0;
    schedRestore = false;
    dispReqIx = 0;
    dispReqSelected = 0;
    needsGUIUpdate = false;
    modified = false;
}