ProgressDialog.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) 2009 Werner Mayer <wmayer@users.sourceforge.net>        *
00003  *                                                                         *
00004  *   This file is part of the FreeCAD CAx development system.              *
00005  *                                                                         *
00006  *   This library is free software; you can redistribute it and/or         *
00007  *   modify it under the terms of the GNU Library General Public           *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2 of the License, or (at your option) any later version.      *
00010  *                                                                         *
00011  *   This library  is distributed in the hope that it will be useful,      *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Library General Public License for more details.                  *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Library General Public     *
00017  *   License along with this library; see the file COPYING.LIB. If not,    *
00018  *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
00019  *   Suite 330, Boston, MA  02111-1307, USA                                *
00020  *                                                                         *
00021  ***************************************************************************/
00022 
00023 
00024 #ifndef GUI_PROGRESSDIALOG_H
00025 #define GUI_PROGRESSDIALOG_H
00026 
00027 #ifndef __Qt4All__
00028 # include "Qt4All.h"
00029 #endif
00030 
00031 #include <Base/Sequencer.h>
00032 
00033 namespace Gui {
00034 
00035 struct SequencerDialogPrivate;
00036 
00037 class ProgressDialog;
00038 class SequencerDialog : public Base::SequencerBase
00039 {
00040 public:
00041     static SequencerDialog* instance();
00042     void pause();
00043     void resume();
00044     bool isBlocking() const;
00045 
00046 protected:
00048     SequencerDialog ();
00050     ~SequencerDialog ();
00051 
00053     void setText (const char* pszTxt);
00055     void startStep();
00057     void nextStep(bool canAbort);
00059     void resetData();
00060     void showRemainingTime();
00061 
00062 private:
00065     void setProgress(int step);
00067     void abort();
00069 
00070     SequencerDialogPrivate* d;
00071     static SequencerDialog* _pclSingleton;
00072 
00073     friend class ProgressDialog;
00074 };
00075 
00076 class ProgressDialog : public QProgressDialog
00077 {
00078     Q_OBJECT
00079 
00080 public:
00082     ProgressDialog (SequencerDialog* s, QWidget * parent=0);
00084     ~ProgressDialog ();
00085 
00089     bool eventFilter(QObject* o, QEvent* e);
00090 
00091 protected Q_SLOTS:
00092     void onCancel();
00093 
00094 protected:
00095     bool canAbort() const;
00097     void enterControlEvents();
00099     void leaveControlEvents();
00100 
00101 private:
00102     SequencerDialog* sequencer;
00103 
00104     friend class SequencerDialog;
00105 };
00106 
00107 } // namespace Gui
00108 
00109 #endif // GUI_PROGRESSDIALOG_H

Generated on Wed Nov 23 19:00:30 2011 for FreeCAD by  doxygen 1.6.1