-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wiring for Custom Datadir #408
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6c21187
qml: wiring for custom datadir with android
D33r-Gee e38c8fb
qml: removed "fullClientVersion" from nodemodel.h so it works with op…
D33r-Gee 740e575
qml: updated pages so they use optionsModel instead of nodeModel
D33r-Gee a9cf27f
qml: backend wiring for custom datadir functionality
D33r-Gee 144e4c8
cpp: added univalue.h to include because it was causing compiler crash
D33r-Gee 366b0fc
qml: refactoring to allow for custom datadir and android support
D33r-Gee f89a2f9
android: permissions for custom datadir
D33r-Gee 8bb72f0
android: custom datadir retrieve filepath
D33r-Gee d76761d
make: added qml/androidcustomdatadir files
D33r-Gee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright (c) 2023-present The Bitcoin Core developers | ||
// Distributed under the MIT software license, see the accompanying | ||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
||
#include <qml/androidcustomdatadir.h> | ||
|
||
#include <common/args.h> | ||
#include <qml/util.h> | ||
#include <qml/guiconstants.h> | ||
#include <qt/guiutil.h> | ||
|
||
#include <QDebug> | ||
#include <QFile> | ||
#include <QStandardPaths> | ||
#include <QDir> | ||
|
||
AndroidCustomDataDir::AndroidCustomDataDir(QObject * parent) | ||
: QObject(parent) | ||
{ | ||
m_default_data_dir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); | ||
} | ||
|
||
void AndroidCustomDataDir::setDataDir(const QString & new_data_dir) | ||
{ | ||
if (m_data_dir == new_data_dir) { | ||
return; | ||
} | ||
|
||
m_data_dir = new_data_dir; | ||
gArgs.SoftSetArg("-datadir", fs::PathToString(GUIUtil::QStringToPath(m_data_dir))); | ||
gArgs.ClearPathCache(); | ||
Q_EMIT dataDirChanged(); | ||
} | ||
|
||
QString AndroidCustomDataDir::readCustomDataDir() | ||
{ | ||
QFile file(m_default_data_dir + "/filepath.txt"); | ||
QString storedPath; | ||
|
||
if (file.open(QIODevice::ReadOnly)) { | ||
QTextStream in(&file); | ||
storedPath = in.readAll().trimmed(); | ||
file.close(); | ||
// Process the retrieved path | ||
qDebug() << "Retrieved path: " << storedPath; | ||
} | ||
return storedPath; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) 2024 The Bitcoin Core developers | ||
// Distributed under the MIT software license, see the accompanying | ||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
||
#ifndef BITCOIN_QML_ANDROIDCUSTOMDATADIR_H | ||
#define BITCOIN_QML_ANDROIDCUSTOMDATADIR_H | ||
|
||
#include <QFile> | ||
#include <QStandardPaths> | ||
#include <QDir> | ||
|
||
class AndroidCustomDataDir : public QObject | ||
{ | ||
Q_OBJECT | ||
Q_PROPERTY(QString dataDir READ dataDir WRITE setDataDir NOTIFY dataDirChanged) | ||
|
||
public: | ||
explicit AndroidCustomDataDir(QObject * parent = nullptr); | ||
|
||
QString dataDir() const { return m_data_dir; } | ||
void setDataDir(const QString & new_data_dir); | ||
QString readCustomDataDir(); | ||
|
||
Q_SIGNALS: | ||
void dataDirChanged(); | ||
|
||
private: | ||
QString m_data_dir; | ||
QString m_default_data_dir; | ||
}; | ||
|
||
#endif // BITCOIN_QML_ANDROIDCUSTOMDATADIR_H |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every commit should pass compilation and all tests so if the failure occurs on the previous commit you should include it there (we are missing the "
CI / test each commit (pull_request)
" that exists on the other repos and I think @hebasto has it pending with other things he wanted to merge here into this repo).