Skip to content

Commit

Permalink
Version 5.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Bionus committed Mar 11, 2017
2 parents 1292b31 + 5d51bd5 commit 4f71ca7
Show file tree
Hide file tree
Showing 36 changed files with 4,534 additions and 186 deletions.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@



### How often does this problem occur?




### What version of the program are you using? On what operating system?


Expand Down
1 change: 1 addition & 0 deletions CrashReporter/CrashReporter.pro
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ TRANSLATIONS += languages/English.ts \
languages/French.ts \
languages/ChineseSimplified.ts \
languages/Russian.ts \
languages/Spanish.ts \
languages/YourLanguage.ts
57 changes: 57 additions & 0 deletions CrashReporter/languages/Spanish.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="es_MX" sourcelanguage="en_US">
<context>
<name>MainWindow</name>
<message>
<location filename="../mainwindow.ui" line="14"/>
<source>Crash Reporter</source>
<translation>Reporte de errores</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="28"/>
<source>Sorry</source>
<translation>Lo sentimos</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="44"/>
<source>Grabber encountered a problem and crashed. The program will try to restore your tabs and other settings when it restarts.</source>
<translation>Grabber ha encontrado un problema y cerrado inesperadamente. El programa intentará restaurar sus pestañas y configuraciones cuando reinicie.</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="60"/>
<source>To help us fix this crash, you can send us a bug report.</source>
<translation>Para ayudarnos a resolver este error, puedes enviarnos un reporte de error.</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="70"/>
<source>Send a bug report</source>
<translation>Enviar un reporte de error</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="95"/>
<source>Log</source>
<translation>Registros</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="102"/>
<source>Settings</source>
<translation>Configuraciones</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="109"/>
<source>Dump</source>
<translation>Vaciado</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="155"/>
<source>Restart</source>
<translation>Reiniciar</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="162"/>
<source>Quit</source>
<translation>Cerrar</translation>
</message>
</context>
</TS>
3 changes: 2 additions & 1 deletion Grabber.pri
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RCC_DIR = $$DESTDIR/qrc
UI_DIR = $$DESTDIR/ui

# Global
APP_VERSION = \\\"5.2.2\\\"
APP_VERSION = \\\"5.2.3\\\"
APP_PREFIX = \\\"$$(PREFIX)\\\"
# General
Expand All @@ -34,6 +34,7 @@ TRANSLATIONS += $${PWD}/languages/English.ts \
$${PWD}/languages/French.ts \
$${PWD}/languages/Russian.ts \
$${PWD}/languages/ChineseSimplified.ts \
$${PWD}/languages/Spanish.ts \
$${PWD}/languages/YourLanguage.ts

# Target WinXP
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ You can download the latest release [here](https://github.com/Bionus/imgbrd-grab
* French
* Russian
* Chinese (simplified)
* Spanish

## Default sources
You can add additional sources very easily, but here's a shot list of some sources that are included and supported by default: Danbooru, Gelbooru, yande.re, Shimmie, Sankaku complex, e621, Konachan, rule34, safebooru, behoimi, Zerochan...
Expand Down
2 changes: 1 addition & 1 deletion gui/src/batch/batchwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<number>0</number>
</property>
<property name="format">
<string>%p%</string>
<string notr="true">%p%</string>
</property>
</widget>
</item>
Expand Down
69 changes: 51 additions & 18 deletions gui/src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "helpers.h"
#include "downloader/download-query-loader.h"
#include "tabs/tabs-loader.h"
#include "theme-loader.h"



Expand All @@ -48,9 +49,6 @@ void mainWindow::init(QStringList args, QMap<QString,QString> params)
m_settings->setValue("crashed", true);
m_settings->sync();

loadLanguage(m_settings->value("language", "English").toString(), true);
ui->setupUi(this);

m_showLog = m_settings->value("Log/show", true).toBool();
if (!m_showLog)
{ ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabLog)); }
Expand All @@ -60,6 +58,36 @@ void mainWindow::init(QStringList args, QMap<QString,QString> params)
log(QString("Path: %1").arg(qApp->applicationDirPath()));
log(QString("Loading preferences from <a href=\"file:///%1\">%1</a>").arg(m_settings->fileName()));

ThemeLoader themeLoader(savePath("themes/", true));
themeLoader.setTheme(m_settings->value("theme", "Default").toString());
ui->setupUi(this);

