Merge branch 'main/rendor-staging' into lua_versions
[ryzomcore.git] / studio / src / pm_watcher.cpp
blob6926048fd7d05e28f1c794a06ddaf5974125fbac
1 // Ryzom Core - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2014 Laszlo KIS-ADAM (dfighter) <dfighter1985@gmail.com>
6 //
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "pm_watcher.h"
22 #include "extension_system/iplugin_manager.h"
23 #include "splash_screen.h"
25 namespace
27 enum Progress
29 PLUGINS_LOADED = 10,
30 PLUGINS_INITIALIZED = 90,
31 PLUGINS_STARTED = 100
35 void PluginManagerWatcher::connect()
37 QObject::connect( pm, SIGNAL( pluginLoading( const char * ) ), this, SLOT( onPluginLoading( const char * ) ) );
38 QObject::connect( pm, SIGNAL( pluginInitializing( const char * ) ), this, SLOT( onPluginInitializing( const char * ) ) );
39 QObject::connect( pm, SIGNAL( pluginStarting( const char * ) ), this, SLOT( onPluginStarting( const char * ) ) );
40 QObject::connect( pm, SIGNAL( pluginsLoaded() ), this, SLOT( onPluginsLoaded() ) );
41 QObject::connect( pm, SIGNAL( pluginsInitialized() ), this, SLOT( onPluginsInitialized() ) );
42 QObject::connect( pm, SIGNAL( pluginsStarted() ), this, SLOT( onPluginsStarted() ) );
43 QObject::connect( pm, SIGNAL( pluginCount( int ) ), this, SLOT( onPluginCount( int ) ) );
46 void PluginManagerWatcher::disconnect()
48 QObject::disconnect( pm, SIGNAL( pluginLoading( const char * ) ), this, SLOT( onPluginLoading( const char * ) ) );
49 QObject::disconnect( pm, SIGNAL( pluginInitializing( const char * ) ), this, SLOT( onPluginInitializing( const char * ) ) );
50 QObject::disconnect( pm, SIGNAL( pluginStarting( const char * ) ), this, SLOT( onPluginStarting( const char * ) ) );
51 QObject::disconnect( pm, SIGNAL( pluginsLoaded() ), this, SLOT( onPluginsLoaded() ) );
52 QObject::disconnect( pm, SIGNAL( pluginsInitialized() ), this, SLOT( onPluginsInitialized() ) );
53 QObject::disconnect( pm, SIGNAL( pluginsStarted() ), this, SLOT( onPluginsStarted() ) );
54 QObject::disconnect( pm, SIGNAL( pluginCount( int ) ), this, SLOT( onPluginCount( int ) ) );
57 void PluginManagerWatcher::onPluginLoading( const char *plugin )
59 QString s = "Loading plugin ";
60 s += plugin;
61 s += "...";
62 sp->setText( s );
64 sp->advanceProgress( PLUGINS_LOADED / pluginCount );
67 void PluginManagerWatcher::onPluginInitializing( const char *plugin )
69 QString s = "Initializing plugin ";
70 s += plugin;
71 s += "...";
72 sp->setText( s );
74 sp->advanceProgress( ( PLUGINS_INITIALIZED - PLUGINS_LOADED ) / pluginCount );
77 void PluginManagerWatcher::onPluginStarting( const char *plugin )
79 QString s = "Starting plugin ";
80 s += plugin;
81 s += "...";
82 sp->setText( s );
84 sp->advanceProgress( ( PLUGINS_STARTED - PLUGINS_INITIALIZED ) / pluginCount );
88 void PluginManagerWatcher::onPluginsLoaded()
90 sp->setProgress( PLUGINS_LOADED );
93 void PluginManagerWatcher::onPluginsInitialized()
95 sp->setProgress( PLUGINS_INITIALIZED );
98 void PluginManagerWatcher::onPluginsStarted()
100 sp->setProgress( PLUGINS_STARTED );
103 void PluginManagerWatcher::onPluginCount( int count )
105 pluginCount = count;