From 0876d2c549360a65c1e524c54295933c51ad78a3 Mon Sep 17 00:00:00 2001 From: scorpio810 Date: Wed, 26 Nov 2014 18:48:24 +0000 Subject: [PATCH] Add a progress bar on save file action git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3519 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/qetdiagrameditor.cpp | 21 +++++++++++++++++---- sources/qetdiagrameditor.h | 1 + 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/sources/qetdiagrameditor.cpp b/sources/qetdiagrameditor.cpp index eaab94426..3ef5f12eb 100644 --- a/sources/qetdiagrameditor.cpp +++ b/sources/qetdiagrameditor.cpp @@ -627,12 +627,18 @@ void QETDiagramEditor::save() { QETResult saved = project_view -> save(); if (saved.isOk()) { QETApp::projectsRecentFiles() -> fileWasOpened(project_view -> project() -> filePath()); - + //fake progressbar + progressBar = new QProgressBar; + progressBar -> setAlignment(Qt::AlignLeft); + progressBar -> setMaximumSize(180, 19); + statusBar()-> addPermanentWidget(progressBar); + progressBar -> setFormat(tr("Enregistrement : %p%", "Visual rendering of write files - %p is the progress percentage")); + progressBar -> setValue(100); + QTimer::singleShot(2000, progressBar, SLOT(hide())); QString title = (project_view -> project() -> title ()); if (title.isEmpty()) title = "QElectroTech "; QString filePath = (project_view -> project() -> filePath ()); - - statusBar()->showMessage(tr("Projet %1 enregistr\351 dans le repertoire: %2.").arg(title).arg (filePath), 2000); + statusBar()-> showMessage(tr("Projet %1 enregistr\351 dans le repertoire: %2.").arg(title).arg (filePath), 2000); } else { showError(saved); } @@ -648,7 +654,14 @@ void QETDiagramEditor::saveAs() { QETResult save_file = project_view -> saveAs(); if (save_file.isOk()) { QETApp::projectsRecentFiles() -> fileWasOpened(project_view -> project() -> filePath()); - + //fake progressbar + progressBar = new QProgressBar; + progressBar -> setAlignment(Qt::AlignLeft); + progressBar -> setMaximumSize(180, 19); + statusBar()-> addPermanentWidget(progressBar); + progressBar -> setFormat(tr("Enregistrement : %p%", "Visual rendering of write files - %p is the progress percentage")); + progressBar -> setValue(100); + QTimer::singleShot(2000, progressBar, SLOT(hide())); QString title = (project_view -> project() -> title ()); if (title.isEmpty()) title = "QElectroTech "; QString filePath = (project_view -> project() -> filePath ()); diff --git a/sources/qetdiagrameditor.h b/sources/qetdiagrameditor.h index 748f0249d..34146bef7 100644 --- a/sources/qetdiagrameditor.h +++ b/sources/qetdiagrameditor.h @@ -210,6 +210,7 @@ class QETDiagramEditor : public QETMainWindow { QAction *close_file; ///< Close current project file QAction *save_file; ///< Save current project QAction *save_file_as; ///< Save current project as a specific file + QProgressBar *progressBar; private: QMdiArea workspace;