author | thufir <thufir> | 2002-07-04 17:21:16 (UTC) |
---|---|---|
committer | thufir <thufir> | 2002-07-04 17:21:16 (UTC) |
commit | 3fc06dce797f62393bab41f4ea520bdbeb31eb9f (patch) (unidiff) | |
tree | dfd314d2c9a2241f3dce5649592808ff1ee4aea0 | |
parent | baf06586f452ea77f773df038aba5635f57d96b8 (diff) | |
download | opie-3fc06dce797f62393bab41f4ea520bdbeb31eb9f.zip opie-3fc06dce797f62393bab41f4ea520bdbeb31eb9f.tar.gz opie-3fc06dce797f62393bab41f4ea520bdbeb31eb9f.tar.bz2 |
added license headers to opie-sheet
-rw-r--r-- | noncore/apps/opie-sheet/cellformat.cpp | 14 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/cellformat.h | 14 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/finddlg.cpp | 14 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/finddlg.h | 14 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/main.cpp | 14 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/mainwindow.cpp | 14 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/mainwindow.h | 14 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/numberdlg.cpp | 14 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/numberdlg.h | 14 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/sheet.cpp | 14 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/sheet.h | 14 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/sortdlg.cpp | 14 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/sortdlg.h | 14 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/textdlg.cpp | 14 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/textdlg.h | 14 |
15 files changed, 210 insertions, 0 deletions
diff --git a/noncore/apps/opie-sheet/cellformat.cpp b/noncore/apps/opie-sheet/cellformat.cpp index 6a2ff72..597502c 100644 --- a/noncore/apps/opie-sheet/cellformat.cpp +++ b/noncore/apps/opie-sheet/cellformat.cpp | |||
@@ -1,48 +1,62 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | |||
10 | /* | ||
11 | * Opie Sheet (formerly Sheet/Qt) | ||
12 | * by Serdar Ozler <sozler@sitebest.com> | ||
13 | */ | ||
14 | |||
1 | #include "cellformat.h" | 15 | #include "cellformat.h" |
2 | 16 | ||
3 | #include <qlistbox.h> | 17 | #include <qlistbox.h> |
4 | #include <qlabel.h> | 18 | #include <qlabel.h> |
5 | 19 | ||
6 | #define COMBO_WIDTHS 155 | 20 | #define COMBO_WIDTHS 155 |
7 | #define COMBO_HEIGHTS 21 | 21 | #define COMBO_HEIGHTS 21 |
8 | 22 | ||
9 | #define COLOR_COUNT 17 | 23 | #define COLOR_COUNT 17 |
10 | #define STYLE_COUNT 14 | 24 | #define STYLE_COUNT 14 |
11 | #define HALIGN_COUNT 3 | 25 | #define HALIGN_COUNT 3 |
12 | #define VALIGN_COUNT 3 | 26 | #define VALIGN_COUNT 3 |
13 | 27 | ||
14 | QColor qtColors[COLOR_COUNT]={Qt::black, Qt::white, Qt::darkGray, Qt::gray, Qt::lightGray, Qt::red, Qt::green, Qt::blue, Qt::cyan, Qt::magenta, Qt::yellow, Qt::darkRed, Qt::darkGreen, Qt::darkBlue, Qt::darkCyan, Qt::darkMagenta, Qt::darkYellow}; | 28 | QColor qtColors[COLOR_COUNT]={Qt::black, Qt::white, Qt::darkGray, Qt::gray, Qt::lightGray, Qt::red, Qt::green, Qt::blue, Qt::cyan, Qt::magenta, Qt::yellow, Qt::darkRed, Qt::darkGreen, Qt::darkBlue, Qt::darkCyan, Qt::darkMagenta, Qt::darkYellow}; |
15 | Qt::BrushStyle brushStyles[STYLE_COUNT]={Qt::SolidPattern, Qt::Dense1Pattern, Qt::Dense2Pattern, Qt::Dense3Pattern, Qt::Dense4Pattern, Qt::Dense5Pattern, Qt::Dense6Pattern, Qt::Dense7Pattern, Qt::HorPattern, Qt::VerPattern, Qt::CrossPattern, Qt::BDiagPattern, Qt::FDiagPattern, Qt::DiagCrossPattern}; | 29 | Qt::BrushStyle brushStyles[STYLE_COUNT]={Qt::SolidPattern, Qt::Dense1Pattern, Qt::Dense2Pattern, Qt::Dense3Pattern, Qt::Dense4Pattern, Qt::Dense5Pattern, Qt::Dense6Pattern, Qt::Dense7Pattern, Qt::HorPattern, Qt::VerPattern, Qt::CrossPattern, Qt::BDiagPattern, Qt::FDiagPattern, Qt::DiagCrossPattern}; |
16 | QString namesHAlign[HALIGN_COUNT]={"Left", "Right", "Center"}; | 30 | QString namesHAlign[HALIGN_COUNT]={"Left", "Right", "Center"}; |
17 | QString namesVAlign[VALIGN_COUNT]={"Top", "Bottom", "Center"}; | 31 | QString namesVAlign[VALIGN_COUNT]={"Top", "Bottom", "Center"}; |
18 | Qt::AlignmentFlags flagsHAlign[HALIGN_COUNT]={Qt::AlignLeft, Qt::AlignRight, Qt::AlignHCenter}; | 32 | Qt::AlignmentFlags flagsHAlign[HALIGN_COUNT]={Qt::AlignLeft, Qt::AlignRight, Qt::AlignHCenter}; |
19 | Qt::AlignmentFlags flagsVAlign[VALIGN_COUNT]={Qt::AlignTop, Qt::AlignBottom, Qt::AlignVCenter}; | 33 | Qt::AlignmentFlags flagsVAlign[VALIGN_COUNT]={Qt::AlignTop, Qt::AlignBottom, Qt::AlignVCenter}; |
20 | 34 | ||
21 | CellFormat::CellFormat(QWidget *parent=0) | 35 | CellFormat::CellFormat(QWidget *parent=0) |
22 | :QDialog(parent, 0, TRUE) | 36 | :QDialog(parent, 0, TRUE) |
23 | { | 37 | { |
24 | // Main widget | 38 | // Main widget |
25 | tabs=new QTabWidget(this); | 39 | tabs=new QTabWidget(this); |
26 | widgetBorders=new QWidget(tabs); | 40 | widgetBorders=new QWidget(tabs); |
27 | widgetBackground=new QWidget(tabs); | 41 | widgetBackground=new QWidget(tabs); |
28 | widgetFont=new QWidget(tabs); | 42 | widgetFont=new QWidget(tabs); |
29 | widgetAlignment=new QWidget(tabs); | 43 | widgetAlignment=new QWidget(tabs); |
30 | tabs->addTab(widgetBorders, tr("&Borders")); | 44 | tabs->addTab(widgetBorders, tr("&Borders")); |
31 | tabs->addTab(widgetBackground, tr("Back&ground")); | 45 | tabs->addTab(widgetBackground, tr("Back&ground")); |
32 | tabs->addTab(widgetFont, tr("&Font")); | 46 | tabs->addTab(widgetFont, tr("&Font")); |
33 | tabs->addTab(widgetAlignment, tr("&Alignment")); | 47 | tabs->addTab(widgetAlignment, tr("&Alignment")); |
34 | 48 | ||
35 | fontDB.loadRenderers(); | 49 | fontDB.loadRenderers(); |
36 | changedFont=changedAlign=changedBrush=FALSE; | 50 | changedFont=changedAlign=changedBrush=FALSE; |
37 | 51 | ||
38 | // Borders tab | 52 | // Borders tab |
39 | borderEditor=new BorderEditor(widgetBorders); | 53 | borderEditor=new BorderEditor(widgetBorders); |
40 | borderEditor->setGeometry(10, 10, 215, 145); | 54 | borderEditor->setGeometry(10, 10, 215, 145); |
41 | connect(borderEditor, SIGNAL(clicked(BorderEditor::BorderArea)), this, SLOT(borderClicked(BorderEditor::BorderArea))); | 55 | connect(borderEditor, SIGNAL(clicked(BorderEditor::BorderArea)), this, SLOT(borderClicked(BorderEditor::BorderArea))); |
42 | 56 | ||
43 | comboBordersWidth=createCombo(COMBO_WIDTH, widgetBorders, tr("&Width:"), 165); | 57 | comboBordersWidth=createCombo(COMBO_WIDTH, widgetBorders, tr("&Width:"), 165); |
44 | comboBordersColor=createCombo(COMBO_COLOR, widgetBorders, tr("&Color:"), 165+(COMBO_HEIGHTS+10)); | 58 | comboBordersColor=createCombo(COMBO_COLOR, widgetBorders, tr("&Color:"), 165+(COMBO_HEIGHTS+10)); |
45 | 59 | ||
46 | buttonBordersDefaults=new QPushButton(tr("&Default Borders"), widgetBorders); | 60 | buttonBordersDefaults=new QPushButton(tr("&Default Borders"), widgetBorders); |
47 | buttonBordersDefaults->setGeometry(115, 165+2*(COMBO_HEIGHTS+10), 110, COMBO_HEIGHTS); | 61 | buttonBordersDefaults->setGeometry(115, 165+2*(COMBO_HEIGHTS+10), 110, COMBO_HEIGHTS); |
48 | connect(buttonBordersDefaults, SIGNAL(clicked()), this, SLOT(slotBordersDefaults())); | 62 | connect(buttonBordersDefaults, SIGNAL(clicked()), this, SLOT(slotBordersDefaults())); |
diff --git a/noncore/apps/opie-sheet/cellformat.h b/noncore/apps/opie-sheet/cellformat.h index b552153..b569b7f 100644 --- a/noncore/apps/opie-sheet/cellformat.h +++ b/noncore/apps/opie-sheet/cellformat.h | |||
@@ -1,48 +1,62 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | |||
10 | /* | ||
11 | * Opie Sheet (formerly Sheet/Qt) | ||
12 | * by Serdar Ozler <sozler@sitebest.com> | ||
13 | */ | ||
14 | |||
1 | #ifndef CELLFORMAT_H | 15 | #ifndef CELLFORMAT_H |
2 | #define CELLFORMAT_H | 16 | #define CELLFORMAT_H |
3 | 17 | ||
4 | #include <qpe/fontdatabase.h> | 18 | #include <qpe/fontdatabase.h> |
5 | #include <qdialog.h> | 19 | #include <qdialog.h> |
6 | #include <qtabwidget.h> | 20 | #include <qtabwidget.h> |
7 | #include <qlayout.h> | 21 | #include <qlayout.h> |
8 | #include <qcombobox.h> | 22 | #include <qcombobox.h> |
9 | #include <qcheckbox.h> | 23 | #include <qcheckbox.h> |
10 | #include <qpushbutton.h> | 24 | #include <qpushbutton.h> |
11 | 25 | ||
12 | #include "sheet.h" | 26 | #include "sheet.h" |
13 | 27 | ||
14 | class BorderEditor: public QFrame | 28 | class BorderEditor: public QFrame |
15 | { | 29 | { |
16 | Q_OBJECT | 30 | Q_OBJECT |
17 | 31 | ||
18 | // QT objects | 32 | // QT objects |
19 | QPen penTop, penBottom, penLeft, penRight, penHorz, penVert; | 33 | QPen penTop, penBottom, penLeft, penRight, penHorz, penVert; |
20 | 34 | ||
21 | // Private functions | 35 | // Private functions |
22 | void drawContents(QPainter *p); | 36 | void drawContents(QPainter *p); |
23 | 37 | ||
24 | // Reimplemented QFrame functions | 38 | // Reimplemented QFrame functions |
25 | void mouseReleaseEvent(QMouseEvent *e); | 39 | void mouseReleaseEvent(QMouseEvent *e); |
26 | 40 | ||
27 | public: | 41 | public: |
28 | // Definitions | 42 | // Definitions |
29 | enum BorderArea {None, Top, Bottom, Left, Right, Horz, Vert}; | 43 | enum BorderArea {None, Top, Bottom, Left, Right, Horz, Vert}; |
30 | 44 | ||
31 | BorderEditor(QWidget *parent=0); | 45 | BorderEditor(QWidget *parent=0); |
32 | ~BorderEditor(); | 46 | ~BorderEditor(); |
33 | 47 | ||
34 | void setPen(const QPen &pen, BorderArea area); | 48 | void setPen(const QPen &pen, BorderArea area); |
35 | QPen getPen(BorderArea area); | 49 | QPen getPen(BorderArea area); |
36 | QPen getDefaultPen() { return QPen(Qt::black, 1, Qt::DotLine); } | 50 | QPen getDefaultPen() { return QPen(Qt::black, 1, Qt::DotLine); } |
37 | 51 | ||
38 | signals: | 52 | signals: |
39 | void clicked(BorderEditor::BorderArea); | 53 | void clicked(BorderEditor::BorderArea); |
40 | }; | 54 | }; |
41 | 55 | ||
42 | class CellFormat: public QDialog | 56 | class CellFormat: public QDialog |
43 | { | 57 | { |
44 | Q_OBJECT | 58 | Q_OBJECT |
45 | 59 | ||
46 | enum comboType {COMBO_OTHER, COMBO_WIDTH, COMBO_FONT, COMBO_SIZE, COMBO_STYLE, COMBO_COLOR, COMBO_VALIGN, COMBO_HALIGN}; | 60 | enum comboType {COMBO_OTHER, COMBO_WIDTH, COMBO_FONT, COMBO_SIZE, COMBO_STYLE, COMBO_COLOR, COMBO_VALIGN, COMBO_HALIGN}; |
47 | 61 | ||
48 | // QT objects | 62 | // QT objects |
diff --git a/noncore/apps/opie-sheet/finddlg.cpp b/noncore/apps/opie-sheet/finddlg.cpp index cfe2f82..d1237ca 100644 --- a/noncore/apps/opie-sheet/finddlg.cpp +++ b/noncore/apps/opie-sheet/finddlg.cpp | |||
@@ -1,48 +1,62 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | |||
10 | /* | ||
11 | * Opie Sheet (formerly Sheet/Qt) | ||
12 | * by Serdar Ozler <sozler@sitebest.com> | ||
13 | */ | ||
14 | |||
1 | #include <qlabel.h> | 15 | #include <qlabel.h> |
2 | #include <qradiobutton.h> | 16 | #include <qradiobutton.h> |
3 | #include "finddlg.h" | 17 | #include "finddlg.h" |
4 | 18 | ||
5 | FindDialog::FindDialog(QWidget *parent=0) | 19 | FindDialog::FindDialog(QWidget *parent=0) |
6 | :QDialog(parent, 0, TRUE) | 20 | :QDialog(parent, 0, TRUE) |
7 | { | 21 | { |
8 | // Main widget | 22 | // Main widget |
9 | tabs=new QTabWidget(this); | 23 | tabs=new QTabWidget(this); |
10 | widgetFind=new QWidget(tabs); | 24 | widgetFind=new QWidget(tabs); |
11 | widgetOptions=new QWidget(tabs); | 25 | widgetOptions=new QWidget(tabs); |
12 | tabs->addTab(widgetFind, tr("&Find && Replace")); | 26 | tabs->addTab(widgetFind, tr("&Find && Replace")); |
13 | tabs->addTab(widgetOptions, tr("&Options")); | 27 | tabs->addTab(widgetOptions, tr("&Options")); |
14 | 28 | ||
15 | // Find tab | 29 | // Find tab |
16 | QLabel *label=new QLabel(tr("&Search for:"), widgetFind); | 30 | QLabel *label=new QLabel(tr("&Search for:"), widgetFind); |
17 | label->setGeometry(10, 10, 215, 20); | 31 | label->setGeometry(10, 10, 215, 20); |
18 | editFind=new QLineEdit(widgetFind); | 32 | editFind=new QLineEdit(widgetFind); |
19 | editFind->setGeometry(10, 40, 215, 20); | 33 | editFind->setGeometry(10, 40, 215, 20); |
20 | label->setBuddy(editFind); | 34 | label->setBuddy(editFind); |
21 | 35 | ||
22 | label=new QLabel(tr("&Replace with:"), widgetFind); | 36 | label=new QLabel(tr("&Replace with:"), widgetFind); |
23 | label->setGeometry(10, 80, 215, 20); | 37 | label->setGeometry(10, 80, 215, 20); |
24 | editReplace=new QLineEdit(widgetFind); | 38 | editReplace=new QLineEdit(widgetFind); |
25 | editReplace->setGeometry(10, 110, 215, 20); | 39 | editReplace->setGeometry(10, 110, 215, 20); |
26 | editReplace->setEnabled(FALSE); | 40 | editReplace->setEnabled(FALSE); |
27 | label->setBuddy(editReplace); | 41 | label->setBuddy(editReplace); |
28 | 42 | ||
29 | groupType=new QVButtonGroup(tr("&Type"), widgetFind); | 43 | groupType=new QVButtonGroup(tr("&Type"), widgetFind); |
30 | groupType->setGeometry(10, 150, 215, 90); | 44 | groupType->setGeometry(10, 150, 215, 90); |
31 | QRadioButton *radio=new QRadioButton(tr("&Find"), groupType); | 45 | QRadioButton *radio=new QRadioButton(tr("&Find"), groupType); |
32 | radio=new QRadioButton(tr("&Replace"), groupType); | 46 | radio=new QRadioButton(tr("&Replace"), groupType); |
33 | radio=new QRadioButton(tr("Replace &all"), groupType); | 47 | radio=new QRadioButton(tr("Replace &all"), groupType); |
34 | groupType->setButton(0); | 48 | groupType->setButton(0); |
35 | connect(groupType, SIGNAL(clicked(int)), this, SLOT(typeChanged(int))); | 49 | connect(groupType, SIGNAL(clicked(int)), this, SLOT(typeChanged(int))); |
36 | 50 | ||
37 | // Options tab | 51 | // Options tab |
38 | checkCase=new QCheckBox(tr("Match &case"), widgetOptions); | 52 | checkCase=new QCheckBox(tr("Match &case"), widgetOptions); |
39 | checkCase->setGeometry(10, 10, 215, 20); | 53 | checkCase->setGeometry(10, 10, 215, 20); |
40 | checkSelection=new QCheckBox(tr("Current &selection only"), widgetOptions); | 54 | checkSelection=new QCheckBox(tr("Current &selection only"), widgetOptions); |
41 | checkSelection->setGeometry(10, 40, 215, 20); | 55 | checkSelection->setGeometry(10, 40, 215, 20); |
42 | checkEntire=new QCheckBox(tr("&Entire cell"), widgetOptions); | 56 | checkEntire=new QCheckBox(tr("&Entire cell"), widgetOptions); |
43 | checkEntire->setGeometry(10, 70, 215, 20); | 57 | checkEntire->setGeometry(10, 70, 215, 20); |
44 | 58 | ||
45 | // Main widget | 59 | // Main widget |
46 | box=new QVBoxLayout(this); | 60 | box=new QVBoxLayout(this); |
47 | box->addWidget(tabs); | 61 | box->addWidget(tabs); |
48 | 62 | ||
diff --git a/noncore/apps/opie-sheet/finddlg.h b/noncore/apps/opie-sheet/finddlg.h index 02c9cdd..1af2da5 100644 --- a/noncore/apps/opie-sheet/finddlg.h +++ b/noncore/apps/opie-sheet/finddlg.h | |||
@@ -1,35 +1,49 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | |||
10 | /* | ||
11 | * Opie Sheet (formerly Sheet/Qt) | ||
12 | * by Serdar Ozler <sozler@sitebest.com> | ||
13 | */ | ||
14 | |||
1 | #ifndef FINDDLG_H | 15 | #ifndef FINDDLG_H |
2 | #define FINDDLG_H | 16 | #define FINDDLG_H |
3 | 17 | ||
4 | #include <qdialog.h> | 18 | #include <qdialog.h> |
5 | #include <qtabwidget.h> | 19 | #include <qtabwidget.h> |
6 | #include <qlayout.h> | 20 | #include <qlayout.h> |
7 | #include <qlineedit.h> | 21 | #include <qlineedit.h> |
8 | #include <qcheckbox.h> | 22 | #include <qcheckbox.h> |
9 | #include <qpushbutton.h> | 23 | #include <qpushbutton.h> |
10 | #include <qvbuttongroup.h> | 24 | #include <qvbuttongroup.h> |
11 | #include "sheet.h" | 25 | #include "sheet.h" |
12 | 26 | ||
13 | class FindDialog: public QDialog | 27 | class FindDialog: public QDialog |
14 | { | 28 | { |
15 | Q_OBJECT | 29 | Q_OBJECT |
16 | 30 | ||
17 | // QT objects | 31 | // QT objects |
18 | QBoxLayout *box; | 32 | QBoxLayout *box; |
19 | QTabWidget *tabs; | 33 | QTabWidget *tabs; |
20 | QWidget *widgetFind, *widgetOptions; | 34 | QWidget *widgetFind, *widgetOptions; |
21 | QCheckBox *checkCase, *checkSelection, *checkEntire; | 35 | QCheckBox *checkCase, *checkSelection, *checkEntire; |
22 | QLineEdit *editFind, *editReplace; | 36 | QLineEdit *editFind, *editReplace; |
23 | QVButtonGroup *groupType; | 37 | QVButtonGroup *groupType; |
24 | 38 | ||
25 | private slots: | 39 | private slots: |
26 | void typeChanged(int id); | 40 | void typeChanged(int id); |
27 | 41 | ||
28 | public: | 42 | public: |
29 | FindDialog(QWidget *parent=0); | 43 | FindDialog(QWidget *parent=0); |
30 | ~FindDialog(); | 44 | ~FindDialog(); |
31 | 45 | ||
32 | int exec(Sheet *s); | 46 | int exec(Sheet *s); |
33 | }; | 47 | }; |
34 | 48 | ||
35 | #endif | 49 | #endif |
diff --git a/noncore/apps/opie-sheet/main.cpp b/noncore/apps/opie-sheet/main.cpp index 236a579..e42b4a5 100644 --- a/noncore/apps/opie-sheet/main.cpp +++ b/noncore/apps/opie-sheet/main.cpp | |||
@@ -1,14 +1,28 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | |||
10 | /* | ||
11 | * Opie Sheet (formerly Sheet/Qt) | ||
12 | * by Serdar Ozler <sozler@sitebest.com> | ||
13 | */ | ||
14 | |||
1 | #include <qpe/qpeapplication.h> | 15 | #include <qpe/qpeapplication.h> |
2 | 16 | ||
3 | #include "mainwindow.h" | 17 | #include "mainwindow.h" |
4 | 18 | ||
5 | int main(int argc, char **argv) | 19 | int main(int argc, char **argv) |
6 | { | 20 | { |
7 | QPEApplication application(argc, argv); | 21 | QPEApplication application(argc, argv); |
8 | 22 | ||
9 | MainWindow windowMain; | 23 | MainWindow windowMain; |
10 | windowMain.setHelpFile(application.qpeDir()+"/help/html/"+QString(argv[0])+".html"); | 24 | windowMain.setHelpFile(application.qpeDir()+"/help/html/"+QString(argv[0])+".html"); |
11 | application.showMainDocumentWidget(&windowMain); | 25 | application.showMainDocumentWidget(&windowMain); |
12 | 26 | ||
13 | return application.exec(); | 27 | return application.exec(); |
14 | } | 28 | } |
diff --git a/noncore/apps/opie-sheet/mainwindow.cpp b/noncore/apps/opie-sheet/mainwindow.cpp index a7441b1..9d69b8a 100644 --- a/noncore/apps/opie-sheet/mainwindow.cpp +++ b/noncore/apps/opie-sheet/mainwindow.cpp | |||
@@ -1,48 +1,62 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | |||
10 | /* | ||
11 | * Opie Sheet (formerly Sheet/Qt) | ||
12 | * by Serdar Ozler <sozler@sitebest.com> | ||
13 | */ | ||
14 | |||
1 | #include "mainwindow.h" | 15 | #include "mainwindow.h" |
2 | 16 | ||
3 | #include <qpe/filemanager.h> | 17 | #include <qpe/filemanager.h> |
4 | #include <qpe/qcopenvelope_qws.h> | 18 | #include <qpe/qcopenvelope_qws.h> |
5 | #include <qmessagebox.h> | 19 | #include <qmessagebox.h> |
6 | #include <qfile.h> | 20 | #include <qfile.h> |
7 | #include <qradiobutton.h> | 21 | #include <qradiobutton.h> |
8 | #include "cellformat.h" | 22 | #include "cellformat.h" |
9 | #include "numberdlg.h" | 23 | #include "numberdlg.h" |
10 | #include "textdlg.h" | 24 | #include "textdlg.h" |
11 | #include "sortdlg.h" | 25 | #include "sortdlg.h" |
12 | #include "finddlg.h" | 26 | #include "finddlg.h" |
13 | 27 | ||
14 | #include "file-new.xpm" | 28 | #include "file-new.xpm" |
15 | #include "file-open.xpm" | 29 | #include "file-open.xpm" |
16 | #include "file-save.xpm" | 30 | #include "file-save.xpm" |
17 | #include "edit-cancel.xpm" | 31 | #include "edit-cancel.xpm" |
18 | #include "edit-accept.xpm" | 32 | #include "edit-accept.xpm" |
19 | #include "help-general.xpm" | 33 | #include "help-general.xpm" |
20 | #include "func-plus.xpm" | 34 | #include "func-plus.xpm" |
21 | #include "func-minus.xpm" | 35 | #include "func-minus.xpm" |
22 | #include "func-cross.xpm" | 36 | #include "func-cross.xpm" |
23 | #include "func-divide.xpm" | 37 | #include "func-divide.xpm" |
24 | #include "func-paran-open.xpm" | 38 | #include "func-paran-open.xpm" |
25 | #include "func-paran-close.xpm" | 39 | #include "func-paran-close.xpm" |
26 | #include "func-comma.xpm" | 40 | #include "func-comma.xpm" |
27 | #include "func-func.xpm" | 41 | #include "func-func.xpm" |
28 | #include "func-equal.xpm" | 42 | #include "func-equal.xpm" |
29 | #include "cell-select.xpm" | 43 | #include "cell-select.xpm" |
30 | 44 | ||
31 | #define DEFAULT_NUM_ROWS 199 | 45 | #define DEFAULT_NUM_ROWS 199 |
32 | #define DEFAULT_NUM_COLS (26*3) | 46 | #define DEFAULT_NUM_COLS (26*3) |
33 | #define DEFAULT_NUM_SHEETS 3 | 47 | #define DEFAULT_NUM_SHEETS 3 |
34 | 48 | ||
35 | MainWindow::MainWindow() | 49 | MainWindow::MainWindow() |
36 | :QMainWindow() | 50 | :QMainWindow() |
37 | { | 51 | { |
38 | // initialize variables | 52 | // initialize variables |
39 | documentModified=FALSE; | 53 | documentModified=FALSE; |
40 | 54 | ||
41 | // construct objects | 55 | // construct objects |
42 | fileSelector=new FileSelector("application/sheet-qt", this, QString::null); | 56 | fileSelector=new FileSelector("application/sheet-qt", this, QString::null); |
43 | connect(fileSelector, SIGNAL(closeMe()), this, SLOT(selectorHide())); | 57 | connect(fileSelector, SIGNAL(closeMe()), this, SLOT(selectorHide())); |
44 | connect(fileSelector, SIGNAL(newSelected(const DocLnk &)), this, SLOT(selectorFileNew(const DocLnk &))); | 58 | connect(fileSelector, SIGNAL(newSelected(const DocLnk &)), this, SLOT(selectorFileNew(const DocLnk &))); |
45 | connect(fileSelector, SIGNAL(fileSelected(const DocLnk &)), this, SLOT(selectorFileOpen(const DocLnk &))); | 59 | connect(fileSelector, SIGNAL(fileSelected(const DocLnk &)), this, SLOT(selectorFileOpen(const DocLnk &))); |
46 | 60 | ||
47 | listSheets.setAutoDelete(TRUE); | 61 | listSheets.setAutoDelete(TRUE); |
48 | 62 | ||
diff --git a/noncore/apps/opie-sheet/mainwindow.h b/noncore/apps/opie-sheet/mainwindow.h index ac90504..554e6f6 100644 --- a/noncore/apps/opie-sheet/mainwindow.h +++ b/noncore/apps/opie-sheet/mainwindow.h | |||
@@ -1,48 +1,62 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | |||
10 | /* | ||
11 | * Opie Sheet (formerly Sheet/Qt) | ||
12 | * by Serdar Ozler <sozler@sitebest.com> | ||
13 | */ | ||
14 | |||
1 | #ifndef MAINWINDOW_H | 15 | #ifndef MAINWINDOW_H |
2 | #define MAINWINDOW_H | 16 | #define MAINWINDOW_H |
3 | 17 | ||
4 | #include <qpe/applnk.h> | 18 | #include <qpe/applnk.h> |
5 | #include <qpe/fileselector.h> | 19 | #include <qpe/fileselector.h> |
6 | #include <qpe/qpemenubar.h> | 20 | #include <qpe/qpemenubar.h> |
7 | #include <qpe/qpetoolbar.h> | 21 | #include <qpe/qpetoolbar.h> |
8 | #include <qmainwindow.h> | 22 | #include <qmainwindow.h> |
9 | #include <qaction.h> | 23 | #include <qaction.h> |
10 | #include <qlineedit.h> | 24 | #include <qlineedit.h> |
11 | #include <qbutton.h> | 25 | #include <qbutton.h> |
12 | #include <qcombobox.h> | 26 | #include <qcombobox.h> |
13 | #include <qtoolbutton.h> | 27 | #include <qtoolbutton.h> |
14 | 28 | ||
15 | #include "sheet.h" | 29 | #include "sheet.h" |
16 | 30 | ||
17 | typedef struct typeSheet | 31 | typedef struct typeSheet |
18 | { | 32 | { |
19 | QString name; | 33 | QString name; |
20 | QList<typeCellData> data; | 34 | QList<typeCellData> data; |
21 | }; | 35 | }; |
22 | 36 | ||
23 | class MainWindow: public QMainWindow | 37 | class MainWindow: public QMainWindow |
24 | { | 38 | { |
25 | Q_OBJECT | 39 | Q_OBJECT |
26 | 40 | ||
27 | // QPE objects | 41 | // QPE objects |
28 | DocLnk currentDoc; | 42 | DocLnk currentDoc; |
29 | QPEMenuBar *menu; | 43 | QPEMenuBar *menu; |
30 | QPEToolBar *toolbarFunctions, *toolbarEdit, *toolbarStandard; | 44 | QPEToolBar *toolbarFunctions, *toolbarEdit, *toolbarStandard; |
31 | FileSelector *fileSelector; | 45 | FileSelector *fileSelector; |
32 | 46 | ||
33 | // QT objects | 47 | // QT objects |
34 | QPopupMenu *menuFile, *menuEdit, *menuInsert, *menuFormat, *menuData, *menuHelp, | 48 | QPopupMenu *menuFile, *menuEdit, *menuInsert, *menuFormat, *menuData, *menuHelp, |
35 | *submenuFunc, *submenuFuncStd, *submenuFuncMath, *submenuFuncStat, | 49 | *submenuFunc, *submenuFuncStd, *submenuFuncMath, *submenuFuncStat, |
36 | *submenuRow, *submenuCol, *submenuSheet; | 50 | *submenuRow, *submenuCol, *submenuSheet; |
37 | QAction *fileNew, *fileOpen, *fileSave, *fileSaveAs, *fileQuit, *helpAbout, *editAccept, *editCancel, *formatCells, | 51 | QAction *fileNew, *fileOpen, *fileSave, *fileSaveAs, *fileQuit, *helpAbout, *editAccept, *editCancel, *formatCells, |
38 | *funcPlus, *funcMinus, *funcCross, *funcDivide, *funcParanOpen, *funcParanClose, *funcComma, *funcEqual, | 52 | *funcPlus, *funcMinus, *funcCross, *funcDivide, *funcParanOpen, *funcParanClose, *funcComma, *funcEqual, |
39 | *editCut, *editCopy, *editPaste, *editPasteContents, *editClear, *insertCols, *insertRows, *insertSheets, *insertCells, | 53 | *editCut, *editCopy, *editPaste, *editPasteContents, *editClear, *insertCols, *insertRows, *insertSheets, *insertCells, |
40 | *rowHeight, *rowShow, *rowHide, *rowAdjust, *colWidth, *colShow, *colHide, *colAdjust, *sheetRename, *sheetRemove, | 54 | *rowHeight, *rowShow, *rowHide, *rowAdjust, *colWidth, *colShow, *colHide, *colAdjust, *sheetRename, *sheetRemove, |
41 | *dataSort, *dataFindReplace, *editCellSelect, *helpGeneral; | 55 | *dataSort, *dataFindReplace, *editCellSelect, *helpGeneral; |
42 | QLineEdit *editData; | 56 | QLineEdit *editData; |
43 | QButton *buttonUp, *buttonDown, *buttonLeft, *buttonRight; | 57 | QButton *buttonUp, *buttonDown, *buttonLeft, *buttonRight; |
44 | QComboBox *comboSheets; | 58 | QComboBox *comboSheets; |
45 | QToolButton *toolFunction; | 59 | QToolButton *toolFunction; |
46 | QList<typeSheet> listSheets; | 60 | QList<typeSheet> listSheets; |
47 | QString helpFile; | 61 | QString helpFile; |
48 | 62 | ||
diff --git a/noncore/apps/opie-sheet/numberdlg.cpp b/noncore/apps/opie-sheet/numberdlg.cpp index de84378..e8de639 100644 --- a/noncore/apps/opie-sheet/numberdlg.cpp +++ b/noncore/apps/opie-sheet/numberdlg.cpp | |||
@@ -1,35 +1,49 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | |||
10 | /* | ||
11 | * Opie Sheet (formerly Sheet/Qt) | ||
12 | * by Serdar Ozler <sozler@sitebest.com> | ||
13 | */ | ||
14 | |||
1 | #include "numberdlg.h" | 15 | #include "numberdlg.h" |
2 | 16 | ||
3 | NumberDialog::NumberDialog(QWidget *parent=0) | 17 | NumberDialog::NumberDialog(QWidget *parent=0) |
4 | :QDialog(parent, 0, TRUE) | 18 | :QDialog(parent, 0, TRUE) |
5 | { | 19 | { |
6 | edit=new QSpinBox(this); | 20 | edit=new QSpinBox(this); |
7 | edit->setGeometry(120, 10, 70, 25); | 21 | edit->setGeometry(120, 10, 70, 25); |
8 | 22 | ||
9 | label=new QLabel(this); | 23 | label=new QLabel(this); |
10 | label->setGeometry(10, 10, 100, 25); | 24 | label->setGeometry(10, 10, 100, 25); |
11 | label->setBuddy(edit); | 25 | label->setBuddy(edit); |
12 | 26 | ||
13 | resize(200, 45); | 27 | resize(200, 45); |
14 | } | 28 | } |
15 | 29 | ||
16 | NumberDialog::~NumberDialog() | 30 | NumberDialog::~NumberDialog() |
17 | { | 31 | { |
18 | } | 32 | } |
19 | 33 | ||
20 | int NumberDialog::exec(const QString &caption, const QString &text, int value=1, int min=1, int max=99, int step=1) | 34 | int NumberDialog::exec(const QString &caption, const QString &text, int value=1, int min=1, int max=99, int step=1) |
21 | { | 35 | { |
22 | setCaption(caption); | 36 | setCaption(caption); |
23 | label->setText(text); | 37 | label->setText(text); |
24 | edit->setValue(value); | 38 | edit->setValue(value); |
25 | edit->setMinValue(min); | 39 | edit->setMinValue(min); |
26 | edit->setMaxValue(max); | 40 | edit->setMaxValue(max); |
27 | edit->setLineStep(step); | 41 | edit->setLineStep(step); |
28 | 42 | ||
29 | return QDialog::exec(); | 43 | return QDialog::exec(); |
30 | } | 44 | } |
31 | 45 | ||
32 | int NumberDialog::getValue() | 46 | int NumberDialog::getValue() |
33 | { | 47 | { |
34 | return edit->value(); | 48 | return edit->value(); |
35 | } | 49 | } |
diff --git a/noncore/apps/opie-sheet/numberdlg.h b/noncore/apps/opie-sheet/numberdlg.h index 46af1d0..81e3326 100644 --- a/noncore/apps/opie-sheet/numberdlg.h +++ b/noncore/apps/opie-sheet/numberdlg.h | |||
@@ -1,24 +1,38 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | |||
10 | /* | ||
11 | * Opie Sheet (formerly Sheet/Qt) | ||
12 | * by Serdar Ozler <sozler@sitebest.com> | ||
13 | */ | ||
14 | |||
1 | #ifndef NUMBERDLG_H | 15 | #ifndef NUMBERDLG_H |
2 | #define NUMBERDLG_H | 16 | #define NUMBERDLG_H |
3 | 17 | ||
4 | #include <qdialog.h> | 18 | #include <qdialog.h> |
5 | #include <qlabel.h> | 19 | #include <qlabel.h> |
6 | #include <qspinbox.h> | 20 | #include <qspinbox.h> |
7 | 21 | ||
8 | class NumberDialog: public QDialog | 22 | class NumberDialog: public QDialog |
9 | { | 23 | { |
10 | Q_OBJECT | 24 | Q_OBJECT |
11 | 25 | ||
12 | // QT objects | 26 | // QT objects |
13 | QLabel *label; | 27 | QLabel *label; |
14 | QSpinBox *edit; | 28 | QSpinBox *edit; |
15 | 29 | ||
16 | public: | 30 | public: |
17 | NumberDialog(QWidget *parent=0); | 31 | NumberDialog(QWidget *parent=0); |
18 | ~NumberDialog(); | 32 | ~NumberDialog(); |
19 | 33 | ||
20 | int exec(const QString &caption, const QString &text, int value=1, int min=1, int max=99, int step=1); | 34 | int exec(const QString &caption, const QString &text, int value=1, int min=1, int max=99, int step=1); |
21 | int getValue(); | 35 | int getValue(); |
22 | }; | 36 | }; |
23 | 37 | ||
24 | #endif | 38 | #endif |
diff --git a/noncore/apps/opie-sheet/sheet.cpp b/noncore/apps/opie-sheet/sheet.cpp index 9526937..1d7ec6f 100644 --- a/noncore/apps/opie-sheet/sheet.cpp +++ b/noncore/apps/opie-sheet/sheet.cpp | |||
@@ -1,48 +1,62 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | |||
10 | /* | ||
11 | * Opie Sheet (formerly Sheet/Qt) | ||
12 | * by Serdar Ozler <sozler@sitebest.com> | ||
13 | */ | ||
14 | |||
1 | #include "sheet.h" | 15 | #include "sheet.h" |
2 | 16 | ||
3 | #include <qmainwindow.h> | 17 | #include <qmainwindow.h> |
4 | #include <qmessagebox.h> | 18 | #include <qmessagebox.h> |
5 | #include <math.h> | 19 | #include <math.h> |
6 | 20 | ||
7 | #define DEFAULT_COL_WIDTH 50 | 21 | #define DEFAULT_COL_WIDTH 50 |
8 | 22 | ||
9 | Sheet::Sheet(int numRows, int numCols, QWidget *parent) | 23 | Sheet::Sheet(int numRows, int numCols, QWidget *parent) |
10 | :QTable(numRows, numCols, parent) | 24 | :QTable(numRows, numCols, parent) |
11 | { | 25 | { |
12 | defaultBorders.right=defaultBorders.bottom=QPen(Qt::gray, 1, Qt::SolidLine); | 26 | defaultBorders.right=defaultBorders.bottom=QPen(Qt::gray, 1, Qt::SolidLine); |
13 | defaultCellData.data=""; | 27 | defaultCellData.data=""; |
14 | defaultCellData.background=QBrush(Qt::white, Qt::SolidPattern); | 28 | defaultCellData.background=QBrush(Qt::white, Qt::SolidPattern); |
15 | defaultCellData.alignment=(Qt::AlignmentFlags)(Qt::AlignLeft | Qt::AlignTop); | 29 | defaultCellData.alignment=(Qt::AlignmentFlags)(Qt::AlignLeft | Qt::AlignTop); |
16 | defaultCellData.fontColor=Qt::black; | 30 | defaultCellData.fontColor=Qt::black; |
17 | defaultCellData.font=font(); | 31 | defaultCellData.font=font(); |
18 | defaultCellData.borders=defaultBorders; | 32 | defaultCellData.borders=defaultBorders; |
19 | 33 | ||
20 | selectionNo=-1; | 34 | selectionNo=-1; |
21 | setSelectionMode(QTable::Single); | 35 | setSelectionMode(QTable::Single); |
22 | 36 | ||
23 | sheetData.setAutoDelete(TRUE); | 37 | sheetData.setAutoDelete(TRUE); |
24 | clipboardData.setAutoDelete(TRUE); | 38 | clipboardData.setAutoDelete(TRUE); |
25 | for (int i=0; i<numCols; ++i) | 39 | for (int i=0; i<numCols; ++i) |
26 | horizontalHeader()->setLabel(i, getHeaderString(i+1), DEFAULT_COL_WIDTH); | 40 | horizontalHeader()->setLabel(i, getHeaderString(i+1), DEFAULT_COL_WIDTH); |
27 | 41 | ||
28 | connect(this, SIGNAL(currentChanged(int, int)), this, SLOT(slotCellSelected(int, int))); | 42 | connect(this, SIGNAL(currentChanged(int, int)), this, SLOT(slotCellSelected(int, int))); |
29 | connect(this, SIGNAL(valueChanged(int, int)), this, SLOT(slotCellChanged(int, int))); | 43 | connect(this, SIGNAL(valueChanged(int, int)), this, SLOT(slotCellChanged(int, int))); |
30 | } | 44 | } |
31 | 45 | ||
32 | Sheet::~Sheet() | 46 | Sheet::~Sheet() |
33 | { | 47 | { |
34 | } | 48 | } |
35 | 49 | ||
36 | typeCellData *Sheet::findCellData(int row, int col) | 50 | typeCellData *Sheet::findCellData(int row, int col) |
37 | { | 51 | { |
38 | typeCellData *tempCellData; | 52 | typeCellData *tempCellData; |
39 | for (tempCellData=sheetData.first(); tempCellData; tempCellData=sheetData.next()) | 53 | for (tempCellData=sheetData.first(); tempCellData; tempCellData=sheetData.next()) |
40 | if (tempCellData->row==row && tempCellData->col==col) | 54 | if (tempCellData->row==row && tempCellData->col==col) |
41 | return tempCellData; | 55 | return tempCellData; |
42 | return NULL; | 56 | return NULL; |
43 | } | 57 | } |
44 | 58 | ||
45 | void Sheet::slotCellSelected(int row, int col) | 59 | void Sheet::slotCellSelected(int row, int col) |
46 | { | 60 | { |
47 | typeCellData *cellData=findCellData(row, col); | 61 | typeCellData *cellData=findCellData(row, col); |
48 | if (cellData) | 62 | if (cellData) |
diff --git a/noncore/apps/opie-sheet/sheet.h b/noncore/apps/opie-sheet/sheet.h index 02899a0..f78a684 100644 --- a/noncore/apps/opie-sheet/sheet.h +++ b/noncore/apps/opie-sheet/sheet.h | |||
@@ -1,48 +1,62 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | |||
10 | /* | ||
11 | * Opie Sheet (formerly Sheet/Qt) | ||
12 | * by Serdar Ozler <sozler@sitebest.com> | ||
13 | */ | ||
14 | |||
1 | #ifndef SHEET_H | 15 | #ifndef SHEET_H |
2 | #define SHEET_H | 16 | #define SHEET_H |
3 | 17 | ||
4 | #include <qtable.h> | 18 | #include <qtable.h> |
5 | #include <qstack.h> | 19 | #include <qstack.h> |
6 | 20 | ||
7 | typedef struct typeCellBorders | 21 | typedef struct typeCellBorders |
8 | { | 22 | { |
9 | QPen right, bottom; | 23 | QPen right, bottom; |
10 | }; | 24 | }; |
11 | 25 | ||
12 | typedef struct typeCellData | 26 | typedef struct typeCellData |
13 | { | 27 | { |
14 | int col, row; | 28 | int col, row; |
15 | typeCellBorders borders; | 29 | typeCellBorders borders; |
16 | QBrush background; | 30 | QBrush background; |
17 | Qt::AlignmentFlags alignment; | 31 | Qt::AlignmentFlags alignment; |
18 | QColor fontColor; | 32 | QColor fontColor; |
19 | QFont font; | 33 | QFont font; |
20 | QString data; | 34 | QString data; |
21 | }; | 35 | }; |
22 | 36 | ||
23 | class Sheet: public QTable | 37 | class Sheet: public QTable |
24 | { | 38 | { |
25 | Q_OBJECT | 39 | Q_OBJECT |
26 | 40 | ||
27 | // Variables | 41 | // Variables |
28 | bool clicksLocked; | 42 | bool clicksLocked; |
29 | int selectionNo; | 43 | int selectionNo; |
30 | typeCellBorders defaultBorders; | 44 | typeCellBorders defaultBorders; |
31 | typeCellData defaultCellData; | 45 | typeCellData defaultCellData; |
32 | 46 | ||
33 | // QT objects | 47 | // QT objects |
34 | QList<typeCellData> sheetData, clipboardData; | 48 | QList<typeCellData> sheetData, clipboardData; |
35 | QString pressedCell, releasedCell, sheetName; | 49 | QString pressedCell, releasedCell, sheetName; |
36 | 50 | ||
37 | // Private functions | 51 | // Private functions |
38 | int getOperatorPriority(char oper); | 52 | int getOperatorPriority(char oper); |
39 | bool findRowColumn(const QString &variable, int *row, int *col, bool giveError=FALSE); | 53 | bool findRowColumn(const QString &variable, int *row, int *col, bool giveError=FALSE); |
40 | bool findRange(const QString &variable1, const QString &variable2, int *row1, int *col1, int *row2, int *col2); | 54 | bool findRange(const QString &variable1, const QString &variable2, int *row1, int *col1, int *row2, int *col2); |
41 | double calculateVariable(const QString &variable); | 55 | double calculateVariable(const QString &variable); |
42 | double calculateFunction(const QString &function, const QString ¶meters); | 56 | double calculateFunction(const QString &function, const QString ¶meters); |
43 | QChar popCharStack(QStack<QChar> *stackChars); | 57 | QChar popCharStack(QStack<QChar> *stackChars); |
44 | QString popStringStack(QStack<QString> *stackStrings); | 58 | QString popStringStack(QStack<QString> *stackStrings); |
45 | QString getParameter(const QString ¶meters, int paramNo, bool giveError=FALSE, const QString funcName=""); | 59 | QString getParameter(const QString ¶meters, int paramNo, bool giveError=FALSE, const QString funcName=""); |
46 | QString dataParser(const QString &data); | 60 | QString dataParser(const QString &data); |
47 | QString dataParserHelper(const QString &data); | 61 | QString dataParserHelper(const QString &data); |
48 | typeCellData *createCellData(int row, int col); | 62 | typeCellData *createCellData(int row, int col); |
diff --git a/noncore/apps/opie-sheet/sortdlg.cpp b/noncore/apps/opie-sheet/sortdlg.cpp index f46562e..4f18fd3 100644 --- a/noncore/apps/opie-sheet/sortdlg.cpp +++ b/noncore/apps/opie-sheet/sortdlg.cpp | |||
@@ -1,48 +1,62 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | |||
10 | /* | ||
11 | * Opie Sheet (formerly Sheet/Qt) | ||
12 | * by Serdar Ozler <sozler@sitebest.com> | ||
13 | */ | ||
14 | |||
1 | #include <qlabel.h> | 15 | #include <qlabel.h> |
2 | #include <qradiobutton.h> | 16 | #include <qradiobutton.h> |
3 | #include <qmessagebox.h> | 17 | #include <qmessagebox.h> |
4 | #include "sortdlg.h" | 18 | #include "sortdlg.h" |
5 | 19 | ||
6 | SortDialog::SortDialog(QWidget *parent=0) | 20 | SortDialog::SortDialog(QWidget *parent=0) |
7 | :QDialog(parent, 0, TRUE) | 21 | :QDialog(parent, 0, TRUE) |
8 | { | 22 | { |
9 | // Main widget | 23 | // Main widget |
10 | tabs=new QTabWidget(this); | 24 | tabs=new QTabWidget(this); |
11 | widgetSort=new QWidget(tabs); | 25 | widgetSort=new QWidget(tabs); |
12 | widgetOptions=new QWidget(tabs); | 26 | widgetOptions=new QWidget(tabs); |
13 | tabs->addTab(widgetSort, tr("&Sort")); | 27 | tabs->addTab(widgetSort, tr("&Sort")); |
14 | tabs->addTab(widgetOptions, tr("&Options")); | 28 | tabs->addTab(widgetOptions, tr("&Options")); |
15 | 29 | ||
16 | // Sort tab | 30 | // Sort tab |
17 | comboFieldA=createFieldCombo(tr("&Sort by"), 10); | 31 | comboFieldA=createFieldCombo(tr("&Sort by"), 10); |
18 | groupOrderA=createOrderButtons(10); | 32 | groupOrderA=createOrderButtons(10); |
19 | comboFieldB=createFieldCombo(tr("&Then by"), 90); | 33 | comboFieldB=createFieldCombo(tr("&Then by"), 90); |
20 | groupOrderB=createOrderButtons(90); | 34 | groupOrderB=createOrderButtons(90); |
21 | comboFieldC=createFieldCombo(tr("Then &by"), 170); | 35 | comboFieldC=createFieldCombo(tr("Then &by"), 170); |
22 | groupOrderC=createOrderButtons(170); | 36 | groupOrderC=createOrderButtons(170); |
23 | 37 | ||
24 | // Options tab | 38 | // Options tab |
25 | checkCase=new QCheckBox(tr("&Case Sensitive"), widgetOptions); | 39 | checkCase=new QCheckBox(tr("&Case Sensitive"), widgetOptions); |
26 | checkCase->setGeometry(10, 10, 215, 20); | 40 | checkCase->setGeometry(10, 10, 215, 20); |
27 | checkCase->setChecked(TRUE); | 41 | checkCase->setChecked(TRUE); |
28 | 42 | ||
29 | groupDirection=new QVButtonGroup(tr("&Direction"), widgetOptions); | 43 | groupDirection=new QVButtonGroup(tr("&Direction"), widgetOptions); |
30 | groupDirection->setGeometry(10, 40, 215, 70); | 44 | groupDirection->setGeometry(10, 40, 215, 70); |
31 | QRadioButton *radio=new QRadioButton(tr("&Top to bottom (rows)"), groupDirection); | 45 | QRadioButton *radio=new QRadioButton(tr("&Top to bottom (rows)"), groupDirection); |
32 | radio=new QRadioButton(tr("&Left to right (columns)"), groupDirection); | 46 | radio=new QRadioButton(tr("&Left to right (columns)"), groupDirection); |
33 | groupDirection->setButton(0); | 47 | groupDirection->setButton(0); |
34 | connect(groupDirection, SIGNAL(clicked(int)), this, SLOT(directionChanged(int))); | 48 | connect(groupDirection, SIGNAL(clicked(int)), this, SLOT(directionChanged(int))); |
35 | 49 | ||
36 | // Main widget | 50 | // Main widget |
37 | box=new QVBoxLayout(this); | 51 | box=new QVBoxLayout(this); |
38 | box->addWidget(tabs); | 52 | box->addWidget(tabs); |
39 | 53 | ||
40 | setCaption(tr("Sort")); | 54 | setCaption(tr("Sort")); |
41 | } | 55 | } |
42 | 56 | ||
43 | SortDialog::~SortDialog() | 57 | SortDialog::~SortDialog() |
44 | { | 58 | { |
45 | } | 59 | } |
46 | 60 | ||
47 | QComboBox *SortDialog::createFieldCombo(const QString &caption, int y) | 61 | QComboBox *SortDialog::createFieldCombo(const QString &caption, int y) |
48 | { | 62 | { |
diff --git a/noncore/apps/opie-sheet/sortdlg.h b/noncore/apps/opie-sheet/sortdlg.h index 2c99f02..b3699a9 100644 --- a/noncore/apps/opie-sheet/sortdlg.h +++ b/noncore/apps/opie-sheet/sortdlg.h | |||
@@ -1,45 +1,59 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | |||
10 | /* | ||
11 | * Opie Sheet (formerly Sheet/Qt) | ||
12 | * by Serdar Ozler <sozler@sitebest.com> | ||
13 | */ | ||
14 | |||
1 | #ifndef SORTDLG_H | 15 | #ifndef SORTDLG_H |
2 | #define SORTDLG_H | 16 | #define SORTDLG_H |
3 | 17 | ||
4 | #include <qdialog.h> | 18 | #include <qdialog.h> |
5 | #include <qtabwidget.h> | 19 | #include <qtabwidget.h> |
6 | #include <qlayout.h> | 20 | #include <qlayout.h> |
7 | #include <qcombobox.h> | 21 | #include <qcombobox.h> |
8 | #include <qcheckbox.h> | 22 | #include <qcheckbox.h> |
9 | #include <qpushbutton.h> | 23 | #include <qpushbutton.h> |
10 | #include <qvbuttongroup.h> | 24 | #include <qvbuttongroup.h> |
11 | #include "sheet.h" | 25 | #include "sheet.h" |
12 | 26 | ||
13 | class SortDialog: public QDialog | 27 | class SortDialog: public QDialog |
14 | { | 28 | { |
15 | Q_OBJECT | 29 | Q_OBJECT |
16 | 30 | ||
17 | // QT objects | 31 | // QT objects |
18 | QBoxLayout *box; | 32 | QBoxLayout *box; |
19 | QTabWidget *tabs; | 33 | QTabWidget *tabs; |
20 | QWidget *widgetSort, *widgetOptions; | 34 | QWidget *widgetSort, *widgetOptions; |
21 | QVButtonGroup *groupOrderA, *groupOrderB, *groupOrderC, *groupDirection; | 35 | QVButtonGroup *groupOrderA, *groupOrderB, *groupOrderC, *groupDirection; |
22 | QCheckBox *checkCase; | 36 | QCheckBox *checkCase; |
23 | QComboBox *comboFieldA, *comboFieldB, *comboFieldC; | 37 | QComboBox *comboFieldA, *comboFieldB, *comboFieldC; |
24 | 38 | ||
25 | // Other objects & variables | 39 | // Other objects & variables |
26 | int row1, col1, row2, col2, direction; | 40 | int row1, col1, row2, col2, direction; |
27 | Sheet *sheet; | 41 | Sheet *sheet; |
28 | 42 | ||
29 | // Private functions | 43 | // Private functions |
30 | QVButtonGroup *createOrderButtons(int y); | 44 | QVButtonGroup *createOrderButtons(int y); |
31 | QComboBox *createFieldCombo(const QString &caption, int y); | 45 | QComboBox *createFieldCombo(const QString &caption, int y); |
32 | void fillFieldCombo(QComboBox *combo); | 46 | void fillFieldCombo(QComboBox *combo); |
33 | int compareItems(QTableItem *item1, QTableItem *item2, int descending=0, bool caseSensitive=TRUE); | 47 | int compareItems(QTableItem *item1, QTableItem *item2, int descending=0, bool caseSensitive=TRUE); |
34 | 48 | ||
35 | private slots: | 49 | private slots: |
36 | void directionChanged(int id); | 50 | void directionChanged(int id); |
37 | 51 | ||
38 | public: | 52 | public: |
39 | SortDialog(QWidget *parent=0); | 53 | SortDialog(QWidget *parent=0); |
40 | ~SortDialog(); | 54 | ~SortDialog(); |
41 | 55 | ||
42 | int exec(Sheet *s); | 56 | int exec(Sheet *s); |
43 | }; | 57 | }; |
44 | 58 | ||
45 | #endif | 59 | #endif |
diff --git a/noncore/apps/opie-sheet/textdlg.cpp b/noncore/apps/opie-sheet/textdlg.cpp index 8245fe4..0810eb2 100644 --- a/noncore/apps/opie-sheet/textdlg.cpp +++ b/noncore/apps/opie-sheet/textdlg.cpp | |||
@@ -1,32 +1,46 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | |||
10 | /* | ||
11 | * Opie Sheet (formerly Sheet/Qt) | ||
12 | * by Serdar Ozler <sozler@sitebest.com> | ||
13 | */ | ||
14 | |||
1 | #include "textdlg.h" | 15 | #include "textdlg.h" |
2 | 16 | ||
3 | TextDialog::TextDialog(QWidget *parent=0) | 17 | TextDialog::TextDialog(QWidget *parent=0) |
4 | :QDialog(parent, 0, TRUE) | 18 | :QDialog(parent, 0, TRUE) |
5 | { | 19 | { |
6 | edit=new QLineEdit(this); | 20 | edit=new QLineEdit(this); |
7 | edit->setGeometry(90, 10, 100, 25); | 21 | edit->setGeometry(90, 10, 100, 25); |
8 | 22 | ||
9 | label=new QLabel(this); | 23 | label=new QLabel(this); |
10 | label->setGeometry(10, 10, 70, 25); | 24 | label->setGeometry(10, 10, 70, 25); |
11 | label->setBuddy(edit); | 25 | label->setBuddy(edit); |
12 | 26 | ||
13 | resize(200, 45); | 27 | resize(200, 45); |
14 | } | 28 | } |
15 | 29 | ||
16 | TextDialog::~TextDialog() | 30 | TextDialog::~TextDialog() |
17 | { | 31 | { |
18 | } | 32 | } |
19 | 33 | ||
20 | int TextDialog::exec(const QString &caption, const QString &text, const QString &value="") | 34 | int TextDialog::exec(const QString &caption, const QString &text, const QString &value="") |
21 | { | 35 | { |
22 | setCaption(caption); | 36 | setCaption(caption); |
23 | label->setText(text); | 37 | label->setText(text); |
24 | edit->setText(value); | 38 | edit->setText(value); |
25 | 39 | ||
26 | return QDialog::exec(); | 40 | return QDialog::exec(); |
27 | } | 41 | } |
28 | 42 | ||
29 | QString TextDialog::getValue() | 43 | QString TextDialog::getValue() |
30 | { | 44 | { |
31 | return edit->text(); | 45 | return edit->text(); |
32 | } | 46 | } |
diff --git a/noncore/apps/opie-sheet/textdlg.h b/noncore/apps/opie-sheet/textdlg.h index f948228..78ef580 100644 --- a/noncore/apps/opie-sheet/textdlg.h +++ b/noncore/apps/opie-sheet/textdlg.h | |||
@@ -1,24 +1,38 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | |||
10 | /* | ||
11 | * Opie Sheet (formerly Sheet/Qt) | ||
12 | * by Serdar Ozler <sozler@sitebest.com> | ||
13 | */ | ||
14 | |||
1 | #ifndef TEXTDLG_H | 15 | #ifndef TEXTDLG_H |
2 | #define TEXTDLG_H | 16 | #define TEXTDLG_H |
3 | 17 | ||
4 | #include <qdialog.h> | 18 | #include <qdialog.h> |
5 | #include <qlabel.h> | 19 | #include <qlabel.h> |
6 | #include <qlineedit.h> | 20 | #include <qlineedit.h> |
7 | 21 | ||
8 | class TextDialog: public QDialog | 22 | class TextDialog: public QDialog |
9 | { | 23 | { |
10 | Q_OBJECT | 24 | Q_OBJECT |
11 | 25 | ||
12 | // QT objects | 26 | // QT objects |
13 | QLabel *label; | 27 | QLabel *label; |
14 | QLineEdit *edit; | 28 | QLineEdit *edit; |
15 | 29 | ||
16 | public: | 30 | public: |
17 | TextDialog(QWidget *parent=0); | 31 | TextDialog(QWidget *parent=0); |
18 | ~TextDialog(); | 32 | ~TextDialog(); |
19 | 33 | ||
20 | int exec(const QString &caption, const QString &text, const QString &value=""); | 34 | int exec(const QString &caption, const QString &text, const QString &value=""); |
21 | QString getValue(); | 35 | QString getValue(); |
22 | }; | 36 | }; |
23 | 37 | ||
24 | #endif | 38 | #endif |