コード例 #1
0
ファイル: mainscene.cpp プロジェクト: dotkrnl/dotFive
void MainScene::toSendUndo(void)
{
    if (m_who_am_i != m_current) return;

    if (ui->undoButton->property("clickStatus").toString()
            == "rejected") return;

    emit requestUndo();

    ui->undoButton->setProperty("clickStatus", "sent");
    ui->undoButton->style()->unpolish(ui->undoButton);
    ui->undoButton->style()->polish(ui->undoButton);
    ui->undoButton->update();
}
コード例 #2
0
void Spreadsheet::updateCell(std::string cell_name, std::string cell_contents, SpreadsheetCallbackInterface * caller)
{
  
  pthread_mutex_lock(&lock1);
   
  std::map<std::string, Cell>::iterator cellContents = cells.find(cell_name);
  if(cellContents != cells.end())
  {
    //put the old stuff into the undo stack
    std::pair<std::string, std::string> undoElement(cell_name, cellContents->second.getContents());
    undoStack.push_back(undoElement);
  }
  else
  {
    //push an empty element to the stack.
    std::pair<std::string, std::string> undoElement(cell_name, "");
    undoStack.push_back(undoElement);
  }
  //will need to update when cell can take a formula...
  cells[cell_name].setContents(cell_contents);
  
  if(cell_contents.substr(0,1).compare("=") == 0 )
  {
    dependencies.changeCell(cell_name, cell_contents);
    
    bool circular = checkForCircularDependency(cell_name);
    if(circular)
    {
      //do an undo and send out an error
      pthread_mutex_unlock(&lock1);
      requestUndo();
      //send an error
      std::cout << "ERROR GOES HERE...NEED TO IMPLEMENT" << std::endl;
      caller -> errorCallback(2, "circular dependency");
    }
    else
    {
      pthread_mutex_unlock(&lock1);
      notifyUsers(cell_name, cell_contents);
    }
  }
  else
  {
    pthread_mutex_unlock(&lock1);
    notifyUsers(cell_name, cell_contents);
  }
  
}