summaryrefslogtreecommitdiff
path: root/noncore/graphics/drawpad/thumbnailview.cpp
Unidiff
Diffstat (limited to 'noncore/graphics/drawpad/thumbnailview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/graphics/drawpad/thumbnailview.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/noncore/graphics/drawpad/thumbnailview.cpp b/noncore/graphics/drawpad/thumbnailview.cpp
index 1ccf484..d190ffe 100644
--- a/noncore/graphics/drawpad/thumbnailview.cpp
+++ b/noncore/graphics/drawpad/thumbnailview.cpp
@@ -1,46 +1,47 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "thumbnailview.h" 14#include "thumbnailview.h"
15 15
16#include "drawpad.h" 16#include "drawpad.h"
17#include "drawpadcanvas.h" 17#include "drawpadcanvas.h"
18#include "newpagedialog.h" 18#include "newpagedialog.h"
19#include "page.h" 19#include "page.h"
20 20
21#include <opie2/oresource.h>
22
21#include <qpe/config.h> 23#include <qpe/config.h>
22#include <qpe/resource.h>
23#include <qpe/timestring.h> 24#include <qpe/timestring.h>
24 25
25#include <qapplication.h> 26#include <qapplication.h>
26#include <qlayout.h> 27#include <qlayout.h>
27#include <qmessagebox.h> 28#include <qmessagebox.h>
28#include <qtoolbutton.h> 29#include <qtoolbutton.h>
29#include <qwhatsthis.h> 30#include <qwhatsthis.h>
30 31
31#define THUMBNAIL_SIZE 48 32#define THUMBNAIL_SIZE 48
32 33
33PageListBoxItem::PageListBoxItem(Page* page, QListBox* parent) 34PageListBoxItem::PageListBoxItem(Page* page, QListBox* parent)
34 : QListBoxItem(parent) 35 : QListBoxItem(parent)
35{ 36{
36 m_pPage = page; 37 m_pPage = page;
37 38
38 QImage image = m_pPage->pixmap()->convertToImage(); 39 QImage image = m_pPage->pixmap()->convertToImage();
39 40
40 int previewWidth = THUMBNAIL_SIZE; 41 int previewWidth = THUMBNAIL_SIZE;
41 int previewHeight = THUMBNAIL_SIZE; 42 int previewHeight = THUMBNAIL_SIZE;
42 43
43 float widthScale = 1.0; 44 float widthScale = 1.0;
44 float heightScale = 1.0; 45 float heightScale = 1.0;
45 46
46 if (previewWidth < image.width()) { 47 if (previewWidth < image.width()) {
@@ -218,74 +219,81 @@ Page* PageListBox::selected() const
218{ 219{
219 Page* page; 220 Page* page;
220 221
221 PageListBoxItem* selectedItem = (PageListBoxItem*)item(currentItem()); 222 PageListBoxItem* selectedItem = (PageListBoxItem*)item(currentItem());
222 223
223 if (selectedItem) { 224 if (selectedItem) {
224 page = selectedItem->page(); 225 page = selectedItem->page();
225 } else { 226 } else {
226 page = NULL; 227 page = NULL;
227 } 228 }
228 229
229 return page; 230 return page;
230} 231}
231 232
232ThumbnailView::ThumbnailView(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas, QWidget* parent, const char* name) 233ThumbnailView::ThumbnailView(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas, QWidget* parent, const char* name)
233 : QWidget(parent, name, Qt::WType_Modal | Qt::WType_TopLevel | Qt::WStyle_ContextHelp) 234 : QWidget(parent, name, Qt::WType_Modal | Qt::WType_TopLevel | Qt::WStyle_ContextHelp)
234{ 235{
235 inLoop = false; 236 inLoop = false;
236 237
237 m_pDrawPad = drawPad; 238 m_pDrawPad = drawPad;
238 m_pDrawPadCanvas = drawPadCanvas; 239 m_pDrawPadCanvas = drawPadCanvas;
239 240
240 setCaption(tr("DrawPad - Thumbnail View")); 241 setCaption(tr("DrawPad - Thumbnail View"));
241 242
243 bool useBigIcon = qApp->desktop()->size().width() > 330;
244
242 QToolButton* newPageButton = new QToolButton(this); 245 QToolButton* newPageButton = new QToolButton(this);
243 newPageButton->setIconSet(Resource::loadIconSet("new")); 246 newPageButton->setUsesBigPixmap( useBigIcon );
247 newPageButton->setPixmap(Opie::Core::OResource::loadPixmap("new", Opie::Core::OResource::SmallIcon));
244 newPageButton->setAutoRaise(true); 248 newPageButton->setAutoRaise(true);
245 connect(newPageButton, SIGNAL(clicked()), this, SLOT(newPage())); 249 connect(newPageButton, SIGNAL(clicked()), this, SLOT(newPage()));
246 QWhatsThis::add( newPageButton, tr( "Click here to add a new sheet." ) ); 250 QWhatsThis::add( newPageButton, tr( "Click here to add a new sheet." ) );
247 251
248 QToolButton* clearPageButton = new QToolButton(this); 252 QToolButton* clearPageButton = new QToolButton(this);
249 clearPageButton->setIconSet(Resource::loadIconSet("drawpad/clear")); 253 clearPageButton->setUsesBigPixmap( useBigIcon );
254 clearPageButton->setPixmap(Opie::Core::OResource::loadPixmap("drawpad/clear", Opie::Core::OResource::SmallIcon));
250 clearPageButton->setAutoRaise(true); 255 clearPageButton->setAutoRaise(true);
251 connect(clearPageButton, SIGNAL(clicked()), this, SLOT(clearPage())); 256 connect(clearPageButton, SIGNAL(clicked()), this, SLOT(clearPage()));
252 QWhatsThis::add( clearPageButton, tr( "Click here to erase the current sheet." ) ); 257 QWhatsThis::add( clearPageButton, tr( "Click here to erase the current sheet." ) );
253 258
254 QToolButton* deletePageButton = new QToolButton(this); 259 QToolButton* deletePageButton = new QToolButton(this);
255 deletePageButton->setIconSet(Resource::loadIconSet("trash")); 260 deletePageButton->setUsesBigPixmap( useBigIcon );
261 deletePageButton->setPixmap(Opie::Core::OResource::loadPixmap("trash", Opie::Core::OResource::SmallIcon));
256 deletePageButton->setAutoRaise(true); 262 deletePageButton->setAutoRaise(true);
257 connect(deletePageButton, SIGNAL(clicked()), this, SLOT(deletePage())); 263 connect(deletePageButton, SIGNAL(clicked()), this, SLOT(deletePage()));
258 QWhatsThis::add( deletePageButton, tr( "Click here to remove the current sheet." ) ); 264 QWhatsThis::add( deletePageButton, tr( "Click here to remove the current sheet." ) );
259 265
260 m_pMovePageUpButton = new QToolButton(this); 266 m_pMovePageUpButton = new QToolButton(this);
261 m_pMovePageUpButton->setIconSet(Resource::loadIconSet("up")); 267 m_pMovePageUpButton->setUsesBigPixmap( useBigIcon );
268 m_pMovePageUpButton->setPixmap(Opie::Core::OResource::loadPixmap("up", Opie::Core::OResource::SmallIcon));
262 m_pMovePageUpButton->setAutoRaise(true); 269 m_pMovePageUpButton->setAutoRaise(true);
263 connect(m_pMovePageUpButton, SIGNAL(clicked()), this, SLOT(movePageUp())); 270 connect(m_pMovePageUpButton, SIGNAL(clicked()), this, SLOT(movePageUp()));
264 QWhatsThis::add( m_pMovePageUpButton, tr( "Click here to move the current sheet up one position in the list." ) ); 271 QWhatsThis::add( m_pMovePageUpButton, tr( "Click here to move the current sheet up one position in the list." ) );
265 272
266 m_pMovePageDownButton = new QToolButton(this); 273 m_pMovePageDownButton = new QToolButton(this);
267 m_pMovePageDownButton->setIconSet(Resource::loadIconSet("down")); 274 m_pMovePageDownButton->setUsesBigPixmap( useBigIcon );
275 m_pMovePageDownButton->setPixmap(Opie::Core::OResource::loadPixmap("down", Opie::Core::OResource::SmallIcon));
268 m_pMovePageDownButton->setAutoRaise(true); 276 m_pMovePageDownButton->setAutoRaise(true);
269 connect(m_pMovePageDownButton, SIGNAL(clicked()), this, SLOT(movePageDown())); 277 connect(m_pMovePageDownButton, SIGNAL(clicked()), this, SLOT(movePageDown()));
270 QWhatsThis::add( m_pMovePageDownButton, tr( "Click here to move the current sheet down one position in the list." ) ); 278 QWhatsThis::add( m_pMovePageDownButton, tr( "Click here to move the current sheet down one position in the list." ) );
271 279
272 m_pPageListBox = new PageListBox(m_pDrawPadCanvas, this); 280 m_pPageListBox = new PageListBox(m_pDrawPadCanvas, this);
273 connect(m_pPageListBox, SIGNAL(selectionChanged()), this, SLOT(changePage())); 281 connect(m_pPageListBox, SIGNAL(selectionChanged()), this, SLOT(changePage()));
274 282
275 QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4); 283 QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4);
276 QHBoxLayout* buttonLayout = new QHBoxLayout(0); 284 QHBoxLayout* buttonLayout = new QHBoxLayout(0);
277 285
278 buttonLayout->addWidget(newPageButton); 286 buttonLayout->addWidget(newPageButton);
279 buttonLayout->addWidget(clearPageButton); 287 buttonLayout->addWidget(clearPageButton);
280 buttonLayout->addWidget(deletePageButton); 288 buttonLayout->addWidget(deletePageButton);
281 buttonLayout->addStretch(); 289 buttonLayout->addStretch();
282 buttonLayout->addWidget(m_pMovePageUpButton); 290 buttonLayout->addWidget(m_pMovePageUpButton);
283 buttonLayout->addWidget(m_pMovePageDownButton); 291 buttonLayout->addWidget(m_pMovePageDownButton);
284 292
285 mainLayout->addLayout(buttonLayout); 293 mainLayout->addLayout(buttonLayout);
286 mainLayout->addWidget(m_pPageListBox); 294 mainLayout->addWidget(m_pPageListBox);
287 295
288 updateView(); 296 updateView();
289} 297}
290 298
291ThumbnailView::~ThumbnailView() 299ThumbnailView::~ThumbnailView()