Changeset View
Changeset View
Standalone View
Standalone View
src/qt/intro.cpp
Show First 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | void FreespaceChecker::check() { | ||||
Q_EMIT reply(replyStatus, replyMessage, freeBytesAvailable); | Q_EMIT reply(replyStatus, replyMessage, freeBytesAvailable); | ||||
} | } | ||||
Intro::Intro(QWidget *parent, uint64_t blockchain_size, | Intro::Intro(QWidget *parent, uint64_t blockchain_size, | ||||
uint64_t chain_state_size) | uint64_t chain_state_size) | ||||
: QDialog(parent), ui(new Ui::Intro), thread(nullptr), signalled(false), | : QDialog(parent), ui(new Ui::Intro), thread(nullptr), signalled(false), | ||||
m_blockchain_size(blockchain_size), m_chain_state_size(chain_state_size) { | m_blockchain_size(blockchain_size), m_chain_state_size(chain_state_size) { | ||||
ui->setupUi(this); | ui->setupUi(this); | ||||
ui->welcomeLabel->setText(ui->welcomeLabel->text().arg(tr(PACKAGE_NAME))); | ui->welcomeLabel->setText(ui->welcomeLabel->text().arg(PACKAGE_NAME)); | ||||
ui->storageLabel->setText(ui->storageLabel->text().arg(tr(PACKAGE_NAME))); | ui->storageLabel->setText(ui->storageLabel->text().arg(PACKAGE_NAME)); | ||||
ui->lblExplanation1->setText(ui->lblExplanation1->text() | ui->lblExplanation1->setText(ui->lblExplanation1->text() | ||||
.arg(tr(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->setText(ui->lblExplanation2->text().arg(PACKAGE_NAME)); | ||||
ui->lblExplanation2->text().arg(tr(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)); | ||||
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; | ||||
storageRequiresMsg = tr("Approximately %1 GB of data will be " | storageRequiresMsg = tr("Approximately %1 GB of data will be " | ||||
"stored in this directory."); | "stored in this directory."); | ||||
} | } | ||||
ui->lblExplanation3->setVisible(true); | ui->lblExplanation3->setVisible(true); | ||||
} else { | } else { | ||||
ui->lblExplanation3->setVisible(false); | ui->lblExplanation3->setVisible(false); | ||||
} | } | ||||
requiredSpace += m_chain_state_size; | requiredSpace += m_chain_state_size; | ||||
ui->sizeWarningLabel->setText( | ui->sizeWarningLabel->setText( | ||||
tr("%1 will download and store a copy of the Bitcoin block chain.") | tr("%1 will download and store a copy of the Bitcoin block chain.") | ||||
.arg(tr(PACKAGE_NAME)) + | .arg(PACKAGE_NAME) + | ||||
" " + storageRequiresMsg.arg(requiredSpace) + " " + | " " + storageRequiresMsg.arg(requiredSpace) + " " + | ||||
tr("The wallet will also be stored in this directory.")); | tr("The wallet will also be stored in this directory.")); | ||||
startThread(); | startThread(); | ||||
} | } | ||||
Intro::~Intro() { | Intro::~Intro() { | ||||
delete ui; | delete ui; | ||||
/* Ensure thread is finished before it is deleted */ | /* Ensure thread is finished before it is deleted */ | ||||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | if (!fs::exists(GUIUtil::qstringToBoostPath(dataDir)) || | ||||
GUIUtil::qstringToBoostPath(dataDir))) { | GUIUtil::qstringToBoostPath(dataDir))) { | ||||
// If a new data directory has been created, make wallets | // If a new data directory has been created, make wallets | ||||
// subdirectory too | // subdirectory too | ||||
TryCreateDirectories(GUIUtil::qstringToBoostPath(dataDir) / | TryCreateDirectories(GUIUtil::qstringToBoostPath(dataDir) / | ||||
"wallets"); | "wallets"); | ||||
} | } | ||||
break; | break; | ||||
} catch (const fs::filesystem_error &) { | } catch (const fs::filesystem_error &) { | ||||
QMessageBox::critical(nullptr, tr(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 */ | ||||
} | } | ||||
} | } | ||||
settings.setValue("strDataDir", dataDir); | settings.setValue("strDataDir", dataDir); | ||||
▲ Show 20 Lines • Show All 101 Lines • Show Last 20 Lines |