mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-17 00:07:51 +00:00
parent
988e299290
commit
223f09dc94
5 changed files with 50 additions and 5 deletions
5
main.cpp
5
main.cpp
|
@ -159,6 +159,7 @@ int main(int argc, char *argv[])
|
|||
// Windows, ~/Monero Accounts/ on nix / osx
|
||||
bool isWindows = false;
|
||||
bool isIOS = false;
|
||||
bool isMac = false;
|
||||
#ifdef Q_OS_WIN
|
||||
isWindows = true;
|
||||
QStringList moneroAccountsRootDir = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation);
|
||||
|
@ -168,6 +169,10 @@ int main(int argc, char *argv[])
|
|||
#elif defined(Q_OS_UNIX)
|
||||
QStringList moneroAccountsRootDir = QStandardPaths::standardLocations(QStandardPaths::HomeLocation);
|
||||
#endif
|
||||
#ifdef Q_OS_MAC
|
||||
isMac = true;
|
||||
#endif
|
||||
|
||||
engine.rootContext()->setContextProperty("isWindows", isWindows);
|
||||
engine.rootContext()->setContextProperty("isIOS", isIOS);
|
||||
|
||||
|
|
3
main.qml
3
main.qml
|
@ -818,6 +818,7 @@ ApplicationWindow {
|
|||
property bool auto_donations_enabled : false
|
||||
property int auto_donations_amount : 50
|
||||
property bool allow_background_mining : false
|
||||
property bool miningIgnoreBattery : true
|
||||
property bool testnet: false
|
||||
property string daemon_address: "localhost:18081"
|
||||
property string payment_id
|
||||
|
@ -857,7 +858,7 @@ ApplicationWindow {
|
|||
return;
|
||||
} else
|
||||
handleTransactionConfirmed()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StandardDialog {
|
||||
|
|
|
@ -64,6 +64,7 @@ Rectangle {
|
|||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
spacing: 20
|
||||
|
||||
Label {
|
||||
id: soloTitleLabel
|
||||
|
@ -97,6 +98,7 @@ Rectangle {
|
|||
color: "#4A4949"
|
||||
text: qsTr("CPU threads") + translationManager.emptyString
|
||||
fontSize: 16
|
||||
Layout.preferredWidth: 120
|
||||
}
|
||||
LineEdit {
|
||||
id: soloMinerThreadsLine
|
||||
|
@ -108,6 +110,43 @@ Rectangle {
|
|||
}
|
||||
|
||||
RowLayout {
|
||||
// Disable this option until stable
|
||||
visible: false
|
||||
Layout.leftMargin: 125
|
||||
CheckBox {
|
||||
id: backgroundMining
|
||||
enabled: startSoloMinerButton.enabled
|
||||
checked: persistentSettings.allow_background_mining
|
||||
onClicked: {persistentSettings.allow_background_mining = checked}
|
||||
text: qsTr("Background mining (experimental)") + translationManager.emptyString
|
||||
checkedIcon: "../images/checkedVioletIcon.png"
|
||||
uncheckedIcon: "../images/uncheckedIcon.png"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
// Disable this option until stable
|
||||
visible: false
|
||||
Layout.leftMargin: 125
|
||||
CheckBox {
|
||||
id: ignoreBattery
|
||||
enabled: startSoloMinerButton.enabled
|
||||
checked: !persistentSettings.miningIgnoreBattery
|
||||
onClicked: {persistentSettings.miningIgnoreBattery = !checked}
|
||||
text: qsTr("Enable mining when running on battery") + translationManager.emptyString
|
||||
checkedIcon: "../images/checkedVioletIcon.png"
|
||||
uncheckedIcon: "../images/uncheckedIcon.png"
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Label {
|
||||
id: manageSoloMinerLabel
|
||||
color: "#4A4949"
|
||||
text: qsTr("Manage miner") + translationManager.emptyString
|
||||
fontSize: 16
|
||||
}
|
||||
|
||||
StandardButton {
|
||||
visible: true
|
||||
|
@ -120,7 +159,7 @@ Rectangle {
|
|||
releasedColor: "#FF6C3C"
|
||||
pressedColor: "#FF4304"
|
||||
onClicked: {
|
||||
var success = walletManager.startMining(appWindow.currentWallet.address, soloMinerThreadsLine.text)
|
||||
var success = walletManager.startMining(appWindow.currentWallet.address, soloMinerThreadsLine.text, persistentSettings.allow_background_mining, persistentSettings.miningIgnoreBattery)
|
||||
if (success) {
|
||||
update()
|
||||
} else {
|
||||
|
|
|
@ -262,11 +262,11 @@ bool WalletManager::isMining() const
|
|||
return m_pimpl->isMining();
|
||||
}
|
||||
|
||||
bool WalletManager::startMining(const QString &address, quint32 threads)
|
||||
bool WalletManager::startMining(const QString &address, quint32 threads, bool backgroundMining, bool ignoreBattery)
|
||||
{
|
||||
if(threads == 0)
|
||||
threads = 1;
|
||||
return m_pimpl->startMining(address.toStdString(), threads);
|
||||
return m_pimpl->startMining(address.toStdString(), threads, backgroundMining, ignoreBattery);
|
||||
}
|
||||
|
||||
bool WalletManager::stopMining()
|
||||
|
|
|
@ -114,7 +114,7 @@ public:
|
|||
Q_INVOKABLE double miningHashRate() const;
|
||||
|
||||
Q_INVOKABLE bool isMining() const;
|
||||
Q_INVOKABLE bool startMining(const QString &address, quint32 threads);
|
||||
Q_INVOKABLE bool startMining(const QString &address, quint32 threads, bool backgroundMining, bool ignoreBattery);
|
||||
Q_INVOKABLE bool stopMining();
|
||||
|
||||
// QML missing such functionality, implementing these helpers here
|
||||
|
|
Loading…
Reference in a new issue