// On first launch after setup, we restore the setup's language
QString setupSettingsFile = savePath("innosetup.ini");
if (QFile::exists(setupSettingsFile))
{
QSettings setupSettings(setupSettingsFile, QSettings::IniFormat);
QString setupLanguage = setupSettings.value("language", "en").toString();

QSettings associations(savePath("languages/languages.ini"), QSettings::IniFormat);
associations.beginGroup("innosetup");
QStringList keys = associations.childKeys();

// Only if the setup language is available in Grabber
if (keys.contains(setupLanguage))
{
m_settings->setValue("language", associations.value(setupLanguage).toString());
}

// Remove the setup settings file to not do this every time
QFile::remove(setupSettingsFile);
}

// Load translations
qApp->installTranslator(&m_translator);
qApp->installTranslator(&m_qtTranslator);
loadLanguage(m_settings->value("language", "English").toString());

tabifyDockWidget(ui->dock_internet, ui->dock_wiki);
tabifyDockWidget(ui->dock_wiki, ui->dock_kfl);
tabifyDockWidget(ui->dock_kfl, ui->dock_favorites);
Expand Down Expand Up @@ -123,8 +151,6 @@ void mainWindow::init(QStringList args, QMap<QString,QString> params)
ui->actionQuit->setShortcut(QKeySequence::Quit);
ui->actionFolder->setShortcut(QKeySequence::Open);

loadLanguage(m_settings->value("language", "English").toString());

connect(ui->actionQuit, SIGNAL(triggered()), qApp, SLOT(quit()));
connect(ui->actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));

Expand Down Expand Up @@ -165,6 +191,7 @@ void mainWindow::init(QStringList args, QMap<QString,QString> params)
m_favoritesTab = new favoritesTab(&m_sites, m_profile, this);
connect(m_favoritesTab, &searchTab::batchAddGroup, this, &mainWindow::batchAddGroup);
connect(m_favoritesTab, SIGNAL(batchAddUnique(DownloadQueryImage)), this, SLOT(batchAddUnique(DownloadQueryImage)));
connect(m_favoritesTab, &searchTab::titleChanged, this, &mainWindow::updateTabTitle);
connect(m_favoritesTab, &searchTab::changed, this, &mainWindow::updateTabs);
ui->tabWidget->insertTab(m_tabs.size(), m_favoritesTab, tr("Favorites"));
ui->tabWidget->setCurrentIndex(0);
Expand Down Expand Up @@ -225,7 +252,7 @@ void mainWindow::init(QStringList args, QMap<QString,QString> params)
// Check for updates
int cfuInterval = m_settings->value("check_for_updates", 24*60*60).toInt();
QDateTime lastCfu = m_settings->value("last_check_for_updates", QDateTime()).toDateTime();
if (cfuInterval > 0 && (!lastCfu.isValid() || lastCfu.addSecs(cfuInterval) <= QDateTime::currentDateTime()))
if (cfuInterval >= 0 && (!lastCfu.isValid() || lastCfu.addSecs(cfuInterval) <= QDateTime::currentDateTime()))
{
m_settings->setValue("last_check_for_updates", QDateTime::currentDateTime());

Expand Down Expand Up @@ -490,8 +517,11 @@ bool mainWindow::loadTabs(QString filename)
m_tagTabs.append(tagTabs);
m_poolTabs.append(poolTabs);

ui->tabWidget->setCurrentIndex(currentTab);
m_forcedTab = true;
if (currentTab >= 0)
{
ui->tabWidget->setCurrentIndex(currentTab);
m_forcedTab = true;
}

return true;
}
Expand Down Expand Up @@ -938,20 +968,17 @@ void mainWindow::logClear()
void mainWindow::logOpen()
{ QDesktopServices::openUrl("file:///" + m_profile->getPath() + "/main.log"); }

