Changeset View
Changeset View
Standalone View
Standalone View
src/qt/intro.cpp
Show First 20 Lines • Show All 118 Lines • ▼ Show 20 Lines | Intro::Intro(QWidget *parent, uint64_t blockchain_size, | ||||
ui->lblExplanation1->setText(ui->lblExplanation1->text() | ui->lblExplanation1->setText(ui->lblExplanation1->text() | ||||
.arg(PACKAGE_NAME) | .arg(PACKAGE_NAME) | ||||
.arg(m_blockchain_size) | .arg(m_blockchain_size) | ||||
.arg(2009) | .arg(2009) | ||||
.arg(tr("Bitcoin"))); | .arg(tr("Bitcoin"))); | ||||
ui->lblExplanation2->setText(ui->lblExplanation2->text().arg(PACKAGE_NAME)); | ui->lblExplanation2->setText(ui->lblExplanation2->text().arg(PACKAGE_NAME)); | ||||
uint64_t pruneTarget = std::max<int64_t>(0, gArgs.GetArg("-prune", 0)); | uint64_t pruneTarget = std::max<int64_t>(0, gArgs.GetArg("-prune", 0)); | ||||
// -prune=1 means enabled, above that it's a size in MB | |||||
if (pruneTarget > 1) { | |||||
ui->prune->setChecked(true); | |||||
ui->prune->setEnabled(false); | |||||
} | |||||
ui->prune->setText(tr("Discard blocks after verification, except most " | |||||
"recent %1 GB (prune)") | |||||
.arg(pruneTarget ? pruneTarget / 1000 : 2)); | |||||
requiredSpace = m_blockchain_size; | requiredSpace = m_blockchain_size; | ||||
QString storageRequiresMsg = | QString storageRequiresMsg = | ||||
tr("At least %1 GB of data will be stored in this directory, and it " | tr("At least %1 GB of data will be stored in this directory, and it " | ||||
"will grow over time."); | "will grow over time."); | ||||
if (pruneTarget) { | if (pruneTarget) { | ||||
uint64_t prunedGBs = std::ceil(pruneTarget * 1024 * 1024.0 / GB_BYTES); | uint64_t prunedGBs = std::ceil(pruneTarget * 1024 * 1024.0 / GB_BYTES); | ||||
if (prunedGBs <= requiredSpace) { | if (prunedGBs <= requiredSpace) { | ||||
requiredSpace = prunedGBs; | requiredSpace = prunedGBs; | ||||
Show All 36 Lines | if (dataDir == getDefaultDataDirectory()) { | ||||
ui->ellipsisButton->setEnabled(true); | ui->ellipsisButton->setEnabled(true); | ||||
} | } | ||||
} | } | ||||
QString Intro::getDefaultDataDirectory() { | QString Intro::getDefaultDataDirectory() { | ||||
return GUIUtil::boostPathToQString(GetDefaultDataDir()); | return GUIUtil::boostPathToQString(GetDefaultDataDir()); | ||||
} | } | ||||
bool Intro::showIfNeeded(interfaces::Node &node, bool &did_show_intro) { | bool Intro::showIfNeeded(interfaces::Node &node, bool &did_show_intro, | ||||
bool &prune) { | |||||
did_show_intro = false; | did_show_intro = false; | ||||
QSettings settings; | QSettings settings; | ||||
/* If data directory provided on command line, no need to look at settings | /* If data directory provided on command line, no need to look at settings | ||||
or show a picking dialog */ | or show a picking dialog */ | ||||
if (!gArgs.GetArg("-datadir", "").empty()) { | if (!gArgs.GetArg("-datadir", "").empty()) { | ||||
return true; | return true; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | if (!fs::exists(GUIUtil::qstringToBoostPath(dataDir)) || | ||||
QMessageBox::critical(nullptr, PACKAGE_NAME, | QMessageBox::critical(nullptr, PACKAGE_NAME, | ||||
tr("Error: Specified data directory " | tr("Error: Specified data directory " | ||||
"\"%1\" cannot be created.") | "\"%1\" cannot be created.") | ||||
.arg(dataDir)); | .arg(dataDir)); | ||||
/* fall through, back to choosing screen */ | /* fall through, back to choosing screen */ | ||||
} | } | ||||
} | } | ||||
// Additional preferences: | |||||
prune = intro.ui->prune->isChecked(); | |||||
settings.setValue("strDataDir", dataDir); | settings.setValue("strDataDir", dataDir); | ||||
settings.setValue("fReset", false); | settings.setValue("fReset", false); | ||||
} | } | ||||
/* Only override -datadir if different from the default, to make it possible | /* Only override -datadir if different from the default, to make it possible | ||||
* to | * to | ||||
* override -datadir in the bitcoin.conf file in the default data directory | * override -datadir in the bitcoin.conf file in the default data directory | ||||
* (to be consistent with bitcoind behavior) | * (to be consistent with bitcoind behavior) | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 93 Lines • Show Last 20 Lines |