diff --git a/src/devices/deviceproperties.ui b/src/devices/deviceproperties.ui index fc5588c82..b2fef78ba 100644 --- a/src/devices/deviceproperties.ui +++ b/src/devices/deviceproperties.ui @@ -393,7 +393,7 @@ BusyIndicator - QLabel + QWidget
widgets/busyindicator.h
diff --git a/src/internet/lastfmsettingspage.ui b/src/internet/lastfmsettingspage.ui index 129e06007..17aac89f7 100644 --- a/src/internet/lastfmsettingspage.ui +++ b/src/internet/lastfmsettingspage.ui @@ -239,7 +239,7 @@ BusyIndicator - QLabel + QWidget
widgets/busyindicator.h
@@ -253,5 +253,38 @@ scrobble_button - + + + username + returnPressed() + login + click() + + + 332 + 104 + + + 706 + 103 + + + + + password + returnPressed() + login + click() + + + 719 + 137 + + + 725 + 108 + + + + diff --git a/src/internet/magnatunesettingspage.ui b/src/internet/magnatunesettingspage.ui index b9c978875..0ca48a2bf 100644 --- a/src/internet/magnatunesettingspage.ui +++ b/src/internet/magnatunesettingspage.ui @@ -200,7 +200,7 @@ BusyIndicator - QLabel + QWidget
widgets/busyindicator.h
diff --git a/src/internet/spotifysettingspage.ui b/src/internet/spotifysettingspage.ui index bddb9a421..2840ce208 100644 --- a/src/internet/spotifysettingspage.ui +++ b/src/internet/spotifysettingspage.ui @@ -240,7 +240,7 @@ BusyIndicator - QLabel + QWidget
widgets/busyindicator.h
diff --git a/src/remote/remotesettingspage.ui b/src/remote/remotesettingspage.ui index 8a2602e7e..748ca1134 100644 --- a/src/remote/remotesettingspage.ui +++ b/src/remote/remotesettingspage.ui @@ -198,7 +198,7 @@ BusyIndicator - QLabel + QWidget
widgets/busyindicator.h
diff --git a/src/ui/albumcoversearcher.ui b/src/ui/albumcoversearcher.ui index f3ffe1100..729aa85fd 100644 --- a/src/ui/albumcoversearcher.ui +++ b/src/ui/albumcoversearcher.ui @@ -87,7 +87,7 @@ BusyIndicator - QLabel + QWidget
widgets/busyindicator.h
diff --git a/src/ui/coverfromurldialog.ui b/src/ui/coverfromurldialog.ui index 132d955aa..b6f4be0d9 100644 --- a/src/ui/coverfromurldialog.ui +++ b/src/ui/coverfromurldialog.ui @@ -34,14 +34,7 @@ - - - - - - true - - + @@ -80,7 +73,7 @@ BusyIndicator - QLabel + QWidget
widgets/busyindicator.h
diff --git a/src/ui/edittagdialog.cpp b/src/ui/edittagdialog.cpp index 4691db3a1..ecee60859 100644 --- a/src/ui/edittagdialog.cpp +++ b/src/ui/edittagdialog.cpp @@ -75,7 +75,7 @@ EditTagDialog::EditTagDialog(CoverProviders* cover_providers, QWidget* parent) ui_->setupUi(this); ui_->splitter->setSizes(QList() << 200 << width() - 200); - ui_->loading_container->hide(); + ui_->loading_label->hide(); // An editable field is one that has a label as a buddy. The label is // important because it gets turned bold when the field is changed. @@ -178,12 +178,12 @@ bool EditTagDialog::SetLoading(const QString& message) { return false; loading_ = loading; - ui_->loading_container->setVisible(loading); ui_->button_box->setEnabled(!loading); ui_->tab_widget->setEnabled(!loading); ui_->song_list->setEnabled(!loading); ui_->fetch_tag->setEnabled(!loading); - ui_->loading_label->setText(message); + ui_->loading_label->setVisible(loading); + ui_->loading_label->set_text(message); return true; } diff --git a/src/ui/edittagdialog.ui b/src/ui/edittagdialog.ui index 8f783801c..01fe91e81 100644 --- a/src/ui/edittagdialog.ui +++ b/src/ui/edittagdialog.ui @@ -841,39 +841,7 @@ - - - - 0 - 0 - - - - - 0 - - - - - - - - - - - - - 0 - 0 - - - - - - - - - + @@ -885,6 +853,11 @@ + + BusyIndicator + QWidget +
widgets/busyindicator.h
+
LineEdit QLineEdit @@ -906,11 +879,6 @@ QSpinBox
widgets/lineedit.h
- - BusyIndicator - QLabel -
widgets/busyindicator.h
-
diff --git a/src/ui/trackselectiondialog.cpp b/src/ui/trackselectiondialog.cpp index cfc62770d..8cd58fe74 100644 --- a/src/ui/trackselectiondialog.cpp +++ b/src/ui/trackselectiondialog.cpp @@ -149,7 +149,7 @@ void TrackSelectionDialog::UpdateStack() { if (data.pending_) { ui_->stack->setCurrentWidget(ui_->loading_page); - ui_->progress_label->setText(data.progress_string_ + "..."); + ui_->progress->set_text(data.progress_string_ + "..."); return; } else if (data.results_.isEmpty()) { ui_->stack->setCurrentWidget(ui_->error_page); @@ -220,10 +220,10 @@ void TrackSelectionDialog::ResultSelected() { void TrackSelectionDialog::SetLoading(const QString& message) { const bool loading = !message.isEmpty(); - ui_->loading_container->setVisible(loading); ui_->button_box->setEnabled(!loading); ui_->splitter->setEnabled(!loading); - ui_->loading_label->setText(message); + ui_->loading_label->setVisible(loading); + ui_->loading_label->set_text(message); } void TrackSelectionDialog::SaveData(const QList& data) { diff --git a/src/ui/trackselectiondialog.ui b/src/ui/trackselectiondialog.ui index a396eba32..89e19d276 100644 --- a/src/ui/trackselectiondialog.ui +++ b/src/ui/trackselectiondialog.ui @@ -69,14 +69,7 @@
- - - - - - - - + @@ -223,33 +216,7 @@ - - - - 0 - - - - - - - - - - - - - 0 - 0 - - - - - - - - - + @@ -274,7 +241,7 @@ BusyIndicator - QLabel + QWidget
widgets/busyindicator.h
diff --git a/src/widgets/busyindicator.cpp b/src/widgets/busyindicator.cpp index 357a0efe8..f0696eefb 100644 --- a/src/widgets/busyindicator.cpp +++ b/src/widgets/busyindicator.cpp @@ -17,14 +17,36 @@ #include "busyindicator.h" +#include #include +BusyIndicator::BusyIndicator(const QString& text, QWidget* parent) + : QWidget(parent) { + Init(text); +} + BusyIndicator::BusyIndicator(QWidget* parent) - : QLabel(parent), - movie_(new QMovie(":spinner.gif")) -{ - setMovie(movie_); - setMinimumSize(16, 16); + : QWidget(parent) { + Init(QString::null); +} + +void BusyIndicator::Init(const QString& text) { + movie_ = new QMovie(":spinner.gif"), + label_ = new QLabel; + + QLabel* icon = new QLabel; + icon->setMovie(movie_); + icon->setMinimumSize(16, 16); + + label_->setWordWrap(true); + + QHBoxLayout* layout = new QHBoxLayout(this); + layout->setContentsMargins(0, 0, 0, 0); + layout->addWidget(icon); + layout->addSpacing(6); + layout->addWidget(label_); + + set_text(text); } BusyIndicator::~BusyIndicator() { @@ -38,3 +60,10 @@ void BusyIndicator::showEvent(QShowEvent*) { void BusyIndicator::hideEvent(QHideEvent*) { movie_->stop(); } + +void BusyIndicator::set_text(const QString& text) { + label_->setText(text); + if (text.isEmpty()) + label_->hide(); +} + diff --git a/src/widgets/busyindicator.h b/src/widgets/busyindicator.h index 8841ee64f..65ba50001 100644 --- a/src/widgets/busyindicator.h +++ b/src/widgets/busyindicator.h @@ -22,19 +22,27 @@ class QMovie; -class BusyIndicator : public QLabel { +class BusyIndicator : public QWidget { Q_OBJECT public: - BusyIndicator(QWidget* parent = 0); + explicit BusyIndicator(const QString& text, QWidget* parent = 0); + explicit BusyIndicator(QWidget* parent = 0); ~BusyIndicator(); + QString text() const; + void set_text(const QString& text); + protected: void showEvent(QShowEvent* event); void hideEvent(QHideEvent* event); + private: + void Init(const QString& text); + private: QMovie* movie_; + QLabel* label_; }; #endif // BUSYINDICATOR_H