00001 /* -*- Mode:c++ -*- */ 00002 /* 00003 * this is part of Spm 00004 * 00005 * Copyright (c) 2008 Guillaume Chevallereau 00006 * 00007 * This program is free software. You can redistribute it and/or modify it 00008 * under the terms of the GNU General Public License as published by the 00009 * Free Software Foundation. Either version 2 of the license or (at your 00010 * option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be usefull but WITHOUT 00013 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00014 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00015 * more details. 00016 * 00017 * You should have received a copy of the GNU General Public License along 00018 * with this program; if not, write to the Free Software Foundation, Inc., 00019 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 00020 */ 00021 #ifndef INSTALLATION_PROCESS_H 00022 #define INSTALLATION_PROCESS_H 00023 00024 #include "process.h" 00025 #include <plugin/infoInterface.h> 00026 #include <plugin/installerInterface.h> 00027 #include <boost/signal.hpp> 00028 00029 namespace Spm 00030 { 00031 namespace Core 00032 { 00033 class InstallationProcess : public Process 00034 { 00035 friend class Repositery; 00036 boost::signal<void (Action *)> newStep_; 00037 boost::signal<void (Plugin::InstallerInterface *)> metaDataParsed_; 00038 Plugin::InfoInterface::version * toInstall_; 00039 std::vector<Plugin::InfoInterface::version *> enableds_; 00040 void setup(std::vector<Action *> & actions); 00041 void installed (std::vector<Plugin::InfoInterface::version *> & installeds, 00042 Plugin::InfoInterface::version * version); 00043 void required (std::vector<Plugin::InfoInterface::version *> & requireds, 00044 Plugin::InfoInterface::version * package); 00045 void recommended (std::vector<Plugin::InfoInterface::version *> & requireds, 00046 Plugin::InfoInterface::version * package); 00047 void optional (std::vector<Plugin::InfoInterface::version *> & requireds, 00048 Plugin::InfoInterface::version * package); 00049 void doRun (); 00050 void onMetaDataParsed(Plugin::InstallerInterface * installer) 00051 { 00052 metaDataParsed_(installer); 00053 } 00054 public: 00055 InstallationProcess (Plugin::InfoInterface::version * version); 00056 00057 void enable (const Plugin::InfoInterface::version * package); 00058 void disable (const Plugin::InfoInterface::version * package); 00059 void installed (std::vector<Plugin::InfoInterface::version *> & installeds); 00060 void required (std::vector<Plugin::InfoInterface::version *> & requireds); 00061 void recommended (std::vector<Plugin::InfoInterface::version *> & recommendeds); 00062 void optional (std::vector<Plugin::InfoInterface::version *> & optionals); 00063 00064 boost::signal<void (Action *)> & installerChangeSignal() 00065 { 00066 return newStep_; 00067 } 00068 00069 boost::signal<void (Plugin::InstallerInterface *)> & signalMetaDataParsed() 00070 { 00071 return metaDataParsed_; 00072 } 00073 00074 Action * current (); 00075 }; 00076 } 00077 } 00078 00079 #endif