Debian Codegraph @

src/qutesheet.h

raw symbols SCIP
1 /*
2 Copyright (C) 2010 Andres Cabrera
3 [email protected]
4
5 This file is part of CsoundQt.
6
7 CsoundQt is free software; you can redistribute it
8 and/or modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
11
12 CsoundQt is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with Csound; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 02111-1307 USA
21 */
22
23 #ifndef QUTESHEET_H
24 #define QUTESHEET_H
25
26 #include <QObject>
27 #include <QList>
28 #include <QVariant>
29
30 #include "eventsheet.h"
31
32 class QuteCells {
33
34 };
35
36 class QuteSheet : public QObject
37 {
38 Q_OBJECT
39 public:
40 QuteSheet(QObject *parent = 0, EventSheet *sheet = 0);
41
42 void setSheetPointer(EventSheet *sheet);
43
44 public slots:
45 // add a constructor
46 QuteSheet* new_QuteSheet() { return new QuteSheet(); }
47
48 // add a destructor
49 void delete_QuteSheet(QuteSheet* o) { delete o; }
50
51 QString text(QuteSheet* o) { return o->rowsToText(o->data()); }
52 QList<QList <QVariant > > allRows(QuteSheet* o) { return o->data(); }
53
54 QString selectionText(QuteSheet* o) { return o->rowsToText(o->selectionRows(o)); }
55 QList<QVariant> selection(QuteSheet* o) { return o->getValuesByRow(selectionRows(o)); }
56 QList<QList <QVariant > > selectionRows(QuteSheet* o) { return o->someCols(o->data(), startRow, numRows,
57 startCol, numCols); }
58 QList<QList <QVariant > > selectionFullRows(QuteSheet* o) { return o->allCols(o->data(), startRow, numRows); }
59
60 void setCellValue(QuteSheet* o, int row, int column, QVariant data) {return o->setSheetCellValue(row, column, data); }
61 bool setRows(QList<QList <QVariant > > new_data,
62 int new_startRow = -1,
63 int new_startCol = -1,
64 int new_numRows = -1,
65 int new_numCols = -1);
66
67 bool setValues(QList <QVariant > new_data,
68 int new_startRow = -1,
69 int new_startCol = -1,
70 int new_numRows = -1,
71 int new_numCols = -1);
72
73 bool setText(QString text,
74 int new_startRow = -1,
75 int new_startCol = -1,
76 int new_numRows = -1,
77 int new_numCols = -1);
78
79 // Helper functions
80 QList<QList <QVariant> > sort(QList<QList <QVariant> > vectors, int p_field = 2);
81 QList<QList <QVariant > > transpose(QList<QList <QVariant > > mtx);
82 QString rowsToText(QList<QList <QVariant > > data);
83
84 private:
85
86 QList<QList <QVariant > > data();
87 bool testConsistency();
88
89 void setSheetCellValue(int row, int column, QVariant data);
90 QList<QVariant> getValuesByRow(QList<QList <QVariant > > data);
91 QList<QList <QVariant > > someCols(QList<QList <QVariant > > data,
92 int row,
93 int numRows,
94 int col,
95 int numCols);
96
97 QList<QList <QVariant > > allCols(QList<QList <QVariant > > data,
98 int row,
99 int numRows);
100
101 bool writeOutFile(QString text);
102
103 EventSheet * m_sheet;
104 int startRow;
105 int startCol;
106 int numRows;
107 int numCols;
108 int totalRows;
109 int totalCols;
110 };
111
112 #endif // QUTESHEET_H