summaryrefslogtreecommitdiff
path: root/noncore/graphics/drawpad/drawpad.cpp
Side-by-side diff
Diffstat (limited to 'noncore/graphics/drawpad/drawpad.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/drawpad/drawpad.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp
index 53db993..459f1a8 100644
--- a/noncore/graphics/drawpad/drawpad.cpp
+++ b/noncore/graphics/drawpad/drawpad.cpp
@@ -43,141 +43,141 @@
#include <qaction.h>
#include <qfile.h>
#include <qmessagebox.h>
#include <qpainter.h>
#include <qspinbox.h>
#include <qtoolbutton.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
DrawPad::DrawPad(QWidget* parent, const char* name)
: QMainWindow(parent, name, WStyle_ContextHelp)
{
// init members
m_pDrawPadCanvas = new DrawPadCanvas(this, this);
connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView()));
setCentralWidget(m_pDrawPadCanvas);
// init menu
setToolBarsMovable(false);
QPEToolBar* menuToolBar = new QPEToolBar(this);
QPEMenuBar* menuBar = new QPEMenuBar(menuToolBar);
QPopupMenu* toolsPopupMenu = new QPopupMenu(menuBar);
QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this);
connect(deleteAllAction, SIGNAL(activated()), this, SLOT(deleteAll()));
deleteAllAction->addTo(toolsPopupMenu);
toolsPopupMenu->insertSeparator();
QAction* importPageAction = new QAction(tr("Import"), tr("Import..."), 0, this);
connect(importPageAction, SIGNAL(activated()), this, SLOT(importPage()));
importPageAction->addTo(toolsPopupMenu);
QAction* exportPageAction = new QAction(tr("Export"), tr("Export..."), 0, this);
connect(exportPageAction, SIGNAL(activated()), this, SLOT(exportPage()));
exportPageAction->addTo(toolsPopupMenu);
toolsPopupMenu->insertSeparator();
QAction* thumbnailViewAction = new QAction(tr("Thumbnail View"), tr("Thumbnail View..."), 0, this);
connect(thumbnailViewAction, SIGNAL(activated()), this, SLOT(thumbnailView()));
thumbnailViewAction->addTo(toolsPopupMenu);
-
+
QAction* pageInformationAction = new QAction(tr("Page Information"), tr("Page Information..."), 0, this);
connect(pageInformationAction, SIGNAL(activated()), this, SLOT(pageInformation()));
pageInformationAction->addTo(toolsPopupMenu);
toolsPopupMenu->insertSeparator();
m_pAntiAliasingAction = new QAction(tr("Anti-Aliasing"), QString::null, 0, this);
m_pAntiAliasingAction->setToggleAction(true);
m_pAntiAliasingAction->addTo(toolsPopupMenu);
menuBar->insertItem(tr("Tools"), toolsPopupMenu);
// init page toolbar
QPEToolBar* pageToolBar = new QPEToolBar(this);
QAction* newPageAction = new QAction(tr("New Page"), Resource::loadPixmap("new"), QString::null, 0, this);
connect(newPageAction, SIGNAL(activated()), this, SLOT(newPage()));
newPageAction->addTo(pageToolBar);
newPageAction->setWhatsThis( tr( "Click here to add a new sheet." ) );
QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadPixmap("drawpad/clear"), QString::null, 0, this);
connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage()));
clearPageAction->addTo(pageToolBar);
clearPageAction->setWhatsThis( tr( "Click here to erase the current sheet." ) );
QAction* deletePageAction = new QAction(tr("Delete Page"), Resource::loadPixmap("trash"), QString::null, 0, this);
connect(deletePageAction, SIGNAL(activated()), this, SLOT(deletePage()));
deletePageAction->addTo(pageToolBar);
deletePageAction->setWhatsThis( tr( "Click here to remove the current sheet." ) );
QPEToolBar* emptyToolBar = new QPEToolBar(this);
emptyToolBar->setHorizontalStretchable(true);
// init navigation toolbar
QPEToolBar* navigationToolBar = new QPEToolBar(this);
- m_pUndoAction = new QAction(tr("Undo"), Resource::loadIconSet("drawpad/undo"), QString::null, 0, this);
+ m_pUndoAction = new QAction(tr("Undo"), Resource::loadIconSet("undo"), QString::null, 0, this);
connect(m_pUndoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(undo()));
m_pUndoAction->addTo(navigationToolBar);
m_pUndoAction->setWhatsThis( tr( "Click here to undo the last action." ) );
- m_pRedoAction = new QAction(tr("Redo"), Resource::loadIconSet("drawpad/redo"), QString::null, 0, this);
+ m_pRedoAction = new QAction(tr("Redo"), Resource::loadIconSet("redo"), QString::null, 0, this);
connect(m_pRedoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(redo()));
m_pRedoAction->addTo(navigationToolBar);
m_pRedoAction->setWhatsThis( tr( "Click here to re-perform the last action." ) );
m_pFirstPageAction = new QAction(tr("First Page"), Resource::loadIconSet("fastback"), QString::null, 0, this);
connect(m_pFirstPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goFirstPage()));
m_pFirstPageAction->addTo(navigationToolBar);
m_pFirstPageAction->setWhatsThis( tr( "Click here to view the first page." ) );
m_pPreviousPageAction = new QAction(tr("Previous Page"), Resource::loadIconSet("back"), QString::null, 0, this);
connect(m_pPreviousPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goPreviousPage()));
m_pPreviousPageAction->addTo(navigationToolBar);
m_pPreviousPageAction->setWhatsThis( tr( "Click here to view the previous page." ) );
m_pNextPageAction = new QAction(tr("Next Page"), Resource::loadIconSet("forward"), QString::null, 0, this);
connect(m_pNextPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goNextPage()));
m_pNextPageAction->addTo(navigationToolBar);
m_pNextPageAction->setWhatsThis( tr( "Click here to view the next page." ) );
m_pLastPageAction = new QAction(tr("Last Page"), Resource::loadIconSet("fastforward"), QString::null, 0, this);
connect(m_pLastPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goLastPage()));
m_pLastPageAction->addTo(navigationToolBar);
m_pLastPageAction->setWhatsThis( tr( "Click here to view the last page." ) );
// init draw mode toolbar
QPEToolBar* drawModeToolBar = new QPEToolBar(this);
m_pLineToolButton = new QToolButton(drawModeToolBar);
m_pLineToolButton->setToggleButton(true);
QWhatsThis::add( m_pLineToolButton, tr( "Click here to select one of the available tools to draw lines." ) );
QPopupMenu* linePopupMenu = new QPopupMenu(m_pLineToolButton);
m_pPointToolAction = new QAction(tr("Draw Point"), Resource::loadPixmap("drawpad/point"), "", 0, this);
connect(m_pPointToolAction, SIGNAL(activated()), this, SLOT(setPointTool()));
m_pPointToolAction->addTo(linePopupMenu);
m_pLineToolAction = new QAction(tr("Draw Line"), Resource::loadPixmap("drawpad/line"), "", 0, this);
connect(m_pLineToolAction, SIGNAL(activated()), this, SLOT(setLineTool()));
m_pLineToolAction->addTo(linePopupMenu);
m_pLineToolButton->setPopup(linePopupMenu);
m_pLineToolButton->setPopupDelay(0);
m_pRectangleToolButton = new QToolButton(drawModeToolBar);
m_pRectangleToolButton->setToggleButton(true);
@@ -511,97 +511,97 @@ void DrawPad::setFillTool()
m_pRectangleToolButton->setOn(false);
m_pEllipseToolButton->setOn(false);
m_pTextToolAction->setOn(false);
m_pFillToolAction->setOn(true);
m_pEraseToolAction->setOn(false);
}
void DrawPad::setEraseTool()
{
if (m_pTool) {
delete m_pTool;
}
m_pTool = new EraseTool(this, m_pDrawPadCanvas);
m_pLineToolButton->setOn(false);
m_pRectangleToolButton->setOn(false);
m_pEllipseToolButton->setOn(false);
m_pTextToolAction->setOn(false);
m_pFillToolAction->setOn(false);
m_pEraseToolAction->setOn(true);
}
void DrawPad::changePenWidth(int value)
{
m_pen.setWidth(value);
}
void DrawPad::changePenColor(const QColor& color)
{
m_pen.setColor(color);
QPainter painter;
painter.begin(m_pPenColorToolButton->pixmap());
painter.fillRect(QRect(0, 12, 14, 2), m_pen.color());
painter.end();
m_pPenColorToolButton->popup()->hide();
}
void DrawPad::changeBrushColor(const QColor& color)
{
m_brush = QBrush(color);
QPainter painter;
painter.begin(m_pBrushColorToolButton->pixmap());
painter.fillRect(QRect(0, 12, 14, 2), m_brush.color());
painter.end();
-
+
m_pBrushColorToolButton->popup()->hide();
}
void DrawPad::updateView()
{
uint pagePosition = m_pDrawPadCanvas->pagePosition();
uint pageCount = m_pDrawPadCanvas->pageCount();
setCaption( tr( "DrawPad - Page %1/%2" ).arg( pagePosition ).arg( pageCount ) );
m_pUndoAction->setEnabled(m_pDrawPadCanvas->currentPage()->undoEnabled());
m_pRedoAction->setEnabled(m_pDrawPadCanvas->currentPage()->redoEnabled());
m_pFirstPageAction->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled());
m_pPreviousPageAction->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled());
m_pNextPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled());
m_pLastPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled());
}
void DrawPad::deleteAll()
{
QMessageBox messageBox(tr("Delete All"), tr("Do you want to delete\nall the pages?"),
QMessageBox::Information, QMessageBox::Yes,
QMessageBox::No | QMessageBox::Escape | QMessageBox::Default,
QMessageBox::NoButton, this);
messageBox.setButtonText(QMessageBox::Yes, tr("Yes"));
messageBox.setButtonText(QMessageBox::No, tr("No"));
if (messageBox.exec() == QMessageBox::Yes) {
m_pDrawPadCanvas->deleteAll();
}
}
void DrawPad::importPage()
{
ImportDialog importDialog(this);
importDialog.showMaximized();
if (importDialog.exec() == QDialog::Accepted) {
const DocLnk* docLnk = importDialog.selected();
if (docLnk) {
m_pDrawPadCanvas->importPage(docLnk->file());
delete docLnk;
}
}