mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-10 13:54:23 +00:00
commit
7233274110
@ -91,7 +91,7 @@ bool InfoHash::operator!=(const InfoHash &other) const
|
|||||||
return (m_nativeHash != other.m_nativeHash);
|
return (m_nativeHash != other.m_nativeHash);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint qHash(const InfoHash &key, uint seed)
|
uint BitTorrent::qHash(const InfoHash &key, uint seed)
|
||||||
{
|
{
|
||||||
return qHash(static_cast<QString>(key), seed);
|
return qHash(static_cast<QString>(key), seed);
|
||||||
}
|
}
|
||||||
|
@ -54,8 +54,8 @@ namespace BitTorrent
|
|||||||
libtorrent::sha1_hash m_nativeHash;
|
libtorrent::sha1_hash m_nativeHash;
|
||||||
QString m_hashString;
|
QString m_hashString;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
uint qHash(const InfoHash &key, uint seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint qHash(const BitTorrent::InfoHash &key, uint seed);
|
|
||||||
|
|
||||||
#endif // BITTORRENT_INFOHASH_H
|
#endif // BITTORRENT_INFOHASH_H
|
||||||
|
@ -3748,7 +3748,7 @@ void Session::recursiveTorrentDownload(const InfoHash &hash)
|
|||||||
Logger::instance()->addMessage(
|
Logger::instance()->addMessage(
|
||||||
tr("Recursive download of file '%1' embedded in torrent '%2'"
|
tr("Recursive download of file '%1' embedded in torrent '%2'"
|
||||||
, "Recursive download of 'test.torrent' embedded in torrent 'test2'")
|
, "Recursive download of 'test.torrent' embedded in torrent 'test2'")
|
||||||
.arg(Utils::Fs::toNativePath(torrentRelpath)).arg(torrent->name()));
|
.arg(Utils::Fs::toNativePath(torrentRelpath), torrent->name()));
|
||||||
const QString torrentFullpath = torrent->savePath() + "/" + torrentRelpath;
|
const QString torrentFullpath = torrent->savePath() + "/" + torrentRelpath;
|
||||||
|
|
||||||
AddTorrentParams params;
|
AddTorrentParams params;
|
||||||
|
@ -597,7 +597,7 @@ void Utils::Misc::openFolderSelect(const QString &absolutePath)
|
|||||||
{
|
{
|
||||||
const QString path = Utils::Fs::fromNativePath(absolutePath);
|
const QString path = Utils::Fs::fromNativePath(absolutePath);
|
||||||
// If the item to select doesn't exist, try to open its parent
|
// If the item to select doesn't exist, try to open its parent
|
||||||
if (!QFileInfo(path).exists()) {
|
if (!QFileInfo::exists(path)) {
|
||||||
openPath(path.left(path.lastIndexOf("/")));
|
openPath(path.left(path.lastIndexOf("/")));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ FileSystemPathEdit::FileSystemPathEdit(Private::FileEditorWithCompletion *editor
|
|||||||
layout->addWidget(editor->widget());
|
layout->addWidget(editor->widget());
|
||||||
layout->addWidget(d->m_browseBtn);
|
layout->addWidget(d->m_browseBtn);
|
||||||
|
|
||||||
connect(d->m_browseAction, &QAction::triggered, [this]() {this->d_func()->browseActionTriggered();});
|
connect(d->m_browseAction, &QAction::triggered, this, [this]() { this->d_func()->browseActionTriggered(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSystemPathEdit::~FileSystemPathEdit() = default;
|
FileSystemPathEdit::~FileSystemPathEdit() = default;
|
||||||
|
@ -392,7 +392,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
|||||||
connect(m_ui->textSmartEpisodeFilters, &QPlainTextEdit::textChanged, this, &OptionsDialog::enableApplyButton);
|
connect(m_ui->textSmartEpisodeFilters, &QPlainTextEdit::textChanged, this, &OptionsDialog::enableApplyButton);
|
||||||
connect(m_ui->spinRSSRefreshInterval, qSpinBoxValueChanged, this, &OptionsDialog::enableApplyButton);
|
connect(m_ui->spinRSSRefreshInterval, qSpinBoxValueChanged, this, &OptionsDialog::enableApplyButton);
|
||||||
connect(m_ui->spinRSSMaxArticlesPerFeed, qSpinBoxValueChanged, this, &OptionsDialog::enableApplyButton);
|
connect(m_ui->spinRSSMaxArticlesPerFeed, qSpinBoxValueChanged, this, &OptionsDialog::enableApplyButton);
|
||||||
connect(m_ui->btnEditRules, &QPushButton::clicked, [this]() { AutomatedRssDownloader(this).exec(); });
|
connect(m_ui->btnEditRules, &QPushButton::clicked, this, [this]() { AutomatedRssDownloader(this).exec(); });
|
||||||
|
|
||||||
// Disable apply Button
|
// Disable apply Button
|
||||||
applyButton->setEnabled(false);
|
applyButton->setEnabled(false);
|
||||||
|
@ -69,7 +69,7 @@ public:
|
|||||||
|
|
||||||
struct PointData
|
struct PointData
|
||||||
{
|
{
|
||||||
uint x;
|
qint64 x;
|
||||||
int y[NB_GRAPHS];
|
int y[NB_GRAPHS];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ void SpeedWidget::update()
|
|||||||
const BitTorrent::SessionStatus &btStatus = BitTorrent::Session::instance()->status();
|
const BitTorrent::SessionStatus &btStatus = BitTorrent::Session::instance()->status();
|
||||||
|
|
||||||
SpeedPlotView::PointData point;
|
SpeedPlotView::PointData point;
|
||||||
point.x = QDateTime::currentDateTime().toTime_t();
|
point.x = QDateTime::currentMSecsSinceEpoch() / 1000;
|
||||||
point.y[SpeedPlotView::UP] = btStatus.uploadRate;
|
point.y[SpeedPlotView::UP] = btStatus.uploadRate;
|
||||||
point.y[SpeedPlotView::DOWN] = btStatus.downloadRate;
|
point.y[SpeedPlotView::DOWN] = btStatus.downloadRate;
|
||||||
point.y[SpeedPlotView::PAYLOAD_UP] = btStatus.payloadUploadRate;
|
point.y[SpeedPlotView::PAYLOAD_UP] = btStatus.payloadUploadRate;
|
||||||
|
@ -52,10 +52,11 @@ public:
|
|||||||
protected slots:
|
protected slots:
|
||||||
void updateSpinValue(int val) const;
|
void updateSpinValue(int val) const;
|
||||||
void updateSliderValue(int val) const;
|
void updateSliderValue(int val) const;
|
||||||
long getSpeedLimit() const;
|
|
||||||
void setupDialog(long max_slider, long val) const;
|
void setupDialog(long max_slider, long val) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
long getSpeedLimit() const;
|
||||||
|
|
||||||
Ui::bandwidth_dlg *m_ui;
|
Ui::bandwidth_dlg *m_ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ namespace
|
|||||||
, m_sizeHint(QCheckBox(m_text).sizeHint())
|
, m_sizeHint(QCheckBox(m_text).sizeHint())
|
||||||
{
|
{
|
||||||
m_checkBox->setCheckState(initialState);
|
m_checkBox->setCheckState(initialState);
|
||||||
connect(m_checkBox, &QCheckBox::stateChanged, [this, onToggle](int newState)
|
connect(m_checkBox, &QCheckBox::stateChanged, this, [this, onToggle](int newState)
|
||||||
{
|
{
|
||||||
m_checkBox->setTristate(false);
|
m_checkBox->setTristate(false);
|
||||||
onToggle(static_cast<Qt::CheckState>(newState));
|
onToggle(static_cast<Qt::CheckState>(newState));
|
||||||
|
@ -78,7 +78,7 @@ void AuthController::logoutAction()
|
|||||||
|
|
||||||
bool AuthController::isBanned() const
|
bool AuthController::isBanned() const
|
||||||
{
|
{
|
||||||
const uint now = QDateTime::currentDateTime().toTime_t();
|
const qint64 now = QDateTime::currentMSecsSinceEpoch() / 1000;
|
||||||
const FailedLogin failedLogin = m_clientFailedLogins.value(sessionManager()->clientId());
|
const FailedLogin failedLogin = m_clientFailedLogins.value(sessionManager()->clientId());
|
||||||
|
|
||||||
bool isBanned = (failedLogin.bannedAt > 0);
|
bool isBanned = (failedLogin.bannedAt > 0);
|
||||||
@ -103,6 +103,6 @@ void AuthController::increaseFailedAttempts()
|
|||||||
if (failedLogin.failedAttemptsCount == MAX_AUTH_FAILED_ATTEMPTS) {
|
if (failedLogin.failedAttemptsCount == MAX_AUTH_FAILED_ATTEMPTS) {
|
||||||
// Max number of failed attempts reached
|
// Max number of failed attempts reached
|
||||||
// Start ban period
|
// Start ban period
|
||||||
failedLogin.bannedAt = QDateTime::currentDateTime().toTime_t();
|
failedLogin.bannedAt = QDateTime::currentMSecsSinceEpoch() / 1000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ private:
|
|||||||
struct FailedLogin
|
struct FailedLogin
|
||||||
{
|
{
|
||||||
int failedAttemptsCount = 0;
|
int failedAttemptsCount = 0;
|
||||||
uint bannedAt = 0;
|
qint64 bannedAt = 0;
|
||||||
};
|
};
|
||||||
mutable QHash<QString, FailedLogin> m_clientFailedLogins;
|
mutable QHash<QString, FailedLogin> m_clientFailedLogins;
|
||||||
};
|
};
|
||||||
|
@ -547,7 +547,7 @@ void WebApplication::sessionInitialize()
|
|||||||
if (!sessionId.isEmpty()) {
|
if (!sessionId.isEmpty()) {
|
||||||
m_currentSession = m_sessions.value(sessionId);
|
m_currentSession = m_sessions.value(sessionId);
|
||||||
if (m_currentSession) {
|
if (m_currentSession) {
|
||||||
const uint now = QDateTime::currentDateTime().toTime_t();
|
const qint64 now = QDateTime::currentMSecsSinceEpoch() / 1000;
|
||||||
if ((now - m_currentSession->m_timestamp) > INACTIVE_TIME) {
|
if ((now - m_currentSession->m_timestamp) > INACTIVE_TIME) {
|
||||||
// session is outdated - removing it
|
// session is outdated - removing it
|
||||||
delete m_sessions.take(sessionId);
|
delete m_sessions.take(sessionId);
|
||||||
@ -605,7 +605,7 @@ void WebApplication::sessionStart()
|
|||||||
Q_ASSERT(!m_currentSession);
|
Q_ASSERT(!m_currentSession);
|
||||||
|
|
||||||
// remove outdated sessions
|
// remove outdated sessions
|
||||||
const uint now = QDateTime::currentDateTime().toTime_t();
|
const qint64 now = QDateTime::currentMSecsSinceEpoch() / 1000;
|
||||||
foreach (const auto session, m_sessions) {
|
foreach (const auto session, m_sessions) {
|
||||||
if ((now - session->timestamp()) > INACTIVE_TIME)
|
if ((now - session->timestamp()) > INACTIVE_TIME)
|
||||||
delete m_sessions.take(session->id());
|
delete m_sessions.take(session->id());
|
||||||
@ -737,7 +737,7 @@ QString WebSession::id() const
|
|||||||
return m_sid;
|
return m_sid;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint WebSession::timestamp() const
|
qint64 WebSession::timestamp() const
|
||||||
{
|
{
|
||||||
return m_timestamp;
|
return m_timestamp;
|
||||||
}
|
}
|
||||||
@ -754,5 +754,5 @@ void WebSession::setData(const QString &id, const QVariant &data)
|
|||||||
|
|
||||||
void WebSession::updateTimestamp()
|
void WebSession::updateTimestamp()
|
||||||
{
|
{
|
||||||
m_timestamp = QDateTime::currentDateTime().toTime_t();
|
m_timestamp = QDateTime::currentMSecsSinceEpoch() / 1000;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ public:
|
|||||||
explicit WebSession(const QString &sid);
|
explicit WebSession(const QString &sid);
|
||||||
|
|
||||||
QString id() const override;
|
QString id() const override;
|
||||||
uint timestamp() const;
|
qint64 timestamp() const;
|
||||||
|
|
||||||
QVariant getData(const QString &id) const override;
|
QVariant getData(const QString &id) const override;
|
||||||
void setData(const QString &id, const QVariant &data) override;
|
void setData(const QString &id, const QVariant &data) override;
|
||||||
@ -68,7 +68,7 @@ private:
|
|||||||
void updateTimestamp();
|
void updateTimestamp();
|
||||||
|
|
||||||
const QString m_sid;
|
const QString m_sid;
|
||||||
uint m_timestamp;
|
qint64 m_timestamp;
|
||||||
QVariantHash m_data;
|
QVariantHash m_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user