| 1 | /* |
| 2 | * File: TapeSplt.h |
| 3 | * |
| 4 | * Author: Jacob Dekel |
| 5 | * Created on: Aug 31, 2010 |
| 6 | * |
| 7 | * Copyright (c) 2009-2013 Jacob Dekel |
| 8 | * $Id$ |
| 9 | * |
| 10 | * tapesplt utility object |
| 11 | * |
| 12 | * This program is free software: you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by |
| 14 | * the Free Software Foundation, either version 3 of the License, or |
| 15 | * (at your option) any later version. |
| 16 | * |
| 17 | * This program is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License |
| 23 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 24 | * |
| 25 | */ |
| 26 | #ifndef TAPESPLT_H |
| 27 | #define TAPESPLT_H |
| 28 | |
| 29 | #include "GenericUtility.h" |
| 30 | #include "ui_TapeSplt.h" |
| 31 | #include <QtWidgets/QDialog> |
| 32 | #include <QTableView> |
| 33 | #include <QStandardItemModel> |
| 34 | #include <QAbstractTableModel> |
| 35 | #include <QLabel> |
| 36 | #include <QSpinBox> |
| 37 | |
| 38 | #include <vector> |
| 39 | |
| 40 | class TapeSpltSubDlg : public QDialog |
| 41 | { |
| 42 | Q_OBJECT |
| 43 | public: |
| 44 | TapeSpltSubDlg(QWidget *parent = 0); |
| 45 | virtual ~TapeSpltSubDlg(); |
| 46 | |
| 47 | private: |
| 48 | QLabel *label; |
| 49 | QLineEdit *lineEdit; |
| 50 | QPushButton *selOutputButton; |
| 51 | QSpinBox *spinBox; |
| 52 | QLabel *label_2; |
| 53 | QPushButton *addButton; |
| 54 | QPushButton *cancelButton; |
| 55 | QTableView *tableView; |
| 56 | |
| 57 | void setupUi(); |
| 58 | |
| 59 | private slots: |
| 60 | void selectOutputSlot(); |
| 61 | void addSlot(); |
| 62 | void cancelSlot(); |
| 63 | |
| 64 | signals: |
| 65 | void fileNameSet(QString, int); |
| 66 | }; |
| 67 | |
| 68 | #define HTableType std::vector<QStringList> |
| 69 | class HTableModel : public QAbstractTableModel |
| 70 | { |
| 71 | public: |
| 72 | HTableModel(QObject * parent = 0); |
| 73 | virtual ~HTableModel(); |
| 74 | |
| 75 | virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; |
| 76 | virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; |
| 77 | bool insertRow(int row, const QModelIndex &, QString, QString); |
| 78 | bool removeRow ( int row, const QModelIndex & parent = QModelIndex() ); |
| 79 | virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; |
| 80 | virtual QVariant rowData(const QModelIndex &index) const; |
| 81 | virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; |
| 82 | bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); |
| 83 | private: |
| 84 | HTableType mTable; |
| 85 | |
| 86 | }; |
| 87 | |
| 88 | class TapeSplt : public GenericUtility |
| 89 | { |
| 90 | Q_OBJECT |
| 91 | |
| 92 | public: |
| 93 | TapeSplt(QWidget *parent = 0); |
| 94 | ~TapeSplt(); |
| 95 | |
| 96 | private: |
| 97 | Ui::TapeSpltClass ui; |
| 98 | HTableModel *mModel; |
| 99 | int mMaxFile; |
| 100 | |
| 101 | virtual void finishedSlot(); |
| 102 | QString genLine(QString file, int blocks); |
| 103 | |
| 104 | private slots: |
| 105 | void runClicked(); |
| 106 | void cancelClicked(); |
| 107 | void selectInputClicked(); |
| 108 | void addClicked(); |
| 109 | void deleteClicked(); |
| 110 | void downClicked(); |
| 111 | void upClicked(); |
| 112 | void fileNameSetSlot(QString, int); |
| 113 | }; |
| 114 | |
| 115 | #endif // TAPESPLT_H |