00001 #ifndef COSTUNITCHILD_H
00002 #define COSTUNITCHILD_H
00003
00004
00005 #include <QTableView>
00006 #include <QDomDocument>
00007
00008 #include "childwindow.h"
00009 #include "../Models/costunitmodel.h"
00010 #include "../Views/piechartview.h"
00011
00012 QT_BEGIN_NAMESPACE
00013 class QLabel;
00014 class QSortFilterProxyModel;
00015 class QItemSelectionModel;
00016 QT_END_NAMESPACE
00017
00018 class Settings;
00019
00020 class CostUnitChild : public ChildWindow
00021 {
00022 Q_OBJECT
00023
00024 public:
00025 CostUnitChild(Settings &set);
00026
00027 void setModel(CostUnitModel *model);
00028 virtual CostUnitModel* model() const
00029 {
00030 return table;
00031 }
00032
00033 QTableView* tableViewWidget() const
00034 {
00035 return tableView;
00036 }
00037
00038 void addEntry(QString, QString);
00039 void removeEntry();
00040 void newFile();
00041 bool loadDocument(const QDomElement fileName);
00042
00043 void setTitle(QString name);
00044 void clear();
00045
00046 void setModelForPieChart(QList<QStringList> data);
00047
00048 public slots:
00049 void setAdditionalCharges(QList<int> data);
00050
00051 void setProduct(QString textProductName, QString textDirectCosts, QString textMarkup, QString textCommission, QString textTradeDiscount, QString textDiscount, QString textSalesTax);
00052 void setProduct(CostUnitProduct *product);
00053
00054 private:
00055 void createControls();
00056 bool maybeSave();
00057
00058 QDomDocument domTree;
00059 QLabel *labelCostUnit;
00060 CostUnitModel *table;
00061 QSortFilterProxyModel *filterModel;
00062 PieChartView *pieChart;
00063 QTableView *tableView;
00064
00065 Settings *settings;
00066
00067 protected:
00068 void closeEvent(QCloseEvent *event);
00069 };
00070
00071 #endif