author | drw <drw> | 2005-05-16 17:09:58 (UTC) |
---|---|---|
committer | drw <drw> | 2005-05-16 17:09:58 (UTC) |
commit | e90364376c77a2f218b2fb291bb97eda7f18c3cb (patch) (side-by-side diff) | |
tree | 48f75cfebe8e5f3004810533f8e2dca4105d0c23 | |
parent | 1de015fb8f267f2451dd26d992cc713e6e02af79 (diff) | |
download | opie-e90364376c77a2f218b2fb291bb97eda7f18c3cb.zip opie-e90364376c77a2f218b2fb291bb97eda7f18c3cb.tar.gz opie-e90364376c77a2f218b2fb291bb97eda7f18c3cb.tar.bz2 |
Resource -> OResource
-rw-r--r-- | noncore/apps/opie-sheet/mainwindow.cpp | 69 |
1 files changed, 51 insertions, 18 deletions
diff --git a/noncore/apps/opie-sheet/mainwindow.cpp b/noncore/apps/opie-sheet/mainwindow.cpp index 3095142..4938ea8 100644 --- a/noncore/apps/opie-sheet/mainwindow.cpp +++ b/noncore/apps/opie-sheet/mainwindow.cpp @@ -5,65 +5,65 @@ _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* * Opie Sheet (formerly Sheet/Qt) * by Serdar Ozler <sozler@sitebest.com> */ #include "mainwindow.h" /* OPIE */ -#include <qpe/resource.h> +#include <opie2/oresource.h> #include <qpe/qpeapplication.h> /* QT */ #include <qmessagebox.h> #include <qradiobutton.h> /* STD */ #include "cellformat.h" #include "numberdlg.h" #include "textdlg.h" #include "sortdlg.h" #include "finddlg.h" #define DEFAULT_NUM_ROWS 300 #define DEFAULT_NUM_COLS (26*3) #define DEFAULT_NUM_SHEETS 3 MainWindow::MainWindow(QWidget *parent, const char* n, WFlags fl) :QMainWindow(parent, n, fl) { // initialize variables documentModified=FALSE; // construct objects currentDoc=0; fileSelector=new FileSelector("application/opie-sheet", this, QString::null); ExcelSelector=new FileSelector("application/excel",this,QString::null,FALSE); connect(fileSelector, SIGNAL(closeMe()), this, SLOT(selectorHide())); connect(fileSelector, SIGNAL(newSelected(const DocLnk&)), this, SLOT(selectorFileNew(const DocLnk&))); connect(fileSelector, SIGNAL(fileSelected(const DocLnk&)), this, SLOT(selectorFileOpen(const DocLnk&))); connect(ExcelSelector,SIGNAL(fileSelected(const DocLnk&)),this,SLOT(slotImportExcel(const DocLnk&))); connect(ExcelSelector,SIGNAL(closeMe()), this, SLOT(ExcelSelectorHide())); @@ -260,160 +260,192 @@ void MainWindow::slotFileNew() void MainWindow::slotFileOpen() { selectorShow(); } void MainWindow::slotImportExcelOpen() { sheet->hide(); setCentralWidget(ExcelSelector); ExcelSelector->show(); ExcelSelector->reread(); } void MainWindow::ExcelSelectorHide() { ExcelSelector->hide(); setCentralWidget(sheet); sheet->show(); } void MainWindow::slotFileSave() { saveCurrentFile(FALSE); } void MainWindow::setDocument(const QString &applnk_filename) { selectorFileOpen(DocLnk(applnk_filename)); } void MainWindow::initActions() { - fileNew=new QAction(tr("New File"), Resource::loadPixmap( "new" ), tr("&New"), 0, this); + fileNew=new QAction(tr("New File"), + Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ), + tr("&New"), 0, this); connect(fileNew, SIGNAL(activated()), this, SLOT(slotFileNew())); - fileOpen=new QAction(tr("Open File"), Resource::loadPixmap( "fileopen" ), tr("&Open"), 0, this); + fileOpen=new QAction(tr("Open File"), + Opie::Core::OResource::loadPixmap( "fileopen", Opie::Core::OResource::SmallIcon ), + tr("&Open"), 0, this); connect(fileOpen, SIGNAL(activated()), this, SLOT(slotFileOpen())); - fileSave=new QAction(tr("Save File"),Resource::loadPixmap( "save" ), tr("&Save"), 0, this); + fileSave=new QAction(tr("Save File"), + Opie::Core::OResource::loadPixmap( "save", Opie::Core::OResource::SmallIcon ), + tr("&Save"), 0, this); connect(fileSave, SIGNAL(activated()), this, SLOT(slotFileSave())); - fileSaveAs=new QAction(tr("Save File As"), Resource::loadPixmap( "save" ), tr("Save &As"), 0, this); + fileSaveAs=new QAction(tr("Save File As"), + Opie::Core::OResource::loadPixmap( "save", Opie::Core::OResource::SmallIcon ), + tr("Save &As"), 0, this); connect(fileSaveAs, SIGNAL(activated()), this, SLOT(slotFileSaveAs())); //fileQuit=new QAction(tr("Quit"), tr("&Quit"), 0, this); //connect(fileQuit, SIGNAL(activated()), this, SLOT(close())); - fileExcelImport=new QAction(tr("Import Excel file"),Resource::loadPixmap( "opie-sheet/excel16" ),tr("Import E&xcel file"),0,this); + fileExcelImport=new QAction(tr("Import Excel file"), + Opie::Core::OResource::loadPixmap( "opie-sheet/excel16", Opie::Core::OResource::SmallIcon ), + tr("Import E&xcel file"),0,this); connect(fileExcelImport, SIGNAL(activated()), this, SLOT(slotImportExcelOpen())); // helpGeneral=new QAction(tr("General Help"), QPixmap(help_general_xpm), tr("&General"), 0, this); //connect(helpGeneral, SIGNAL(activated()), this, SLOT(slotHelpGeneral())); //helpAbout=new QAction(tr("About Opie Sheet"), tr("&About"), 0, this); //connect(helpAbout, SIGNAL(activated()), this, SLOT(slotHelpAbout())); - editAccept=new QAction(tr("Accept"),Resource::loadPixmap( "enter" ) , tr("&Accept"), 0, this); + editAccept=new QAction(tr("Accept"), + Opie::Core::OResource::loadPixmap( "enter", Opie::Core::OResource::SmallIcon ), + tr("&Accept"), 0, this); connect(editAccept, SIGNAL(activated()), this, SLOT(slotEditAccept())); - editCancel=new QAction(tr("Cancel"), Resource::loadPixmap( "close" ), tr("&Cancel"), 0, this); + editCancel=new QAction(tr("Cancel"), + Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ), + tr("&Cancel"), 0, this); connect(editCancel, SIGNAL(activated()), this, SLOT(slotEditCancel())); - editCellSelect=new QAction(tr("Cell Selector"), Resource::loadPixmap( "opie-sheet/cell-select" ), tr("Cell &Selector"), 0, this); + editCellSelect=new QAction(tr("Cell Selector"), + Opie::Core::OResource::loadPixmap( "opie-sheet/cell-select", Opie::Core::OResource::SmallIcon ), + tr("Cell &Selector"), 0, this); editCellSelect->setToggleAction(TRUE); connect(editCellSelect, SIGNAL(toggled(bool)), this, SLOT(slotCellSelect(bool))); editCut=new QAction(tr("Cut Cells"), tr("Cu&t"), 0, this); editCopy=new QAction(tr("Copy Cells"), tr("&Copy"), 0, this); editPaste=new QAction(tr("Paste Cells"), tr("&Paste"), 0, this); connect(editPaste, SIGNAL(activated()), this, SLOT(slotEditPaste())); editPasteContents=new QAction(tr("Paste Contents"), tr("Paste Cont&ents"), 0, this); connect(editPasteContents, SIGNAL(activated()), this, SLOT(slotEditPasteContents())); editClear=new QAction(tr("Clear Cells"), tr("C&lear"), 0, this); insertCells=new QAction(tr("Insert Cells"), tr("C&ells"), 0, this); connect(insertCells, SIGNAL(activated()), this, SLOT(slotInsertCells())); insertRows=new QAction(tr("Insert Rows"), tr("&Rows"), 0, this); connect(insertRows, SIGNAL(activated()), this, SLOT(slotInsertRows())); insertCols=new QAction(tr("Insert Columns"), tr("&Columns"), 0, this); connect(insertCols, SIGNAL(activated()), this, SLOT(slotInsertCols())); insertSheets=new QAction(tr("Add Sheets"), tr("&Sheets"), 0, this); connect(insertSheets, SIGNAL(activated()), this, SLOT(slotInsertSheets())); formatCells=new QAction(tr("Cells"), tr("&Cells"), 0, this); connect(formatCells, SIGNAL(activated()), this, SLOT(slotFormatCells())); rowHeight=new QAction(tr("Row Height"), tr("H&eight"), 0, this); connect(rowHeight, SIGNAL(activated()), this, SLOT(slotRowHeight())); rowAdjust=new QAction(tr("Adjust Row"), tr("&Adjust"), 0, this); connect(rowAdjust, SIGNAL(activated()), this, SLOT(slotRowAdjust())); rowShow=new QAction(tr("Show Row"), tr("&Show"), 0, this); connect(rowShow, SIGNAL(activated()), this, SLOT(slotRowShow())); rowHide=new QAction(tr("Hide Row"), tr("&Hide"), 0, this); connect(rowHide, SIGNAL(activated()), this, SLOT(slotRowHide())); colWidth=new QAction(tr("Column Width"), tr("&Width"), 0, this); connect(colWidth, SIGNAL(activated()), this, SLOT(slotColumnWidth())); colAdjust=new QAction(tr("Adjust Column"), tr("&Adjust"), 0, this); connect(colAdjust, SIGNAL(activated()), this, SLOT(slotColumnAdjust())); colShow=new QAction(tr("Show Column"), tr("&Show"), 0, this); connect(colShow, SIGNAL(activated()), this, SLOT(slotColumnShow())); colHide=new QAction(tr("Hide Column"), tr("&Hide"), 0, this); connect(colHide, SIGNAL(activated()), this, SLOT(slotColumnHide())); sheetRename=new QAction(tr("Rename Sheet"), tr("&Rename"), 0, this); connect(sheetRename, SIGNAL(activated()), this, SLOT(slotSheetRename())); sheetRemove=new QAction(tr("Remove Sheet"), tr("R&emove"), 0, this); connect(sheetRemove, SIGNAL(activated()), this, SLOT(slotSheetRemove())); dataSort=new QAction(tr("Sort Data"), tr("&Sort"), 0, this); connect(dataSort, SIGNAL(activated()), this, SLOT(slotDataSort())); dataFindReplace=new QAction(tr("Find && Replace"), tr("&Find && Replace"), 0, this); connect(dataFindReplace, SIGNAL(activated()), this, SLOT(slotDataFindReplace())); - funcEqual=new QAction(tr("Equal To"), Resource::loadPixmap( "opie-sheet/func-equal" ), tr("&Equal To"), 0, this); + funcEqual=new QAction(tr("Equal To"), + Opie::Core::OResource::loadPixmap( "opie-sheet/func-equal", Opie::Core::OResource::SmallIcon ), + tr("&Equal To"), 0, this); funcEqual->setToolTip("="); connect(funcEqual, SIGNAL(activated()), this, SLOT(slotFuncOutput())); - funcPlus=new QAction(tr("Addition"), Resource::loadPixmap( "opie-sheet/func-plus" ), tr("&Addition"), 0, this); + funcPlus=new QAction(tr("Addition"), + Opie::Core::OResource::loadPixmap( "opie-sheet/func-plus", Opie::Core::OResource::SmallIcon ), + tr("&Addition"), 0, this); funcPlus->setToolTip("+"); connect(funcPlus, SIGNAL(activated()), this, SLOT(slotFuncOutput())); - funcMinus=new QAction(tr("Subtraction"), Resource::loadPixmap( "opie-sheet/func-minus" ), tr("&Subtraction"), 0, this); + funcMinus=new QAction(tr("Subtraction"), + Opie::Core::OResource::loadPixmap( "opie-sheet/func-minus", Opie::Core::OResource::SmallIcon ), + tr("&Subtraction"), 0, this); funcMinus->setToolTip("-"); connect(funcMinus, SIGNAL(activated()), this, SLOT(slotFuncOutput())); - funcCross=new QAction(tr("Multiplication"), Resource::loadPixmap ("opie-sheet/func-cross" ), tr("&Multiplication"), 0, this); + funcCross=new QAction(tr("Multiplication"), + Opie::Core::OResource::loadPixmap ("opie-sheet/func-cross", Opie::Core::OResource::SmallIcon ), + tr("&Multiplication"), 0, this); funcCross->setToolTip("*"); connect(funcCross, SIGNAL(activated()), this, SLOT(slotFuncOutput())); - funcDivide=new QAction(tr("Division"), Resource::loadPixmap( "opie-sheet/func-divide" ), tr("&Division"), 0, this); + funcDivide=new QAction(tr("Division"), + Opie::Core::OResource::loadPixmap( "opie-sheet/func-divide", Opie::Core::OResource::SmallIcon ), + tr("&Division"), 0, this); funcDivide->setToolTip("/"); connect(funcDivide, SIGNAL(activated()), this, SLOT(slotFuncOutput())); - funcParanOpen=new QAction(tr("Open ParanthesistempCellData->row+row1, tempCellData->col+col1"), Resource::loadPixmap( "opie-sheet/func-paran-open" ), tr("&Open Paranthesis"), 0, this); + funcParanOpen=new QAction(tr("Open ParanthesistempCellData->row+row1, tempCellData->col+col1"), + Opie::Core::OResource::loadPixmap( "opie-sheet/func-paran-open", Opie::Core::OResource::SmallIcon ), + tr("&Open Paranthesis"), 0, this); funcParanOpen->setToolTip("("); connect(funcParanOpen, SIGNAL(activated()), this, SLOT(slotFuncOutput())); - funcParanClose=new QAction(tr("Close Paranthesis"), Resource::loadPixmap( "opie-sheet/func-paran-close" ), tr("&Close Paranthesis"), 0, this); + funcParanClose=new QAction(tr("Close Paranthesis"), + Opie::Core::OResource::loadPixmap( "opie-sheet/func-paran-close", Opie::Core::OResource::SmallIcon ), + tr("&Close Paranthesis"), 0, this); funcParanClose->setToolTip(")"); connect(funcParanClose, SIGNAL(activated()), this, SLOT(slotFuncOutput())); - funcComma=new QAction(tr("Comma"), Resource::loadPixmap( "opie-sheet/func-comma" ), tr("&Comma"), 0, this); + funcComma=new QAction(tr("Comma"), + Opie::Core::OResource::loadPixmap( "opie-sheet/func-comma", Opie::Core::OResource::SmallIcon ), + tr("&Comma"), 0, this); funcComma->setToolTip(","); connect(funcComma, SIGNAL(activated()), this, SLOT(slotFuncOutput())); } void MainWindow::initMenu() { menu=new QMenuBar(this); menuFile=new QPopupMenu; fileNew->addTo(menuFile); fileOpen->addTo(menuFile); fileSave->addTo(menuFile); fileSaveAs->addTo(menuFile); // menuFile->insertSeparator(); // fileQuit->addTo(menuFile); menuFile->insertSeparator(); fileExcelImport->addTo(menuFile); menu->insertItem(tr("&File"), menuFile); menuEdit=new QPopupMenu; editAccept->addTo(menuEdit); editCancel->addTo(menuEdit); editCellSelect->addTo(menuEdit); menuEdit->insertSeparator(); editCut->addTo(menuEdit); editCopy->addTo(menuEdit); editPaste->addTo(menuEdit); editPasteContents->addTo(menuEdit); editClear->addTo(menuEdit); menu->insertItem(tr("&Edit"), menuEdit); menuInsert=new QPopupMenu; @@ -591,65 +623,66 @@ void MainWindow::initMenu() void MainWindow::initStandardToolbar() { toolbarStandard=new QToolBar(this); toolbarStandard->setHorizontalStretchable(TRUE); moveToolBar(toolbarStandard, Top); fileNew->addTo(toolbarStandard); fileOpen->addTo(toolbarStandard); fileSave->addTo(toolbarStandard); comboSheets=new QComboBox(toolbarStandard); toolbarStandard->setStretchableWidget(comboSheets); connect(comboSheets, SIGNAL(activated(const QString&)), this, SLOT(slotSheetChanged(const QString&))); } void MainWindow::initFunctionsToolbar() { toolbarFunctions=new QToolBar(this); toolbarFunctions->setHorizontalStretchable(TRUE); moveToolBar(toolbarFunctions, Bottom); funcEqual->addTo(toolbarFunctions); funcPlus->addTo(toolbarFunctions); funcMinus->addTo(toolbarFunctions); funcCross->addTo(toolbarFunctions); funcDivide->addTo(toolbarFunctions); funcParanOpen->addTo(toolbarFunctions); funcParanClose->addTo(toolbarFunctions); funcComma->addTo(toolbarFunctions); toolFunction=new QToolButton(toolbarFunctions); - toolFunction->setPixmap(Resource::loadPixmap( "opie-sheet/func-func" )); + toolFunction->setUsesBigPixmap( qApp->desktop()->size().width() > 330 ); + toolFunction->setPixmap(Opie::Core::OResource::loadPixmap( "opie-sheet/func-func", Opie::Core::OResource::SmallIcon )); toolFunction->setTextLabel(tr("Functions")); toolFunction->setPopup(submenuFunc); toolFunction->setPopupDelay(0); } void MainWindow::initEditToolbar() { toolbarEdit=new QToolBar(this); toolbarEdit->setHorizontalStretchable(TRUE); moveToolBar(toolbarEdit, Bottom); editAccept->addTo(toolbarEdit); editCancel->addTo(toolbarEdit); editData=new QLineEdit(toolbarEdit); toolbarEdit->setStretchableWidget(editData); connect(editData, SIGNAL(returnPressed()), this, SLOT(slotEditAccept())); editCellSelect->addTo(toolbarEdit); } void MainWindow::slotHelpAbout() { QDialog dialogAbout(this, 0, TRUE); dialogAbout.resize(width()-40, height()-80); dialogAbout.setCaption(tr("About Opie Sheet")); QLabel label(tr("Opie Sheet\nSpreadsheet Software for Opie\nQWDC Beta Winner (as Sheet/Qt)\n\nDeveloped by: Serdar Ozler\nRelease 1.0.2\nRelease Date: October 08, 2002\n\nThis product is licensed under GPL. It is freely distributable. If you want to get the latest version and also the source code, please visit the web site.\n\nhttp://qtopia.sitebest.com"), &dialogAbout); label.setGeometry(dialogAbout.rect()); label.setAlignment(Qt::AlignCenter | Qt::WordBreak); dialogAbout.exec(); |