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
|
// Windows, ~/Monero Accounts/ on nix / osx
|
||||||
bool isWindows = false;
|
bool isWindows = false;
|
||||||
bool isIOS = false;
|
bool isIOS = false;
|
||||||
|
bool isMac = false;
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
isWindows = true;
|
isWindows = true;
|
||||||
QStringList moneroAccountsRootDir = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation);
|
QStringList moneroAccountsRootDir = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation);
|
||||||
|
@ -168,6 +169,10 @@ int main(int argc, char *argv[])
|
||||||
#elif defined(Q_OS_UNIX)
|
#elif defined(Q_OS_UNIX)
|
||||||
QStringList moneroAccountsRootDir = QStandardPaths::standardLocations(QStandardPaths::HomeLocation);
|
QStringList moneroAccountsRootDir = QStandardPaths::standardLocations(QStandardPaths::HomeLocation);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
isMac = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
engine.rootContext()->setContextProperty("isWindows", isWindows);
|
engine.rootContext()->setContextProperty("isWindows", isWindows);
|
||||||
engine.rootContext()->setContextProperty("isIOS", isIOS);
|
engine.rootContext()->setContextProperty("isIOS", isIOS);
|
||||||
|
|
||||||
|
|
1
main.qml
1
main.qml
|
@ -818,6 +818,7 @@ ApplicationWindow {
|
||||||
property bool auto_donations_enabled : false
|
property bool auto_donations_enabled : false
|
||||||
property int auto_donations_amount : 50
|
property int auto_donations_amount : 50
|
||||||
property bool allow_background_mining : false
|
property bool allow_background_mining : false
|
||||||
|
property bool miningIgnoreBattery : true
|
||||||
property bool testnet: false
|
property bool testnet: false
|
||||||
property string daemon_address: "localhost:18081"
|
property string daemon_address: "localhost:18081"
|
||||||
property string payment_id
|
property string payment_id
|
||||||
|
|
|
@ -64,6 +64,7 @@ Rectangle {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
|
spacing: 20
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
id: soloTitleLabel
|
id: soloTitleLabel
|
||||||
|
@ -97,6 +98,7 @@ Rectangle {
|
||||||
color: "#4A4949"
|
color: "#4A4949"
|
||||||
text: qsTr("CPU threads") + translationManager.emptyString
|
text: qsTr("CPU threads") + translationManager.emptyString
|
||||||
fontSize: 16
|
fontSize: 16
|
||||||
|
Layout.preferredWidth: 120
|
||||||
}
|
}
|
||||||
LineEdit {
|
LineEdit {
|
||||||
id: soloMinerThreadsLine
|
id: soloMinerThreadsLine
|
||||||
|
@ -108,6 +110,43 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
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 {
|
StandardButton {
|
||||||
visible: true
|
visible: true
|
||||||
|
@ -120,7 +159,7 @@ Rectangle {
|
||||||
releasedColor: "#FF6C3C"
|
releasedColor: "#FF6C3C"
|
||||||
pressedColor: "#FF4304"
|
pressedColor: "#FF4304"
|
||||||
onClicked: {
|
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) {
|
if (success) {
|
||||||
update()
|
update()
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -262,11 +262,11 @@ bool WalletManager::isMining() const
|
||||||
return m_pimpl->isMining();
|
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)
|
if(threads == 0)
|
||||||
threads = 1;
|
threads = 1;
|
||||||
return m_pimpl->startMining(address.toStdString(), threads);
|
return m_pimpl->startMining(address.toStdString(), threads, backgroundMining, ignoreBattery);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WalletManager::stopMining()
|
bool WalletManager::stopMining()
|
||||||
|
|
|
@ -114,7 +114,7 @@ public:
|
||||||
Q_INVOKABLE double miningHashRate() const;
|
Q_INVOKABLE double miningHashRate() const;
|
||||||
|
|
||||||
Q_INVOKABLE bool isMining() 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();
|
Q_INVOKABLE bool stopMining();
|
||||||
|
|
||||||
// QML missing such functionality, implementing these helpers here
|
// QML missing such functionality, implementing these helpers here
|
||||||
|
|
Loading…
Reference in a new issue