Skip to content

Commit

Permalink
Version 6.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Bionus committed Jun 11, 2018
2 parents c6b55fa + bda3f49 commit 2e07d6f
Show file tree
Hide file tree
Showing 85 changed files with 642 additions and 523 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ endif()
project(Grabber)
set(USE_SSL 1)

add_definitions(-DVERSION="6.0.1")
add_definitions(-DVERSION="6.0.2")
add_definitions(-DPROJECT_WEBSITE_URL="https://bionus.github.io/imgbrd-grabber/")
add_definitions(-DPROJECT_GITHUB_URL="https://github.com/Bionus/imgbrd-grabber")
add_definitions(-DSOURCE_ISSUES_URL="https://raw.githubusercontent.com/wiki/Bionus/imgbrd-grabber/SourceIssues.md")
Expand Down
42 changes: 21 additions & 21 deletions gui/src/batch/batchwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void batchWindow::closeEvent(QCloseEvent *e)
void batchWindow::pause()
{
m_paused = !m_paused;
ui->labelSpeed->setText(m_paused ? tr("Paused") : "");
ui->labelSpeed->setText(m_paused ? tr("Paused") : QString());
ui->buttonPause->setText(m_paused ? tr("Resume") : tr("Pause"));

#ifdef Q_OS_WIN
Expand Down Expand Up @@ -114,7 +114,7 @@ void batchWindow::clear()

ui->progressTotal->setValue(0);
ui->progressTotal->setMaximum(100);
ui->labelImages->setText("0/0");
ui->labelImages->setText(QStringLiteral("0/0"));
ui->cancelButton->setText(tr("Cancel"));

#ifdef Q_OS_WIN
Expand All @@ -137,10 +137,10 @@ void batchWindow::clearImages()

ui->tableWidget->clearContents();
ui->tableWidget->setRowCount(0);
ui->labelMessage->setText("");
ui->labelMessage->setText(QString());
ui->progressCurrent->setValue(0);
ui->progressCurrent->setMaximum(100);
ui->labelSpeed->setText("");
ui->labelSpeed->setText(QString());

qDeleteAll(m_progressBars);
m_progressBars.clear();
Expand Down Expand Up @@ -169,12 +169,12 @@ void batchWindow::copyToClipboard()
{ urls.append(selected.at(i)->text()); }
}
}
qApp->clipboard()->setText(urls.join("\n"));
qApp->clipboard()->setText(urls.join('\n'));
}

