diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-09-26 18:58:40 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-09-26 18:58:40 +0000 |
| commit | 1ac72677511d781430b2a35de3d0ffc75fdb526d (patch) | |
| tree | d5e5c2b545cf2c4350a518de214cdb6379c085d2 /src/plugins/General/notifier/popupwidget.cpp | |
| parent | 76c7627348c54f29eb181e2ba875d3aa463403cd (diff) | |
| download | qmmp-1ac72677511d781430b2a35de3d0ffc75fdb526d.tar.gz qmmp-1ac72677511d781430b2a35de3d0ffc75fdb526d.tar.bz2 qmmp-1ac72677511d781430b2a35de3d0ffc75fdb526d.zip | |
some notifier plugin changes
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1263 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/General/notifier/popupwidget.cpp')
| -rw-r--r-- | src/plugins/General/notifier/popupwidget.cpp | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/src/plugins/General/notifier/popupwidget.cpp b/src/plugins/General/notifier/popupwidget.cpp index 83c0adb29..b69f21ef6 100644 --- a/src/plugins/General/notifier/popupwidget.cpp +++ b/src/plugins/General/notifier/popupwidget.cpp @@ -40,22 +40,15 @@ PopupWidget::PopupWidget(QWidget *parent) Qt::WindowStaysOnTopHint | Qt::Dialog | Qt::FramelessWindowHint); setFrameStyle(QFrame::Box | QFrame::Plain); - QHBoxLayout *hlayout = new QHBoxLayout(this); + QHBoxLayout *hlayout = new QHBoxLayout(this); //layout m_pixlabel = new QLabel(this); m_pixlabel->setPixmap(QPixmap(":/notifier_icon.png")); m_pixlabel->setFixedSize(32,32); hlayout->addWidget(m_pixlabel); - //layout - QVBoxLayout *vlayout = new QVBoxLayout(); - hlayout->addLayout (vlayout); - setLayout(hlayout); - //first line + m_label1 = new QLabel(this); - vlayout->addWidget(m_label1); - //second line - m_label2 = new QLabel(this); - vlayout->addWidget(m_label2); - //resize(sizeHint()); //update size hint + hlayout->addWidget (m_label1); + //settings QSettings settings(Qmmp::configFile(), QSettings::IniFormat); settings.beginGroup("Notifier"); @@ -63,7 +56,7 @@ PopupWidget::PopupWidget(QWidget *parent) m_pos = settings.value("message_pos", PopupWidget::BOTTOMLEFT).toUInt(); setWindowOpacity(settings.value("opacity", 1.0).toDouble()); QString fontname = settings.value("font").toString(); - m_coverSize = settings.value("cover_size", 48).toInt(); + m_coverSize = settings.value("cover_size", 64).toInt(); settings.endGroup(); //font QFont font; @@ -89,37 +82,43 @@ void PopupWidget::showMetaData() { m_timer->stop(); SoundCore *core = SoundCore::instance(); - QString title = core->metaData(Qmmp::TITLE); - if (title.isEmpty()) - title = core->metaData(Qmmp::URL).section('/',-1); + QString title = "<b>"; + if (core->metaData(Qmmp::TITLE).isEmpty()) + title.append(core->metaData(Qmmp::URL).section('/',-1)); + else + title.append(core->metaData(Qmmp::TITLE)); if (core->totalTime() > 0) { title.append(" "); title.append(QString("(%1:%2)").arg(core->totalTime()/60000).arg(core->totalTime()%60000/1000, 2, 10, QChar('0'))); } - m_label1->setText("<b>" + title + "</b>"); + title.append("</b>"); - QString info = core->metaData(Qmmp::ARTIST); - if (!info.isEmpty() && !core->metaData(Qmmp::ALBUM).isEmpty()) - info.append(" - " + core->metaData(Qmmp::ALBUM)); - if (!info.isEmpty()) + if(!core->metaData(Qmmp::ARTIST).isEmpty()) { - m_label2->setText(info); - m_label2->show(); + title.append("<br>"); + title.append(core->metaData(Qmmp::ARTIST)); } - else - m_label2->hide(); + + if(!core->metaData(Qmmp::ALBUM).isEmpty()) + { + title.append("<br>"); + title.append(core->metaData(Qmmp::ALBUM)); + } + m_label1->setText(title); QPixmap pix = Decoder::findCover(core->metaData(Qmmp::URL)); if(!pix.isNull()) { m_pixlabel->setFixedSize(m_coverSize,m_coverSize); m_pixlabel->setPixmap(pix.scaled(m_coverSize,m_coverSize)); + m_label1->setAlignment(Qt::AlignTop); } else { m_pixlabel->setPixmap(QPixmap(":/notifier_icon.png")); m_pixlabel->setFixedSize(32,32); + m_label1->setAlignment(Qt::AlignVCenter); } qApp->processEvents(); resize(sizeHint()); @@ -135,9 +134,9 @@ void PopupWidget::showVolume(int v) m_pixlabel->setPixmap(QPixmap(":/notifier_icon.png")); m_pixlabel->setFixedSize(32,32); m_timer->stop(); + m_label1->setAlignment(Qt::AlignVCenter); m_label1->setText("<b>" + tr("Volume:") + QString (" %1\%").arg(v)+ + "</b>"); - m_label2->hide(); qApp->processEvents(); resize(sizeHint()); qApp->processEvents(); |
