mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-01-08 14:49:58 +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/send_backward.png</file>
|
||||||
<file>ico/sortir_fs.png</file>
|
<file>ico/sortir_fs.png</file>
|
||||||
<file>ico/south.png</file>
|
<file>ico/south.png</file>
|
||||||
|
<file>ico/splash.png</file>
|
||||||
<file>ico/terminal.png</file>
|
<file>ico/terminal.png</file>
|
||||||
<file>ico/text.png</file>
|
<file>ico/text.png</file>
|
||||||
<file>ico/textfield.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) :
|
QETApp::QETApp(int &argc, char **argv) :
|
||||||
QETSingleApplication(argc, argv, QString("qelectrotech-" + QETApp::userName())),
|
QETSingleApplication(argc, argv, QString("qelectrotech-" + QETApp::userName())),
|
||||||
|
splash_screen_(0),
|
||||||
non_interactive_execution_(false)
|
non_interactive_execution_(false)
|
||||||
{
|
{
|
||||||
parseArguments();
|
parseArguments();
|
||||||
@@ -55,6 +56,7 @@ QETApp::QETApp(int &argc, char **argv) :
|
|||||||
std::exit(EXIT_SUCCESS);
|
std::exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initSplashScreen();
|
||||||
initStyle();
|
initStyle();
|
||||||
initSystemTray();
|
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
|
// on ouvre soit les fichiers passes en parametre soit un nouvel editeur de projet
|
||||||
if (qet_arguments_.files().isEmpty()) {
|
if (qet_arguments_.files().isEmpty()) {
|
||||||
|
setSplashScreenStep(tr("Chargement... \311diteur de sch\351mas"));
|
||||||
new QETDiagramEditor();
|
new QETDiagramEditor();
|
||||||
} else {
|
} else {
|
||||||
|
setSplashScreenStep(tr("Chargement... Ouverture des fichiers"));
|
||||||
openFiles(qet_arguments_);
|
openFiles(qet_arguments_);
|
||||||
}
|
}
|
||||||
buildSystemTrayMenu();
|
buildSystemTrayMenu();
|
||||||
|
splash_screen_ -> hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Destructeur
|
/// 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
|
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
|
Construit l'icone dans le systray et son menu
|
||||||
*/
|
*/
|
||||||
void QETApp::initSystemTray() {
|
void QETApp::initSystemTray() {
|
||||||
|
setSplashScreenStep(tr("Chargement... icône du systray"));
|
||||||
// initialisation des menus de l'icone dans le systray
|
// initialisation des menus de l'icone dans le systray
|
||||||
menu_systray = new QMenu(tr("QElectroTech"));
|
menu_systray = new QMenu(tr("QElectroTech"));
|
||||||
|
|
||||||
|
|||||||
3
qetapp.h
3
qetapp.h
@@ -84,6 +84,7 @@ class QETApp : public QETSingleApplication {
|
|||||||
QTranslator qtTranslator;
|
QTranslator qtTranslator;
|
||||||
QTranslator qetTranslator;
|
QTranslator qetTranslator;
|
||||||
QSystemTrayIcon *qsti;
|
QSystemTrayIcon *qsti;
|
||||||
|
QSplashScreen *splash_screen_;
|
||||||
QMenu *menu_systray;
|
QMenu *menu_systray;
|
||||||
QAction *quitter_qet;
|
QAction *quitter_qet;
|
||||||
QAction *reduce_appli;
|
QAction *reduce_appli;
|
||||||
@@ -136,6 +137,8 @@ class QETApp : public QETSingleApplication {
|
|||||||
private:
|
private:
|
||||||
QList<QWidget *> floatingToolbarsAndDocksForMainWindow(QMainWindow *) const;
|
QList<QWidget *> floatingToolbarsAndDocksForMainWindow(QMainWindow *) const;
|
||||||
void parseArguments();
|
void parseArguments();
|
||||||
|
void initSplashScreen();
|
||||||
|
void setSplashScreenStep(const QString & = QString());
|
||||||
void initLanguage();
|
void initLanguage();
|
||||||
void initStyle();
|
void initStyle();
|
||||||
void initConfiguration();
|
void initConfiguration();
|
||||||
|
|||||||
Reference in New Issue
Block a user