Implement DBResumeDataStorage class

This commit is contained in:
Vladimir Golovnev (Glassez) 2021-03-24 11:53:47 +03:00
parent 223d15802e
commit 383eaf44ac
No known key found for this signature in database
GPG key ID: 52A2C7DEE2DFA6F7
13 changed files with 745 additions and 25 deletions

View file

@ -61,6 +61,7 @@ namespace
{
// qBittorrent section
QBITTORRENT_HEADER,
RESUME_DATA_STORAGE,
#if defined(Q_OS_WIN)
OS_MEMORY_PRIORITY,
#endif
@ -166,6 +167,10 @@ void AdvancedSettings::saveAdvancedSettings()
Preferences *const pref = Preferences::instance();
BitTorrent::Session *const session = BitTorrent::Session::instance();
session->setResumeDataStorageType((m_comboBoxResumeDataStorage.currentIndex() == 0)
? BitTorrent::ResumeDataStorageType::Legacy
: BitTorrent::ResumeDataStorageType::SQLite);
#if defined(Q_OS_WIN)
BitTorrent::OSMemoryPriority prio = BitTorrent::OSMemoryPriority::Normal;
switch (m_comboBoxOSMemoryPriority.currentIndex())
@ -392,6 +397,10 @@ void AdvancedSettings::loadAdvancedSettings()
addRow(LIBTORRENT_HEADER, QString::fromLatin1("<b>%1</b>").arg(tr("libtorrent Section")), labelLibtorrentLink);
static_cast<QLabel *>(cellWidget(LIBTORRENT_HEADER, PROPERTY))->setAlignment(Qt::AlignCenter | Qt::AlignVCenter);
m_comboBoxResumeDataStorage.addItems({tr("Fastresume files"), tr("SQLite database (experimental)")});
m_comboBoxResumeDataStorage.setCurrentIndex((session->resumeDataStorageType() == BitTorrent::ResumeDataStorageType::Legacy) ? 0 : 1);
addRow(RESUME_DATA_STORAGE, tr("Resume data storage type (requires restart)"), &m_comboBoxResumeDataStorage);
#if defined(Q_OS_WIN)
m_comboBoxOSMemoryPriority.addItems({tr("Normal"), tr("Below normal"), tr("Medium"), tr("Low"), tr("Very low")});
int OSMemoryPriorityIndex = 0;