]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Removed helper class ProgressIndicator (not needed anymore because of the use of...
authorPeter Penz <peter.penz19@gmail.com>
Sat, 20 Jan 2007 15:03:14 +0000 (15:03 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Sat, 20 Jan 2007 15:03:14 +0000 (15:03 +0000)
svn path=/trunk/playground/utils/dolphin/; revision=625608

src/CMakeLists.txt
src/dolphinmainwindow.cpp
src/dolphinview.cpp
src/progressindicator.cpp [deleted file]
src/progressindicator.h [deleted file]

index 8e5816edf2f3160b21db4469bd7ad2d4c61ddba8..175f31f51421c6859c37bbbc44f157f8a59cf040 100644 (file)
@@ -31,7 +31,6 @@ set(dolphin_SRCS
    iconsviewsettingspage.cpp
    infosidebarpage.cpp
    main.cpp
-   progressindicator.cpp
    protocolcombo.cpp
    pixmapviewer.cpp
    renamedialog.cpp
index 45f99eaebfbe06f4b55f1535f671f58559a2741c..de81af06d121cbf834c31de38870cd5ff2a8202b 100644 (file)
@@ -29,7 +29,6 @@
 #include "dolphinstatusbar.h"
 #include "dolphinapplication.h"
 #include "urlnavigator.h"
-#include "progressindicator.h"
 #include "dolphinsettings.h"
 #include "bookmarkssidebarpage.h"
 #include "infosidebarpage.h"
index bf92b34f4d617cbb4aa44768b2eab7d4e79ea15a..470abe5b7a22621a9aeae8f9b746b43b11040ad8 100644 (file)
@@ -45,7 +45,6 @@
 #include "dolphiniconsview.h"
 #include "dolphincontextmenu.h"
 #include "filterbar.h"
-#include "progressindicator.h"
 #include "renamedialog.h"
 #include "urlnavigator.h"
 #include "viewproperties.h"
@@ -242,11 +241,6 @@ void DolphinView::renameSelectedItems()
             assert(newName.contains('#'));
 
             const int urlsCount = urls.count();
-            ProgressIndicator* progressIndicator =
-                new  ProgressIndicator(mainWindow(),
-                                       i18n("Renaming items..."),
-                                       i18n("Renaming finished."),
-                                       urlsCount);
 
             // iterate through all selected items and rename them...
             const int replaceIndex = newName.indexOf('#');
@@ -262,8 +256,6 @@ void DolphinView::renameSelectedItems()
 
                     const bool destExists = KIO::NetAccess::exists(dest, false, view);
                     if (destExists) {
-                        delete progressIndicator;
-                        progressIndicator = 0;
                         view->statusBar()->setMessage(i18n("Renaming failed (item '%1' already exists).",name),
                                                       DolphinStatusBar::Error);
                         break;
@@ -275,11 +267,7 @@ void DolphinView::renameSelectedItems()
                         //undoMan.addCommand(command);
                     }
                 }
-
-                progressIndicator->execOperation();
             }
-            delete progressIndicator;
-            progressIndicator = 0;
 
             //undoMan.endMacro();
         }
diff --git a/src/progressindicator.cpp b/src/progressindicator.cpp
deleted file mode 100644 (file)
index 6805788..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2006 by Peter Penz                                      *
- *   peter.penz@gmx.at                                                     *
- *                                                                         *
- *   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          *
- ***************************************************************************/
-
-#include "progressindicator.h"
-#include "dolphinmainwindow.h"
-#include "dolphinstatusbar.h"
-#include <QApplication>
-
-ProgressIndicator::ProgressIndicator(DolphinMainWindow* mainWindow,
-                                     const QString& progressText,
-                                     const QString& finishedText,
-                                     int operationsCount)
- :  m_mainWindow(mainWindow),
-    m_showProgress(false),
-    m_operationsCount(operationsCount),
-    m_operationsIndex(0),
-    m_startTime(QTime::currentTime()),
-    m_finishedText(finishedText)
-{
-    DolphinStatusBar* statusBar = mainWindow->activeView()->statusBar();
-    statusBar->clear();
-    statusBar->setProgressText(progressText);
-    statusBar->setProgress(0);
-}
-
-
-ProgressIndicator::~ProgressIndicator()
-{
-    DolphinStatusBar* statusBar = m_mainWindow->activeView()->statusBar();
-    statusBar->setProgressText(QString::null);
-    statusBar->setProgress(100);
-    statusBar->setMessage(m_finishedText, DolphinStatusBar::OperationCompleted);
-
-    if (m_showProgress) {
-        m_mainWindow->setEnabled(true);
-    }
-}
-
-void ProgressIndicator::execOperation()
-{
-    ++m_operationsIndex;
-
-    if (!m_showProgress) {
-        const int elapsed = m_startTime.msecsTo(QTime::currentTime());
-        if (elapsed > 500) {
-            // the operations took already more than 500 milliseconds,
-            // therefore show a progress indication
-            m_mainWindow->setEnabled(false);
-            m_showProgress = true;
-        }
-    }
-
-    if (m_showProgress) {
-        const QTime currentTime = QTime::currentTime();
-        if (m_startTime.msecsTo(currentTime) > 100) {
-            m_startTime = currentTime;
-
-            DolphinStatusBar* statusBar = m_mainWindow->activeView()->statusBar();
-            statusBar->setProgress((m_operationsIndex * 100) / m_operationsCount);
-#warning "EVIL, DANGER, FIRE"
-            qApp->processEvents();
-            statusBar->repaint();
-        }
-    }
-}
-
-
diff --git a/src/progressindicator.h b/src/progressindicator.h
deleted file mode 100644 (file)
index 542f776..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2006 by Peter Penz                                      *
- *   peter.penz@gmx.at                                                     *
- *                                                                         *
- *   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>
-
-class DolphinMainWindow;
-
-/**
- * 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 <peter.penz@gmx.at>
- */
-class ProgressIndicator
-{
-public:
-    /**
-     * @param mainWindow        The mainwindow this statusbar should operate on
-     * @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(DolphinMainWindow *mainWindow,
-                      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:
-    DolphinMainWindow *m_mainWindow;
-    bool m_showProgress;
-    int m_operationsCount;
-    int m_operationsIndex;
-    QTime m_startTime;
-    QString m_finishedText;
-};
-
-#endif