summaryrefslogtreecommitdiffstats
path: root/src/progressindicator.h
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-17 23:39:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-17 23:39:35 +0000
commitf48aef5ed7f2e333984766d9ceb02e01ecbd47a7 (patch)
tree6ed79de882f3051cf7999a9cee2b633d8daabeab /src/progressindicator.h
downloaddolphin-f48aef5ed7f2e333984766d9ceb02e01ecbd47a7.tar.gz
dolphin-f48aef5ed7f2e333984766d9ceb02e01ecbd47a7.zip
Added old KDE3 version of dolphin
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/dolphin@1076309 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/progressindicator.h')
-rw-r--r--src/progressindicator.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/progressindicator.h b/src/progressindicator.h
new file mode 100644
index 0000000..7889607
--- /dev/null
+++ b/src/progressindicator.h
@@ -0,0 +1,78 @@
+/***************************************************************************
+ * Copyright (C) 2006 by Peter Penz *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 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 General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+#ifndef PROGRESSINDICATOR_H
+#define PROGRESSINDICATOR_H
+
+#include <qdatetime.h>
+
+/**
+ * Allows to show a progress of synchronous operations. Sample code:
+ * \code
+ * const int operationsCount = 100;
+ * ProgressIndicator progressIndicator(i18n("Loading..."),
+ * i18n("Loading finished."),
+ * operationsCount);
+ * for (int i = 0; i < operationsCount; ++i) {
+ * progressIndicator.execOperation();
+ * // do synchronous operation...
+ * }
+ * \endcode
+ * The progress indicator takes care to show the progress bar only after
+ * a delay of around 500 milliseconds. This means if all operations are
+ * executing within 500 milliseconds, no progress bar is shown at all.
+ * As soon as the progress bar is shown, the application still may process
+ * events, but the the Dolphin main widget is disabled.
+ *
+ * @author Peter Penz <[email protected]>
+ */
+class ProgressIndicator
+{
+public:
+ /**
+ * @param progressText Text for the progress bar (e. g. "Loading...").
+ * @param finishedText Text which is displayed after the operations have been finished
+ * (e. g. "Loading finished.").
+ * @param operationsCount Number of operations.
+ */
+ ProgressIndicator(const QString& progressText,
+ const QString& finishedText,
+ int operationsCount);
+
+ /**
+ * Sets the progress to 100 % and displays the 'finishedText' property
+ * in the status bar.
+ */
+ ~ProgressIndicator();
+
+ /**
+ * Increases the progress and should be invoked
+ * before each operation.
+ */
+ void execOperation();
+
+private:
+ bool m_showProgress;
+ int m_operationsCount;
+ int m_operationsIndex;
+ QTime m_startTime;
+ QString m_finishedText;
+};
+
+#endif