00001
00002
00003
00004
00005
00006
00007
00008 #ifndef DATAVIEWER_H
00009 #define DATAVIEWER_H
00010
00011 #include <QMainWindow>
00012 #include "ui_dataviewer.h"
00013
00014 class QAbstractItemModel;
00015 class QTableView;
00016 class QTextEdit;
00017 class QToolBar;
00018 class QAction;
00019 class QSplitter;
00020 class QSqlQueryModel;
00021 class QResizeEvent;
00022
00023
00027 class DataViewer : public QMainWindow
00028 {
00029 Q_OBJECT
00030 public:
00031 DataViewer(QWidget * parent = 0);
00032 ~DataViewer(){};
00033
00037 bool setTableModel(QAbstractItemModel * model, bool showButtons = false);
00039 void setStatusText(const QString & text);
00040 void appendStatusText(const QString & text);
00042 void showStatusText(bool show);
00043
00044 QSqlQueryModel* tableData();
00045 QStringList tableHeader();
00046
00047 QByteArray saveSplitter() { return ui.splitter->saveState(); };
00048 void restoreSplitter(QByteArray state) { ui.splitter->restoreState(state); };
00049
00050 static const QString canFetchMore();
00051
00053 void freeResources();
00054
00055 public slots:
00057 void showSqlScriptResult(QString line);
00059 void sqlScriptStart();
00060
00061 private:
00062 Ui::DataViewer ui;
00063 bool dataResized;
00064
00065 void resizeViewToContents(QAbstractItemModel * model);
00066 void resizeEvent(QResizeEvent * event);
00068 void setShowButtons(bool show);
00069
00070 private slots:
00071 void addRow();
00072 void removeRow();
00073 void truncateTable();
00074 void exportData();
00075 void commit();
00076 void rollback();
00086 void copyHandler();
00087
00096 void openStandaloneWindow();
00097
00098 void handleBlobPreview(bool);
00099 void tableView_selectionChanged(const QItemSelection &, const QItemSelection &);
00100 void tableView_dataResized(int column, int oldWidth, int newWidth);
00101
00103 void tabWidget_currentChanged(int);
00111 void itemView_indexChanged();
00112 };
00113
00114
00116 namespace DataViewerTools {
00117
00125 class KeyPressEater : public QObject
00126 {
00127 Q_OBJECT
00128
00129 public:
00130 KeyPressEater(QObject * parent = 0) : QObject(parent) {};
00131 ~KeyPressEater(){};
00132
00133 signals:
00136 void copyRequest();
00137
00138 protected:
00140 bool eventFilter(QObject *obj, QEvent *event);
00141 };
00142
00143 }
00144
00145 #endif