KTutorial
0.5.1
|
00001 /*************************************************************************** 00002 * Copyright (C) 2009 by Daniel Calviño Sánchez <danxuliu@gmail.com> * 00003 * Copyright (C) 2010 by Daniel Calviño Sánchez <danxuliu@gmail.com> * 00004 * Copyright (C) 2012 by Daniel Calviño Sánchez <danxuliu@gmail.com> * 00005 * * 00006 * This program is free software; you can redistribute it and/or modify * 00007 * it under the terms of the GNU General Public License as published by * 00008 * the Free Software Foundation; either version 2 of the License, or * 00009 * (at your option) any later version. * 00010 * * 00011 * This program is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00014 * GNU General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU General Public License * 00017 * along with this program; If not, see <http://www.gnu.org/licenses/>. * 00018 ***************************************************************************/ 00019 00020 #include "ScriptedTutorial.h" 00021 00022 #include <kross/core/action.h> 00023 00024 #include "ScriptingModule.h" 00025 #include "../TutorialInformation.h" 00026 00027 namespace ktutorial { 00028 namespace scripting { 00029 00030 ScriptedTutorial::ScriptedTutorial(const QString& filename): 00031 Tutorial(new TutorialInformation(filename)) { 00032 00033 mScriptAction = new Kross::Action(this, filename); 00034 00035 if (mScriptAction->setFile(filename)) { 00036 mScriptAction->addObject(this, "tutorial"); 00037 mScriptAction->addObject(ScriptingModule::self(), "ktutorial"); 00038 mScriptAction->trigger(); 00039 mValid = !mScriptAction->hadError(); 00040 } else { 00041 mValid = false; 00042 } 00043 } 00044 00045 ScriptedTutorial::~ScriptedTutorial() { 00046 } 00047 00048 QObject* ScriptedTutorial::tutorialInformationAsObject() const { 00049 return tutorialInformation(); 00050 } 00051 00052 bool ScriptedTutorial::isValid() const { 00053 return mValid; 00054 } 00055 00056 //protected: 00057 00058 void ScriptedTutorial::setup() { 00059 emit setup(this); 00060 } 00061 00062 void ScriptedTutorial::tearDown() { 00063 emit tearDown(this); 00064 } 00065 00066 } 00067 }