From 1ac72677511d781430b2a35de3d0ffc75fdb526d Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Sat, 26 Sep 2009 18:58:40 +0000 Subject: some notifier plugin changes git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1263 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/General/notifier/popupwidget.cpp | 49 ++--- src/plugins/General/notifier/popupwidget.h | 1 - src/plugins/General/notifier/settingsdialog.cpp | 2 +- src/plugins/General/notifier/settingsdialog.ui | 279 ++++++++++++------------ src/ui/textscroller.cpp | 1 - 5 files changed, 165 insertions(+), 167 deletions(-) (limited to 'src') 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 = ""; + 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("" + title + ""); + title.append(""); - 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("
"); + title.append(core->metaData(Qmmp::ARTIST)); } - else - m_label2->hide(); + + if(!core->metaData(Qmmp::ALBUM).isEmpty()) + { + title.append("
"); + 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("" + tr("Volume:") + QString (" %1\%").arg(v)+ + ""); - m_label2->hide(); qApp->processEvents(); resize(sizeHint()); qApp->processEvents(); diff --git a/src/plugins/General/notifier/popupwidget.h b/src/plugins/General/notifier/popupwidget.h index c7bbafeef..a845ea24c 100644 --- a/src/plugins/General/notifier/popupwidget.h +++ b/src/plugins/General/notifier/popupwidget.h @@ -60,7 +60,6 @@ private: void updatePosition(); QTimer *m_timer; QLabel *m_label1; - QLabel *m_label2; QLabel *m_pixlabel; uint m_pos; int m_coverSize; diff --git a/src/plugins/General/notifier/settingsdialog.cpp b/src/plugins/General/notifier/settingsdialog.cpp index ba39add86..f3b150313 100644 --- a/src/plugins/General/notifier/settingsdialog.cpp +++ b/src/plugins/General/notifier/settingsdialog.cpp @@ -51,7 +51,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) ui.volumeCheckBox->setChecked(settings.value("volume_notification", TRUE).toBool()); ui.transparencySlider->setValue(100 - settings.value("opacity", 1.0).toDouble()*100); QString fontname = settings.value ("font").toString(); - ui.sizeSpinBox->setValue(settings.value ("cover_size", 48).toInt()); + ui.sizeSpinBox->setValue(settings.value ("cover_size", 64).toInt()); settings.endGroup(); QFont font; if(!fontname.isEmpty()) diff --git a/src/plugins/General/notifier/settingsdialog.ui b/src/plugins/General/notifier/settingsdialog.ui index bbbcfd5ea..0695d4351 100644 --- a/src/plugins/General/notifier/settingsdialog.ui +++ b/src/plugins/General/notifier/settingsdialog.ui @@ -1,7 +1,8 @@ - + + SettingsDialog - - + + 0 0 @@ -9,28 +10,28 @@ 403 - + Notifier Plugin Settings - - + + 6 - + 6 - + 6 - - - + + + Psi Notification - + - - + + Enable Psi notification @@ -38,115 +39,115 @@ - - - + + + Desktop Notification - - - - + + + + Song change notification - - - + + + Volume change notification - - - + + + Font: - - - + + + QFrame::StyledPanel - + QFrame::Sunken - + - - - + + + Cover size: - - - + + + Delay (ms): - + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - + + + 100 - + 10000 - + 100 - + 1000 - - - + + + Transparency - - - + + + 90 - + Qt::Horizontal - - - + + + 18 0 - + 0 - - - + + + Qt::Vertical - + 20 32 @@ -154,143 +155,143 @@ - - - + + + 3 - - - + + + - + true - + true - - - + + + - + true - + true - - - + + + - + true - + true - - - + + + - + true - + true - - - + + + - + true - + true - - - + + + - + true - + true - - - + + + - + true - + true - - - + + + - + true - + true - - - + + + - + true - + true - - - + + + Position - - - + + + Qt::Vertical - + 20 30 @@ -298,35 +299,35 @@ - - - + + + ... - - - + + + 32 - - 80 + + 120 - - 48 + + 64 - + - + Qt::Horizontal - + 131 31 @@ -334,15 +335,15 @@ - - - - + + + + 0 0 - + QDialogButtonBox::Cancel|QDialogButtonBox::Ok @@ -357,11 +358,11 @@ SettingsDialog accept() - + 257 341 - + 62 314 @@ -373,11 +374,11 @@ SettingsDialog reject() - + 257 341 - + 95 299 @@ -389,11 +390,11 @@ trasparencyLabel setNum(int) - + 183 187 - + 233 184 diff --git a/src/ui/textscroller.cpp b/src/ui/textscroller.cpp index 46dbf8fa8..50fa0849b 100644 --- a/src/ui/textscroller.cpp +++ b/src/ui/textscroller.cpp @@ -96,7 +96,6 @@ void TextScroller::setText(const QString& text) m_scrollText = "*** " + text; x = m_autoscroll ? -50 : -150; m_bitmap = m_bitmapConf && (m_text.toLatin1() == m_text.toLocal8Bit()); - qDebug("==== %s", m_text.toLatin1().constData()); } update(); } -- cgit v1.2.3-13-gbd6f