aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.cpp')
-rw-r--r--src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.cpp b/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.cpp
index 49b1a55..499c176 100644
--- a/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.cpp
+++ b/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.cpp
@@ -22,6 +22,7 @@
#include "SPI.h"
#include "DSi_I2C.h"
#include "NDS.h"
+#include "Config.h"
#include "types.h"
@@ -40,8 +41,8 @@ PowerManagementDialog::PowerManagementDialog(QWidget* parent) : QDialog(parent),
{
ui->grpDSBattery->setEnabled(false);
- oldDSiBatteryCharging = DSi_BPTWL::GetBatteryCharging();
oldDSiBatteryLevel = DSi_BPTWL::GetBatteryLevel();
+ oldDSiBatteryCharging = DSi_BPTWL::GetBatteryCharging();
}
else
{
@@ -74,12 +75,24 @@ PowerManagementDialog::~PowerManagementDialog()
void PowerManagementDialog::done(int r)
{
- if (r != QDialog::Accepted)
+ if (r == QDialog::Accepted)
+ {
+ if (NDS::ConsoleType == 1)
+ {
+ Config::DSiBatteryLevel = DSi_BPTWL::GetBatteryLevel();
+ Config::DSiBatteryCharging = DSi_BPTWL::GetBatteryCharging();
+ }
+ else
+ {
+ Config::DSBatteryLevelOkay = SPI_Powerman::GetBatteryLevelOkay();
+ }
+ }
+ else
{
if (NDS::ConsoleType == 1)
{
- DSi_BPTWL::SetBatteryCharging(oldDSiBatteryCharging);
DSi_BPTWL::SetBatteryLevel(oldDSiBatteryLevel);
+ DSi_BPTWL::SetBatteryCharging(oldDSiBatteryCharging);
}
else
{