WITH_XC_AUTOTYPE defaults to ON and WITH_XC_HTTP includes ALL networking

This commit is contained in:
Jonathan White 2017-03-02 18:44:01 -05:00
parent cdce9e27fb
commit 3139ae1528
No known key found for this signature in database
GPG key ID: 440FC65F2E0C6E01
4 changed files with 27 additions and 6 deletions

View file

@ -28,10 +28,12 @@
#include "gui/IconModels.h"
#include "gui/MessageBox.h"
#ifdef WITH_XC_HTTP
#include "http/qhttp/qhttpclient.hpp"
#include "http/qhttp/qhttpclientresponse.hpp"
using namespace qhttp::client;
#endif
IconStruct::IconStruct()
: uuid(Uuid())
@ -45,7 +47,9 @@ EditWidgetIcons::EditWidgetIcons(QWidget* parent)
, m_database(nullptr)
, m_defaultIconModel(new DefaultIconModel(this))
, m_customIconModel(new CustomIconModel(this))
#ifdef WITH_XC_HTTP
, m_httpClient(nullptr)
#endif
{
m_ui->setupUi(this);
@ -65,6 +69,9 @@ EditWidgetIcons::EditWidgetIcons(QWidget* parent)
connect(m_ui->faviconButton, SIGNAL(clicked()), SLOT(downloadFavicon()));
m_ui->faviconButton->setVisible(false);
m_fallbackToGoogle = true;
m_redirectCount = 0;
}
EditWidgetIcons::~EditWidgetIcons()
@ -138,18 +145,25 @@ void EditWidgetIcons::load(const Uuid& currentUuid, Database* database, const Ic
void EditWidgetIcons::setUrl(const QString& url)
{
#ifdef WITH_XC_HTTP
m_url = url;
m_ui->faviconButton->setVisible(!url.isEmpty());
resetFaviconDownload();
#else
m_ui->faviconButton->setVisible(false);
#endif
}
void EditWidgetIcons::downloadFavicon()
{
#ifdef WITH_XC_HTTP
QUrl url = QUrl(m_url);
url.setPath("/favicon.ico");
fetchFavicon(url);
#endif
}
#ifdef WITH_XC_HTTP
void EditWidgetIcons::fetchFavicon(const QUrl& url)
{
if (nullptr == m_httpClient) {
@ -241,6 +255,7 @@ void EditWidgetIcons::resetFaviconDownload(bool clearRedirect)
m_fallbackToGoogle = true;
m_ui->faviconButton->setDisabled(false);
}
#endif
void EditWidgetIcons::addCustomIcon()
{