Skip to content
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

DRAFT: Custom data directory support #273

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions build-aux/m4/bitcoin_qt.m4
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,15 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
if test -d "$qt_plugin_path/../qml/Qt/labs/settings"; then
QT_LIBS="$QT_LIBS -L$qt_plugin_path/../qml/Qt/labs/settings"
fi
if test -d "$qt_plugin_path/../qml/QtQuick/Dialogs"; then
QT_LIBS="$QT_LIBS -L$qt_plugin_path/../qml/QtQuick/Dialogs -L$qt_plugin_path/../qml/QtQuick/Dialogs/Private"
fi
if test -d "$qt_plugin_path/../qml/Qt/labs/folderlistmodel"; then
QT_LIBS="$QT_LIBS -L$qt_plugin_path/../qml/Qt/labs/folderlistmodel"
fi
if test -d "$qt_plugin_path/../qml/Qt/labs/settings"; then
QT_LIBS="$QT_LIBS -L$qt_plugin_path/../qml/Qt/labs/settings"
fi

dnl qtquickcontrols2 module paths
if test -d "$qt_plugin_path/../qml/QtQuick/Controls.2"; then
Expand Down Expand Up @@ -215,6 +224,11 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
dnl qtquickcontrols module plugins
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QtQuickControls1Plugin], [-lqtquickcontrolsplugin])
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QmlSettingsPlugin], [-lqmlsettingsplugin])
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QtQuick2DialogsPlugin], [-ldialogplugin])
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QtQuick2DialogsPrivatePlugin], [-ldialogsprivateplugin])
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QtQuickControls1Plugin], [-lqtquickcontrolsplugin])
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QmlFolderListModelPlugin], [-lqmlfolderlistmodelplugin])
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QmlSettingsPlugin], [-lqmlsettingsplugin])
dnl qtquickcontrols2 module plugins
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QtQuickControls2Plugin], [-lqtquickcontrols2plugin])
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QtQuickTemplates2Plugin], [-lqtquicktemplates2plugin])
Expand All @@ -228,6 +242,10 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
dnl qtquickcontrols module plugins
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QtQuickControls1Plugin], [-lqml_QtQuick_Controls_qtquickcontrolsplugin])
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QmlSettingsPlugin], [-lqml_Qt_labs_settings_qmlsettingsplugin])
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QtQuick2DialogsPlugin], [-lqml_QtQuick_Dialogs_dialogplugin])
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QtQuickControls1Plugin], [-lqml_QtQuick_Controls_qtquickcontrolsplugin])
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QmlFolderListModelPlugin], [-lqml_Qt_labs_folderlistmodel_qmlfolderlistmodelplugin])
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QmlSettingsPlugin], [-lqml_Qt_labs_settings_qmlsettingsplugin])
dnl qtquickcontrols2 module plugins
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QtQuickControls2Plugin], [-lqml_QtQuick_Controls_2_qtquickcontrols2plugin])
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QtQuickTemplates2Plugin], [-lqml_QtQuick_Templates_2_qtquicktemplates2plugin])
Expand Down
2 changes: 1 addition & 1 deletion src/qml/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ The following runtime dependencies are also required for dynamic builds;
they are not needed for static builds:

```
sudo apt install qml-module-qtquick2 qml-module-qtquick-controls qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qtquick-window2 qml-module-qt-labs-settings
sudo apt install qml-module-qtquick2 qml-module-qtquick-controls qml-module-qtquick-controls2 qml-module-qtquick-dialogs qml-module-qtquick-layouts qml-module-qtquick-window2 qml-module-qt-labs-settings
```

#### Fedora:
Expand Down
5 changes: 5 additions & 0 deletions src/qml/bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,14 @@ QT_END_NAMESPACE
#include <QtPlugin>
Q_IMPORT_PLUGIN(QtQmlPlugin)
Q_IMPORT_PLUGIN(QtQmlModelsPlugin)
Q_IMPORT_PLUGIN(QtQuick2DialogsPlugin)
#ifndef QT_QPA_PLATFORM_ANDROID
Q_IMPORT_PLUGIN(QtQuick2DialogsPrivatePlugin)
#endif
Q_IMPORT_PLUGIN(QtQuick2Plugin)
Q_IMPORT_PLUGIN(QtQuick2WindowPlugin)
Q_IMPORT_PLUGIN(QtQuickControls1Plugin)
Q_IMPORT_PLUGIN(QmlFolderListModelPlugin)
Q_IMPORT_PLUGIN(QmlSettingsPlugin)
Q_IMPORT_PLUGIN(QtQuickLayoutsPlugin)
Q_IMPORT_PLUGIN(QtQuickControls2Plugin)
Expand Down
15 changes: 15 additions & 0 deletions src/qml/components/StorageLocations.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtQuick.Dialogs 1.3
import "../controls"

ColumnLayout {
Expand All @@ -21,9 +22,23 @@ ColumnLayout {
checked: true
}
OptionButton {
id: customDirOption
Layout.fillWidth: true
ButtonGroup.group: group
text: qsTr("Custom")
description: qsTr("Choose the directory and storage device.")
customDir: fileDialog.folder
onClicked: fileDialog.open()
}

FileDialog {
id: fileDialog
title: qsTr("Please choose a directory")
selectFolder: true
folder: shortcuts.home
onAccepted: {
customDirOption.customDir = fileDilog.folder
}
}

}
22 changes: 22 additions & 0 deletions src/qml/controls/OptionButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Button {
property string description
property bool recommended: false
property string image: ""
property string customDir: ""
padding: 15
checkable: true
implicitWidth: 450
Expand Down Expand Up @@ -80,6 +81,27 @@ Button {
}
}
}
Loader {
Layout.topMargin: 12
Layout.fillWidth: true
active: button.customDir.length > 0
visible: active
sourceComponent: Button {
id: container
background: Rectangle {
color: Theme.color.neutral2
radius: 5
}
font.family: "Inter"
font.styleName: "Semi Bold"
font.pixelSize: 13
contentItem: Text {
font: container.font
color: Theme.color.neutral9
text: button.customDir
}
}
}
}
Item {
height: parent.height
Expand Down