mirror of
https://github.com/clementine-player/Clementine
synced 2025-02-06 06:03:23 +01:00
If there's a URL on the clipboard, fill in the textbox on the add by URL page automatically. Set focus on the query textbox when going to a page, and select the first podcast automatically when results arrive.
This commit is contained in:
parent
e6640f1d10
commit
3cafaf52ae
@ -21,6 +21,7 @@
|
|||||||
#include "ui_addpodcastbyurl.h"
|
#include "ui_addpodcastbyurl.h"
|
||||||
#include "core/closure.h"
|
#include "core/closure.h"
|
||||||
|
|
||||||
|
#include <QClipboard>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
@ -72,3 +73,19 @@ void AddPodcastByUrl::RequestFinished(PodcastUrlLoaderReply* reply) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AddPodcastByUrl::Show() {
|
||||||
|
ui_->url->setFocus();
|
||||||
|
if (!ui_->url->text().isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QClipboard* clipboard = QApplication::clipboard();
|
||||||
|
foreach (const QString& contents, QStringList() << clipboard->text(QClipboard::Clipboard)
|
||||||
|
<< clipboard->text(QClipboard::Selection)) {
|
||||||
|
if (contents.contains("://")) {
|
||||||
|
ui_->url->setText(contents);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -32,6 +32,8 @@ public:
|
|||||||
AddPodcastByUrl(Application* app, QWidget* parent = 0);
|
AddPodcastByUrl(Application* app, QWidget* parent = 0);
|
||||||
~AddPodcastByUrl();
|
~AddPodcastByUrl();
|
||||||
|
|
||||||
|
void Show();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void GoClicked();
|
void GoClicked();
|
||||||
void RequestFinished(PodcastUrlLoaderReply* reply);
|
void RequestFinished(PodcastUrlLoaderReply* reply);
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "widgets/widgetfadehelper.h"
|
#include "widgets/widgetfadehelper.h"
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
const char* AddPodcastDialog::kBbcOpmlUrl = "http://www.bbc.co.uk/podcasts.opml";
|
const char* AddPodcastDialog::kBbcOpmlUrl = "http://www.bbc.co.uk/podcasts.opml";
|
||||||
|
|
||||||
@ -153,6 +154,17 @@ void AddPodcastDialog::PageBusyChanged(bool busy) {
|
|||||||
void AddPodcastDialog::CurrentPageBusyChanged(bool busy) {
|
void AddPodcastDialog::CurrentPageBusyChanged(bool busy) {
|
||||||
ui_->results_stack->setCurrentWidget(busy ? ui_->busy_page : ui_->results_page);
|
ui_->results_stack->setCurrentWidget(busy ? ui_->busy_page : ui_->results_page);
|
||||||
ui_->stack->setDisabled(busy);
|
ui_->stack->setDisabled(busy);
|
||||||
|
|
||||||
|
QTimer::singleShot(0, this, SLOT(SelectFirstPodcast()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddPodcastDialog::SelectFirstPodcast() {
|
||||||
|
// Select the first item if there was one.
|
||||||
|
const PodcastDiscoveryModel* model = pages_[ui_->provider_list->currentRow()]->model();
|
||||||
|
if (model->rowCount() > 0) {
|
||||||
|
ui_->results->selectionModel()->setCurrentIndex(
|
||||||
|
model->index(0, 0), QItemSelectionModel::ClearAndSelect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddPodcastDialog::AddPodcast() {
|
void AddPodcastDialog::AddPodcast() {
|
||||||
|
@ -47,6 +47,8 @@ private slots:
|
|||||||
void PageBusyChanged(bool busy);
|
void PageBusyChanged(bool busy);
|
||||||
void CurrentPageBusyChanged(bool busy);
|
void CurrentPageBusyChanged(bool busy);
|
||||||
|
|
||||||
|
void SelectFirstPodcast();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void AddPage(AddPodcastPage* page);
|
void AddPage(AddPodcastPage* page);
|
||||||
|
|
||||||
|
@ -87,3 +87,7 @@ void GPodderSearchPage::SearchFailed(mygpo::PodcastList* list) {
|
|||||||
// Try doing the search again.
|
// Try doing the search again.
|
||||||
SearchClicked();
|
SearchClicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GPodderSearchPage::Show() {
|
||||||
|
ui_->query->setFocus();
|
||||||
|
}
|
||||||
|
@ -36,6 +36,8 @@ public:
|
|||||||
GPodderSearchPage(Application* app, QWidget* parent = 0);
|
GPodderSearchPage(Application* app, QWidget* parent = 0);
|
||||||
~GPodderSearchPage();
|
~GPodderSearchPage();
|
||||||
|
|
||||||
|
void Show();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void SearchClicked();
|
void SearchClicked();
|
||||||
void SearchFinished(mygpo::PodcastList* list);
|
void SearchFinished(mygpo::PodcastList* list);
|
||||||
|
@ -101,3 +101,7 @@ void ITunesSearchPage::SearchFinished(QNetworkReply* reply) {
|
|||||||
model()->appendRow(model()->CreatePodcastItem(podcast));
|
model()->appendRow(model()->CreatePodcastItem(podcast));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ITunesSearchPage::Show() {
|
||||||
|
ui_->query->setFocus();
|
||||||
|
}
|
||||||
|
@ -32,6 +32,8 @@ public:
|
|||||||
ITunesSearchPage(Application* app, QWidget* parent);
|
ITunesSearchPage(Application* app, QWidget* parent);
|
||||||
~ITunesSearchPage();
|
~ITunesSearchPage();
|
||||||
|
|
||||||
|
void Show();
|
||||||
|
|
||||||
static const char* kUrlBase;
|
static const char* kUrlBase;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user