File indexing completed on 2024-06-02 04:22:39

0001 /**
0002  * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
0003  *
0004  * This file is part of the KGantt library.
0005  *
0006  * SPDX-License-Identifier: GPL-2.0-or-later
0007  */
0008 
0009 #ifndef ENTRYDIALOG_H
0010 #define ENTRYDIALOG_H
0011 
0012 #include <QDateTime>
0013 #include <QDialog>
0014 #include <QModelIndex>
0015 
0016 QT_BEGIN_NAMESPACE
0017 class QAbstractItemModel;
0018 namespace Ui {
0019     class EntryDialog;
0020 }
0021 QT_END_NAMESPACE
0022 
0023 namespace KGantt {
0024     class ConstraintModel;
0025 }
0026 
0027 class EntryDialog : public QDialog {
0028     Q_OBJECT
0029 
0030 public:
0031     explicit EntryDialog( const QAbstractItemModel* model, QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags() );
0032     void initFrom( const QModelIndex& index, const KGantt::ConstraintModel* constraintModel );
0033     
0034     QString name() const;
0035     int type() const;
0036     QDateTime startDate() const;
0037     QDateTime endDate() const;
0038     int completion() const;
0039     bool readOnly() const;
0040     QModelIndex depends() const;
0041     QString legend() const;
0042 
0043 private Q_SLOTS:
0044     void updateEndDate( const QDateTime& startDate );
0045     void disableEditing( bool disable );
0046     void typeChanged( int index );
0047     
0048 private:
0049     void init();
0050     void addDependItem( const QAbstractItemModel* model, const QModelIndex& index, int indent = 0 );
0051     
0052     QList<QPersistentModelIndex> indexList;
0053     const QAbstractItemModel* model;
0054     Ui::EntryDialog* ui;
0055 };
0056 
0057 #endif /* ENTRYDIALOG_H */