Modify message-widget so that it uses a squeezed-text label. Because of this, always use Cantata's copy of KMessageWidget for all KDE builds.

This commit is contained in:
craig.p.drummond
2013-10-11 19:10:34 +00:00
parent aea075ba72
commit 420a214a8f
6 changed files with 49 additions and 43 deletions

View File

@@ -71,6 +71,8 @@
services - but only filter the ones on the filtering service.
38. Dont hide other online services / streams when searching.
39. Also read Jamendo genre's from album tag.
40. Modify message-widget so that it uses a squeezed-text label. Because of
this, always use Cantata's copy of KMessageWidget for all KDE builds.
1.1.4
-----

View File

@@ -15,11 +15,11 @@ if (NOT WIN32)
endif (NOT WIN32)
if (ENABLE_KDE_SUPPORT )
macro_ensure_version("4.7.0" ${KDE_VERSION} KDE_VERSION_47)
if (NOT KDE_VERSION_47)
# macro_ensure_version("4.7.0" ${KDE_VERSION} KDE_VERSION_47)
# if (NOT KDE_VERSION_47)
set(SUPPORT_SRCS ${SUPPORT_SRCS} kmessagewidget.cpp )
set(SUPPORT_MOC_HDRS ${SUPPORT_MOC_HDRS} kmessagewidget.h )
endif (NOT KDE_VERSION_47)
# endif (NOT KDE_VERSION_47)
kde4_add_ui_files(SUPPORT_UI_HDRS ${SUPPORT_UIS} )
set(SUPPORT_SRCS ${SUPPORT_SRCS} dialog.cpp)
else (ENABLE_KDE_SUPPORT)

View File

@@ -30,6 +30,7 @@
#endif
#include "icon.h"
#include "squeezedtextlabel.h"
#include <QEvent>
#include <QGridLayout>
#include <QHBoxLayout>
@@ -88,7 +89,7 @@ void KMsgWidgetPrivate::init(KMsgWidget *q_ptr)
iconLabel = new QLabel(content);
iconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
textLabel = new QLabel(content);
textLabel = new SqueezedTextLabel(content);
textLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
textLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
@@ -344,17 +345,17 @@ void KMsgWidget::setMessageType(KMsgWidget::MessageType type)
d->iconLabel->setPixmap(icon.pixmap(size));
}
QSize KMsgWidget::sizeHint() const
{
ensurePolished();
return d->content->sizeHint();
}
//QSize KMsgWidget::sizeHint() const
//{
// ensurePolished();
// return d->content->sizeHint();
//}
QSize KMsgWidget::minimumSizeHint() const
{
ensurePolished();
return d->content->minimumSizeHint();
}
//QSize KMsgWidget::minimumSizeHint() const
//{
// ensurePolished();
// return d->content->minimumSizeHint();
//}
bool KMsgWidget::event(QEvent* event)
{

View File

@@ -23,6 +23,7 @@
#include <QFrame>
class KMsgWidgetPrivate;
class SqueezedTextLabel;
/**
* @short A widget to provide feedback or propose opportunistic interactions.
@@ -125,9 +126,9 @@ public:
void removeAction(QAction *action);
QSize sizeHint() const;
// QSize sizeHint() const;
QSize minimumSizeHint() const;
// QSize minimumSizeHint() const;
int heightForWidth(int width) const;
@@ -180,7 +181,7 @@ public:
KMsgWidget* q;
QFrame* content;
QLabel* iconLabel;
QLabel* textLabel;
SqueezedTextLabel* textLabel;
QToolButton* closeButton;
QTimeLine* timeLine;

View File

@@ -33,12 +33,12 @@ MessageWidget::~MessageWidget()
{
}
#if defined ENABLE_KDE_SUPPORT
#if KDE_IS_VERSION(4, 9, 4) && !KDE_IS_VERSION(4, 9, 5)
// BUG:142
#define NO_ANIMATED_SHOW
#endif
#endif
//#if defined ENABLE_KDE_SUPPORT
//#if KDE_IS_VERSION(4, 9, 4) && !KDE_IS_VERSION(4, 9, 5)
//// BUG:142
//#define NO_ANIMATED_SHOW
//#endif
//#endif
void MessageWidget::setMessage(const QString &msg, MessageType type, bool showCloseButton)
{
@@ -46,16 +46,18 @@ void MessageWidget::setMessage(const QString &msg, MessageType type, bool showCl
setVisible(false);
return;
}
QString text=msg;
if (text.length()>154) {
text=text.left(150)+QLatin1String("...");
}
if (msg.length()>500) {
setToolTip(msg.left(500)+QLatin1String("..."));
} else {
setToolTip(msg);
}
setText(text);
// QString text=msg;
// if (text.length()>154) {
// text=text.left(150)+QLatin1String("...");
// }
// if (msg.length()>500) {
// setToolTip(msg.left(500)+QLatin1String("..."));
// } else {
// setToolTip(msg);
// }
// setText(text);
setText(msg);
setToolTip(msg);
setMessageType(type);
setCloseButtonVisible(showCloseButton);
#if defined NO_ANIMATED_SHOW

View File

@@ -24,17 +24,17 @@
#ifndef MESSAGEWIDGET_H
#define MESSAGEWIDGET_H
#ifdef ENABLE_KDE_SUPPORT
#include <kdeversion.h>
#if KDE_IS_VERSION(4, 7, 0)
#include <KDE/KMessageWidget>
typedef KMessageWidget KMsgWidget;
#else // KDE_IS_VERSION(4, 7, 0)
//#ifdef ENABLE_KDE_SUPPORT
//#include <kdeversion.h>
//#if KDE_IS_VERSION(4, 7, 0)
//#include <KDE/KMessageWidget>
//typedef KMessageWidget KMsgWidget;
//#else // KDE_IS_VERSION(4, 7, 0)
//#include "kmessagewidget.h"
//#endif // KDE_IS_VERSION(4, 7, 0)
//#else // ENABLE_KDE_SUPPORT
#include "kmessagewidget.h"
#endif // KDE_IS_VERSION(4, 7, 0)
#else // ENABLE_KDE_SUPPORT
#include "kmessagewidget.h"
#endif // ENABLE_KDE_SUPPORT
//#endif // ENABLE_KDE_SUPPORT
#include <QList>