mirror of
https://github.com/clementine-player/Clementine
synced 2025-02-02 20:36:44 +01:00
Revert "Add an option to specify a gpodder server."
This commit is contained in:
parent
41c103413c
commit
0991209087
@ -19,7 +19,6 @@
|
||||
|
||||
#include "gpoddersync.h"
|
||||
|
||||
#include <Config.h>
|
||||
#include <QCoreApplication>
|
||||
#include <QHostInfo>
|
||||
#include <QNetworkAccessManager>
|
||||
@ -51,11 +50,6 @@ GPodderSync::GPodderSync(Application* app, QObject* parent)
|
||||
get_updates_timer_(new QTimer(this)),
|
||||
flush_queue_timer_(new QTimer(this)),
|
||||
flushing_queue_(false) {
|
||||
// Store the base URL in case we need to reset it. The config instance is a
|
||||
// singleton and this is assuming that the configuration hasn't been modified
|
||||
// before now.
|
||||
default_base_url_ = mygpo::Config::instance()->mygpoBaseUrl();
|
||||
|
||||
ReloadSettings();
|
||||
LoadQueue();
|
||||
|
||||
@ -103,38 +97,26 @@ void GPodderSync::ReloadSettings() {
|
||||
username_ = s.value("gpodder_username").toString();
|
||||
password_ = s.value("gpodder_password").toString();
|
||||
last_successful_get_ = s.value("gpodder_last_get").toDateTime();
|
||||
UpdateBaseUrl(s.value("gpodder_base_url").toUrl());
|
||||
|
||||
if (!username_.isEmpty() && !password_.isEmpty()) {
|
||||
qLog(Debug) << "Using gpodder base URL"
|
||||
<< mygpo::Config::instance()->mygpoBaseUrl();
|
||||
api_.reset(new mygpo::ApiRequest(username_, password_, network_));
|
||||
}
|
||||
}
|
||||
|
||||
void GPodderSync::Login(const QString& username, const QString& password,
|
||||
const QString& device_name) {
|
||||
Login(username, password, device_name, QUrl());
|
||||
}
|
||||
|
||||
void GPodderSync::Login(const QString& username, const QString& password,
|
||||
const QString& device_name, const QUrl& custom_url) {
|
||||
UpdateBaseUrl(custom_url);
|
||||
qLog(Debug) << "Using gpodder base URL"
|
||||
<< mygpo::Config::instance()->mygpoBaseUrl();
|
||||
api_.reset(new mygpo::ApiRequest(username, password, network_));
|
||||
|
||||
QNetworkReply* reply = api_->renameDevice(
|
||||
username, DeviceId(), device_name,
|
||||
Utilities::IsLaptop() ? mygpo::Device::LAPTOP : mygpo::Device::DESKTOP);
|
||||
NewClosure(reply, SIGNAL(finished()), this,
|
||||
SLOT(LoginFinished(QNetworkReply*, QString, QString, QUrl)), reply,
|
||||
username, password, custom_url);
|
||||
SLOT(LoginFinished(QNetworkReply*, QString, QString)), reply,
|
||||
username, password);
|
||||
}
|
||||
|
||||
void GPodderSync::LoginFinished(QNetworkReply* reply, const QString& username,
|
||||
const QString& password,
|
||||
const QUrl& custom_url) {
|
||||
const QString& password) {
|
||||
reply->deleteLater();
|
||||
|
||||
if (reply->error() == QNetworkReply::NoError) {
|
||||
@ -145,7 +127,6 @@ void GPodderSync::LoginFinished(QNetworkReply* reply, const QString& username,
|
||||
s.beginGroup(kSettingsGroup);
|
||||
s.setValue("gpodder_username", username);
|
||||
s.setValue("gpodder_password", password);
|
||||
s.setValue("gpodder_base_url", custom_url);
|
||||
|
||||
DoInitialSync();
|
||||
emit LoginSuccess();
|
||||
@ -155,15 +136,6 @@ void GPodderSync::LoginFinished(QNetworkReply* reply, const QString& username,
|
||||
}
|
||||
}
|
||||
|
||||
void GPodderSync::UpdateBaseUrl(const QUrl& custom_base_url) {
|
||||
// If the custom URL is empty, use the default.
|
||||
if (!custom_base_url.isEmpty()) {
|
||||
mygpo::Config::instance()->setMygpoBaseUrl(custom_base_url);
|
||||
} else {
|
||||
mygpo::Config::instance()->setMygpoBaseUrl(default_base_url_);
|
||||
}
|
||||
}
|
||||
|
||||
void GPodderSync::Logout() {
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
@ -375,7 +347,7 @@ void GPodderSync::FlushUpdateQueue() {
|
||||
username_, DeviceId(), queued_add_subscriptions_.values(),
|
||||
queued_remove_subscriptions_.values()));
|
||||
|
||||
qLog(Info) << "Sending" << all_urls.count() << "changes to gpodder service";
|
||||
qLog(Info) << "Sending" << all_urls.count() << "changes to gpodder.net";
|
||||
|
||||
NewClosure(reply, SIGNAL(finished()), this,
|
||||
SLOT(AddRemoveFinished(mygpo::AddRemoveResultPtr, QList<QUrl>)),
|
||||
|
@ -64,9 +64,6 @@ class GPodderSync : public QObject {
|
||||
void Login(const QString& username, const QString& password,
|
||||
const QString& device_name);
|
||||
|
||||
void Login(const QString& username, const QString& password,
|
||||
const QString& device_name, const QUrl& custom_url);
|
||||
|
||||
// Clears any saved username and password from QSettings.
|
||||
void Logout();
|
||||
|
||||
@ -80,7 +77,7 @@ class GPodderSync : public QObject {
|
||||
private slots:
|
||||
void ReloadSettings();
|
||||
void LoginFinished(QNetworkReply* reply, const QString& username,
|
||||
const QString& password, const QUrl& custom_url);
|
||||
const QString& password);
|
||||
|
||||
void DeviceUpdatesFinished(mygpo::DeviceUpdatesPtr reply);
|
||||
void DeviceUpdatesParseError();
|
||||
@ -107,8 +104,6 @@ class GPodderSync : public QObject {
|
||||
|
||||
void DoInitialSync();
|
||||
|
||||
void UpdateBaseUrl(const QUrl& custom_base_url);
|
||||
|
||||
private:
|
||||
Application* app_;
|
||||
QNetworkAccessManager* network_;
|
||||
@ -121,7 +116,6 @@ class GPodderSync : public QObject {
|
||||
QString password_;
|
||||
QDateTime last_successful_get_;
|
||||
QTimer* get_updates_timer_;
|
||||
QUrl default_base_url_;
|
||||
|
||||
QTimer* flush_queue_timer_;
|
||||
QSet<QUrl> queued_add_subscriptions_;
|
||||
|
@ -44,8 +44,6 @@ PodcastSettingsPage::PodcastSettingsPage(SettingsDialog* dialog)
|
||||
connect(ui_->login_state, SIGNAL(LogoutClicked()), SLOT(LogoutClicked()));
|
||||
connect(ui_->download_dir_browse, SIGNAL(clicked()),
|
||||
SLOT(DownloadDirBrowse()));
|
||||
connect(ui_->gpodder_advanced, SIGNAL(stateChanged(int)),
|
||||
SLOT(GpodderAdvancedChanged(int)));
|
||||
|
||||
GPodderSync* gsync = dialog->app()->gpodder_sync();
|
||||
connect(gsync, SIGNAL(LoginSuccess()), SLOT(GpodderLoginSuccess()));
|
||||
@ -91,16 +89,6 @@ void PodcastSettingsPage::Load() {
|
||||
s.value("gpodder_device_name", GPodderSync::DefaultDeviceName())
|
||||
.toString());
|
||||
|
||||
QUrl base_url = s.value("gpodder_base_url").toUrl();
|
||||
if (base_url.isEmpty()) {
|
||||
ui_->gpodder_advanced->setCheckState(Qt::Unchecked);
|
||||
ui_->gpodder_advanced_group->setEnabled(false);
|
||||
} else {
|
||||
ui_->gpodder_advanced->setCheckState(Qt::Checked);
|
||||
ui_->gpodder_advanced_group->setEnabled(true);
|
||||
}
|
||||
ui_->gpodder_base_url->setText(base_url.toString());
|
||||
|
||||
if (dialog()->app()->gpodder_sync()->is_logged_in()) {
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedIn,
|
||||
ui_->username->text());
|
||||
@ -127,19 +115,8 @@ void PodcastSettingsPage::Save() {
|
||||
void PodcastSettingsPage::LoginClicked() {
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::LoginInProgress);
|
||||
|
||||
if (ui_->gpodder_advanced->checkState()) {
|
||||
QUrl url(ui_->gpodder_base_url->text());
|
||||
if (url.isEmpty() || !url.isValid()) {
|
||||
GpodderLoginFailure("Invalid URL");
|
||||
return;
|
||||
}
|
||||
dialog()->app()->gpodder_sync()->Login(ui_->username->text(),
|
||||
ui_->password->text(),
|
||||
ui_->device_name->text(), url);
|
||||
} else {
|
||||
dialog()->app()->gpodder_sync()->Login(
|
||||
ui_->username->text(), ui_->password->text(), ui_->device_name->text());
|
||||
}
|
||||
dialog()->app()->gpodder_sync()->Login(
|
||||
ui_->username->text(), ui_->password->text(), ui_->device_name->text());
|
||||
}
|
||||
|
||||
void PodcastSettingsPage::GpodderLoginSuccess() {
|
||||
@ -168,7 +145,3 @@ void PodcastSettingsPage::DownloadDirBrowse() {
|
||||
|
||||
ui_->download_dir->setText(QDir::toNativeSeparators(directory));
|
||||
}
|
||||
|
||||
void PodcastSettingsPage::GpodderAdvancedChanged(int state) {
|
||||
ui_->gpodder_advanced_group->setEnabled(state != Qt::Unchecked);
|
||||
}
|
||||
|
@ -45,8 +45,6 @@ class PodcastSettingsPage : public SettingsPage {
|
||||
|
||||
void DownloadDirBrowse();
|
||||
|
||||
void GpodderAdvancedChanged(int state);
|
||||
|
||||
private:
|
||||
Ui_PodcastSettingsPage* ui_;
|
||||
};
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>616</width>
|
||||
<height>672</height>
|
||||
<height>656</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -174,7 +174,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gpodder_groupBox">
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>gpodder.net</string>
|
||||
</property>
|
||||
@ -198,16 +198,7 @@
|
||||
<item>
|
||||
<widget class="QWidget" name="login_group" native="true">
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
@ -245,45 +236,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Device name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="device_name"/>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="gpodder_advanced_group">
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="gpodder_base_url"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="gpodder_base_url_label">
|
||||
<property name="text">
|
||||
<string>Base URL</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="gpodder_advanced">
|
||||
<property name="text">
|
||||
<string>Advanced Settings</string>
|
||||
</property>
|
||||
<property name="tristate">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -324,6 +286,5 @@
|
||||
<tabstop>device_name</tabstop>
|
||||
<tabstop>login</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
Loading…
x
Reference in New Issue
Block a user