You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
3.6 KiB
C++
106 lines
3.6 KiB
C++
11 years ago
|
// Ryzom Core - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||
|
//
|
||
5 years ago
|
// This source file has been modified by the following contributors:
|
||
|
// Copyright (C) 2014 Laszlo KIS-ADAM (dfighter) <dfighter1985@gmail.com>
|
||
|
//
|
||
11 years ago
|
// This program is free software: you can redistribute it and/or modify
|
||
|
// it under the terms of the GNU Affero General Public License as
|
||
|
// published by the Free Software Foundation, either version 3 of the
|
||
|
// License, or (at your option) any later version.
|
||
|
//
|
||
|
// This program is distributed in the hope that it will be useful,
|
||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
// GNU Affero General Public License for more details.
|
||
|
//
|
||
|
// You should have received a copy of the GNU Affero General Public License
|
||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
|
||
|
|
||
|
#include "pm_watcher.h"
|
||
11 years ago
|
#include "extension_system/iplugin_manager.h"
|
||
11 years ago
|
#include "splash_screen.h"
|
||
|
|
||
11 years ago
|
namespace
|
||
|
{
|
||
|
enum Progress
|
||
|
{
|
||
|
PLUGINS_LOADED = 10,
|
||
|
PLUGINS_INITIALIZED = 90,
|
||
|
PLUGINS_STARTED = 100
|
||
|
};
|
||
|
}
|
||
|
|
||
11 years ago
|
void PluginManagerWatcher::connect()
|
||
11 years ago
|
{
|
||
|
QObject::connect( pm, SIGNAL( pluginLoading( const char * ) ), this, SLOT( onPluginLoading( const char * ) ) );
|
||
11 years ago
|
QObject::connect( pm, SIGNAL( pluginInitializing( const char * ) ), this, SLOT( onPluginInitializing( const char * ) ) );
|
||
|
QObject::connect( pm, SIGNAL( pluginStarting( const char * ) ), this, SLOT( onPluginStarting( const char * ) ) );
|
||
11 years ago
|
QObject::connect( pm, SIGNAL( pluginsLoaded() ), this, SLOT( onPluginsLoaded() ) );
|
||
|
QObject::connect( pm, SIGNAL( pluginsInitialized() ), this, SLOT( onPluginsInitialized() ) );
|
||
|
QObject::connect( pm, SIGNAL( pluginsStarted() ), this, SLOT( onPluginsStarted() ) );
|
||
|
QObject::connect( pm, SIGNAL( pluginCount( int ) ), this, SLOT( onPluginCount( int ) ) );
|
||
11 years ago
|
}
|
||
|
|
||
|
void PluginManagerWatcher::disconnect()
|
||
11 years ago
|
{
|
||
|
QObject::disconnect( pm, SIGNAL( pluginLoading( const char * ) ), this, SLOT( onPluginLoading( const char * ) ) );
|
||
11 years ago
|
QObject::disconnect( pm, SIGNAL( pluginInitializing( const char * ) ), this, SLOT( onPluginInitializing( const char * ) ) );
|
||
|
QObject::disconnect( pm, SIGNAL( pluginStarting( const char * ) ), this, SLOT( onPluginStarting( const char * ) ) );
|
||
11 years ago
|
QObject::disconnect( pm, SIGNAL( pluginsLoaded() ), this, SLOT( onPluginsLoaded() ) );
|
||
|
QObject::disconnect( pm, SIGNAL( pluginsInitialized() ), this, SLOT( onPluginsInitialized() ) );
|
||
|
QObject::disconnect( pm, SIGNAL( pluginsStarted() ), this, SLOT( onPluginsStarted() ) );
|
||
|
QObject::disconnect( pm, SIGNAL( pluginCount( int ) ), this, SLOT( onPluginCount( int ) ) );
|
||
11 years ago
|
}
|
||
|
|
||
|
void PluginManagerWatcher::onPluginLoading( const char *plugin )
|
||
|
{
|
||
|
QString s = "Loading plugin ";
|
||
|
s += plugin;
|
||
|
s += "...";
|
||
|
sp->setText( s );
|
||
11 years ago
|
|
||
|
sp->advanceProgress( PLUGINS_LOADED / pluginCount );
|
||
11 years ago
|
}
|
||
|
|
||
|
void PluginManagerWatcher::onPluginInitializing( const char *plugin )
|
||
|
{
|
||
|
QString s = "Initializing plugin ";
|
||
|
s += plugin;
|
||
|
s += "...";
|
||
|
sp->setText( s );
|
||
11 years ago
|
|
||
|
sp->advanceProgress( ( PLUGINS_INITIALIZED - PLUGINS_LOADED ) / pluginCount );
|
||
11 years ago
|
}
|
||
|
|
||
|
void PluginManagerWatcher::onPluginStarting( const char *plugin )
|
||
|
{
|
||
|
QString s = "Starting plugin ";
|
||
|
s += plugin;
|
||
|
s += "...";
|
||
|
sp->setText( s );
|
||
11 years ago
|
|
||
|
sp->advanceProgress( ( PLUGINS_STARTED - PLUGINS_INITIALIZED ) / pluginCount );
|
||
11 years ago
|
}
|
||
|
|
||
|
|
||
11 years ago
|
void PluginManagerWatcher::onPluginsLoaded()
|
||
|
{
|
||
|
sp->setProgress( PLUGINS_LOADED );
|
||
|
}
|
||
11 years ago
|
|
||
11 years ago
|
void PluginManagerWatcher::onPluginsInitialized()
|
||
|
{
|
||
|
sp->setProgress( PLUGINS_INITIALIZED );
|
||
|
}
|
||
|
|
||
|
void PluginManagerWatcher::onPluginsStarted()
|
||
|
{
|
||
|
sp->setProgress( PLUGINS_STARTED );
|
||
|
}
|
||
|
|
||
|
void PluginManagerWatcher::onPluginCount( int count )
|
||
|
{
|
||
|
pluginCount = count;
|
||
|
}
|