void Settings::setDifficulty(int newDifficulty)
{
    if (newDifficulty != difficulty()) {
        setValue(DIFFICULTY_KEY, newDifficulty);
        emit difficultyChanged(newDifficulty);
    }
}
MainWindow::MainWindow()
{
    m_main = new MainArea();
    QGraphicsView* view = new QGraphicsView(m_main, this);
    view->setOptimizationFlags( QGraphicsView::DontClipPainter |
                                QGraphicsView::DontSavePainterState |
                                QGraphicsView::DontAdjustForAntialiasing );
//    view->setViewportUpdateMode( QGraphicsView::FullViewportUpdate );
    view->setCacheMode( QGraphicsView::CacheBackground );
    view->setHorizontalScrollBarPolicy ( Qt::ScrollBarAlwaysOff );
    view->setVerticalScrollBarPolicy ( Qt::ScrollBarAlwaysOff );
    setCentralWidget(view);

    setupActions();

#ifndef Q_OS_QNX
    QLayout* l = layout();
    Q_ASSERT(l);
    l->setSizeConstraint(QLayout::SetFixedSize);

    // setup status bar
    KStatusBar* bar = statusBar();
    Q_ASSERT(bar);
    m_time_label = new QLabel("");
    bar->addPermanentWidget(m_time_label);

    m_balls_label = new QLabel("");
    bar->addWidget(m_balls_label);
//     bar->setItemAlignment(STATUSBAR_BALLS, Qt::AlignLeft);
#endif

    connect(m_main, SIGNAL(changeGameTime(int)), this, SLOT(setGameTime(int)));
    connect(m_main, SIGNAL(changeBallNumber(int)), this, SLOT(setBallNumber(int)));
    connect(m_main, SIGNAL(changeState(bool)), this, SLOT(changeState(bool)));
    connect(m_main, SIGNAL(pause(bool)), this, SLOT(pause(bool)));

#ifndef Q_OS_QNX
    stateChanged("playing", KXMLGUIClient::StateReverse);
#endif
    connect(m_main, SIGNAL(starting()), this, SLOT(newGame()));
    connect(m_main, SIGNAL(gameOver(int)), this, SLOT(gameOver(int)));

#ifndef Q_OS_QNX
    KGameDifficulty::init(this, this, SLOT(difficultyChanged(KGameDifficulty::standardLevel)));
    KGameDifficulty::setRestartOnChange(KGameDifficulty::RestartOnChange);
    KGameDifficulty::addStandardLevel(KGameDifficulty::Easy);
    KGameDifficulty::addStandardLevel(KGameDifficulty::Medium);
    KGameDifficulty::addStandardLevel(KGameDifficulty::Hard);
    KGameDifficulty::setLevel(KGameDifficulty::standardLevel(KollisionConfig::gameDifficulty()));
#endif

#ifdef Q_OS_QNX
    //setMinimumSize(m_main->sceneRect().size().toSize());
#endif
}
void DifficultyProfile::setDifficulty(Difficulty difficulty)
{
    m_difficulty = difficulty;

    emit difficultyChanged();
}
Beispiel #4
0
void ActivityInfo::setDifficulty(const int &difficulty)
{
  m_difficulty = difficulty;
  emit difficultyChanged();
}
Beispiel #5
0
void Settings::setDifficulty(const Settings::Difficulty &difficulty)
{
    _difficulty = difficulty;
    emit difficultyChanged(_difficulty);
}