Mercurial > minori
diff src/gui/pages/torrents.cc @ 291:9a88e1725fd2
*: refactor lots of stuff
I forgot to put this into different commits, oops!
anyway, it doesn't really matter *that* much since this is an
unfinished hobby project anyway. once it starts getting stable
commit history will be more important, but for now it's not
that big of a deal
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Sun, 12 May 2024 16:31:07 -0400 |
parents | f31305b9f60a |
children | a0aa8c8c4307 |
line wrap: on
line diff
--- a/src/gui/pages/torrents.cc Wed May 08 17:32:28 2024 -0400 +++ b/src/gui/pages/torrents.cc Sun May 12 16:31:07 2024 -0400 @@ -65,9 +65,10 @@ const std::filesystem::path torrents_dir = Filesystem::GetTorrentsPath(); std::filesystem::create_directories(torrents_dir); - HTTP::GetThread* thread = new HTTP::GetThread(link, {}, this); + /* this sucks */ + HTTP::RequestThread* thread = new HTTP::RequestThread(link, {}, "", HTTP::Type::Get, this); - connect(thread, &HTTP::GetThread::ReceivedData, this, [this, torrents_dir, filename](const QByteArray& data) { + connect(thread, &HTTP::RequestThread::ReceivedData, this, [this, torrents_dir, filename](const QByteArray& data) { std::ofstream file(torrents_dir / filename, std::ofstream::out | std::ofstream::trunc); if (!file) return; // wat @@ -75,14 +76,14 @@ file.write(data.data(), data.size()); file.close(); }); - connect(thread, &HTTP::GetThread::finished, thread, &HTTP::GetThread::deleteLater); + connect(thread, &HTTP::RequestThread::finished, thread, &HTTP::RequestThread::deleteLater); thread->start(); } } QByteArray TorrentsPageListModel::DownloadTorrentList() { - return HTTP::Get(session.config.torrents.feed_link); + return HTTP::Request(session.config.torrents.feed_link); } void TorrentsPageListModel::ParseFeedDescription(const std::string& description, Torrent& torrent) { @@ -416,9 +417,9 @@ if (!model) return; - HTTP::GetThread* thread = new HTTP::GetThread(session.config.torrents.feed_link); + HTTP::RequestThread* thread = new HTTP::RequestThread(session.config.torrents.feed_link); - connect(thread, &HTTP::GetThread::ReceivedData, this, [&](const QByteArray& ba) { + connect(thread, &HTTP::RequestThread::ReceivedData, this, [&](const QByteArray& ba) { /* This is to make sure we aren't in a different thread * messing around with GUI stuff */ @@ -426,7 +427,7 @@ model->ParseTorrentList(ba); treeview->setUpdatesEnabled(true); }); - connect(thread, &QThread::finished, thread, &QThread::deleteLater); + connect(thread, &HTTP::RequestThread::finished, thread, &HTTP::RequestThread::deleteLater); thread->start(); }