mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-14 12:26:32 +02:00
Persistent storage for common settings. closes #10
This commit is contained in:
parent
1eac46ae73
commit
2151f1395c
5
main.cpp
5
main.cpp
@ -43,6 +43,11 @@
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
|
app.setApplicationName("monero-core");
|
||||||
|
app.setOrganizationDomain("getmonero.org");
|
||||||
|
app.setOrganizationName("The Monero Project");
|
||||||
|
|
||||||
filter *eventFilter = new filter;
|
filter *eventFilter = new filter;
|
||||||
app.installEventFilter(eventFilter);
|
app.installEventFilter(eventFilter);
|
||||||
|
|
||||||
|
2
main.qml
2
main.qml
@ -30,6 +30,8 @@ import QtQuick 2.2
|
|||||||
import QtQuick.Window 2.0
|
import QtQuick.Window 2.0
|
||||||
import QtQuick.Controls 1.1
|
import QtQuick.Controls 1.1
|
||||||
import QtQuick.Controls.Styles 1.1
|
import QtQuick.Controls.Styles 1.1
|
||||||
|
|
||||||
|
|
||||||
import "components"
|
import "components"
|
||||||
import "wizard"
|
import "wizard"
|
||||||
|
|
||||||
|
@ -38,13 +38,17 @@ Item {
|
|||||||
|
|
||||||
onOpacityChanged: visible = opacity !== 0
|
onOpacityChanged: visible = opacity !== 0
|
||||||
|
|
||||||
|
function onPageOpened(settingsObject) {
|
||||||
|
enableAutoDonationCheckBox.checked = settingsObject.auto_donations_enabled
|
||||||
|
autoDonationAmountText.text = settingsObject.auto_donations_amount
|
||||||
|
allowBackgroundMiningCheckBox.checked = settingsObject.allow_background_mining
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function onPageClosed(settingsObject) {
|
function onPageClosed(settingsObject) {
|
||||||
settingsObject['auto_donations_enabled'] = enableAutoDonationCheckBox.checked;
|
settingsObject['auto_donations_enabled'] = enableAutoDonationCheckBox.checked;
|
||||||
settingsObject['auto_donations_amount'] = autoDonationAmountText.text;
|
settingsObject['auto_donations_amount'] = parseInt(autoDonationAmountText.text);
|
||||||
settingsObject['allow_background_mining'] = allowBackgroundMiningCheckBox.checked;
|
settingsObject['allow_background_mining'] = allowBackgroundMiningCheckBox.checked;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
import QtQuick 2.2
|
import QtQuick 2.2
|
||||||
|
import Qt.labs.settings 1.0
|
||||||
|
|
||||||
import "../components"
|
import "../components"
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@ -142,10 +144,34 @@ Rectangle {
|
|||||||
|
|
||||||
// saving wallet_filename;
|
// saving wallet_filename;
|
||||||
settings['wallet_filename'] = new_wallet_filename;
|
settings['wallet_filename'] = new_wallet_filename;
|
||||||
|
|
||||||
|
// persist settings
|
||||||
|
persistentSettings.language = settings.language
|
||||||
|
persistentSettings.account_name = settings.account_name
|
||||||
|
persistentSettings.wallet_path = settings.wallet_path
|
||||||
|
persistentSettings.allow_background_mining = settings.allow_background_mining
|
||||||
|
persistentSettings.auto_donations_enabled = settings.auto_donations_enabled
|
||||||
|
persistentSettings.auto_donations_amount = settings.auto_donations_amount
|
||||||
|
}
|
||||||
|
|
||||||
|
// reading settings from persistent storage
|
||||||
|
Component.onCompleted: {
|
||||||
|
settings['allow_background_mining'] = persistentSettings.allow_background_mining
|
||||||
|
settings['auto_donations_enabled'] = persistentSettings.auto_donations_enabled
|
||||||
|
settings['auto_donations_amount'] = persistentSettings.auto_donations_amount
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Settings {
|
||||||
|
id: persistentSettings
|
||||||
|
|
||||||
|
property string language
|
||||||
|
property string account_name
|
||||||
|
property string wallet_path
|
||||||
|
property bool auto_donations_enabled : true
|
||||||
|
property int auto_donations_amount : 50
|
||||||
|
property bool allow_background_mining : true
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: nextButton
|
id: nextButton
|
||||||
|
Loading…
Reference in New Issue
Block a user