KTutorial  0.5.1
Step.h
00001 /***************************************************************************
00002  *   Copyright (C) 2008 by Daniel Calviño Sánchez <danxuliu@gmail.com>     *
00003  *   Copyright (C) 2009 by Daniel Calviño Sánchez <danxuliu@gmail.com>     *
00004  *   Copyright (C) 2010 by Daniel Calviño Sánchez <danxuliu@gmail.com>     *
00005  *   Copyright (C) 2011 by Daniel Calviño Sánchez <danxuliu@gmail.com>     *
00006  *   Copyright (C) 2012 by Daniel Calviño Sánchez <danxuliu@gmail.com>     *
00007  *                                                                         *
00008  *   This program is free software; you can redistribute it and/or modify  *
00009  *   it under the terms of the GNU General Public License as published by  *
00010  *   the Free Software Foundation; either version 2 of the License, or     *
00011  *   (at your option) any later version.                                   *
00012  *                                                                         *
00013  *   This program is distributed in the hope that it will be useful,       *
00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00016  *   GNU General Public License for more details.                          *
00017  *                                                                         *
00018  *   You should have received a copy of the GNU General Public License     *
00019  *   along with this program; If not, see <http://www.gnu.org/licenses/>.  *
00020  ***************************************************************************/
00021 
00022 #ifndef KTUTORIAL_STEP_H
00023 #define KTUTORIAL_STEP_H
00024 
00025 #include <QtCore/QObject>
00026 
00027 #include "ktutorial_export.h"
00028 
00029 namespace ktutorial {
00030 class Option;
00031 class WaitFor;
00032 }
00033 
00034 namespace ktutorial {
00035 
00134 class KTUTORIAL_EXPORT Step: public QObject {
00135 Q_OBJECT
00136 public:
00137 
00144     explicit Step(const QString& id);
00145 
00149     virtual ~Step();
00150 
00156     QString id() const;
00157 
00163     QList<Option*> options() const;
00164 
00170     QString text() const;
00171 
00182     Q_INVOKABLE void setText(const QString& text);
00183 
00189     bool isActive() const;
00190 
00197     void setActive(bool active);
00198 
00221     Q_INVOKABLE void addOption(Option* option, QObject* receiver,
00222                                const QString& slot);
00223 
00242     Q_INVOKABLE void addOption(Option* option, const QString& nextStepId);
00243 
00266     Q_INVOKABLE void addWaitFor(WaitFor* waitFor, QObject* receiver,
00267                                 const QString& slot);
00268 
00287     Q_INVOKABLE void addWaitFor(WaitFor* waitFor, const QString& nextStepId);
00288 
00299     Q_INVOKABLE void removeOption(Option* option);
00300 
00318     Q_INVOKABLE void removeWaitFor(WaitFor* waitFor);
00319 
00320 Q_SIGNALS:
00321 
00329     void nextStepRequested(const QString& nextStepId);
00330 
00331 protected:
00332 
00338     virtual void setup();
00339 
00345     virtual void tearDown();
00346 
00358     virtual void connectWaitFor(WaitFor* waitFor, QObject* receiver,
00359                                 const QString& slot);
00360 
00369     virtual void disconnectWaitFor(WaitFor* waitFor);
00370 
00371 private:
00372 
00373     class StepPrivate* d;
00374 
00380     void setupWrapper();
00381 
00387     void tearDownWrapper();
00388 
00397     bool addOption(Option* option);
00398 
00406     bool addWaitFor(WaitFor* waitFor);
00407 
00408 private Q_SLOTS:
00409 
00416     void requestNextStepForWaitFor(WaitFor* waitFor);
00417 
00418 };
00419 
00420 }
00421 
00422 #endif