00001
00002
00003
00004
00005
00006
00007
00008 #ifndef IMPORTTABLEDIALOG_H
00009 #define IMPORTTABLEDIALOG_H
00010
00011 #include "ui_importtabledialog.h"
00012
00013
00018 class ImportTableDialog : public QDialog, public Ui::ImportTableDialog
00019 {
00020 Q_OBJECT
00021
00022 public:
00023 ImportTableDialog(QWidget * parent = 0, const QString & tableName = 0, const QString & schema = 0);
00024
00025 private:
00026 QObject * m_parent;
00028 QString m_tableName;
00029
00030 QString sqliteSeparator();
00031
00032 void sqlitePreview();
00033
00034 private slots:
00035 void fileButton_clicked();
00037 void slotAccepted();
00039 void createPreview(int i = 0);
00041 void createPreview(bool);
00042 void customEdit_textChanged(QString);
00043
00044 void setTablesForSchema(const QString & schema);
00045
00046 };
00047
00049 namespace ImportTable
00050 {
00051
00057 class BaseModel : public QAbstractTableModel
00058 {
00059 Q_OBJECT
00060
00061 public:
00062 BaseModel(QObject * parent = 0);
00063
00064 int rowCount(const QModelIndex & parent = QModelIndex()) const;
00065 int columnCount(const QModelIndex & parent = QModelIndex()) const;
00066
00067 QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
00068
00069 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
00070
00072 int m_columns;
00075 QList<QStringList> m_values;
00076 };
00077
00078
00080 class CSVModel : public BaseModel
00081 {
00082 Q_OBJECT
00083
00084 public:
00085 CSVModel(QString fileName, QString separator, QObject * parent = 0, int maxRows = 0);
00086 };
00087
00091 class XMLModel : public BaseModel
00092 {
00093 Q_OBJECT
00094
00095 public:
00096 XMLModel(QString fileName, QObject * parent = 0, int maxRows = 0);
00097 };
00098
00099 };
00100
00101 #endif