예제 #1
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    boardWidget = new BoardViewer(this);
    ui->scrollArea->setWidget(boardWidget);

    connect(ui->nextMoveButtton,SIGNAL(clicked()),boardWidget,SLOT(nextMove()));
    connect(ui->clearButton,SIGNAL(clicked()),boardWidget,SLOT(clearBoard()));
    connect(ui->randomFillButton,SIGNAL(clicked()),boardWidget,SLOT(randomFill()));
    connect(ui->zoomInButton,SIGNAL(clicked()),boardWidget,SLOT(zoomIn()));
    connect(ui->zoomOutButton,SIGNAL(clicked()),boardWidget,SLOT(zoomOut()));
    connect(ui->sizeDownButton,SIGNAL(clicked()),boardWidget,SLOT(sizeDown()));
    connect(ui->sizeUpButton,SIGNAL(clicked()),boardWidget,SLOT(sizeUp()));
    connect(ui->cycledBorderButton,SIGNAL(toggled(bool)),boardWidget,SLOT(setBorderTypeCycled(bool)));
    connect(ui->deadBorderButton,SIGNAL(toggled(bool)),boardWidget,SLOT(setBorderTypeDead(bool)));
    connect(ui->mobiusBorderButton,SIGNAL(toggled(bool)),boardWidget,SLOT(setBorderTypeMobius(bool)));
    connect(ui->resetButton,SIGNAL(clicked()),boardWidget,SLOT(reset()));
    connect(ui->resetButton,SIGNAL(clicked()),this,SLOT(reset()));



    QSettings settings;
    int borderType=settings.value("/Settings/BorderType",GameBoard::borderCycled).toInt();
    switch (borderType)
    {
    case GameBoard::borderCycled: ui->cycledBorderButton->setChecked(true); break;
    case GameBoard::borderDead:   ui->deadBorderButton->setChecked(true); break;
    case GameBoard::borderMobius: ui->mobiusBorderButton->setChecked(true); break;
    }

    coords = new QLabel(this);
    generationNumber = new QLabel(this);
    generationNumber->setText(" "+tr("Покоління")+": 0");
    coords->setText("(-,-)");
    coords->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
    coords->setMinimumWidth(coordLabelWidth);

    ui->statusBar->addWidget(coords);
    ui->statusBar->addWidget(generationNumber);

    connect(boardWidget,SIGNAL(changeGeneration(int)),this,SLOT(generationChanged(int)));
    connect(boardWidget,SIGNAL(changeCoords(QString,QString)),this,SLOT(coordsChanged(QString,QString)));

    ui->action_about->setShortcut(Qt::Key_F1);
    connect(ui->action_about,SIGNAL(triggered()),this,SLOT(aboutProgram()));
    connect(ui->action_Qt,SIGNAL(triggered()),this,SLOT(aboutQt()));

    ui->action_open->setShortcut(Qt::CTRL + Qt::Key_O);
    ui->action_save->setShortcut(Qt::CTRL + Qt::Key_S);
    connect(ui->action_open,SIGNAL(triggered()),this,SLOT(loadFromFile()));
    connect(ui->action_save,SIGNAL(triggered()),this,SLOT(saveToFile()));
}
예제 #2
0
void getProcCenters(scalar_t **&procCenters, procId_t &numCoords, int &coorDim){
    numCoords = nProcs;
    coorDim = procDIM;
    randomFill(procCenters, numCoords, coorDim);
}
예제 #3
0
void getPartCenters(scalar_t **&partCenters, procId_t &numCoords, int &coorDim){
    numCoords = nParts;
    coorDim = partDIM;
    randomFill(partCenters, numCoords, coorDim);
}