Example #1
0
KBBTutorial::KBBTutorial(QWidget* parent) : QGroupBox(i18n("Tutorial"), parent)
{
	m_marker = 0;
	m_gameWidget = 0;

	setMinimumSize(QSize(WIDTH, WIDTH));
	setFixedWidth(WIDTH);

	QVBoxLayout *tutorialLayout = new QVBoxLayout();
	setLayout(tutorialLayout);
	setFlat(true);

	m_progression = new QProgressBar(this);
	m_progression->setTextVisible(true);
	m_progression->setFormat("%v / %m");
	m_progression->setMinimum(FIRST_STEP-1);
	m_progression->setMaximum(LAST_STEP);
	m_progression->setWhatsThis(i18n("Displays the progress of the tutorial."));
	tutorialLayout->addWidget(m_progression);

	m_title = new QLabel(this);
	tutorialLayout->addWidget(m_title, 0, Qt::AlignHCenter);

	m_explanation = new KTextEdit(this);
	m_explanation->setReadOnly(true);
	m_explanation->setFrameStyle(QFrame::NoFrame);
	m_explanation->setAlignment(Qt::AlignJustify);
	tutorialLayout->addWidget(m_explanation);

	tutorialLayout->addStretch();


	QHBoxLayout *actionLayout = new QHBoxLayout();
	tutorialLayout->addLayout(actionLayout);
	QLabel* iconLabel = new QLabel(this);
	iconLabel->setFixedSize(24, 24);
	iconLabel->setPixmap(KIcon( QLatin1String( "go-next" )).pixmap(24, 24));
	actionLayout->addWidget(iconLabel, 0, Qt::AlignVCenter);
	m_playerAction = new QLabel(this);
	m_playerAction->setWhatsThis(i18n("Describes what you should do to reach the next tutorial step."));
	m_playerAction->setAlignment(Qt::AlignLeft);
	m_playerAction->setWordWrap(true);
	m_playerAction->setFrameStyle(QFrame::StyledPanel);
	m_playerAction->setStyleSheet("border-style: none");
	actionLayout->addWidget(m_playerAction, 0, Qt::AlignVCenter);

	QHBoxLayout *buttonLayout = new QHBoxLayout();
	tutorialLayout->addLayout(buttonLayout);
	m_buttonPrevious = new KPushButton(KIcon( QLatin1String( "go-previous") ), i18nc("Previous tutorial step", "&Previous"), this);
	m_buttonPrevious->setWhatsThis(i18n("Go back to the previous tutorial step."));
	connect(m_buttonPrevious, SIGNAL(clicked()), this, SLOT(previousStep()));
	buttonLayout->addWidget(m_buttonPrevious);
	m_buttonNext = new KPushButton(KIcon( QLatin1String( "go-next")) , i18nc("Next tutorial step", "&Next"), this);
	m_buttonNext->setWhatsThis(i18n("Go to the next tutorial step."));
	connect(m_buttonNext, SIGNAL(clicked()), this, SLOT(nextStep()));
	m_buttonNext->setDefault(true);
	buttonLayout->addWidget(m_buttonNext);
}
StepperNewGesture::StepperNewGesture(ExecutionManager *pExecutionManager, CommandChooser* pCommandChooser, int pNumberOfGesture, QWidget* parent) : Stepper(parent)
{
    this->executionManager = pExecutionManager;
    this->commandChooser = pCommandChooser;
    this->numberOfGesture = pNumberOfGesture;
    this->recordSaved = false;
    this->record = NULL;
    this->gestures = new QList<Gesture*>();
    this->timer = new QTimer(this);
    connect(this->timer, SIGNAL(timeout()), this, SLOT(startTimer()));
    this->time = new QTime(0,0,1);

    disconnect(this->buttonNext, SIGNAL(clicked()), 0, 0);
    disconnect(this->buttonPrevious, SIGNAL(clicked()), 0, 0);

    connect(this->buttonNext, SIGNAL(clicked()), this, SLOT(nextStep()));
    connect(this->buttonPrevious, SIGNAL(clicked()), this, SLOT(previousStep()));

    this->stepActions = new QList<StepperNewGesture::StepAction>();
}
Example #3
0
bool SCAnimationDirector::navigate(Navigation navigation)
{
    bool finished = false;
    if (m_pageEffectRunner) {
        m_pageEffectRunner->finish();
        finishAnimations();
        // finish on first step
        m_timeLine.stop();
        finished = true;
    }
    else if (m_timeLine.state() == QTimeLine::Running) { // there are still shape animations running
        finishAnimations();
        m_timeLine.stop();
        finished = true;
    }

    bool presentationFinished = false;

    switch (navigation)
    {
        case FirstPage:
        case PreviousPage:
        case NextPage:
        case LastPage:
            presentationFinished = changePage(navigation);
            break;
        case PreviousStep:
            previousStep();
            break;
        case NextStep:
            if (!finished) {
                presentationFinished = nextStep();
            }
            break;
        default:
            break;
    }

    return presentationFinished;
}