From 382d988082af6cb74c128b7011c2c0c8c9c00cfc Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 19 Oct 2009 17:01:34 +0200 Subject: check title length fix --- src/previewimage.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/previewimage.cpp') diff --git a/src/previewimage.cpp b/src/previewimage.cpp index 724d3744..b90a4720 100644 --- a/src/previewimage.cpp +++ b/src/previewimage.cpp @@ -102,6 +102,7 @@ void PreviewImage::loadUrlPreview(const QUrl& url) { m_pixmap.load(m_savePath); m_imageLabel->setPixmap(m_pixmap); + checkTitle(); m_textLabel->setText(m_title); } else @@ -131,6 +132,7 @@ void PreviewImage::snapFinished() m_pixmap = ws->previewImage(); m_imageLabel->setPixmap(m_pixmap); + checkTitle(); m_textLabel->setText(m_title); // kDebug() << "m_pixmap: " << m_pixmap.size(); @@ -167,6 +169,7 @@ void PreviewImage::showEmptyPreview() m_imageLabel->clear(); m_textLabel->clear(); + QHBoxLayout *layout = new QHBoxLayout(m_imageLabel); m_button = new QToolButton(m_imageLabel); m_button->setDefaultAction(historyMenu()); m_button->setPopupMode(QToolButton::InstantPopup); @@ -174,9 +177,8 @@ void PreviewImage::showEmptyPreview() m_button->setText(i18n("Add Preview")); m_button->setAutoRaise(true); m_button->setIconSize(QSize(48, 48)); - m_button->show(); - -// m_textLabel->setText( i18n("Add Preview") ); + layout->addWidget(m_button); + m_imageLabel->setLayout(layout); } @@ -333,3 +335,13 @@ QString PreviewImage::guessNameFromUrl(QUrl url) return name; } + + +void PreviewImage::checkTitle() +{ + if(m_title.length() > 23) + { + m_title.truncate(20); + m_title += "..."; + } +} -- cgit v1.2.1