mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-30 15:50:52 +01:00
Ajout d'un splash screen
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@362 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
BIN
ico/splash.png
Normal file
BIN
ico/splash.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
@@ -64,6 +64,7 @@
|
||||
<file>ico/send_backward.png</file>
|
||||
<file>ico/sortir_fs.png</file>
|
||||
<file>ico/south.png</file>
|
||||
<file>ico/splash.png</file>
|
||||
<file>ico/terminal.png</file>
|
||||
<file>ico/text.png</file>
|
||||
<file>ico/textfield.png</file>
|
||||
|
||||
30
qetapp.cpp
30
qetapp.cpp
@@ -37,6 +37,7 @@ RecentFiles *QETApp::elements_recent_files_ = 0;
|
||||
*/
|
||||
QETApp::QETApp(int &argc, char **argv) :
|
||||
QETSingleApplication(argc, argv, QString("qelectrotech-" + QETApp::userName())),
|
||||
splash_screen_(0),
|
||||
non_interactive_execution_(false)
|
||||
{
|
||||
parseArguments();
|
||||
@@ -55,6 +56,7 @@ QETApp::QETApp(int &argc, char **argv) :
|
||||
std::exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
initSplashScreen();
|
||||
initStyle();
|
||||
initSystemTray();
|
||||
|
||||
@@ -72,11 +74,14 @@ QETApp::QETApp(int &argc, char **argv) :
|
||||
|
||||
// on ouvre soit les fichiers passes en parametre soit un nouvel editeur de projet
|
||||
if (qet_arguments_.files().isEmpty()) {
|
||||
setSplashScreenStep(tr("Chargement... \311diteur de sch\351mas"));
|
||||
new QETDiagramEditor();
|
||||
} else {
|
||||
setSplashScreenStep(tr("Chargement... Ouverture des fichiers"));
|
||||
openFiles(qet_arguments_);
|
||||
}
|
||||
buildSystemTrayMenu();
|
||||
splash_screen_ -> hide();
|
||||
}
|
||||
|
||||
/// Destructeur
|
||||
@@ -612,6 +617,30 @@ void QETApp::parseArguments() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Initialise le splash screen si et seulement si l'execution est interactive.
|
||||
Autrement, l'attribut splash_screen_ vaut 0.
|
||||
*/
|
||||
void QETApp::initSplashScreen() {
|
||||
if (non_interactive_execution_) return;
|
||||
splash_screen_ = new QSplashScreen(QPixmap(":/ico/splash.png"));
|
||||
splash_screen_ -> show();
|
||||
setSplashScreenStep(tr("Chargement..."));
|
||||
}
|
||||
|
||||
/**
|
||||
Change le texte du splash screen et prend en compte les evenements.
|
||||
Si l'application s'execute de facon non interactive, cette methode ne fait
|
||||
rien.
|
||||
*/
|
||||
void QETApp::setSplashScreenStep(const QString &message) {
|
||||
if (!splash_screen_) return;
|
||||
if (!message.isEmpty()) {
|
||||
splash_screen_ -> showMessage(message, Qt::AlignBottom | Qt::AlignLeft);
|
||||
}
|
||||
processEvents();
|
||||
}
|
||||
|
||||
/**
|
||||
Determine et applique le langage a utiliser pour l'application
|
||||
*/
|
||||
@@ -660,6 +689,7 @@ void QETApp::initConfiguration() {
|
||||
Construit l'icone dans le systray et son menu
|
||||
*/
|
||||
void QETApp::initSystemTray() {
|
||||
setSplashScreenStep(tr("Chargement... icône du systray"));
|
||||
// initialisation des menus de l'icone dans le systray
|
||||
menu_systray = new QMenu(tr("QElectroTech"));
|
||||
|
||||
|
||||
3
qetapp.h
3
qetapp.h
@@ -84,6 +84,7 @@ class QETApp : public QETSingleApplication {
|
||||
QTranslator qtTranslator;
|
||||
QTranslator qetTranslator;
|
||||
QSystemTrayIcon *qsti;
|
||||
QSplashScreen *splash_screen_;
|
||||
QMenu *menu_systray;
|
||||
QAction *quitter_qet;
|
||||
QAction *reduce_appli;
|
||||
@@ -136,6 +137,8 @@ class QETApp : public QETSingleApplication {
|
||||
private:
|
||||
QList<QWidget *> floatingToolbarsAndDocksForMainWindow(QMainWindow *) const;
|
||||
void parseArguments();
|
||||
void initSplashScreen();
|
||||
void setSplashScreenStep(const QString & = QString());
|
||||
void initLanguage();
|
||||
void initStyle();
|
||||
void initConfiguration();
|
||||
|
||||
Reference in New Issue
Block a user