00001 #ifndef ACCOUNTINGRECORDWIDGET_H
00002 #define ACCOUNTINGRECORDWIDGET_H
00003
00004 #include <QWidget>
00005 #include "../Data/datadefinitions.h"
00006 #include "accountingrecord.h"
00007 #include "../Data/settings.h"
00008
00009 class AComboBox;
00010 class ALineEdit;
00011 class DataExercise;
00012 class AccountModel;
00013 class DataExerciseValidator;
00014 class AccountingRecord;
00015 class QVBoxLayout;
00016
00017 class AccountingRecordWidget : public QWidget
00018 {
00019 Q_OBJECT;
00020 public:
00021 AccountingRecordWidget(QWidget *parent = 0);
00022
00023 void setSettings(Settings *settings);
00024
00025
00026
00027
00028
00029 void makeWidgetForExercise(bool editable, AccountModel *model, DataExercise *exercise);
00030
00031
00032
00033
00034
00035 void makeWidgetForTask(bool editable, AccountModel *model, DataExercise *exercise, bool showSolution = false);
00036
00037
00038
00039
00040 void makeWidgetForPrinter(AccountModel *model, DataExercise *exercise, bool editable);
00041
00042 void makeButtonRow(int type);
00043
00044
00045
00046
00047 void setShowSolution(bool showSolution) { this->showSolution = showSolution; }
00048
00049 void setAccountingTable(AccountModel *model) { this->model = model; }
00050 void deleteWidget();
00051 QVBoxLayout* accountingRecordLayout() { return p_accountingRecordLayout; }
00052
00053 QList<AccountingRecord *> accountingRecordList()
00054 {
00055 return p_accountingRecordList;
00056 }
00057 public slots:
00058 void saveBeforeActualizingAccounts();
00059
00060 private:
00061 void resetAllStylesForValidator();
00062 void clearSettings();
00063 void createWidgetRow(bool editable, AccountModel *model, AccountingRecordWidgetType::type type, DataAccountingRecord *record = 0);
00064 void createWidget(bool editable);
00065
00066 AccountingRecord *newAccountingRecord();
00067
00068 bool showSolution;
00069 DataExercise *exercise;
00070 AccountModel *model;
00071 DataExerciseValidator *validator;
00072
00073 QList<AccountingRecord *> p_accountingRecordList;
00074 QVBoxLayout *p_accountingRecordLayout;
00075 QVBoxLayout *p_layoutForAll;
00076 QHBoxLayout *buttonRow;
00077 QList<DataAccountingRecord *> *accountingList;
00078 Settings *settings;
00079
00080 signals:
00081 void finishAccountingRecord();
00082 void backToAccountingRecord();
00083 void beginToValidate(DataExercise*, AccountingInformation*, QList<AccountingInformation>*, QList<AccountingInformation>*);
00084 void actualizeAccountsAfterSaving();
00085 void changeState(QString, int, DataExerciseStatus);
00086 void forwardErrorMesssage(QString);
00087
00088 private slots:
00089 void addNewAccountingRecord();
00090 void removeAccountingRecord();
00091 void correctAccountingRecord();
00092
00093 };
00094
00095 #endif // ACCOUNTINGRECORDWIDGET_H