Skip to content

Commit

Permalink
Version 7.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Bionus committed Apr 18, 2019
2 parents ff54df8 + 6443be1 commit 0408cf7
Show file tree
Hide file tree
Showing 140 changed files with 1,793 additions and 653 deletions.
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,15 @@
"contributions": [
"bug"
]
},
{
"login": "brazenvoid",
"name": "Umair Ahmed",
"avatar_url": "https://avatars1.githubusercontent.com/u/8722533?s=122",
"profile": "https://github.com/brazenvoid",
"contributions": [
"bug"
]
}
]
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
e2e/viewer/result.json
release/sites/helper.js
release/sites/*/model.js
release/sites/*/*/cookies.txt
release/sites/*/*/settings.ini
release/sites/*/*/tags.txt
release/sites/*/*/tags.db
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ endif()

project(Grabber)
if((NOT DEFINED VERSION) OR ((DEFINED NIGHTLY) AND (NIGHTLY MATCHES "1")))
set(VERSION "7.0.1")
set(VERSION "7.1.0")
else()
string(REGEX REPLACE "^v" "" VERSION "${VERSION}")
endif()
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,10 @@ You can add additional sources very easily, but here's a short list of some sour
See the [Compilation](https://github.com/Bionus/imgbrd-grabber/wiki/Compilation) wiki page to know how to build Grabber.

## Contributors
<!-- ALL-CONTRIBUTORS-LIST:START -->
<!-- prettier-ignore -->
| [<img src="https://avatars2.githubusercontent.com/u/882719?s=122" width="122px;"/><br /><sub><b>Jack Vasti</b></sub>](https://github.com/Bionus)<br />[💻](https://github.com/Bionus/imgbrd-grabber/commits?author=Bionus "Code") [📖](https://github.com/Bionus/imgbrd-grabber/commits?author=Bionus "Documentation") [⚠️](https://github.com/Bionus/imgbrd-grabber/commits?author=Bionus "Tests") | [<img src="https://avatars0.githubusercontent.com/u/16903308?s=122" width="122px;"/><br /><sub><b>YMI</b></sub>](https://github.com/Zzzyyzzyxx)<br />[🐛](https://github.com/Bionus/imgbrd-grabber/issues?q=author%3AYMI "Bug reports") [🤔](#ideas-YMI "Ideas, Planning, & Feedback") | [<img src="https://avatars2.githubusercontent.com/u/12085184?s=122" width="122px;"/><br /><sub><b>SultrySamthepenna&hellip;</b></sub>](https://github.com/SultrySamthepennanceman)<br />[🐛](https://github.com/Bionus/imgbrd-grabber/issues?q=author%3ASultrySamthepennanceman "Bug reports") | [<img src="https://avatars1.githubusercontent.com/u/5648875?s=122" width="122px;"/><br /><sub><b>Barry Anders</b></sub>](https://github.com/BarryMode)<br />[💻](https://github.com/Bionus/imgbrd-grabber/commits?author=BarryMode "Code") [🐛](https://github.com/Bionus/imgbrd-grabber/issues?q=author%3ABarryMode "Bug reports") | [<img src="https://avatars3.githubusercontent.com/u/2048861?s=122" width="122px;"/><br /><sub><b>Ken Swenson</b></sub>](https://github.com/Flat)<br />[💻](https://github.com/Bionus/imgbrd-grabber/commits?author=Flat "Code") [📦](#platform-Flat "Packaging/porting to new platform") | [<img src="https://avatars0.githubusercontent.com/u/18506295?s=122" width="122px;"/><br /><sub><b>Larry He</b></sub>](https://github.com/larry-he)<br />[💻](https://github.com/Bionus/imgbrd-grabber/commits?author=larry-he "Code") |
| :---: | :---: | :---: | :---: | :---: | :---: |
| [<img src="https://avatars3.githubusercontent.com/u/19770864?s=122" width="122px;"/><br /><sub><b>brodycas3</b></sub>](https://github.com/brodycas3)<br />[🐛](https://github.com/Bionus/imgbrd-grabber/issues?q=author%3Abrodycas3 "Bug reports") | [<img src="https://avatars1.githubusercontent.com/u/1650692?s=122" width="122px;"/><br /><sub><b>Klion Xu</b></sub>](https://github.com/sanddudu)<br />[🌍](#translation-sanddudu "Translation") | [<img src="https://avatars2.githubusercontent.com/u/22294259?s=122" width="122px;"/><br /><sub><b>MasterPetrik</b></sub>](https://github.com/MasterPetrik)<br />[🐛](https://github.com/Bionus/imgbrd-grabber/issues?q=author%3AMasterPetrik "Bug reports") [🌍](#translation-MasterPetrik "Translation") [🤔](#ideas-MasterPetrik "Ideas, Planning, & Feedback") | [<img src="https://avatars3.githubusercontent.com/u/6687927?s=122" width="122px;"/><br /><sub><b>Eddy Castillo</b></sub>](https://github.com/dyskette)<br />[🌍](#translation-dyskette "Translation") | [<img src="https://avatars0.githubusercontent.com/u/6564956?s=122" width="122px;"/><br /><sub><b>MrAndre96</b></sub>](https://github.com/MrAndre96)<br />[🐛](https://github.com/Bionus/imgbrd-grabber/issues?q=author%3AMrAndre96 "Bug reports") |
<!-- ALL-CONTRIBUTORS-LIST:START -->
<!-- prettier-ignore -->
<table><tr><td align="center"><a href="https://github.com/Bionus"><img src="https://avatars2.githubusercontent.com/u/882719?s=122" width="122px;" alt="Jack Vasti"/><br /><sub><b>Jack Vasti</b></sub></a><br /><a href="https://github.com/Bionus/imgbrd-grabber/commits?author=Bionus" title="Code">💻</a> <a href="https://github.com/Bionus/imgbrd-grabber/commits?author=Bionus" title="Documentation">📖</a> <a href="https://github.com/Bionus/imgbrd-grabber/commits?author=Bionus" title="Tests">⚠️</a></td><td align="center"><a href="https://github.com/Zzzyyzzyxx"><img src="https://avatars0.githubusercontent.com/u/16903308?s=122" width="122px;" alt="YMI"/><br /><sub><b>YMI</b></sub></a><br /><a href="https://github.com/Bionus/imgbrd-grabber/issues?q=author%3AYMI" title="Bug reports">🐛</a> <a href="#ideas-YMI" title="Ideas, Planning, & Feedback">🤔</a></td><td align="center"><a href="https://github.com/SultrySamthepennanceman"><img src="https://avatars2.githubusercontent.com/u/12085184?s=122" width="122px;" alt="SultrySamthepenna&hellip;"/><br /><sub><b>SultrySamthepenna&hellip;</b></sub></a><br /><a href="https://github.com/Bionus/imgbrd-grabber/issues?q=author%3ASultrySamthepennanceman" title="Bug reports">🐛</a></td><td align="center"><a href="https://github.com/BarryMode"><img src="https://avatars1.githubusercontent.com/u/5648875?s=122" width="122px;" alt="Barry Anders"/><br /><sub><b>Barry Anders</b></sub></a><br /><a href="https://github.com/Bionus/imgbrd-grabber/commits?author=BarryMode" title="Code">💻</a> <a href="https://github.com/Bionus/imgbrd-grabber/issues?q=author%3ABarryMode" title="Bug reports">🐛</a></td><td align="center"><a href="https://github.com/Flat"><img src="https://avatars3.githubusercontent.com/u/2048861?s=122" width="122px;" alt="Ken Swenson"/><br /><sub><b>Ken Swenson</b></sub></a><br /><a href="https://github.com/Bionus/imgbrd-grabber/commits?author=Flat" title="Code">💻</a> <a href="#platform-Flat" title="Packaging/porting to new platform">📦</a></td><td align="center"><a href="https://github.com/larry-he"><img src="https://avatars0.githubusercontent.com/u/18506295?s=122" width="122px;" alt="Larry He"/><br /><sub><b>Larry He</b></sub></a><br /><a href="https://github.com/Bionus/imgbrd-grabber/commits?author=larry-he" title="Code">💻</a></td></tr><tr><td align="center"><a href="https://github.com/brodycas3"><img src="https://avatars3.githubusercontent.com/u/19770864?s=122" width="122px;" alt="brodycas3"/><br /><sub><b>brodycas3</b></sub></a><br /><a href="https://github.com/Bionus/imgbrd-grabber/issues?q=author%3Abrodycas3" title="Bug reports">🐛</a></td><td align="center"><a href="https://github.com/sanddudu"><img src="https://avatars1.githubusercontent.com/u/1650692?s=122" width="122px;" alt="Klion Xu"/><br /><sub><b>Klion Xu</b></sub></a><br /><a href="#translation-sanddudu" title="Translation">🌍</a></td><td align="center"><a href="https://github.com/MasterPetrik"><img src="https://avatars2.githubusercontent.com/u/22294259?s=122" width="122px;" alt="MasterPetrik"/><br /><sub><b>MasterPetrik</b></sub></a><br /><a href="https://github.com/Bionus/imgbrd-grabber/issues?q=author%3AMasterPetrik" title="Bug reports">🐛</a> <a href="#translation-MasterPetrik" title="Translation">🌍</a> <a href="#ideas-MasterPetrik" title="Ideas, Planning, & Feedback">🤔</a></td><td align="center"><a href="https://github.com/dyskette"><img src="https://avatars3.githubusercontent.com/u/6687927?s=122" width="122px;" alt="Eddy Castillo"/><br /><sub><b>Eddy Castillo</b></sub></a><br /><a href="#translation-dyskette" title="Translation">🌍</a></td><td align="center"><a href="https://github.com/MrAndre96"><img src="https://avatars0.githubusercontent.com/u/6564956?s=122" width="122px;" alt="MrAndre96"/><br /><sub><b>MrAndre96</b></sub></a><br /><a href="https://github.com/Bionus/imgbrd-grabber/issues?q=author%3AMrAndre96" title="Bug reports">🐛</a></td><td align="center"><a href="https://github.com/brazenvoid"><img src="https://avatars1.githubusercontent.com/u/8722533?s=122" width="122px;" alt="Umair Ahmed"/><br /><sub><b>Umair Ahmed</b></sub></a><br /><a href="https://github.com/Bionus/imgbrd-grabber/issues?q=author%3Abrazenvoid" title="Bug reports">🐛</a></td></tr></table>

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification.
Expand Down
4 changes: 0 additions & 4 deletions e2e/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QNetworkAccessManager>
#include <QTimer>
#include "functions.h"
#include "logger.h"
Expand Down Expand Up @@ -70,7 +69,6 @@ int main(int argc, char *argv[])
QJsonDocument input = QJsonDocument::fromJson(f.readAll());
f.close();

auto manager = new QNetworkAccessManager();
Profile *profile = new Profile(savePath());
auto allSources = profile->getSources();
auto allSites = profile->getSites();
Expand Down Expand Up @@ -188,8 +186,6 @@ int main(int argc, char *argv[])
allJson[sourceName] = sourceJson;
}

manager->deleteLater();

profile->setBlacklistedTags(oldBlacklist);

QJsonDocument outDoc(allJson);
Expand Down
9 changes: 7 additions & 2 deletions gui/src/batch/add-unique-window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <ui_add-unique-window.h>
#include "downloader/download-query-image.h"
#include "helpers.h"
#include "logger.h"
#include "models/api/api.h"
#include "models/filename.h"
#include "models/image.h"
Expand Down Expand Up @@ -163,8 +164,9 @@ void AddUniqueWindow::loadNext()
void AddUniqueWindow::replyFinished(Page *p)
{
if (p->images().isEmpty()) {
log(QString("No image found for search '%1'").arg(p->search().join(' ')), Logger::Warning);
p->deleteLater();
error(this, tr("No image found."));
next();
return;
}

Expand All @@ -180,8 +182,11 @@ void AddUniqueWindow::addLoadedImage()
void AddUniqueWindow::addImage(const QSharedPointer<Image> &img)
{
emit sendData(DownloadQueryImage(img, m_sites[ui->comboSites->currentText()], ui->lineFilename->text(), ui->lineFolder->text()));
next();
}

void AddUniqueWindow::next()
{
ui->progressBar->setValue(ui->progressBar->value() + 1);

loadNext();
}
1 change: 1 addition & 0 deletions gui/src/batch/add-unique-window.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class AddUniqueWindow : public QDialog
void sendData(const DownloadQueryImage &);

protected:
void next();
void toggleMultiLine(bool toggle, QPlainTextEdit *ptxt, QLabel *label);

private:
Expand Down
7 changes: 5 additions & 2 deletions gui/src/batch/add-unique-window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
Expand All @@ -86,8 +89,8 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>400</height>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
Expand Down
10 changes: 8 additions & 2 deletions gui/src/favorite-window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ FavoriteWindow::FavoriteWindow(Profile *profile, Favorite favorite, QWidget *par
Monitor monitor = m_favorite.getMonitors().first();
ui->spinMonitoringInterval->setValue(qFloor(monitor.interval() / 60.0));
ui->comboMonitoringSource->setCurrentIndex(sourceKeys.indexOf(monitor.site()->url()));
ui->checkMonitoingDownload->setChecked(monitor.download());
ui->linePathOverride->setText(monitor.pathOverride());
ui->lineFilenameOverride->setText(monitor.filenameOverride());
}

connect(this, &QDialog::accepted, this, &FavoriteWindow::save);
Expand Down Expand Up @@ -74,14 +77,17 @@ void FavoriteWindow::save()

// Update monitors
int interval = ui->spinMonitoringInterval->value() * 60;
bool download = ui->checkMonitoingDownload->isChecked();
QString pathOverride = ui->linePathOverride->text();
QString filenameOverride = ui->lineFilenameOverride->text();
Site *site = m_profile->getSites().value(ui->comboMonitoringSource->currentText());
QList<Monitor> monitors = oldFav.getMonitors();
if (interval == 0) {
monitors.clear();
} else if (monitors.isEmpty()) {
monitors.append(Monitor(site, interval, QDateTime::currentDateTimeUtc()));
monitors.append(Monitor(site, interval, QDateTime::currentDateTimeUtc(), download, pathOverride, filenameOverride));
} else {
Monitor rep(site, interval, monitors[0].lastCheck());
Monitor rep(site, interval, monitors[0].lastCheck(), download, pathOverride, filenameOverride);
monitors[0] = rep;
}

Expand Down
48 changes: 41 additions & 7 deletions gui/src/favorite-window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>331</width>
<height>197</height>
<width>400</width>
<height>293</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -128,6 +128,16 @@
<string>Monitors</string>
</attribute>
<layout class="QFormLayout" name="formLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="labelMonitoringSource">
<property name="text">
<string>Source</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboMonitoringSource"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelMonitoringInterval">
<property name="text">
Expand Down Expand Up @@ -155,15 +165,39 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="labelMonitoringSource">
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="checkMonitoingDownload">
<property name="text">
<string>Source</string>
<string>Download</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboMonitoringSource"/>
<item row="4" column="0">
<widget class="QLabel" name="labelPathOverride">
<property name="text">
<string>Path</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="labelFilenameOverride">
<property name="text">
<string>Filename</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QLabel" name="labelOverrideHelp">
<property name="text">
<string>&lt;i&gt;Leave empty to use default settings.&lt;/i&gt;</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="linePathOverride"/>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="lineFilenameOverride"/>
</item>
</layout>
</widget>
Expand Down
28 changes: 17 additions & 11 deletions gui/src/main-window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "danbooru-downloader-importer.h"
#include "downloader/download-query-group.h"
#include "downloader/download-query-image.h"
#include "downloader/download-queue.h"
#include "functions.h"
#include "helpers.h"
#include "logger.h"
Expand All @@ -28,6 +29,7 @@
#include "models/filtering/post-filter.h"
#include "models/profile.h"
#include "monitoring-center.h"
#include "network/network-reply.h"
#include "settings/options-window.h"
#include "settings/start-window.h"
#include "tabs/downloads-tab.h"
Expand Down Expand Up @@ -219,12 +221,16 @@ void MainWindow::init(const QStringList &args, const QMap<QString, QString> &par
restoreGeometry(m_settings->value("geometry").toByteArray());
restoreState(m_settings->value("state").toByteArray());

// Download queue
const int maxConcurrency = qMax(1, qMin(m_settings->value("Save/simultaneous").toInt(), 10));
m_downloadQueue = new DownloadQueue(maxConcurrency, this);

// Tab bar context menu
ui->tabWidget->tabBar()->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->tabWidget->tabBar(), &QTabBar::customContextMenuRequested, this, &MainWindow::tabContextMenuRequested);

// Downloads tab
m_downloadsTab = new DownloadsTab(m_profile, this);
m_downloadsTab = new DownloadsTab(m_profile, m_downloadQueue, this);
ui->tabWidget->insertTab(m_tabs.size(), m_downloadsTab, m_downloadsTab->windowTitle());
ui->tabWidget->setCurrentIndex(0);

Expand All @@ -234,7 +240,7 @@ void MainWindow::init(const QStringList &args, const QMap<QString, QString> &par
}

// Favorites tab
m_favoritesTab = new FavoritesTab(m_profile, this);
m_favoritesTab = new FavoritesTab(m_profile, m_downloadQueue, this);
connect(m_favoritesTab, &SearchTab::batchAddGroup, m_downloadsTab, &DownloadsTab::batchAddGroup);
connect(m_favoritesTab, SIGNAL(batchAddUnique(DownloadQueryImage)), m_downloadsTab, SLOT(batchAddUnique(DownloadQueryImage)));
connect(m_favoritesTab, &SearchTab::titleChanged, this, &MainWindow::updateTabTitle);
Expand Down Expand Up @@ -371,7 +377,7 @@ void MainWindow::initialLoginsDone()
ui->tabWidget->setCurrentIndex(qMax(0, m_forcedTab));
m_forcedTab = -1;

m_monitoringCenter = new MonitoringCenter(m_profile, m_trayIcon, this);
m_monitoringCenter = new MonitoringCenter(m_profile, m_downloadQueue, m_trayIcon, this);
m_monitoringCenter->start();
}

Expand Down Expand Up @@ -418,7 +424,7 @@ void MainWindow::onFirstLoad()

void MainWindow::addTab(const QString &tag, bool background, bool save, SearchTab *source)
{
auto *w = new TagTab(m_profile, this);
auto *w = new TagTab(m_profile, m_downloadQueue, this);
this->addSearchTab(w, background, save, source);

if (!tag.isEmpty()) {
Expand All @@ -429,7 +435,7 @@ void MainWindow::addTab(const QString &tag, bool background, bool save, SearchTa
}
void MainWindow::addPoolTab(int pool, const QString &site, bool background, bool save, SearchTab *source)
{
auto *w = new PoolTab(m_profile, this);
auto *w = new PoolTab(m_profile, m_downloadQueue, this);
this->addSearchTab(w, background, save, source);

if (!site.isEmpty()) {
Expand All @@ -443,7 +449,7 @@ void MainWindow::addPoolTab(int pool, const QString &site, bool background, bool
}
void MainWindow::addGalleryTab(Site *site, QSharedPointer<Image> gallery, bool background, bool save, SearchTab *source)
{
auto *w = new GalleryTab(site, std::move(gallery), m_profile, this);
auto *w = new GalleryTab(site, std::move(gallery), m_profile, m_downloadQueue, this);
this->addSearchTab(w, background, save, source);
}
void MainWindow::addSearchTab(SearchTab *w, bool background, bool save, SearchTab *source)
Expand Down Expand Up @@ -505,7 +511,7 @@ bool MainWindow::loadTabs(const QString &filename)
QList<SearchTab*> tabs;
int currentTab;

if (!TabsLoader::load(filename, tabs, currentTab, m_profile, this)) {
if (!TabsLoader::load(filename, tabs, currentTab, m_profile, m_downloadQueue, this)) {
return false;
}

Expand Down Expand Up @@ -561,7 +567,7 @@ void MainWindow::restoreLastClosedTab()
}

QJsonObject infos = m_closedTabs.takeLast();
SearchTab *tab = TabsLoader::loadTab(infos, m_profile, this, true);
SearchTab *tab = TabsLoader::loadTab(infos, m_profile, m_downloadQueue, this, true);
addSearchTab(tab);

ui->actionRestoreLastClosedTab->setEnabled(!m_closedTabs.isEmpty());
Expand Down Expand Up @@ -1074,11 +1080,11 @@ void MainWindow::dropEvent(QDropEvent *event)
QString url = mimeData->text();
if (isUrl(url)) {
QEventLoop loopLoad;
QNetworkReply *reply = m_networkAccessManager.get(QNetworkRequest(QUrl(url)));
connect(reply, &QNetworkReply::finished, &loopLoad, &QEventLoop::quit);
NetworkReply *reply = m_networkManager.get(QNetworkRequest(QUrl(url)));
connect(reply, &NetworkReply::finished, &loopLoad, &QEventLoop::quit);
loopLoad.exec();

if (reply->error() == QNetworkReply::NoError) {
if (reply->error() == NetworkReply::NetworkError::NoError) {
QString md5 = QCryptographicHash::hash(reply->readAll(), QCryptographicHash::Md5).toHex();
loadTag("md5:" + md5, true, false);
}
Expand Down
Loading

0 comments on commit 0408cf7

Please sign in to comment.