mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-25 22:14:32 +00:00
commit
1baa71c97a
@ -34,6 +34,7 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QHostAddress>
|
#include <QHostAddress>
|
||||||
|
#include <QLocale>
|
||||||
|
|
||||||
#include "base/logger.h"
|
#include "base/logger.h"
|
||||||
#include "base/preferences.h"
|
#include "base/preferences.h"
|
||||||
@ -100,12 +101,15 @@ void GeoIPManager::loadDatabase()
|
|||||||
|
|
||||||
QString error;
|
QString error;
|
||||||
m_geoIPDatabase = GeoIPDatabase::load(filepath, error);
|
m_geoIPDatabase = GeoIPDatabase::load(filepath, error);
|
||||||
if (m_geoIPDatabase)
|
if (m_geoIPDatabase) {
|
||||||
|
const QLocale locale {Preferences::instance()->getLocale()};
|
||||||
Logger::instance()->addMessage(tr("GeoIP database loaded. Type: %1. Build time: %2.")
|
Logger::instance()->addMessage(tr("GeoIP database loaded. Type: %1. Build time: %2.")
|
||||||
.arg(m_geoIPDatabase->type(), m_geoIPDatabase->buildEpoch().toString()),
|
.arg(m_geoIPDatabase->type(), locale.toString(m_geoIPDatabase->buildEpoch())),
|
||||||
Log::INFO);
|
Log::INFO);
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
Logger::instance()->addMessage(tr("Couldn't load GeoIP database. Reason: %1").arg(error), Log::WARNING);
|
Logger::instance()->addMessage(tr("Couldn't load GeoIP database. Reason: %1").arg(error), Log::WARNING);
|
||||||
|
}
|
||||||
|
|
||||||
manageDatabaseUpdate();
|
manageDatabaseUpdate();
|
||||||
}
|
}
|
||||||
|
@ -71,6 +71,21 @@
|
|||||||
#include "ui_optionsdialog.h"
|
#include "ui_optionsdialog.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
QStringList translatedWeekdayNames()
|
||||||
|
{
|
||||||
|
// return translated strings from Monday to Sunday in user selected locale
|
||||||
|
|
||||||
|
const QLocale locale {Preferences::instance()->getLocale()};
|
||||||
|
const QDate date {2018, 11, 5}; // Monday
|
||||||
|
QStringList ret;
|
||||||
|
for (int i = 0; i < 7; ++i)
|
||||||
|
ret.append(locale.toString(date.addDays(i), "dddd"));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class WheelEventEater : public QObject
|
class WheelEventEater : public QObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -164,8 +179,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
|||||||
initializeLanguageCombo();
|
initializeLanguageCombo();
|
||||||
|
|
||||||
// Load week days (scheduler)
|
// Load week days (scheduler)
|
||||||
for (uint i = 1; i <= 7; ++i)
|
m_ui->comboBoxScheduleDays->addItems(translatedWeekdayNames());
|
||||||
m_ui->comboBoxScheduleDays->addItem(QDate::longDayName(i, QDate::StandaloneFormat));
|
|
||||||
|
|
||||||
// Load options
|
// Load options
|
||||||
loadOptions();
|
loadOptions();
|
||||||
|
@ -37,10 +37,6 @@
|
|||||||
#include "base/utils/misc.h"
|
#include "base/utils/misc.h"
|
||||||
#include "searchsortmodel.h"
|
#include "searchsortmodel.h"
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
const char i18nContext[] = "SearchListDelegate";
|
|
||||||
}
|
|
||||||
|
|
||||||
SearchListDelegate::SearchListDelegate(QObject *parent)
|
SearchListDelegate::SearchListDelegate(QObject *parent)
|
||||||
: QItemDelegate(parent)
|
: QItemDelegate(parent)
|
||||||
@ -63,7 +59,7 @@ void SearchListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
|
|||||||
case SearchSortModel::LEECHES:
|
case SearchSortModel::LEECHES:
|
||||||
opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter;
|
opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter;
|
||||||
QItemDelegate::drawDisplay(painter, opt, option.rect
|
QItemDelegate::drawDisplay(painter, opt, option.rect
|
||||||
, (index.data().toLongLong() >= 0) ? index.data().toString() : QCoreApplication::translate(i18nContext, "Unknown"));
|
, (index.data().toLongLong() >= 0) ? index.data().toString() : tr("Unknown"));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
QItemDelegate::paint(painter, option, index);
|
QItemDelegate::paint(painter, option, index);
|
||||||
|
@ -33,6 +33,8 @@
|
|||||||
|
|
||||||
class SearchListDelegate : public QItemDelegate
|
class SearchListDelegate : public QItemDelegate
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SearchListDelegate(QObject *parent);
|
explicit SearchListDelegate(QObject *parent);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user