0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-03-06 14:19:59 -05:00

Merge bitcoin-core/gui#523: scripted-diff: Rename functions to drop mention of boost

3c4f5d2a20 scripted-diff: Rename functions to drop mention of boost (Hennadii Stepanov)

Pull request description:

  Nothing specific to Boost is in `GUIUtil::qstringToBoostPath` and `GUIUtil::boostPathToQString` functions.

  Related to bitcoin/bitcoin#20744.

ACKs for top commit:
  laanwj:
    Concept and code review ACK 3c4f5d2a20
  promag:
    Code review ACK 3c4f5d2a20 👋

Tree-SHA512: 0c8790979783a067811f7699b4ce4c204f6e0818d5f32986ec24b2c71583b4496d7a0e0c0361dd77c7e641a75d983fee35cd51ef722bbca9a5f13194efb3b4c0
This commit is contained in:
Hennadii Stepanov 2022-01-12 14:23:54 +02:00
commit e0ae5418cb
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
6 changed files with 18 additions and 18 deletions

View file

@ -221,12 +221,12 @@ QString ClientModel::formatClientStartupTime() const
QString ClientModel::dataDir() const QString ClientModel::dataDir() const
{ {
return GUIUtil::boostPathToQString(gArgs.GetDataDirNet()); return GUIUtil::PathToQString(gArgs.GetDataDirNet());
} }
QString ClientModel::blocksDir() const QString ClientModel::blocksDir() const
{ {
return GUIUtil::boostPathToQString(gArgs.GetBlocksDirPath()); return GUIUtil::PathToQString(gArgs.GetBlocksDirPath());
} }
void ClientModel::updateBanlist() void ClientModel::updateBanlist()

View file

@ -281,7 +281,7 @@ void LoadFont(const QString& file_name)
QString getDefaultDataDirectory() QString getDefaultDataDirectory()
{ {
return boostPathToQString(GetDefaultDataDir()); return PathToQString(GetDefaultDataDir());
} }
QString getSaveFileName(QWidget *parent, const QString &caption, const QString &dir, QString getSaveFileName(QWidget *parent, const QString &caption, const QString &dir,
@ -418,7 +418,7 @@ void openDebugLogfile()
/* Open debug.log with the associated application */ /* Open debug.log with the associated application */
if (fs::exists(pathDebug)) if (fs::exists(pathDebug))
QDesktopServices::openUrl(QUrl::fromLocalFile(boostPathToQString(pathDebug))); QDesktopServices::openUrl(QUrl::fromLocalFile(PathToQString(pathDebug)));
} }
bool openBitcoinConf() bool openBitcoinConf()
@ -434,11 +434,11 @@ bool openBitcoinConf()
configFile.close(); configFile.close();
/* Open bitcoin.conf with the associated application */ /* Open bitcoin.conf with the associated application */
bool res = QDesktopServices::openUrl(QUrl::fromLocalFile(boostPathToQString(pathConfig))); bool res = QDesktopServices::openUrl(QUrl::fromLocalFile(PathToQString(pathConfig)));
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
// Workaround for macOS-specific behavior; see #15409. // Workaround for macOS-specific behavior; see #15409.
if (!res) { if (!res) {
res = QProcess::startDetached("/usr/bin/open", QStringList{"-t", boostPathToQString(pathConfig)}); res = QProcess::startDetached("/usr/bin/open", QStringList{"-t", PathToQString(pathConfig)});
} }
#endif #endif
@ -652,12 +652,12 @@ void setClipboard(const QString& str)
} }
} }
fs::path qstringToBoostPath(const QString &path) fs::path QStringToPath(const QString &path)
{ {
return fs::u8path(path.toStdString()); return fs::u8path(path.toStdString());
} }
QString boostPathToQString(const fs::path &path) QString PathToQString(const fs::path &path)
{ {
return QString::fromStdString(path.u8string()); return QString::fromStdString(path.u8string());
} }

View file

@ -209,10 +209,10 @@ namespace GUIUtil
bool SetStartOnSystemStartup(bool fAutoStart); bool SetStartOnSystemStartup(bool fAutoStart);
/** Convert QString to OS specific boost path through UTF-8 */ /** Convert QString to OS specific boost path through UTF-8 */
fs::path qstringToBoostPath(const QString &path); fs::path QStringToPath(const QString &path);
/** Convert OS specific boost path to QString through UTF-8 */ /** Convert OS specific boost path to QString through UTF-8 */
QString boostPathToQString(const fs::path &path); QString PathToQString(const fs::path &path);
/** Convert enum Network to QString */ /** Convert enum Network to QString */
QString NetworkToQString(Network net); QString NetworkToQString(Network net);

View file

