mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
commit
1baa71c97a
@ -34,6 +34,7 @@
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QHostAddress>
|
||||
#include <QLocale>
|
||||
|
||||
#include "base/logger.h"
|
||||
#include "base/preferences.h"
|
||||
@ -100,12 +101,15 @@ void GeoIPManager::loadDatabase()
|
||||
|
||||
QString 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.")
|
||||
.arg(m_geoIPDatabase->type(), m_geoIPDatabase->buildEpoch().toString()),
|
||||
.arg(m_geoIPDatabase->type(), locale.toString(m_geoIPDatabase->buildEpoch())),
|
||||
Log::INFO);
|
||||
else
|
||||
}
|
||||
else {
|
||||
Logger::instance()->addMessage(tr("Couldn't load GeoIP database. Reason: %1").arg(error), Log::WARNING);
|
||||
}
|
||||
|
||||
manageDatabaseUpdate();
|
||||
}
|
||||
|
@ -71,6 +71,21 @@
|
||||
#include "ui_optionsdialog.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
|
||||
{
|
||||
public:
|
||||
@ -164,8 +179,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
||||
initializeLanguageCombo();
|
||||
|
||||
// Load week days (scheduler)
|
||||
for (uint i = 1; i <= 7; ++i)
|
||||
m_ui->comboBoxScheduleDays->addItem(QDate::longDayName(i, QDate::StandaloneFormat));
|
||||
m_ui->comboBoxScheduleDays->addItems(translatedWeekdayNames());
|
||||
|
||||
// Load options
|
||||
loadOptions();
|
||||
|
@ -37,10 +37,6 @@
|
||||
#include "base/utils/misc.h"
|
||||
#include "searchsortmodel.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
const char i18nContext[] = "SearchListDelegate";
|
||||
}
|
||||
|
||||
SearchListDelegate::SearchListDelegate(QObject *parent)
|
||||
: QItemDelegate(parent)
|
||||
@ -63,7 +59,7 @@ void SearchListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
|
||||
case SearchSortModel::LEECHES:
|
||||
opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter;
|
||||
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;
|
||||
default:
|
||||
QItemDelegate::paint(painter, option, index);
|
||||
|
@ -33,6 +33,8 @@
|
||||
|
||||
class SearchListDelegate : public QItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SearchListDelegate(QObject *parent);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user