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 | |||
@@ -26,8 +26,9 @@ | |||
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) |
@@ -55,12 +56,13 @@ PageListBoxItem::PageListBoxItem(Page* page, QListBox* parent) | |||
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); |
@@ -143,26 +145,26 @@ QString PageListBoxItem::dateTimeString(QDateTime dateTime) | |||
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 | ||
@@ -228,9 +230,9 @@ Page* PageListBox::selected() const | |||
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; |
@@ -241,28 +243,33 @@ ThumbnailView::ThumbnailView(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas, QWi | |||
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 | ||