@ -67,7 +67,7 @@ FreespaceChecker::FreespaceChecker(Intro *_intro)
void FreespaceChecker::check() void FreespaceChecker::check()
{ {
QString dataDirStr = intro->getPathToCheck(); QString dataDirStr = intro->getPathToCheck();
fs::path dataDir = GUIUtil::qstringToBoostPath(dataDirStr); fs::path dataDir = GUIUtil::QStringToPath(dataDirStr);
uint64_t freeBytesAvailable = 0; uint64_t freeBytesAvailable = 0;
int replyStatus = ST_OK; int replyStatus = ST_OK;
QString replyMessage = tr("A new data directory will be created."); QString replyMessage = tr("A new data directory will be created.");
@ -216,7 +216,7 @@ bool Intro::showIfNeeded(bool& did_show_intro, int64_t& prune_MiB)
/* 2) Allow QSettings to override default dir */ /* 2) Allow QSettings to override default dir */
dataDir = settings.value("strDataDir", dataDir).toString(); dataDir = settings.value("strDataDir", dataDir).toString();
if(!fs::exists(GUIUtil::qstringToBoostPath(dataDir)) || gArgs.GetBoolArg("-choosedatadir", DEFAULT_CHOOSE_DATADIR) || settings.value("fReset", false).toBool() || gArgs.GetBoolArg("-resetguisettings", false)) if(!fs::exists(GUIUtil::QStringToPath(dataDir)) || gArgs.GetBoolArg("-choosedatadir", DEFAULT_CHOOSE_DATADIR) || settings.value("fReset", false).toBool() || gArgs.GetBoolArg("-resetguisettings", false))
{ {
/* Use selectParams here to guarantee Params() can be used by node interface */ /* Use selectParams here to guarantee Params() can be used by node interface */
try { try {
@ -240,9 +240,9 @@ bool Intro::showIfNeeded(bool& did_show_intro, int64_t& prune_MiB)
} }
dataDir = intro.getDataDirectory(); dataDir = intro.getDataDirectory();
try { try {
if (TryCreateDirectories(GUIUtil::qstringToBoostPath(dataDir))) { if (TryCreateDirectories(GUIUtil::QStringToPath(dataDir))) {
// If a new data directory has been created, make wallets subdirectory too // If a new data directory has been created, make wallets subdirectory too
TryCreateDirectories(GUIUtil::qstringToBoostPath(dataDir) / "wallets"); TryCreateDirectories(GUIUtil::QStringToPath(dataDir) / "wallets");
} }
break; break;
} catch (const fs::filesystem_error&) { } catch (const fs::filesystem_error&) {
@ -263,7 +263,7 @@ bool Intro::showIfNeeded(bool& did_show_intro, int64_t& prune_MiB)
* (to be consistent with bitcoind behavior) * (to be consistent with bitcoind behavior)
*/ */
if(dataDir != GUIUtil::getDefaultDataDirectory()) { if(dataDir != GUIUtil::getDefaultDataDirectory()) {
gArgs.SoftSetArg("-datadir", fs::PathToString(GUIUtil::qstringToBoostPath(dataDir))); // use OS locale for path setting gArgs.SoftSetArg("-datadir", fs::PathToString(GUIUtil::QStringToPath(dataDir))); // use OS locale for path setting
} }
return true; return true;
} }

View file

@ -209,8 +209,8 @@ static void CopySettings(QSettings& dst, const QSettings& src)
/** Back up a QSettings to an ini-formatted file. */ /** Back up a QSettings to an ini-formatted file. */
static void BackupSettings(const fs::path& filename, const QSettings& src) static void BackupSettings(const fs::path& filename, const QSettings& src)
{ {
qInfo() << "Backing up GUI settings to" << GUIUtil::boostPathToQString(filename); qInfo() << "Backing up GUI settings to" << GUIUtil::PathToQString(filename);
QSettings dst(GUIUtil::boostPathToQString(filename), QSettings::IniFormat); QSettings dst(GUIUtil::PathToQString(filename), QSettings::IniFormat);
dst.clear(); dst.clear();
CopySettings(dst, src); CopySettings(dst, src);
} }

View file

@ -51,7 +51,7 @@ static QString ipcServerName()
// Append a simple hash of the datadir // Append a simple hash of the datadir
// Note that gArgs.GetDataDirNet() returns a different path // Note that gArgs.GetDataDirNet() returns a different path
// for -testnet versus main net // for -testnet versus main net
QString ddir(GUIUtil::boostPathToQString(gArgs.GetDataDirNet())); QString ddir(GUIUtil::PathToQString(gArgs.GetDataDirNet()));
name.append(QString::number(qHash(ddir))); name.append(QString::number(qHash(ddir)));
return name; return name;