F:/KPlato/koffice/kplato/kptview.h

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002   Copyright (C) 1998, 1999, 2000 Torben Weis <weis@kde.org>
00003   Copyright (C) 2002 - 2006 Dag Andersen <danders@get2net.dk>
00004 
00005   This library is free software; you can redistribute it and/or
00006   modify it under the terms of the GNU Library General Public
00007   License as published by the Free Software Foundation; either
00008   version 2 of the License, or (at your option) any later version.
00009 
00010   This library is distributed in the hope that it will be useful,
00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013   Library General Public License for more details.
00014 
00015   You should have received a copy of the GNU Library General Public License
00016   along with this library; see the file COPYING.LIB.  If not, write to
00017   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018 * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef KPLATO_VIEW
00022 #define KPLATO_VIEW
00023 
00024 #include <KoView.h>
00025 
00026 #include "kptcontext.h"
00027 
00028 #include <QMenu>
00029 #include <QDockWidget>
00030 #include <QTreeWidget>
00031 
00032 #include <kxmlguiclient.h>
00033 
00034 class QStackedWidget;
00035 
00036 class KPrinter;
00037 class KAction;
00038 class KActionMenu;
00039 class KSelectAction;
00040 class KToggleAction;
00041 class KStatusBarLabel;
00042 
00043 namespace KPlato
00044 {
00045 
00046 class View;
00047 class ViewListDockWidget;
00048 class AccountsView;
00049 class GanttView;
00050 class ResourceView;
00051 class TaskEditor;
00052 //class ReportView;
00053 class Part;
00054 class Node;
00055 class Project;
00056 class Relation;
00057 class Context;
00058 class ViewAdaptor;
00059 
00060 class ViewListTreeWidget : public QTreeWidget
00061 {
00062     Q_OBJECT
00063 public:
00064     ViewListTreeWidget( QWidget *parent );
00065     QTreeWidgetItem *findCategory( const QString cat );
00066 
00067 protected:
00068     void drawRow( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const;
00069 
00070 signals:
00071     void activated( QTreeWidgetItem* );
00072 
00073 private slots:
00074     void handleMousePress( QTreeWidgetItem *item );
00075 };
00076 
00077 class ViewListDockWidget : public QDockWidget
00078 {
00079     Q_OBJECT
00080 public:
00081     ViewListDockWidget( QString name, KMainWindow *parent );
00082     QTreeWidgetItem *addCategory( QString name );
00083     void addView( QTreeWidgetItem *category, QString name, QWidget *widget, QString icon = QString::null );
00084 
00085 signals:
00086     void activated( QWidget* );
00087 
00088 protected slots:
00089     void slotActivated( QTreeWidgetItem *item );
00090 
00091 private:
00092     ViewListTreeWidget *m_viewList;
00093 };
00094 
00095 //-----------
00096 class ViewBase : public QWidget, public KXMLGUIClient
00097 {
00098     Q_OBJECT
00099 public:
00100     ViewBase(View *mainview, QWidget *parent);
00101     ViewBase(QWidget *parent);
00102 
00103     View *mainView() const;
00104     virtual ~ViewBase() {}
00105 
00106     virtual void setZoom(double /*zoom*/) {}
00107     virtual void draw() {}
00108     virtual void draw(Project &/*project*/) {}
00109     virtual void drawChanges(Project &project) { draw(project); }
00110     
00111 public slots:
00112     virtual void setViewActive( bool active, KXMLGUIFactory *factory=0 );
00113 
00114 protected:
00115     virtual void addActions( KXMLGUIFactory *factory );
00116     virtual void removeActions();
00117 
00118     View *m_mainview;
00119 
00120 };
00121 
00122 
00123 //-------------
00124 class View : public KoView
00125 {
00126     Q_OBJECT
00127 
00128 public:
00129     View( Part* part, QWidget* parent = 0 );
00130     ~View();
00134     virtual void setZoom( double zoom );
00135 
00136     Part *getPart() const;
00137 
00138     Project& getProject() const;
00139 
00140     virtual void setupPrinter( KPrinter &printer );
00141     virtual void print( KPrinter &printer );
00142 
00143     QMenu *popupMenu( const QString& name );
00144 
00145     void projectCalculate();
00146 
00147     virtual ViewAdaptor* dbusObject();
00148 
00149     virtual bool setContext( Context &context );
00150     virtual void getContext( Context &context ) const;
00151 
00152     void setTaskActionsEnabled( QWidget *w, bool on );
00153     void setScheduleActionsEnabled();
00154 
00155 public slots:
00156     void slotUpdate( bool calculate );
00157     void slotEditResource();
00158     void slotEditCut();
00159     void slotEditCopy();
00160     void slotEditPaste();
00161     void slotViewSelector( bool show );
00162     void slotViewGantt();
00163     void slotViewExpected();
00164     void slotViewOptimistic();
00165     void slotViewPessimistic();
00166 
00167     void slotViewGanttResources();
00168     void slotViewGanttTaskName();
00169     void slotViewGanttTaskLinks();
00170     void slotViewGanttProgress();
00171     void slotViewGanttFloat();
00172     void slotViewGanttCriticalTasks();
00173     void slotViewGanttCriticalPath();
00174     void slotViewGanttNoInformation();
00175     void slotViewTaskAppointments();
00176     void slotViewResources();
00177     void slotViewResourceAppointments();
00178     void slotViewAccounts();
00179     void slotAddTask();
00180     void slotAddSubTask();
00181     void slotAddMilestone();
00182     void slotProjectEdit();
00183     void slotDefineWBS();
00184     void slotGenerateWBS();
00185     void slotConfigure();
00186     void slotAddRelation( Node *par, Node *child );
00187     void slotModifyRelation( Relation *rel );
00188     void slotAddRelation( Node *par, Node *child, int linkType );
00189     void slotModifyRelation( Relation *rel, int linkType );
00190 
00191     void slotExportGantt(); // testing
00192     void setTaskActionsEnabled( bool on );
00193 
00194     void slotRenameNode( Node *node, const QString& name );
00195 
00196     void slotPopupMenu( const QString& menuname, const QPoint & pos );
00197 
00198 protected slots:
00199     void slotViewActivated( QWidget* );
00200 
00201     void slotProjectCalendar();
00202     void slotProjectWorktime();
00203     void slotProjectCalculate();
00204     void slotProjectCalculateExpected();
00205     void slotProjectCalculateOptimistic();
00206     void slotProjectCalculatePessimistic();
00207     void slotProjectAccounts();
00208     void slotProjectResources();
00209     void slotViewReportDesign();
00210     void slotViewReports();
00211 
00212     void slotOpenNode();
00213     void slotTaskProgress();
00214     void slotDeleteTask( QList<Node*> lst );
00215     void slotDeleteTask( Node *node );
00216     void slotDeleteTask();
00217     void slotIndentTask();
00218     void slotUnindentTask();
00219     void slotMoveTaskUp();
00220     void slotMoveTaskDown();
00221 
00222     void slotConnectNode();
00223 
00224     void slotCurrentChanged( int );
00225 
00226 #ifndef NDEBUG
00227     void slotPrintDebug();
00228     void slotPrintSelectedDebug();
00229     void slotPrintCalendarDebug();
00230     void slotPrintTestDebug();
00231 #else
00232     static void slotPrintDebug() { };
00233     static void slotPrintSelectedDebug() { };
00234     static void slotPrintCalendarDebug() { };
00235     static void slotPrintTestDebug() { };
00236 #endif
00237 
00238 protected:
00239     void createViewSelector();
00240     virtual void updateReadWrite( bool readwrite );
00241     Node *currentTask();
00242     void updateView( QWidget *widget );
00243 
00244 private:
00245     QStackedWidget *m_tab;
00246     ViewBase *m_currentview;
00247     GanttView *m_ganttview;
00248     ResourceView *m_resourceview;
00249     AccountsView *m_accountsview;
00250     TaskEditor *m_taskeditor;
00251     //    ReportView *m_reportview;
00252     //    Q3PtrList<QString> m_reportTemplateFiles;
00253 
00254     ViewListDockWidget *m_viewlist;
00255 
00256     int m_viewGrp;
00257     int m_defaultFontSize;
00258     int m_currentEstimateType;
00259 
00260     bool m_updateGanttview;
00261     bool m_updateResourceview;
00262     bool m_updateAccountsview;
00263 
00264     KStatusBarLabel *m_estlabel;
00265 
00266     ViewAdaptor* m_dbus;
00267 
00268     // ------ Edit
00269     KAction *actionCut;
00270     KAction *actionCopy;
00271     KAction *actionPaste;
00272 
00273     KAction *actionIndentTask;
00274     KAction *actionUnindentTask;
00275     KAction *actionMoveTaskUp;
00276     KAction *actionMoveTaskDown;
00277 
00278     // ------ View
00279     KAction *actionViewGantt;
00280 
00281     KToggleAction *actionViewSelector;
00282 
00283     KToggleAction *actionViewExpected;
00284     KToggleAction *actionViewOptimistic;
00285     KToggleAction *actionViewPessimistic;
00286 
00287     KToggleAction *actionViewGanttResources;
00288     KToggleAction *actionViewGanttTaskName;
00289     KToggleAction *actionViewGanttTaskLinks;
00290     KToggleAction *actionViewGanttProgress;
00291     KToggleAction *actionViewGanttFloat;
00292     KToggleAction *actionViewGanttCriticalTasks;
00293     KToggleAction *actionViewGanttCriticalPath;
00294     KToggleAction *actionViewGanttNotScheduled;
00295     KToggleAction *actionViewTaskAppointments;
00296 
00297     KAction *actionViewResources;
00298     KToggleAction *actionViewResourceAppointments;
00299     KAction *actionViewAccounts;
00300 
00301     // ------ Insert
00302     KAction *actionAddTask;
00303     KAction *actionAddSubtask;
00304     KAction *actionAddMilestone;
00305 
00306     // ------ Project
00307     KAction *actionEditMainProject;
00308     KAction *actionEditStandardWorktime;
00309     KAction *actionEditCalendar;
00310     KAction *actionEditAccounts;
00311     KAction *actionEditResources;
00312     KActionMenu *actionCalculate;
00313     KAction *actionCalculateExpected;
00314     KAction *actionCalculateOptimistic;
00315     KAction *actionCalculatePessimistic;
00316     // ------ Reports
00317     KAction *actionFirstpage;
00318     KAction *actionPriorpage;
00319     KAction *actionNextpage;
00320     KAction *actionLastpage;
00321 
00322     // ------ Tools
00323     KAction *actionDefineWBS;
00324     KAction *actionGenerateWBS;
00325 
00326     // ------ Export (testing)
00327     KAction *actionExportGantt;
00328 
00329     // ------ Settings
00330     KAction *actionConfigure;
00331 
00332     // ------ Popup
00333     KAction *actionOpenNode;
00334     KAction *actionTaskProgress;
00335     KAction *actionDeleteTask;
00336     KAction *actionEditResource;
00337 
00338     //Test
00339     KAction *actNoInformation;
00340 };
00341 
00342 } //Kplato namespace
00343 
00344 #endif

Généré le Wed Nov 22 23:40:58 2006 pour KPlato par  doxygen 1.5.1-p1