set(CMAKE_VERBOSE_MAKEFILE ON)
endif()
-set(MONERO_HEAD "2ab81abe7bea16f0f6da55da3b212f9ffbca8dcd")
+set(MONERO_HEAD "4982ac420c101be2afb387138c4ee57b1a5c2f9b")
set(BUILD_GUI_DEPS ON)
option(ARCH "Target architecture" "native")
set(BUILD_64 ON)
-Subproject commit 2ab81abe7bea16f0f6da55da3b212f9ffbca8dcd
+Subproject commit 4982ac420c101be2afb387138c4ee57b1a5c2f9b
void Settings::setupPathsTab() {
ui->lineEdit_defaultWalletDir->setText(config()->get(Config::walletDirectory).toString());
ui->lineEdit_configDir->setText(Config::defaultConfigDir().path());
- ui->lineEdit_applicationDir->setText(QCoreApplication::applicationDirPath());
+ ui->lineEdit_applicationDir->setText(Utils::applicationPath());
connect(ui->btn_browseDefaultWalletDir, &QPushButton::clicked, [this]{
QString walletDirOld = config()->get(Config::walletDirectory).toString();
}
m_openingWallet = true;
- m_walletManager->openWalletAsync(path, password, constants::networkType, 1);
+ m_walletManager->openWalletAsync(path, password, constants::networkType, constants::kdfRounds, Utils::ringDatabasePath());
}
void WindowManager::onWalletOpened(Wallet *wallet) {
#include "model/AddressBookModel.h"
#include "model/TransactionHistoryModel.h"
#include "utils/brute.h"
+#include "utils/Utils.h"
#include "constants.h"
CLI::CLI(Mode mode, QCommandLineParser *cmdargs, QObject *parent)
QString password = cmdargs->value("password");
- m_walletManager->openWalletAsync(walletFile, password, constants::networkType);
+ m_walletManager->openWalletAsync(walletFile, password, constants::networkType, constants::kdfRounds, Utils::ringDatabasePath());
}
else if (mode == Mode::BruteforcePassword)
{
return new Wallet(w);
}
-Wallet *WalletManager::openWallet(const QString &path, const QString &password, NetworkType::Type nettype, quint64 kdfRounds)
+Wallet *WalletManager::openWallet(const QString &path, const QString &password, NetworkType::Type nettype, quint64 kdfRounds, const QString &ringDatabasePath)
{
QMutexLocker locker(&m_mutex);
WalletPassphraseListenerImpl tmpListener(this);
qDebug() << QString("%1: opening wallet at %2, nettype = %3 ").arg(__PRETTY_FUNCTION__).arg(qPrintable(path)).arg(nettype);
- Monero::Wallet * w = m_pimpl->openWallet(path.toStdString(), password.toStdString(), static_cast<Monero::NetworkType>(nettype), kdfRounds, &tmpListener);
+ Monero::Wallet * w = m_pimpl->openWallet(path.toStdString(), password.toStdString(), static_cast<Monero::NetworkType>(nettype), kdfRounds, ringDatabasePath.toStdString(), &tmpListener);
w->setListener(nullptr);
qDebug() << QString("%1: opened wallet: %2, status: %3").arg(__PRETTY_FUNCTION__).arg(w->address(0, 0).c_str()).arg(w->status());
return wallet;
}
-void WalletManager::openWalletAsync(const QString &path, const QString &password, NetworkType::Type nettype, quint64 kdfRounds)
+void WalletManager::openWalletAsync(const QString &path, const QString &password, NetworkType::Type nettype, quint64 kdfRounds, const QString &ringDatabasePath)
{
- m_scheduler.run([this, path, password, nettype, kdfRounds] {
- emit walletOpened(openWallet(path, password, nettype, kdfRounds));
+ m_scheduler.run([this, path, password, nettype, kdfRounds, ringDatabasePath] {
+ emit walletOpened(openWallet(path, password, nettype, kdfRounds, ringDatabasePath));
});
}
* \param nettype - type of network the wallet is running on
* \return wallet object pointer
*/
- Wallet * openWallet(const QString &path, const QString &password, NetworkType::Type nettype = NetworkType::MAINNET, quint64 kdfRounds = 1);
+ Wallet * openWallet(const QString &path, const QString &password, NetworkType::Type nettype = NetworkType::MAINNET, quint64 kdfRounds = 1, const QString &ringDatabasePath = "");
/*!
* \brief openWalletAsync - asynchronous version of "openWallet". Returns immediately. "walletOpened" signal
* emitted when wallet opened;
*/
- void openWalletAsync(const QString &path, const QString &password, NetworkType::Type nettype = NetworkType::MAINNET, quint64 kdfRounds = 1);
+ void openWalletAsync(const QString &path, const QString &password, NetworkType::Type nettype = NetworkType::MAINNET, quint64 kdfRounds = 1, const QString &ringDatabasePath = "");
Wallet * recoveryWallet(const QString &path, const QString &password, const QString &seed, const QString &seed_offset,
NetworkType::Type nettype = NetworkType::MAINNET, quint64 restoreHeight = 0, quint64 kdfRounds = 1);
return pathDir.exists();
}
+QString portablePath() {
+ return Utils::applicationPath() + "/feather_data";
+}
+
+bool isPortableMode() {
+ return Utils::portableFileExists(Utils::applicationPath());
+}
+
bool portableFileExists(const QString &dir) {
QStringList portableFiles = {".portable", ".portable.txt", "portable.txt"};
}
QString defaultWalletDir() {
- QString portablePath = QCoreApplication::applicationDirPath();
- if (Utils::portableFileExists(portablePath)) {
- return portablePath + "/feather_data/wallets";
+ if (Utils::isPortableMode()) {
+ return Utils::portablePath() + "/wallets";
}
if (TailsOS::detect()) {
return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/wallets";
}
+QString ringDatabasePath() {
+ if (Utils::isPortableMode()) {
+ QString suffix = "";
+ if (constants::networkType != NetworkType::Type::MAINNET) {
+ suffix = "-" + Utils::QtEnumToString(constants::networkType);
+ }
+ return Utils::portablePath() + "/ringdb" + suffix;
+ }
+ return ""; // Use libwallet default
+}
+
QString applicationPath() {
- QString applicationPath = qgetenv("APPIMAGE");
- if (!applicationPath.isEmpty()) {
- applicationPath = QFileInfo(applicationPath).absoluteDir().path();
- } else {
- applicationPath = QCoreApplication::applicationDirPath();
+ QString applicationPath = QCoreApplication::applicationDirPath();
+ QDir appDir(applicationPath);
+
+#ifdef Q_OS_MACOS
+ // applicationDirPath will be inside the app bundle
+
+ if (applicationPath.endsWith("Contents/MacOS")) {
+ appDir.cd("../../..");
}
+ return appDir.absolutePath();
+#endif
+
+ QString appimagePath = qgetenv("APPIMAGE");
+ if (!appimagePath.isEmpty()) {
+ return QFileInfo(appimagePath).absoluteDir().path();
+ }
+
return applicationPath;
}
bool pixmapWrite(const QString &path, const QPixmap &pixmap);
QStringList fileFind(const QRegularExpression &pattern, const QString &baseDir, int level, int depth, int maxPerDir);
- bool dirExists(const QString &path);
+ QString portablePath();
+ bool isPortableMode();
bool portableFileExists(const QString &dir);
+ QString ringDatabasePath();
+
+ bool dirExists(const QString &path);
QString defaultWalletDir();
QString applicationPath();
}
QDir Config::defaultConfigDir() {
- QString portablePath = QCoreApplication::applicationDirPath();
- if (Utils::portableFileExists(portablePath)) {
- return portablePath + "/feather_data";
+ if (Utils::isPortableMode()) {
+ return Utils::portablePath();
}
if (TailsOS::detect()) {
#endif
}
-QDir Config::defaultPortableConfigDir() {
- return QDir(QCoreApplication::applicationDirPath() + "/feather_data");
-}
-
Config::~Config()
{
}
void resetToDefaults();
static QDir defaultConfigDir();
- static QDir defaultPortableConfigDir();
static Config* instance();