Diffstat (limited to 'noncore/graphics/drawpad/thumbnailview.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/graphics/drawpad/thumbnailview.cpp | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/noncore/graphics/drawpad/thumbnailview.cpp b/noncore/graphics/drawpad/thumbnailview.cpp index 9b08ca2..90ba39c 100644 --- a/noncore/graphics/drawpad/thumbnailview.cpp +++ b/noncore/graphics/drawpad/thumbnailview.cpp | |||
@@ -24,12 +24,13 @@ | |||
24 | 24 | ||
25 | #include <qapplication.h> | 25 | #include <qapplication.h> |
26 | #include <qimage.h> | 26 | #include <qimage.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qmessagebox.h> | 28 | #include <qmessagebox.h> |
29 | #include <qtoolbutton.h> | 29 | #include <qtoolbutton.h> |
30 | #include <qwhatsthis.h> | ||
30 | 31 | ||
31 | #define THUMBNAIL_SIZE 48 | 32 | #define THUMBNAIL_SIZE 48 |
32 | 33 | ||
33 | PageListBoxItem::PageListBoxItem(Page* page, QListBox* parent) | 34 | PageListBoxItem::PageListBoxItem(Page* page, QListBox* parent) |
34 | : QListBoxItem(parent) | 35 | : QListBoxItem(parent) |
35 | { | 36 | { |
@@ -53,16 +54,17 @@ PageListBoxItem::PageListBoxItem(Page* page, QListBox* parent) | |||
53 | 54 | ||
54 | float scale = (widthScale < heightScale ? widthScale : heightScale); | 55 | float scale = (widthScale < heightScale ? widthScale : heightScale); |
55 | QImage thumbnailImage = image.smoothScale((int)(image.width() * scale) , (int)(image.height() * scale)); | 56 | QImage thumbnailImage = image.smoothScale((int)(image.width() * scale) , (int)(image.height() * scale)); |
56 | 57 | ||
57 | m_thumbnail.convertFromImage(thumbnailImage); | 58 | m_thumbnail.convertFromImage(thumbnailImage); |
58 | 59 | ||
59 | m_titleText = QObject::tr("Title:") + " " + m_pPage->title(); | 60 | m_titleText = QObject::tr( "Title: %1" ).arg( m_pPage->title() ); |
60 | m_dimensionText = QObject::tr("Dimension:") + " " + QString::number(m_pPage->pixmap()->width()) | 61 | m_dimensionText = QObject::tr( "Dimension: %1x%2" ). |
61 | + "x" + QString::number(m_pPage->pixmap()->height()); | 62 | arg( m_pPage->pixmap()->width() ). |
62 | m_dateText = QObject::tr("Date:") + " " + dateTimeString(m_pPage->lastModified()); | 63 | arg( m_pPage->pixmap()->height() ); |
64 | m_dateText = QObject::tr( "Date: %1" ).arg( dateTimeString(m_pPage->lastModified()) ); | ||
63 | 65 | ||
64 | QColor baseColor = parent->colorGroup().base(); | 66 | QColor baseColor = parent->colorGroup().base(); |
65 | int h, s, v; | 67 | int h, s, v; |
66 | baseColor.hsv(&h, &s, &v); | 68 | baseColor.hsv(&h, &s, &v); |
67 | 69 | ||
68 | if (v > 128) { | 70 | if (v > 128) { |
@@ -141,30 +143,30 @@ QString PageListBoxItem::dateTimeString(QDateTime dateTime) | |||
141 | QChar separator = config.readEntry("Separator", "/")[0]; | 143 | QChar separator = config.readEntry("Separator", "/")[0]; |
142 | DateFormat::Order shortOrder = (DateFormat::Order)config .readNumEntry("ShortOrder", DateFormat::DayMonthYear); | 144 | DateFormat::Order shortOrder = (DateFormat::Order)config .readNumEntry("ShortOrder", DateFormat::DayMonthYear); |
143 | 145 | ||
144 | for (int i = 0; i < 3; i++) { | 146 | for (int i = 0; i < 3; i++) { |
145 | switch((shortOrder >> (i * 3)) & 0x0007) { | 147 | switch((shortOrder >> (i * 3)) & 0x0007) { |
146 | case 0x0001: | 148 | case 0x0001: |
147 | result += QString().sprintf("%02d", dateTime.date().day()); | 149 | result.append( QString().sprintf("%02d", dateTime.date().day()) ); |
148 | break; | 150 | break; |
149 | case 0x0002: | 151 | case 0x0002: |
150 | result += QString().sprintf("%02d", dateTime.date().month()); | 152 | result.append( QString().sprintf("%02d", dateTime.date().month()) ); |
151 | break; | 153 | break; |
152 | case 0x0004: | 154 | case 0x0004: |
153 | result += QString().sprintf("%04d", dateTime.date().year()); | 155 | result.append( QString().sprintf("%04d", dateTime.date().year()) ); |
154 | break; | 156 | break; |
155 | default: | 157 | default: |
156 | break; | 158 | break; |
157 | } | 159 | } |
158 | 160 | ||
159 | if (i < 2) { | 161 | if (i < 2) { |
160 | result += separator; | 162 | result.append( separator ); |
161 | } | 163 | } |
162 | } | 164 | } |
163 | 165 | ||
164 | result += QString().sprintf(" %02d:%02d", dateTime.time().hour(), dateTime.time().minute()); | 166 | result.append( QString().sprintf(" %02d:%02d", dateTime.time().hour(), dateTime.time().minute()) ); |
165 | 167 | ||
166 | return result; | 168 | return result; |
167 | } | 169 | } |
168 | 170 | ||
169 | PageListBox::PageListBox(DrawPadCanvas* drawPadCanvas, QWidget* parent, const char* name) | 171 | PageListBox::PageListBox(DrawPadCanvas* drawPadCanvas, QWidget* parent, const char* name) |
170 | : QListBox(parent, name) | 172 | : QListBox(parent, name) |
@@ -226,45 +228,50 @@ Page* PageListBox::selected() const | |||
226 | } | 228 | } |
227 | 229 | ||
228 | return page; | 230 | return page; |
229 | } | 231 | } |
230 | 232 | ||
231 | ThumbnailView::ThumbnailView(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas, QWidget* parent, const char* name) | 233 | ThumbnailView::ThumbnailView(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas, QWidget* parent, const char* name) |
232 | : QWidget(parent, name, Qt::WType_Modal | Qt::WType_TopLevel) | 234 | : QWidget(parent, name, Qt::WType_Modal | Qt::WType_TopLevel | Qt::WStyle_ContextHelp) |
233 | { | 235 | { |
234 | inLoop = false; | 236 | inLoop = false; |
235 | 237 | ||
236 | m_pDrawPad = drawPad; | 238 | m_pDrawPad = drawPad; |
237 | m_pDrawPadCanvas = drawPadCanvas; | 239 | m_pDrawPadCanvas = drawPadCanvas; |
238 | 240 | ||
239 | setCaption(tr("DrawPad - Thumbnail View")); | 241 | setCaption(tr("DrawPad - Thumbnail View")); |
240 | 242 | ||
241 | QToolButton* newPageButton = new QToolButton(this); | 243 | QToolButton* newPageButton = new QToolButton(this); |
242 | newPageButton->setIconSet(Resource::loadIconSet("new")); | 244 | newPageButton->setIconSet(Resource::loadIconSet("new")); |
243 | newPageButton->setAutoRaise(true); | 245 | newPageButton->setAutoRaise(true); |
244 | connect(newPageButton, SIGNAL(clicked()), this, SLOT(newPage())); | 246 | connect(newPageButton, SIGNAL(clicked()), this, SLOT(newPage())); |
247 | QWhatsThis::add( newPageButton, tr( "Click here to add a new sheet." ) ); | ||
245 | 248 | ||
246 | QToolButton* clearPageButton = new QToolButton(this); | 249 | QToolButton* clearPageButton = new QToolButton(this); |
247 | clearPageButton->setIconSet(Resource::loadIconSet("drawpad/clear")); | 250 | clearPageButton->setIconSet(Resource::loadIconSet("drawpad/clear")); |
248 | clearPageButton->setAutoRaise(true); | 251 | clearPageButton->setAutoRaise(true); |
249 | connect(clearPageButton, SIGNAL(clicked()), this, SLOT(clearPage())); | 252 | connect(clearPageButton, SIGNAL(clicked()), this, SLOT(clearPage())); |
253 | QWhatsThis::add( clearPageButton, tr( "Click here to erase the current sheet." ) ); | ||
250 | 254 | ||
251 | QToolButton* deletePageButton = new QToolButton(this); | 255 | QToolButton* deletePageButton = new QToolButton(this); |
252 | deletePageButton->setIconSet(Resource::loadIconSet("trash")); | 256 | deletePageButton->setIconSet(Resource::loadIconSet("trash")); |
253 | deletePageButton->setAutoRaise(true); | 257 | deletePageButton->setAutoRaise(true); |
254 | connect(deletePageButton, SIGNAL(clicked()), this, SLOT(deletePage())); | 258 | connect(deletePageButton, SIGNAL(clicked()), this, SLOT(deletePage())); |
259 | QWhatsThis::add( deletePageButton, tr( "Click here to remove the current sheet." ) ); | ||
255 | 260 | ||
256 | m_pMovePageUpButton = new QToolButton(this); | 261 | m_pMovePageUpButton = new QToolButton(this); |
257 | m_pMovePageUpButton->setIconSet(Resource::loadIconSet("up")); | 262 | m_pMovePageUpButton->setIconSet(Resource::loadIconSet("up")); |
258 | m_pMovePageUpButton->setAutoRaise(true); | 263 | m_pMovePageUpButton->setAutoRaise(true); |
259 | connect(m_pMovePageUpButton, SIGNAL(clicked()), this, SLOT(movePageUp())); | 264 | connect(m_pMovePageUpButton, SIGNAL(clicked()), this, SLOT(movePageUp())); |
265 | QWhatsThis::add( m_pMovePageUpButton, tr( "Click here to move the current sheet up one position in the list." ) ); | ||
260 | 266 | ||
261 | m_pMovePageDownButton = new QToolButton(this); | 267 | m_pMovePageDownButton = new QToolButton(this); |
262 | m_pMovePageDownButton->setIconSet(Resource::loadIconSet("down")); | 268 | m_pMovePageDownButton->setIconSet(Resource::loadIconSet("down")); |
263 | m_pMovePageDownButton->setAutoRaise(true); | 269 | m_pMovePageDownButton->setAutoRaise(true); |
264 | connect(m_pMovePageDownButton, SIGNAL(clicked()), this, SLOT(movePageDown())); | 270 | connect(m_pMovePageDownButton, SIGNAL(clicked()), this, SLOT(movePageDown())); |
271 | QWhatsThis::add( m_pMovePageDownButton, tr( "Click here to move the current sheet down one position in the list." ) ); | ||
265 | 272 | ||
266 | m_pPageListBox = new PageListBox(m_pDrawPadCanvas, this); | 273 | m_pPageListBox = new PageListBox(m_pDrawPadCanvas, this); |
267 | connect(m_pPageListBox, SIGNAL(selectionChanged()), this, SLOT(changePage())); | 274 | connect(m_pPageListBox, SIGNAL(selectionChanged()), this, SLOT(changePage())); |
268 | 275 | ||
269 | QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4); | 276 | QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4); |
270 | QHBoxLayout* buttonLayout = new QHBoxLayout(0); | 277 | QHBoxLayout* buttonLayout = new QHBoxLayout(0); |