Subversion Repositories OpenInventory

Rev

Rev 99 | Rev 104 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

#ifndef MAINWINDOW_H
#define MAINWINDOW_H


//#include "mysql.h"
#include <QMainWindow>
#include <QStandardItemModel>
#include <QStandardItem>
#include <QTreeWidgetItem>
#include <QTextCodec>
#include <QSqlDatabase>

#include <QtGui>
#include <QString>
#include <QtSql>


/*
#include <QSqlField>
#include <QSqlRecord>
#include <QSqlTableModel>
#include <QSqlQueryModel>
#include <QTableView>
#include <QSqlDriverPlugin>
#include <QIcon>
#include <QVariant>
#include <QProcess>
#include <QByteArray>
*/


typedef struct Class {
        QString name;
        QString ID;

} TClass;




namespace Ui {
    class MainWindow;
}

class MainWindow : public QMainWindow {
    Q_OBJECT
public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();

protected:
    void changeEvent(QEvent *e);

private:
    Ui::MainWindow *ui;

    QStandardItemModel *model;
    QStandardItem *item;
    QTreeWidgetItem *rootItem1, *rootItem2;
    void openBase();
    bool readModel();
    void setupModelData(const QStringList &lines, QTreeWidgetItem *parent);
    void creatModelString();
    QString modelString; // ñòðîêà, îïèñûâàþùàÿ ìîäåëü ïðåäñòàâëåíèÿ
    void addChildsString(QTreeWidgetItem *parentItem, int level);

    QSqlDatabase sql;

    bool openDataBase();
    bool buildPreviewModel(QString modelName, QString rootClassID);
    QString ClassName(QString class_id); //âîçâðàùàåò èìÿ êëàññà ïî åãî ID
    void addChildsItems(QTreeWidgetItem *perent_class_item); // äîáîâëÿåì ê ýëåìåíòó äåðåâà â êà÷åñòâå äî÷åðíèõ ýëåìåíòîâ âñå êëàññû, äëÿ êîòîðûõ êëàññ ýëåìåíòà ÿâëÿåòñÿ êîíòåéíåðîì
    QStringList classChields(QString class_id);
    QMap <QString, QString> getClassList(); // ïîëó÷àåì ñïèñîê êëàññîâ

};

#endif // MAINWINDOW_H