Show the di.fm/sky.fm "Expires on" date on a separate line

This commit is contained in:
David Sansome 2011-11-05 21:46:34 +00:00
parent b37f679c36
commit 1f0c2333d0
7 changed files with 57 additions and 10 deletions

View File

@ -332,5 +332,6 @@
<file>allthethings.png</file>
<file>globalsearch.css</file>
<file>clementine-spotify-public.pem</file>
<file>icons/22x22/user-away.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -88,11 +88,11 @@ void DigitallyImportedSettingsPage::UpdateLoginState(
const QString& listen_hash, const QString& name, const QDateTime& expires) {
if (listen_hash.isEmpty()) {
ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedOut);
ui_->login_state->SetExpires(QDate());
ui_->login_state->SetAccountTypeVisible(true);
} else {
ui_->login_state->SetLoggedIn(
LoginStateWidget::LoggedIn,
name + " (" + tr("Expires on %1").arg(expires.date().toString(Qt::SystemLocaleLongDate)) + ")");
ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedIn, name);
ui_->login_state->SetExpires(expires.date());
ui_->login_state->SetAccountTypeVisible(false);
}

View File

@ -1628,7 +1628,7 @@ msgstr ""
msgid "Except between tracks on the same album or in the same CUE sheet"
msgstr ""
#: internet/digitallyimportedsettingspage.cpp:95
#: widgets/loginstatewidget.cpp:112
#, qt-format
msgid "Expires on %1"
msgstr ""
@ -1811,7 +1811,7 @@ msgstr ""
#: ../bin/src/ui_transcoderoptionsspeex.h:216
#: ../bin/src/ui_transcoderoptionsvorbis.h:201
#: ../bin/src/ui_transcoderoptionswma.h:78 ../bin/src/ui_equalizerslider.h:82
#: ../bin/src/ui_fileview.h:106 ../bin/src/ui_loginstatewidget.h:145
#: ../bin/src/ui_fileview.h:106 ../bin/src/ui_loginstatewidget.h:171
#: ../bin/src/ui_trackslider.h:69 ../bin/src/ui_visualisationoverlay.h:178
msgid "Form"
msgstr ""
@ -3597,11 +3597,11 @@ msgstr ""
msgid "Shuffle playlist"
msgstr ""
#: ../bin/src/ui_remotesettingspage.h:202 ../bin/src/ui_loginstatewidget.h:147
#: ../bin/src/ui_remotesettingspage.h:202 ../bin/src/ui_loginstatewidget.h:173
msgid "Sign out"
msgstr ""
#: ../bin/src/ui_loginstatewidget.h:149
#: ../bin/src/ui_loginstatewidget.h:175
msgid "Signing in..."
msgstr ""
@ -4352,16 +4352,16 @@ msgstr ""
msgid "You are about to download the following albums"
msgstr ""
#: ../bin/src/ui_loginstatewidget.h:146
#: ../bin/src/ui_loginstatewidget.h:172
msgid "You are not signed in."
msgstr ""
#: widgets/loginstatewidget.cpp:67
#: widgets/loginstatewidget.cpp:69
#, qt-format
msgid "You are signed in as %1."
msgstr ""
#: widgets/loginstatewidget.cpp:65
#: widgets/loginstatewidget.cpp:67
msgid "You are signed in."
msgstr ""

View File

@ -19,6 +19,7 @@
#include "ui_loginstatewidget.h"
#include "ui/iconloader.h"
#include <QDate>
#include <QKeyEvent>
LoginStateWidget::LoginStateWidget(QWidget* parent)
@ -27,6 +28,7 @@ LoginStateWidget::LoginStateWidget(QWidget* parent)
{
ui_->setupUi(this);
ui_->signed_in->hide();
ui_->expires->hide();
ui_->account_type->hide();
ui_->busy->hide();
@ -102,3 +104,12 @@ bool LoginStateWidget::eventFilter(QObject* object, QEvent* event) {
return QWidget::eventFilter(object, event);
}
void LoginStateWidget::SetExpires(const QDate& expires) {
ui_->expires->setVisible(expires.isValid());
if (expires.isValid()) {
const QString expires_text = expires.toString(Qt::SystemLocaleLongDate);
ui_->expires_label->setText(tr("Expires on %1").arg("<b>" + expires_text + "</b>"));
}
}

View File

@ -18,6 +18,7 @@
#ifndef LOGINSTATEWIDGET_H
#define LOGINSTATEWIDGET_H
#include <QDate>
#include <QWidget>
class Ui_LoginStateWidget;
@ -57,6 +58,8 @@ public slots:
void SetAccountTypeText(const QString& text);
void SetAccountTypeVisible(bool visible);
void SetExpires(const QDate& expires);
signals:
void LogoutClicked();
void LoginClicked();

View File

@ -97,6 +97,38 @@
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="expires" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="pixmap">
<pixmap resource="../../data/data.qrc">:/icons/22x22/user-away.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="expires_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="account_type" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_3">