EOL
This commit is contained in:
parent
0dcabb6b64
commit
8fab3ccce1
4 changed files with 467 additions and 467 deletions
|
@ -1,236 +1,236 @@
|
||||||
// Ryzom Core - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
// Ryzom Core - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU Affero General Public License as
|
// it under the terms of the GNU Affero General Public License as
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
// License, or (at your option) any later version.
|
// License, or (at your option) any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU Affero General Public License for more details.
|
// GNU Affero General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
// 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/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
#include "settings_dialog.h"
|
#include "settings_dialog.h"
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
int findListItem( QListWidget *l, const QString &s )
|
int findListItem( QListWidget *l, const QString &s )
|
||||||
{
|
{
|
||||||
for( int i = 0; i < l->count(); i++ )
|
for( int i = 0; i < l->count(); i++ )
|
||||||
{
|
{
|
||||||
QListWidgetItem *item = l->item( i );
|
QListWidgetItem *item = l->item( i );
|
||||||
if( item->text() == s )
|
if( item->text() == s )
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsDialog::SettingsDialog( QDialog *parent ) :
|
SettingsDialog::SettingsDialog( QDialog *parent ) :
|
||||||
QDialog( parent )
|
QDialog( parent )
|
||||||
{
|
{
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
setupConnections();
|
setupConnections();
|
||||||
settings = NULL;
|
settings = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsDialog::~SettingsDialog()
|
SettingsDialog::~SettingsDialog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::load()
|
void SettingsDialog::load()
|
||||||
{
|
{
|
||||||
pluginsLE->setText( settings->value( "PluginPath" ).toString() );
|
pluginsLE->setText( settings->value( "PluginPath" ).toString() );
|
||||||
|
|
||||||
settings->beginGroup( "DataPath" );
|
settings->beginGroup( "DataPath" );
|
||||||
|
|
||||||
sheetsLE->setText( settings->value( "LevelDesignPath" ).toString() );
|
sheetsLE->setText( settings->value( "LevelDesignPath" ).toString() );
|
||||||
assetsLE->setText( settings->value( "AssetsPath" ).toString() );
|
assetsLE->setText( settings->value( "AssetsPath" ).toString() );
|
||||||
primitivesLE->setText( settings->value( "PrimitivesPath" ).toString() );
|
primitivesLE->setText( settings->value( "PrimitivesPath" ).toString() );
|
||||||
ligoLE->setText( settings->value( "LigoConfigFile" ).toString() );
|
ligoLE->setText( settings->value( "LigoConfigFile" ).toString() );
|
||||||
|
|
||||||
QStringList l = settings->value( "SearchPaths" ).toStringList();
|
QStringList l = settings->value( "SearchPaths" ).toStringList();
|
||||||
{
|
{
|
||||||
QStringListIterator itr( l );
|
QStringListIterator itr( l );
|
||||||
while( itr.hasNext() )
|
while( itr.hasNext() )
|
||||||
{
|
{
|
||||||
QString p = itr.next();
|
QString p = itr.next();
|
||||||
if( findListItem( searchLW, p ) == -1 )
|
if( findListItem( searchLW, p ) == -1 )
|
||||||
searchLW->addItem( p );
|
searchLW->addItem( p );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
l.clear();
|
l.clear();
|
||||||
|
|
||||||
l = settings->value( "RecursiveSearchPathes" ).toStringList();
|
l = settings->value( "RecursiveSearchPathes" ).toStringList();
|
||||||
{
|
{
|
||||||
QStringListIterator itr( l );
|
QStringListIterator itr( l );
|
||||||
while( itr.hasNext() )
|
while( itr.hasNext() )
|
||||||
{
|
{
|
||||||
QString p = itr.next();
|
QString p = itr.next();
|
||||||
if( findListItem( recursiveLW, p ) == -1 )
|
if( findListItem( recursiveLW, p ) == -1 )
|
||||||
recursiveLW->addItem( p );
|
recursiveLW->addItem( p );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::saveSearchPaths()
|
void SettingsDialog::saveSearchPaths()
|
||||||
{
|
{
|
||||||
QStringList l;
|
QStringList l;
|
||||||
for( int i = 0; i < searchLW->count(); i++ )
|
for( int i = 0; i < searchLW->count(); i++ )
|
||||||
{
|
{
|
||||||
l.push_back( searchLW->item( i )->text() );
|
l.push_back( searchLW->item( i )->text() );
|
||||||
}
|
}
|
||||||
|
|
||||||
settings->setValue( "SearchPaths", l );
|
settings->setValue( "SearchPaths", l );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::saveRecursivePaths()
|
void SettingsDialog::saveRecursivePaths()
|
||||||
{
|
{
|
||||||
QStringList l;
|
QStringList l;
|
||||||
for( int i = 0; i < recursiveLW->count(); i++ )
|
for( int i = 0; i < recursiveLW->count(); i++ )
|
||||||
{
|
{
|
||||||
l.push_back( recursiveLW->item( i )->text() );
|
l.push_back( recursiveLW->item( i )->text() );
|
||||||
}
|
}
|
||||||
|
|
||||||
settings->setValue( "RecursiveSearchPathes", l );
|
settings->setValue( "RecursiveSearchPathes", l );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::save()
|
void SettingsDialog::save()
|
||||||
{
|
{
|
||||||
settings->setValue( "PluginPath", pluginsLE->text() );
|
settings->setValue( "PluginPath", pluginsLE->text() );
|
||||||
|
|
||||||
settings->beginGroup( "DataPath" );
|
settings->beginGroup( "DataPath" );
|
||||||
|
|
||||||
settings->setValue( "LevelDesignPath", sheetsLE->text() );
|
settings->setValue( "LevelDesignPath", sheetsLE->text() );
|
||||||
settings->setValue( "AssetsPath", assetsLE->text() );
|
settings->setValue( "AssetsPath", assetsLE->text() );
|
||||||
settings->setValue( "PrimitivesPath", primitivesLE->text() );
|
settings->setValue( "PrimitivesPath", primitivesLE->text() );
|
||||||
settings->setValue( "LigoConfigFile", ligoLE->text() );
|
settings->setValue( "LigoConfigFile", ligoLE->text() );
|
||||||
|
|
||||||
saveSearchPaths();
|
saveSearchPaths();
|
||||||
saveRecursivePaths();
|
saveRecursivePaths();
|
||||||
|
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
|
|
||||||
settings->sync();
|
settings->sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::accept()
|
void SettingsDialog::accept()
|
||||||
{
|
{
|
||||||
save();
|
save();
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::reject()
|
void SettingsDialog::reject()
|
||||||
{
|
{
|
||||||
QDialog::reject();
|
QDialog::reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::onOKClicked()
|
void SettingsDialog::onOKClicked()
|
||||||
{
|
{
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::onCancelClicked()
|
void SettingsDialog::onCancelClicked()
|
||||||
{
|
{
|
||||||
reject();
|
reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::onPluginBClicked()
|
void SettingsDialog::onPluginBClicked()
|
||||||
{
|
{
|
||||||
QString p = QFileDialog::getExistingDirectory( this, tr( "Plugins directory" ), "" );
|
QString p = QFileDialog::getExistingDirectory( this, tr( "Plugins directory" ), "" );
|
||||||
pluginsLE->setText( p );
|
pluginsLE->setText( p );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::onSheetsBClicked()
|
void SettingsDialog::onSheetsBClicked()
|
||||||
{
|
{
|
||||||
QString p = QFileDialog::getExistingDirectory( this, tr( "Sheets directory" ), "" );
|
QString p = QFileDialog::getExistingDirectory( this, tr( "Sheets directory" ), "" );
|
||||||
sheetsLE->setText( p );
|
sheetsLE->setText( p );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::onAssetsBClicked()
|
void SettingsDialog::onAssetsBClicked()
|
||||||
{
|
{
|
||||||
QString p = QFileDialog::getExistingDirectory( this, tr( "Assets directory" ), "" );
|
QString p = QFileDialog::getExistingDirectory( this, tr( "Assets directory" ), "" );
|
||||||
assetsLE->setText( p );
|
assetsLE->setText( p );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::onPrimitivesBClicked()
|
void SettingsDialog::onPrimitivesBClicked()
|
||||||
{
|
{
|
||||||
QString p = QFileDialog::getExistingDirectory( this, tr( "Primitives directory" ), "" );
|
QString p = QFileDialog::getExistingDirectory( this, tr( "Primitives directory" ), "" );
|
||||||
primitivesLE->setText( p );
|
primitivesLE->setText( p );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::onLigoBClicked()
|
void SettingsDialog::onLigoBClicked()
|
||||||
{
|
{
|
||||||
QString p = QFileDialog::getExistingDirectory( this, tr( "LIGO directory" ), "" );
|
QString p = QFileDialog::getExistingDirectory( this, tr( "LIGO directory" ), "" );
|
||||||
ligoLE->setText( p );
|
ligoLE->setText( p );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::onPathAddClicked()
|
void SettingsDialog::onPathAddClicked()
|
||||||
{
|
{
|
||||||
QString p = QFileDialog::getExistingDirectory( this, tr( "Search path" ), "" );
|
QString p = QFileDialog::getExistingDirectory( this, tr( "Search path" ), "" );
|
||||||
if( p.isEmpty() )
|
if( p.isEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( findListItem( searchLW, p ) != -1 )
|
if( findListItem( searchLW, p ) != -1 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
searchLW->addItem( p );
|
searchLW->addItem( p );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::onPathRemoveClicked()
|
void SettingsDialog::onPathRemoveClicked()
|
||||||
{
|
{
|
||||||
QListWidgetItem *i = searchLW->currentItem();
|
QListWidgetItem *i = searchLW->currentItem();
|
||||||
if( i == NULL )
|
if( i == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
delete i;
|
delete i;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::onRecursiveAddClicked()
|
void SettingsDialog::onRecursiveAddClicked()
|
||||||
{
|
{
|
||||||
QString p = QFileDialog::getExistingDirectory( this, tr( "Recursive search path" ), "" );
|
QString p = QFileDialog::getExistingDirectory( this, tr( "Recursive search path" ), "" );
|
||||||
if( p.isEmpty() )
|
if( p.isEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( findListItem( recursiveLW, p ) != -1 )
|
if( findListItem( recursiveLW, p ) != -1 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
recursiveLW->addItem( p );
|
recursiveLW->addItem( p );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::onRecursiveRemoveClicked()
|
void SettingsDialog::onRecursiveRemoveClicked()
|
||||||
{
|
{
|
||||||
QListWidgetItem *i = recursiveLW->currentItem();
|
QListWidgetItem *i = recursiveLW->currentItem();
|
||||||
if( i == NULL )
|
if( i == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
delete i;
|
delete i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SettingsDialog::setupConnections()
|
void SettingsDialog::setupConnections()
|
||||||
{
|
{
|
||||||
connect( bb, SIGNAL( accepted() ), this, SLOT( onOKClicked() ) );
|
connect( bb, SIGNAL( accepted() ), this, SLOT( onOKClicked() ) );
|
||||||
connect( bb, SIGNAL( rejected() ), this, SLOT( onCancelClicked() ) );
|
connect( bb, SIGNAL( rejected() ), this, SLOT( onCancelClicked() ) );
|
||||||
|
|
||||||
connect( pluginsB, SIGNAL( clicked( bool ) ), this, SLOT( onPluginBClicked() ) );
|
connect( pluginsB, SIGNAL( clicked( bool ) ), this, SLOT( onPluginBClicked() ) );
|
||||||
connect( sheetsB, SIGNAL( clicked( bool ) ), this, SLOT( onSheetsBClicked() ) );
|
connect( sheetsB, SIGNAL( clicked( bool ) ), this, SLOT( onSheetsBClicked() ) );
|
||||||
connect( assetsB, SIGNAL( clicked( bool ) ), this, SLOT( onAssetsBClicked() ) );
|
connect( assetsB, SIGNAL( clicked( bool ) ), this, SLOT( onAssetsBClicked() ) );
|
||||||
connect( primitivesB, SIGNAL( clicked( bool ) ), this, SLOT( onPrimitivesBClicked() ) );
|
connect( primitivesB, SIGNAL( clicked( bool ) ), this, SLOT( onPrimitivesBClicked() ) );
|
||||||
connect( ligoB, SIGNAL( clicked( bool ) ), this, SLOT( onLigoBClicked() ) );
|
connect( ligoB, SIGNAL( clicked( bool ) ), this, SLOT( onLigoBClicked() ) );
|
||||||
|
|
||||||
connect( pathAddB, SIGNAL( clicked( bool ) ), this, SLOT( onPathAddClicked() ) );
|
connect( pathAddB, SIGNAL( clicked( bool ) ), this, SLOT( onPathAddClicked() ) );
|
||||||
connect( pathRemoveB, SIGNAL( clicked( bool ) ), this, SLOT( onPathRemoveClicked() ) );
|
connect( pathRemoveB, SIGNAL( clicked( bool ) ), this, SLOT( onPathRemoveClicked() ) );
|
||||||
connect( recAddB, SIGNAL( clicked( bool ) ), this, SLOT( onRecursiveAddClicked() ) );
|
connect( recAddB, SIGNAL( clicked( bool ) ), this, SLOT( onRecursiveAddClicked() ) );
|
||||||
connect( recRemoveB, SIGNAL( clicked( bool ) ), this, SLOT( onRecursiveRemoveClicked() ) );
|
connect( recRemoveB, SIGNAL( clicked( bool ) ), this, SLOT( onRecursiveRemoveClicked() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,62 +1,62 @@
|
||||||
// Ryzom Core - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
// Ryzom Core - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU Affero General Public License as
|
// it under the terms of the GNU Affero General Public License as
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
// License, or (at your option) any later version.
|
// License, or (at your option) any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU Affero General Public License for more details.
|
// GNU Affero General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
// 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/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#ifndef SETTINGS_DIALOG_H
|
#ifndef SETTINGS_DIALOG_H
|
||||||
#define SETTINGS_DIALOG_H
|
#define SETTINGS_DIALOG_H
|
||||||
|
|
||||||
#include "ui_settings_dialog.h"
|
#include "ui_settings_dialog.h"
|
||||||
|
|
||||||
class QSettings;
|
class QSettings;
|
||||||
|
|
||||||
class SettingsDialog : public QDialog, public Ui::SettingsDialog
|
class SettingsDialog : public QDialog, public Ui::SettingsDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SettingsDialog( QDialog *parent = NULL );
|
SettingsDialog( QDialog *parent = NULL );
|
||||||
~SettingsDialog();
|
~SettingsDialog();
|
||||||
|
|
||||||
void setSettings( QSettings *s ){ settings = s; }
|
void setSettings( QSettings *s ){ settings = s; }
|
||||||
|
|
||||||
void load();
|
void load();
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void accept();
|
void accept();
|
||||||
void reject();
|
void reject();
|
||||||
|
|
||||||
void onOKClicked();
|
void onOKClicked();
|
||||||
void onCancelClicked();
|
void onCancelClicked();
|
||||||
|
|
||||||
void onPluginBClicked();
|
void onPluginBClicked();
|
||||||
void onSheetsBClicked();
|
void onSheetsBClicked();
|
||||||
void onAssetsBClicked();
|
void onAssetsBClicked();
|
||||||
void onPrimitivesBClicked();
|
void onPrimitivesBClicked();
|
||||||
void onLigoBClicked();
|
void onLigoBClicked();
|
||||||
|
|
||||||
void onPathAddClicked();
|
void onPathAddClicked();
|
||||||
void onPathRemoveClicked();
|
void onPathRemoveClicked();
|
||||||
void onRecursiveAddClicked();
|
void onRecursiveAddClicked();
|
||||||
void onRecursiveRemoveClicked();
|
void onRecursiveRemoveClicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupConnections();
|
void setupConnections();
|
||||||
void save();
|
void save();
|
||||||
void saveSearchPaths();
|
void saveSearchPaths();
|
||||||
void saveRecursivePaths();
|
void saveRecursivePaths();
|
||||||
|
|
||||||
QSettings *settings;
|
QSettings *settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,109 +1,109 @@
|
||||||
// Ryzom Core - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
// Ryzom Core - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU Affero General Public License as
|
// it under the terms of the GNU Affero General Public License as
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
// License, or (at your option) any later version.
|
// License, or (at your option) any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU Affero General Public License for more details.
|
// GNU Affero General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
// 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/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
#include "splash_screen.h"
|
#include "splash_screen.h"
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QStyleOptionProgressBarV2>
|
#include <QStyleOptionProgressBarV2>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
|
|
||||||
SplashScreen::SplashScreen() :
|
SplashScreen::SplashScreen() :
|
||||||
QSplashScreen()
|
QSplashScreen()
|
||||||
{
|
{
|
||||||
progress = 0;
|
progress = 0;
|
||||||
textX = 5;
|
textX = 5;
|
||||||
textY = 20;
|
textY = 20;
|
||||||
pbLeft = 2;
|
pbLeft = 2;
|
||||||
pbTop = 0;
|
pbTop = 0;
|
||||||
pbWidth = 100;
|
pbWidth = 100;
|
||||||
pbHeight = 20;
|
pbHeight = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
SplashScreen::~SplashScreen()
|
SplashScreen::~SplashScreen()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplashScreen::setPixmap( const QPixmap &pixmap )
|
void SplashScreen::setPixmap( const QPixmap &pixmap )
|
||||||
{
|
{
|
||||||
QSplashScreen::setPixmap( pixmap );
|
QSplashScreen::setPixmap( pixmap );
|
||||||
|
|
||||||
if( this->pixmap().width() > 0 )
|
if( this->pixmap().width() > 0 )
|
||||||
pbWidth = this->pixmap().width() - 4;
|
pbWidth = this->pixmap().width() - 4;
|
||||||
|
|
||||||
if( this->pixmap().height() > 0 )
|
if( this->pixmap().height() > 0 )
|
||||||
pbTop = this->pixmap().height() - pbHeight - 2;
|
pbTop = this->pixmap().height() - pbHeight - 2;
|
||||||
|
|
||||||
textY = pbTop - pbHeight / 2;
|
textY = pbTop - pbHeight / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplashScreen::setText( const QString &text )
|
void SplashScreen::setText( const QString &text )
|
||||||
{
|
{
|
||||||
this->text = text;
|
this->text = text;
|
||||||
repaint();
|
repaint();
|
||||||
QCoreApplication::instance()->processEvents();
|
QCoreApplication::instance()->processEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplashScreen::clearText()
|
void SplashScreen::clearText()
|
||||||
{
|
{
|
||||||
setText( "" );
|
setText( "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplashScreen::setProgress( int percent )
|
void SplashScreen::setProgress( int percent )
|
||||||
{
|
{
|
||||||
progress = percent;
|
progress = percent;
|
||||||
repaint();
|
repaint();
|
||||||
QCoreApplication::instance()->processEvents();
|
QCoreApplication::instance()->processEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplashScreen::advanceProgress( int percent )
|
void SplashScreen::advanceProgress( int percent )
|
||||||
{
|
{
|
||||||
progress += percent;
|
progress += percent;
|
||||||
repaint();
|
repaint();
|
||||||
QCoreApplication::instance()->processEvents();
|
QCoreApplication::instance()->processEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplashScreen::drawContents( QPainter *painter )
|
void SplashScreen::drawContents( QPainter *painter )
|
||||||
{
|
{
|
||||||
QSplashScreen::drawContents( painter );
|
QSplashScreen::drawContents( painter );
|
||||||
|
|
||||||
if( progressBarEnabled )
|
if( progressBarEnabled )
|
||||||
{
|
{
|
||||||
QStyleOptionProgressBarV2 pbStyle;
|
QStyleOptionProgressBarV2 pbStyle;
|
||||||
pbStyle.initFrom( this );
|
pbStyle.initFrom( this );
|
||||||
pbStyle.state = QStyle::State_Enabled;
|
pbStyle.state = QStyle::State_Enabled;
|
||||||
pbStyle.textVisible = false;
|
pbStyle.textVisible = false;
|
||||||
pbStyle.minimum = 0;
|
pbStyle.minimum = 0;
|
||||||
pbStyle.maximum = 100;
|
pbStyle.maximum = 100;
|
||||||
pbStyle.progress = progress;
|
pbStyle.progress = progress;
|
||||||
pbStyle.invertedAppearance = false;
|
pbStyle.invertedAppearance = false;
|
||||||
pbStyle.rect = QRect( pbLeft, pbTop, pbWidth, pbHeight );
|
pbStyle.rect = QRect( pbLeft, pbTop, pbWidth, pbHeight );
|
||||||
|
|
||||||
style()->drawControl( QStyle::CE_ProgressBar, &pbStyle, painter, this );
|
style()->drawControl( QStyle::CE_ProgressBar, &pbStyle, painter, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !text.isEmpty() )
|
if( !text.isEmpty() )
|
||||||
{
|
{
|
||||||
QPen oldPen = painter->pen();
|
QPen oldPen = painter->pen();
|
||||||
QPen pen;
|
QPen pen;
|
||||||
pen.setColor( Qt::white );
|
pen.setColor( Qt::white );
|
||||||
painter->setPen( pen );
|
painter->setPen( pen );
|
||||||
painter->drawText( textX, textY, text );
|
painter->drawText( textX, textY, text );
|
||||||
painter->setPen( oldPen );
|
painter->setPen( oldPen );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,60 +1,60 @@
|
||||||
// Ryzom Core - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
// Ryzom Core - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU Affero General Public License as
|
// it under the terms of the GNU Affero General Public License as
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
// License, or (at your option) any later version.
|
// License, or (at your option) any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU Affero General Public License for more details.
|
// GNU Affero General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
// 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/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
#ifndef SPLASH_SCREEN_H
|
#ifndef SPLASH_SCREEN_H
|
||||||
#define SPLASH_SCREEN_H
|
#define SPLASH_SCREEN_H
|
||||||
|
|
||||||
|
|
||||||
#include <QSplashScreen>
|
#include <QSplashScreen>
|
||||||
|
|
||||||
class SplashScreen : public QSplashScreen
|
class SplashScreen : public QSplashScreen
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SplashScreen();
|
SplashScreen();
|
||||||
~SplashScreen();
|
~SplashScreen();
|
||||||
|
|
||||||
void setPixmap( const QPixmap &pixmap );
|
void setPixmap( const QPixmap &pixmap );
|
||||||
|
|
||||||
void setText( const QString &text );
|
void setText( const QString &text );
|
||||||
void clearText();
|
void clearText();
|
||||||
void setTextXY( int x, int y ){ textX = x; textY = y; }
|
void setTextXY( int x, int y ){ textX = x; textY = y; }
|
||||||
void setProgress( int percent );
|
void setProgress( int percent );
|
||||||
void advanceProgress( int percent );
|
void advanceProgress( int percent );
|
||||||
|
|
||||||
void setProgressBarEnabled( bool b ){ progressBarEnabled = b; }
|
void setProgressBarEnabled( bool b ){ progressBarEnabled = b; }
|
||||||
void setProgressBarRect( int left, int top, int width, int height ){}
|
void setProgressBarRect( int left, int top, int width, int height ){}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void drawContents( QPainter *painter );
|
void drawContents( QPainter *painter );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int progress;
|
int progress;
|
||||||
int pbLeft;
|
int pbLeft;
|
||||||
int pbTop;
|
int pbTop;
|
||||||
int pbWidth;
|
int pbWidth;
|
||||||
int pbHeight;
|
int pbHeight;
|
||||||
|
|
||||||
QString text;
|
QString text;
|
||||||
int textX;
|
int textX;
|
||||||
int textY;
|
int textY;
|
||||||
|
|
||||||
bool progressBarEnabled;
|
bool progressBarEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue