Exemple #1
0
void MTest::initMTest()
{
    MScore::DPI  = 120;
    MScore::PDPI = 120;
    MScore::DPMM = MScore::DPI / INCH;

    synti  = new MasterSynthesizer();
    mscore = new MScore;
    mscore->init();
    preferences.shortestNote = MScore::division / 4; // midi quantization: 1/16

    root = TESTROOT "/mtest";
    loadInstrumentTemplates(":/instruments.xml");
    score = readScore("/test.mscx");
}
void MTest::initMTest()
      {
      initMyResources();
//      DPI  = 120;
//      PDPI = 120;
      MScore::noGui = true;

      synti  = new MasterSynthesizer();
      mscore = new MScore;
      new MuseScoreCore;
      mscore->init();
      preferences.shortestNote = MScore::division / 4; // midi quantization: 1/16

      root = TESTROOT "/mtest";
      loadInstrumentTemplates(":/instruments.xml");
      score = readScore("/test.mscx");
      }
Exemple #3
0
void MTest::initMTest()
      {
      qputenv("QML_DISABLE_DISK_CACHE", "true");
      qSetMessagePattern("%{function}: %{message}");
      initMyResources();
//      DPI  = 120;
//      PDPI = 120;
      MScore::noGui = true;

      synti  = new MasterSynthesizer();
      mscore = new MScore;
      new MuseScoreCore;
      mscore->init();
      ed.init();

      preferences.init(true);

      root = TESTROOT "/mtest";
      loadInstrumentTemplates(":/instruments.xml");
      score = readScore("test.mscx");
      }
void Window::openScores()
{
    tempo->stop();
    newWindow->close();
    readScore();

    QWidget *windowScore = new QWidget;
    QLabel *scoreLabel =new QLabel("SCORE: ",this);
    QLabel *scoreResult =new QLabel(str,this);
    QPushButton *botaoOk = new QPushButton("Ok");

    QVBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(scoreLabel);
    layout->addWidget(scoreResult);

    layout->addWidget(botaoOk);

    windowScore->setLayout(layout);
    windowScore->show();

    connect (botaoOk,SIGNAL(clicked()),windowScore,SLOT(close()));
}
void TestMeasure::minWidth()
      {
      Score* score = readScore(DIR + "measure2.mscx");
      score->doLayout();
      int n = score->systems()->size();
      int measuresSystem[n];
      for (int i = 0; i < n; ++i)
            measuresSystem[i] = score->systems()->at(i)->measures().size();

      Measure* m1 = score->systems()->at(1)->lastMeasure();
      Measure* m2 = score->systems()->at(2)->firstMeasure();
      qreal mw1 = m1->minWidth1();
      qreal mw2 = m2->minWidth1();

      score->doLayout();

      //QCOMPARE(mw1, m1->minWidth1());
      //QCOMPARE(mw2, m2->minWidth1());

      // after second layout nothing should be changed:
      for (int i = 0; i < n; ++i)
            QCOMPARE(measuresSystem[i], score->systems()->at(i)->measures().size());
      }
Exemple #6
0
ScoreWindow::ScoreWindow()
  : exitButton(" Ok ", this),
    winLabel(""),
    defeatLabel(""),
    winpLabel(""),
    defeatpLabel(""),
    cwinLabel(""),
    cdefeatLabel(""),
    undoLabel(""),
    totalLabel(""),
    mainCon(300, 400)
{
  mainCon.add(&winLabel);
  mainCon.add(&defeatLabel);
  mainCon.add(&winpLabel);
  mainCon.add(&defeatpLabel);
  mainCon.add(&cwinLabel);
  mainCon.add(&cdefeatLabel);
  mainCon.add(&undoLabel);
  mainCon.add(&totalLabel);
  mainCon.add(&exitButton);
  mainCon.reallocate();

  container(&mainCon);

  _wins = _defeats = 0;
  _continuousWins = 0;
  _continuousDefeats = 0;
  _previousWon = false;
  _undos = 0;
  _totalScore = 0;
  exitPressed = false;

  char* home = getenv("HOME");

  if (home == NULL) {
    fprintf(stderr, "Cannot get $HOME. Assuming I am at home directory now.\n");
    saveFile = ".xfreecell";
  } else {
    saveFile = home;
    saveFile += "/.xfreecell";
  }

  DIR* dir = opendir(saveFile.c_str());

  if (dir == NULL) {
    switch (errno) {
    case ENOENT:
      fprintf(stderr, "Directory %s not found. Creating.\n", saveFile.c_str());
      mkdir(saveFile.c_str(), 0755);
      break;
    case ENOTDIR:
      fprintf(stderr, "%s must be directory.\n", saveFile.c_str());
      exit(1);
      break;
    default:
      perror("ScoreWindow::ScoreWindow()");
      exit(1);
    }
  } else
    closedir(dir);
  saveFile += "/score";

  readScore();
  borderWidth(1);
}
void Window::save()
{
    scr = quadro->saveSocore;

    boxLayout = new QHBoxLayout();
    if(boxLayout == NULL){
        qDebug() << "boxLayout Falhou!";
        chek = true;
    }else{
        qDebug() << "boxLayout Sucesso!";
    }

    labelNome = new QLabel("Nome: ",this);
    if(labelNome == NULL){
        qDebug() << "labelNome Falhou!";
        chek = true;
    }else{
        qDebug() << "labelNome Sucesso!";
    }

    botaoSave = new QPushButton("Save",this);
    if(botaoSave == NULL){
        qDebug() << "botaoSave Falhou!";
        chek = true;
    }else{
        qDebug() << "botaoSave Sucesso!";
    }

    edit = new QLineEdit(this);
    if(edit == NULL){
        qDebug() << "edit Falhou!";
        chek = true;
    }else{
        qDebug() << "edit Sucesso!";
    }

    newWindow = new QWidget;
    if(newWindow == NULL){
        qDebug() << "newWindow Falhou!";
        chek = true;
    }else{
        qDebug() << "newWindow Sucesso!";
    }

    if(chek == true)
    {
        falhaCritica();
    }else{
        boxLayout->addWidget(labelNome);
        boxLayout->addWidget(edit);
        boxLayout->addWidget(botaoSave);

        newWindow -> setLayout(boxLayout);
        newWindow -> show();

        if(readScore() == false){
            connect(botaoSave,SIGNAL(clicked()),this,SLOT(writeScore()));
        }else{
            connect(botaoSave,SIGNAL(clicked()),this,SLOT(readWriteScore()));
        }
    }
}