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>allthethings.png</file>
<file>globalsearch.css</file> <file>globalsearch.css</file>
<file>clementine-spotify-public.pem</file> <file>clementine-spotify-public.pem</file>
<file>icons/22x22/user-away.png</file>
</qresource> </qresource>
</RCC> </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) { const QString& listen_hash, const QString& name, const QDateTime& expires) {
if (listen_hash.isEmpty()) { if (listen_hash.isEmpty()) {
ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedOut); ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedOut);
ui_->login_state->SetExpires(QDate());
ui_->login_state->SetAccountTypeVisible(true); ui_->login_state->SetAccountTypeVisible(true);
} else { } else {
ui_->login_state->SetLoggedIn( ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedIn, name);
LoginStateWidget::LoggedIn, ui_->login_state->SetExpires(expires.date());
name + " (" + tr("Expires on %1").arg(expires.date().toString(Qt::SystemLocaleLongDate)) + ")");
ui_->login_state->SetAccountTypeVisible(false); 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" msgid "Except between tracks on the same album or in the same CUE sheet"
msgstr "" msgstr ""
#: internet/digitallyimportedsettingspage.cpp:95 #: widgets/loginstatewidget.cpp:112
#, qt-format #, qt-format
msgid "Expires on %1" msgid "Expires on %1"
msgstr "" msgstr ""
@ -1811,7 +1811,7 @@ msgstr ""
#: ../bin/src/ui_transcoderoptionsspeex.h:216 #: ../bin/src/ui_transcoderoptionsspeex.h:216
#: ../bin/src/ui_transcoderoptionsvorbis.h:201 #: ../bin/src/ui_transcoderoptionsvorbis.h:201
#: ../bin/src/ui_transcoderoptionswma.h:78 ../bin/src/ui_equalizerslider.h:82 #: ../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 #: ../bin/src/ui_trackslider.h:69 ../bin/src/ui_visualisationoverlay.h:178
msgid "Form" msgid "Form"
msgstr "" msgstr ""
@ -3597,11 +3597,11 @@ msgstr ""
msgid "Shuffle playlist" msgid "Shuffle playlist"
msgstr "" 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" msgid "Sign out"
msgstr "" msgstr ""
#: ../bin/src/ui_loginstatewidget.h:149 #: ../bin/src/ui_loginstatewidget.h:175
msgid "Signing in..." msgid "Signing in..."
msgstr "" msgstr ""
@ -4352,16 +4352,16 @@ msgstr ""
msgid "You are about to download the following albums" msgid "You are about to download the following albums"
msgstr "" msgstr ""
#: ../bin/src/ui_loginstatewidget.h:146 #: ../bin/src/ui_loginstatewidget.h:172
msgid "You are not signed in." msgid "You are not signed in."
msgstr "" msgstr ""
#: widgets/loginstatewidget.cpp:67 #: widgets/loginstatewidget.cpp:69
#, qt-format #, qt-format
msgid "You are signed in as %1." msgid "You are signed in as %1."
msgstr "" msgstr ""
#: widgets/loginstatewidget.cpp:65 #: widgets/loginstatewidget.cpp:67
msgid "You are signed in." msgid "You are signed in."
msgstr "" msgstr ""

View File

@ -19,6 +19,7 @@
#include "ui_loginstatewidget.h" #include "ui_loginstatewidget.h"
#include "ui/iconloader.h" #include "ui/iconloader.h"
#include <QDate>
#include <QKeyEvent> #include <QKeyEvent>
LoginStateWidget::LoginStateWidget(QWidget* parent) LoginStateWidget::LoginStateWidget(QWidget* parent)
@ -27,6 +28,7 @@ LoginStateWidget::LoginStateWidget(QWidget* parent)
{ {
ui_->setupUi(this); ui_->setupUi(this);
ui_->signed_in->hide(); ui_->signed_in->hide();
ui_->expires->hide();
ui_->account_type->hide(); ui_->account_type->hide();
ui_->busy->hide(); ui_->busy->hide();
@ -102,3 +104,12 @@ bool LoginStateWidget::eventFilter(QObject* object, QEvent* event) {
return QWidget::eventFilter(object, 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 #ifndef LOGINSTATEWIDGET_H
#define LOGINSTATEWIDGET_H #define LOGINSTATEWIDGET_H
#include <QDate>
#include <QWidget> #include <QWidget>
class Ui_LoginStateWidget; class Ui_LoginStateWidget;
@ -57,6 +58,8 @@ public slots:
void SetAccountTypeText(const QString& text); void SetAccountTypeText(const QString& text);
void SetAccountTypeVisible(bool visible); void SetAccountTypeVisible(bool visible);
void SetExpires(const QDate& expires);
signals: signals:
void LogoutClicked(); void LogoutClicked();
void LoginClicked(); void LoginClicked();

View File

@ -97,6 +97,38 @@
</layout> </layout>
</widget> </widget>
</item> </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> <item>
<widget class="QWidget" name="account_type" native="true"> <widget class="QWidget" name="account_type" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">