void mainWindow::switchTranslator(QTranslator& translator, const QString& filename)
{
qApp->removeTranslator(&translator);
if (translator.load(filename))
{ qApp->installTranslator(&translator); }
}
void mainWindow::loadLanguage(const QString& rLanguage, bool shutup)
{
if (m_currLang != rLanguage)
{
m_currLang = rLanguage;
QLocale locale = QLocale(m_currLang);
QLocale::setDefault(locale);
switchTranslator(m_translator, savePath("languages/"+m_currLang+".qm", true));

m_translator.load(savePath("languages/"+m_currLang+".qm", true));
m_qtTranslator.load(savePath("languages/qt/"+m_currLang+".qm", true));

if (!shutup)
{
log(QString("Translating texts in %1...").arg(m_currLang));
Expand Down Expand Up @@ -1122,6 +1149,7 @@ void mainWindow::getAll(bool all)
m_getAllFailed.clear();
m_getAllDownloading.clear();
m_getAllSkippedImages.clear();
m_batchPending.clear();

QList<QTableWidgetItem *> selected = ui->tableBatchUniques->selectedItems();
int count = selected.size();
Expand Down Expand Up @@ -1271,14 +1299,18 @@ void mainWindow::getAllFinishedLogins()
int imagesPerPack = pagesPerPack * b.perpage;
int packs = qCeil((float)b.total / imagesPerPack);

int lastPageImages = b.total % imagesPerPack;
if (lastPageImages == 0)
lastPageImages = imagesPerPack;

for (int i = 0; i < packs; ++i)
{
Downloader *downloader = new Downloader(m_profile,
b.tags.split(' '),
QStringList(),
QList<Site*>() << b.site,
b.page + i * pagesPerPack,
(i == packs - 1 ? b.total % imagesPerPack : imagesPerPack),
(i == packs - 1 ? lastPageImages : imagesPerPack),
b.perpage,
b.path,
b.filename,
Expand Down Expand Up @@ -1728,7 +1760,7 @@ void mainWindow::getAllGetImage(QSharedPointer<Image> img)
{
if (whatToDo == "copy")
{
m_getAllIgnored++;
m_getAllDownloaded++;
log(QString("Copy from <a href=\"file:///%1\">%1</a> vers <a href=\"file:///%2\">%2</a>").arg(md5Duplicate).arg(fp));
QFile::copy(md5Duplicate, fp);

Expand All @@ -1747,7 +1779,7 @@ void mainWindow::getAllGetImage(QSharedPointer<Image> img)
}
else
{
m_getAllIgnored++;
m_getAllExists++;
log(QString("MD5 \"%1\" of the image <a href=\"%2\">%2</a> already found in file <a href=\"file:///%3\">%3</a>").arg(img->md5(), img->url(), md5Duplicate));
}
}
Expand Down Expand Up @@ -1996,6 +2028,7 @@ void mainWindow::getAllFinished()
int pos = i - rem;
m_progressBars[pos]->deleteLater();
m_progressBars.removeAt(pos);
m_groupBatchs.removeAt(pos);
ui->tableBatchGroups->removeRow(pos);
rem++;
}
Expand Down
3 changes: 1 addition & 2 deletions gui/src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ class mainWindow : public QMainWindow
void md5FixOpen();
void renameExisting();
// Language
void switchTranslator(QTranslator&, const QString&);
void loadLanguage(const QString&, bool shutup = false);
void changeEvent(QEvent*);
// Favorites
Expand Down Expand Up @@ -194,7 +193,7 @@ class mainWindow : public QMainWindow
QSettings *m_settings;
batchWindow *m_progressdialog;
QString m_currLang, m_link;
QTranslator m_translator;
QTranslator m_translator, m_qtTranslator;
QList<DownloadQueryGroup> m_groupBatchs;
QList<QSharedPointer<Image>> m_getAllRemaining, m_getAllDownloading, m_getAllFailed, m_images, m_getAllSkippedImages;
QWidget *m_currentTab;
Expand Down
14 changes: 14 additions & 0 deletions gui/src/settings/optionswindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "functions.h"
#include "helpers.h"
#include "language-loader.h"
#include "theme-loader.h"



Expand Down Expand Up @@ -198,6 +199,13 @@ optionsWindow::optionsWindow(Profile *profile, QWidget *parent)
ui->layoutCustom->insertRow(i, leName, leTags);
}

// Themes
ThemeLoader themeLoader(savePath("themes/", true));
QStringList themes = themeLoader.getAllThemes();
for (QString theme : themes)
{ ui->comboTheme->addItem(theme, theme); }
ui->comboTheme->setCurrentText(settings->value("theme", "Default").toString());

QStringList positions = QStringList() << "top" << "left" << "auto";
ui->comboTagsPosition->setCurrentIndex(positions.indexOf(settings->value("tagsposition", "top").toString()));
ui->spinPreload->setValue(settings->value("preload", 0).toInt());
Expand Down Expand Up @@ -691,6 +699,12 @@ void optionsWindow::save()
settings->endGroup();
settings->endGroup();

// Themes
QString theme = ui->comboTheme->currentText();
ThemeLoader themeLoader(savePath("themes/", true));
if (themeLoader.setTheme(theme))
{ settings->setValue("theme", theme); }

QStringList positions = QStringList() << "top" << "left" << "auto";
settings->setValue("tagsposition", positions.at(ui->comboTagsPosition->currentIndex()));
settings->setValue("preload", ui->spinPreload->value());
Expand Down
Loading

0 comments on commit 4f71ca7

Please sign in to comment.