void batchWindow::setCount(int cnt)
{ ui->tableWidget->setRowCount(cnt); }
void batchWindow::addImage(const QString &url, int batch, float size)
void batchWindow::addImage(const QString &url, int batch, double size)
{
m_urls.append(url);

Expand All @@ -186,9 +186,9 @@ void batchWindow::addImage(const QString &url, int batch, float size)
ui->tableWidget->setItem(m_items, 1, new QTableWidgetItem(QString::number(batch)));
ui->tableWidget->setItem(m_items, 2, new QTableWidgetItem(url));
QString unit = getUnit(&size);
ui->tableWidget->setItem(m_items, 3, new QTableWidgetItem(size != 0 ? QLocale::system().toString(size, 'f', size < 10 ? 2 : 0)+" "+unit : ""));
ui->tableWidget->setItem(m_items, 3, new QTableWidgetItem(size > 0 ? QLocale::system().toString(size, 'f', size < 10 ? 2 : 0) + " " + unit : QString()));
ui->tableWidget->setItem(m_items, 4, new QTableWidgetItem());
ui->tableWidget->setItem(m_items, 5, new QTableWidgetItem("0 %"));
ui->tableWidget->setItem(m_items, 5, new QTableWidgetItem(QStringLiteral("0 %")));

/* auto *progressBar = new QProgressBar(this);
progressBar->setTextVisible(false);
Expand Down Expand Up @@ -257,8 +257,8 @@ void batchWindow::imageUrlChanged(const QString &before, const QString &after)
{
m_urls[i] = after;
ui->tableWidget->item(i, 2)->setText(after);
ui->tableWidget->item(i, 3)->setText("");
ui->tableWidget->item(i, 4)->setText("");
ui->tableWidget->item(i, 3)->setText(QString());
ui->tableWidget->item(i, 4)->setText(QString());
ui->tableWidget->item(i, 5)->setText("0 %");
}
}
Expand All @@ -268,7 +268,7 @@ void batchWindow::statusImage(const QString &url, int percent)
if (i != -1)
ui->tableWidget->item(i, 5)->setText(QString::number(percent)+" %");
}
void batchWindow::speedImage(const QString &url, float speed)
void batchWindow::speedImage(const QString &url, double speed)
{
m_speeds[url] = static_cast<int>(speed);
QString unit = getUnit(&speed)+"/s";
Expand All @@ -279,15 +279,15 @@ void batchWindow::speedImage(const QString &url, float speed)

drawSpeed();
}
void batchWindow::sizeImage(const QString &url, float size)
void batchWindow::sizeImage(const QString &url, double size)
{
int i = indexOf(url);
if (i != -1)
{
QString unit = getUnit(&size);
QString label = size > 0
? QLocale::system().toString(size, 'f', size < 10 ? 2 : 0) + " "+unit
: "";
: QString();
ui->tableWidget->item(i, 3)->setText(label);
}
}
Expand All @@ -307,8 +307,8 @@ void batchWindow::loadedImage(const QString &url, Downloadable::SaveResult resul
if (i != -1)
{
scrollTo(i);
ui->tableWidget->item(i, 4)->setText("");
ui->tableWidget->item(i, 5)->setText("");
ui->tableWidget->item(i, 4)->setText(QString());
ui->tableWidget->item(i, 5)->setText(QString());

switch (result)
{
Expand Down Expand Up @@ -343,14 +343,14 @@ void batchWindow::drawSpeed()
{ return; }
m_time->restart();

float speed = 0;
double speed = 0;
for (auto sp = m_speeds.begin(); sp != m_speeds.end(); ++sp)
{ speed += sp.value(); }
if (m_speeds.size() == m_maxSpeeds)
{ m_mean.append(speed); }
QString unit = getUnit(&speed)+"/s";
{ m_mean.append(qRound(speed)); }
QString unit = getUnit(&speed) + "/s";

float speedMean = 0;
double speedMean = 0;
int count = qMin(m_mean.count(), 60);
if (count > 0)
{
Expand Down Expand Up @@ -398,7 +398,7 @@ void batchWindow::setCurrentMax(int max)
void batchWindow::setTotalValue(int val)
{
m_images = val;
ui->labelImages->setText(QString("%1/%2").arg(m_images).arg(m_imagesCount));
ui->labelImages->setText(QStringLiteral("%1/%2").arg(m_images).arg(m_imagesCount));
ui->progressTotal->setValue(val);

if (val >= m_imagesCount)
Expand All @@ -411,7 +411,7 @@ void batchWindow::setTotalValue(int val)
void batchWindow::setTotalMax(int max)
{
m_imagesCount = max;
ui->labelImages->setText(QString("0/%2").arg(max));
ui->labelImages->setText(QStringLiteral("0/%2").arg(max));
ui->progressTotal->setMaximum(max);

#ifdef Q_OS_WIN
Expand Down
6 changes: 3 additions & 3 deletions gui/src/batch/batchwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ class batchWindow : public QDialog
void setCurrentMax(int max);
void setTotalValue(int val);
void setTotalMax(int max);
void addImage(const QString &, int, float);
void sizeImage(const QString &, float);
void addImage(const QString &, int, double);
void sizeImage(const QString &, double);
void loadingImage(const QString &url);
void statusImage(const QString &, int);
void speedImage(const QString &, float);
void speedImage(const QString &, double);
void loadedImage(const QString &url, Downloadable::SaveResult result);
void on_buttonDetails_clicked(bool visible);
void closeEvent(QCloseEvent *) override;
Expand Down
Loading

0 comments on commit 2e07d6f

Please sign in to comment.