diff options
Diffstat (limited to 'src/frontend/qt_sdl')
12 files changed, 1318 insertions, 0 deletions
diff --git a/src/frontend/qt_sdl/CMakeLists.txt b/src/frontend/qt_sdl/CMakeLists.txt index 8b29bae..ec88026 100644 --- a/src/frontend/qt_sdl/CMakeLists.txt +++ b/src/frontend/qt_sdl/CMakeLists.txt @@ -6,6 +6,8 @@ SET(SOURCES_QT_SDL CheatsDialog.cpp Config.cpp EmuSettingsDialog.cpp + PowerManagement/PowerManagementDialog.cpp + PowerManagement/resources/battery.qrc InputConfig/InputConfigDialog.cpp InputConfig/MapButton.h InputConfig/resources/ds.qrc diff --git a/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.cpp b/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.cpp new file mode 100644 index 0000000..b67736a --- /dev/null +++ b/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.cpp @@ -0,0 +1,106 @@ +/* + Copyright 2016-2021 Rayyan Ansari + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ + +#include "PowerManagementDialog.h" +#include "ui_PowerManagementDialog.h" + +#include "SPI.h" +#include "DSi_I2C.h" +#include "NDS.h" + +#include "types.h" + +#include <QtDebug> + +PowerManagementDialog* PowerManagementDialog::currentDlg = nullptr; + +PowerManagementDialog::PowerManagementDialog(QWidget* parent) : QDialog(parent), ui(new Ui::PowerManagementDialog) +{ + ui->setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + + if (NDS::ConsoleType) + ui->grpDSBattery->setEnabled(false); + else + ui->grpDSiBattery->setEnabled(false); + + updateDSBatteryLevelControls(); + + ui->cbDSiBatteryCharging->setChecked(DSi_BPTWL::GetBatteryCharging()); + int dsiBatterySliderPos; + switch (DSi_BPTWL::GetBatteryLevel()) + { + case DSi_BPTWL::batteryLevel_AlmostEmpty: dsiBatterySliderPos = 0; break; + case DSi_BPTWL::batteryLevel_Low: dsiBatterySliderPos = 1; break; + case DSi_BPTWL::batteryLevel_Half: dsiBatterySliderPos = 2; break; + case DSi_BPTWL::batteryLevel_ThreeQuarters: dsiBatterySliderPos = 3; break; + case DSi_BPTWL::batteryLevel_Full: dsiBatterySliderPos = 4; break; + } + ui->sliderDSiBatteryLevel->setValue(dsiBatterySliderPos); +} + +PowerManagementDialog::~PowerManagementDialog() +{ + delete ui; +} + +void PowerManagementDialog::done(int r) +{ + QDialog::done(r); + + closeDlg(); +} + +void PowerManagementDialog::on_rbDSBatteryLow_clicked() +{ + SPI_Powerman::SetBatteryLevelOkay(false); +} + +void PowerManagementDialog::on_rbDSBatteryOkay_clicked() +{ + SPI_Powerman::SetBatteryLevelOkay(true); +} + +void PowerManagementDialog::updateDSBatteryLevelControls() +{ + if (SPI_Powerman::GetBatteryLevelOkay()) + ui->rbDSBatteryOkay->setChecked(true); + else + ui->rbDSBatteryLow->setChecked(true); +} + +void PowerManagementDialog::on_cbDSiBatteryCharging_toggled() +{ + DSi_BPTWL::SetBatteryCharging(ui->cbDSiBatteryCharging->isChecked()); +} + +void PowerManagementDialog::on_sliderDSiBatteryLevel_valueChanged(int value) +{ + u8 newBatteryLevel; + switch (value) + { + case 0: newBatteryLevel = DSi_BPTWL::batteryLevel_AlmostEmpty; break; + case 1: newBatteryLevel = DSi_BPTWL::batteryLevel_Low; break; + case 2: newBatteryLevel = DSi_BPTWL::batteryLevel_Half; break; + case 3: newBatteryLevel = DSi_BPTWL::batteryLevel_ThreeQuarters; break; + case 4: newBatteryLevel = DSi_BPTWL::batteryLevel_Full; break; + } + DSi_BPTWL::SetBatteryLevel(newBatteryLevel); + updateDSBatteryLevelControls(); +} + diff --git a/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.h b/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.h new file mode 100644 index 0000000..c9f3b4a --- /dev/null +++ b/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.h @@ -0,0 +1,69 @@ +/* + Copyright 2016-2021 Rayyan Ansari + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ + +#ifndef POWERMANAGEMENTDIALOG_H +#define POWERMANAGEMENTDIALOG_H + +#include <QDialog> +#include <QAbstractButton> + +namespace Ui { class PowerManagementDialog; } +class PowerManagementDialog; + +class PowerManagementDialog : public QDialog +{ + Q_OBJECT + +public: + explicit PowerManagementDialog(QWidget* parent); + ~PowerManagementDialog(); + + static PowerManagementDialog* currentDlg; + static PowerManagementDialog* openDlg(QWidget* parent) + { + if (currentDlg) + { + currentDlg->activateWindow(); + return currentDlg; + } + + currentDlg = new PowerManagementDialog(parent); + currentDlg->open(); + return currentDlg; + } + static void closeDlg() + { + currentDlg = nullptr; + } + +private slots: + void done(int r); + + void on_rbDSBatteryLow_clicked(); + void on_rbDSBatteryOkay_clicked(); + + void on_cbDSiBatteryCharging_toggled(); + void on_sliderDSiBatteryLevel_valueChanged(int value); + +private: + Ui::PowerManagementDialog* ui; + + void updateDSBatteryLevelControls(); +}; + +#endif // POWERMANAGEMENTDIALOG_H + diff --git a/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.ui b/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.ui new file mode 100644 index 0000000..a2c1216 --- /dev/null +++ b/src/frontend/qt_sdl/PowerManagement/PowerManagementDialog.ui @@ -0,0 +1,258 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>PowerManagementDialog</class> + <widget class="QDialog" name="PowerManagementDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>562</width> + <height>279</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="windowTitle"> + <string>Power management - melonDS</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QGroupBox" name="grpDSBattery"> + <property name="title"> + <string>DS Battery</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="1" column="1"> + <widget class="QRadioButton" name="rbDSBatteryLow"> + <property name="text"> + <string>Low</string> + </property> + </widget> + </item> + <item row="0" column="0" rowspan="2"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Battery Level</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QRadioButton" name="rbDSBatteryOkay"> + <property name="text"> + <string>Okay</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="3" column="0"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QGroupBox" name="grpDSiBattery"> + <property name="title"> + <string>DSi Battery</string> + </property> + <layout class="QGridLayout" name="gridLayout_6"> + <item row="1" column="2"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Almost Empty</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Preferred</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="0" colspan="5"> + <widget class="QCheckBox" name="cbDSiBatteryCharging"> + <property name="text"> + <string>Charging</string> + </property> + </widget> + </item> + <item row="1" column="8"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Full</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_1"> + <property name="text"> + <string>Battery Level</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="resources/battery.qrc">:/dsibattery/dsi_batteryalmostempty.svg</pixmap> + </property> + <property name="scaledContents"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="2" column="4"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="resources/battery.qrc">:/dsibattery/dsi_batterylow.svg</pixmap> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="2" column="5"> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="resources/battery.qrc">:/dsibattery/dsi_battery2.svg</pixmap> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="2" column="6"> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="resources/battery.qrc">:/dsibattery/dsi_battery3.svg</pixmap> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="2" column="7"> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="resources/battery.qrc">:/dsibattery/dsi_batteryfull.svg</pixmap> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="1" column="3" colspan="5"> + <widget class="QSlider" name="sliderDSiBatteryLevel"> + <property name="maximum"> + <number>4</number> + </property> + <property name="pageStep"> + <number>1</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksBothSides</enum> + </property> + <property name="tickInterval"> + <number>1</number> + </property> + </widget> + </item> + <item row="2" column="0" colspan="3"> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <resources> + <include location="resources/battery.qrc"/> + </resources> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>PowerManagementDialog</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>PowerManagementDialog</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/src/frontend/qt_sdl/PowerManagement/resources/battery.qrc b/src/frontend/qt_sdl/PowerManagement/resources/battery.qrc new file mode 100644 index 0000000..7f9c95b --- /dev/null +++ b/src/frontend/qt_sdl/PowerManagement/resources/battery.qrc @@ -0,0 +1,9 @@ +<RCC> + <qresource prefix="dsibattery"> + <file>dsi_batteryalmostempty.svg</file> + <file>dsi_batterylow.svg</file> + <file>dsi_battery2.svg</file> + <file>dsi_battery3.svg</file> + <file>dsi_batteryfull.svg</file> + </qresource> +</RCC> diff --git a/src/frontend/qt_sdl/PowerManagement/resources/dsi_battery2.svg b/src/frontend/qt_sdl/PowerManagement/resources/dsi_battery2.svg new file mode 100644 index 0000000..e9c4b75 --- /dev/null +++ b/src/frontend/qt_sdl/PowerManagement/resources/dsi_battery2.svg @@ -0,0 +1,171 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + width="12.236976mm" + height="6.2838535mm" + viewBox="0 0 12.236976 6.283854" + version="1.1" + id="svg5" + inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)" + sodipodi:docname="battery2.svg" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg"> + <sodipodi:namedview + id="namedview7" + pagecolor="#ff8100" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageshadow="2" + inkscape:pageopacity="1" + inkscape:pagecheckerboard="false" + inkscape:document-units="mm" + showgrid="true" + height="200mm" + showborder="true" + inkscape:showpageshadow="false" + borderlayer="false" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" + inkscape:zoom="10.24" + inkscape:cx="2.7832031" + inkscape:cy="2.0507813" + inkscape:window-width="1920" + inkscape:window-height="1011" + inkscape:window-x="0" + inkscape:window-y="32" + inkscape:window-maximized="1" + inkscape:current-layer="layer1"> + <inkscape:grid + type="xygrid" + id="grid11" + spacingx="0.26458333" + spacingy="0.26458333" + originx="-91.777345" + originy="-47.128916" /> + </sodipodi:namedview> + <defs + id="defs2" /> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(-91.777344,-47.12891)"> + <rect + style="fill:#000000;fill-rule:evenodd;stroke-width:0.0211535" + id="rect153" + width="1.3229166" + height="2.9765623" + x="91.777344" + y="48.782555" /> + <rect + style="fill:#000000;stroke-width:0.0162915" + id="rect177" + width="10.914062" + height="0.66145831" + x="93.100258" + y="47.12891" /> + <rect + style="fill:#000000;stroke-width:0.0165364" + id="rect179" + width="0.66145831" + height="4.9609375" + x="93.100258" + y="47.790367" /> + <rect + style="fill:#000000;stroke-width:0.0162915" + id="rect181" + width="10.914062" + height="0.66145873" + x="93.100258" + y="52.751305" /> + <rect + style="fill:#000000;stroke-width:0.0165364" + id="rect183" + width="0.66145831" + height="4.9609375" + x="103.35286" + y="47.790367" /> + <rect + style="fill:#ffffff;stroke-width:0.0162585" + id="rect318" + width="9.5911455" + height="0.49609375" + x="93.761719" + y="47.790367" /> + <rect + style="fill:#ffffff;stroke-width:0.0158876" + id="rect408" + width="0.49609372" + height="3.96875" + x="93.761719" + y="48.286461" /> + <rect + style="fill:#ffffff;stroke-width:0.015706" + id="rect410" + width="9.5911455" + height="0.49609351" + x="93.761719" + y="52.255211" /> + <rect + style="fill:#ffffff;stroke-width:0.0158876" + id="rect412" + width="0.4960939" + height="3.9687498" + x="102.85677" + y="48.286461" /> + <rect + style="fill:#ffffff;stroke-width:0.0224686" + id="rect414" + width="0.66145849" + height="3.9687498" + x="95.911453" + y="48.286461" /> + <rect + style="fill:#ffffff;stroke-width:0.0158876" + id="rect414-3" + width="0.66145885" + height="3.9687498" + x="98.226562" + y="48.286461" /> + <rect + style="fill:#ffffff;stroke-width:0.0158876" + id="rect414-6" + width="0.66145819" + height="3.9687498" + x="100.54166" + y="48.286461" /> + <rect + style="fill:#999999;stroke-width:0.0165364" + id="rect1736" + width="1.6536455" + height="3.9687498" + x="94.257812" + y="48.286461" /> + <rect + style="fill:#999999;stroke-width:0.0165364" + id="rect1738" + width="1.6536458" + height="3.96875" + x="96.572914" + y="48.286461" /> + <rect + style="fill:#00ccff;stroke-width:0.0165364" + id="rect1740" + width="1.6536458" + height="3.96875" + x="98.888016" + y="48.286461" /> + <rect + style="fill:#00ccff;stroke-width:0.0165364" + id="rect1742" + width="1.6536458" + height="3.96875" + x="101.20312" + y="48.286461" /> + </g> +</svg> diff --git a/src/frontend/qt_sdl/PowerManagement/resources/dsi_battery3.svg b/src/frontend/qt_sdl/PowerManagement/resources/dsi_battery3.svg new file mode 100644 index 0000000..d464ef3 --- /dev/null +++ b/src/frontend/qt_sdl/PowerManagement/resources/dsi_battery3.svg @@ -0,0 +1,171 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + width="12.236976mm" + height="6.2838535mm" + viewBox="0 0 12.236976 6.283854" + version="1.1" + id="svg5" + inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)" + sodipodi:docname="battery3.svg" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg"> + <sodipodi:namedview + id="namedview7" + pagecolor="#ff8100" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageshadow="2" + inkscape:pageopacity="1" + inkscape:pagecheckerboard="false" + inkscape:document-units="mm" + showgrid="true" + height="200mm" + showborder="true" + inkscape:showpageshadow="false" + borderlayer="false" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" + inkscape:zoom="10.24" + inkscape:cx="2.7832031" + inkscape:cy="2.0507813" + inkscape:window-width="1920" + inkscape:window-height="1011" + inkscape:window-x="0" + inkscape:window-y="32" + inkscape:window-maximized="1" + inkscape:current-layer="layer1"> + <inkscape:grid + type="xygrid" + id="grid11" + spacingx="0.26458333" + spacingy="0.26458333" + originx="-91.777345" + originy="-47.128916" /> + </sodipodi:namedview> + <defs + id="defs2" /> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(-91.777344,-47.12891)"> + <rect + style="fill:#000000;fill-rule:evenodd;stroke-width:0.0211535" + id="rect153" + width="1.3229166" + height="2.9765623" + x="91.777344" + y="48.782555" /> + <rect + style="fill:#000000;stroke-width:0.0162915" + id="rect177" + width="10.914062" + height="0.66145831" + x="93.100258" + y="47.12891" /> + <rect + style="fill:#000000;stroke-width:0.0165364" + id="rect179" + width="0.66145831" + height="4.9609375" + x="93.100258" + y="47.790367" /> + <rect + style="fill:#000000;stroke-width:0.0162915" + id="rect181" + width="10.914062" + height="0.66145873" + x="93.100258" + y="52.751305" /> + <rect + style="fill:#000000;stroke-width:0.0165364" + id="rect183" + width="0.66145831" + height="4.9609375" + x="103.35286" + y="47.790367" /> + <rect + style="fill:#ffffff;stroke-width:0.0162585" + id="rect318" + width="9.5911455" + height="0.49609375" + x="93.761719" + y="47.790367" /> + <rect + style="fill:#ffffff;stroke-width:0.0158876" + id="rect408" + width="0.49609372" + height="3.96875" + x="93.761719" + y="48.286461" /> + <rect + style="fill:#ffffff;stroke-width:0.015706" + id="rect410" + width="9.5911455" + height="0.49609351" + x="93.761719" + y="52.255211" /> + <rect + style="fill:#ffffff;stroke-width:0.0158876" + id="rect412" + width="0.4960939" + height="3.9687498" + x="102.85677" + y="48.286461" /> + <rect + style="fill:#ffffff;stroke-width:0.0224686" + id="rect414" + width="0.66145849" + height="3.9687498" + x="95.911453" + y="48.286461" /> + <rect + style="fill:#ffffff;stroke-width:0.0158876" + id="rect414-3" + width="0.66145885" + height="3.9687498" + x="98.226562" + y="48.286461" /> + <rect + style="fill:#ffffff;stroke-width:0.0158876" + id="rect414-6" + width="0.66145819" + height="3.9687498" + x="100.54166" + y="48.286461" /> + <rect + style="fill:#999999;stroke-width:0.0165364" + id="rect1736" + width="1.6536455" + height="3.9687498" + x="94.257812" + y="48.286461" /> + <rect + style="fill:#00ccff;stroke-width:0.0165364" + id="rect1738" + width="1.6536458" + height="3.96875" + x="96.572914" + y="48.286461" /> + <rect + style="fill:#00ccff;stroke-width:0.0165364" + id="rect1740" + width="1.6536458" + height="3.96875" + x="98.888016" + y="48.286461" /> + <rect + style="fill:#00ccff;stroke-width:0.0165364" + id="rect1742" + width="1.6536458" + height="3.96875" + x="101.20312" + y="48.286461" /> + </g> +</svg> diff --git a/src/frontend/qt_sdl/PowerManagement/resources/dsi_batteryalmostempty.svg b/src/frontend/qt_sdl/PowerManagement/resources/dsi_batteryalmostempty.svg new file mode 100644 index 0000000..4f598fa --- /dev/null +++ b/src/frontend/qt_sdl/PowerManagement/resources/dsi_batteryalmostempty.svg @@ -0,0 +1,171 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + width="12.236976mm" + height="6.2838535mm" + viewBox="0 0 12.236976 6.283854" + version="1.1" + id="svg5" + inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)" + sodipodi:docname="dsi_batteryalmostempty.svg" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg"> + <sodipodi:namedview + id="namedview7" + pagecolor="#ff8100" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageshadow="2" + inkscape:pageopacity="1" + inkscape:pagecheckerboard="false" + inkscape:document-units="mm" + showgrid="true" + height="200mm" + showborder="true" + inkscape:showpageshadow="false" + borderlayer="false" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" + inkscape:zoom="14.481547" + inkscape:cx="35.389866" + inkscape:cy="16.503762" + inkscape:window-width="1920" + inkscape:window-height="1011" + inkscape:window-x="0" + inkscape:window-y="32" + inkscape:window-maximized="1" + inkscape:current-layer="layer1"> + <inkscape:grid + type="xygrid" + id="grid11" + spacingx="0.26458333" + spacingy="0.26458333" + originx="-91.77735" + originy="-47.128928" /> + </sodipodi:namedview> + <defs + id="defs2" /> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(-91.777344,-47.12891)"> + <rect + style="fill:#ff2a2a;fill-rule:evenodd;stroke-width:0.0211535" + id="rect153" + width="1.3229166" + height="2.9765623" + x="91.777344" + y="48.782555" /> + <rect + style="fill:#ff2a2a;stroke-width:0.0162915" + id="rect177" + width="10.914062" + height="0.66145831" + x="93.100258" + y="47.12891" /> + <rect + style="fill:#ff2a2a;stroke-width:0.0165364" + id="rect179" + width="0.66145831" + height="4.9609375" + x="93.100258" + y="47.790367" /> + <rect + style="fill:#ff2a2a;stroke-width:0.0162915" + id="rect181" + width="10.914062" + height="0.66145873" + x="93.100258" + y="52.751305" /> + <rect + style="fill:#ff2a2a;stroke-width:0.0165364" + id="rect183" + width="0.66145831" + height="4.9609375" + x="103.35286" + y="47.790367" /> + <rect + style="fill:#ffffff;stroke-width:0.0162585" + id="rect318" + width="9.5911455" + height="0.49609375" + x="93.761719" + y="47.790367" /> + <rect + style="fill:#ffffff;stroke-width:0.0158876" + id="rect408" + width="0.49609372" + height="3.96875" + x="93.761719" + y="48.286461" /> + <rect + style="fill:#ffffff;stroke-width:0.015706" + id="rect410" + width="9.5911455" + height="0.49609351" + x="93.761719" + y="52.255211" /> + <rect + style="fill:#ffffff;stroke-width:0.0158876" + id="rect412" + width="0.4960939" + height="3.9687498" + x="102.85677" + y="48.286461" /> + <rect + style="fill:#ffffff;stroke-width:0.0224686" + id="rect414" + width="0.66145849" + height="3.9687498" + x="95.911453" + y="48.286461" /> + <rect + style="fill:#ffffff;stroke-width:0.0158876" + id="rect414-3" + width="0.66145885" + height="3.9687498" + x="98.226562" + y="48.286461" /> + <rect + style="fill:#ffffff;stroke-width:0.0158876" + id="rect414-6" + width="0.66145819" + height="3.9687498" + x="100.54166" + y="48.286461" /> + <rect + style="fill:#999999;stroke-width:0.0165364" + id="rect1736" + width="1.6536455" + height="3.9687498" + x="94.257812" + y="48.286461" /> + <rect + style="fill:#999999;stroke-width:0.0165364" + id="rect1738" + width="1.6536458" + height="3.96875" + x="96.572914" + y="48.286461" /> + <rect + style="fill:#999999;stroke-width:0.0165364" + id="rect1740" + width="1.6536458" + height="3.96875" + x="98.888016" + y="48.286461" /> + <rect + style="fill:#ff2a2a;stroke-width:0.0165364" + id="rect1742" + width="1.6536458" + height="3.96875" + x="101.20312" + y="48.286461" /> + </g> +</svg> diff --git a/src/frontend/qt_sdl/PowerManagement/resources/dsi_batteryfull.svg b/src/frontend/qt_sdl/PowerManagement/resources/dsi_batteryfull.svg new file mode 100644 index 0000000..dbf8499 --- /dev/null +++ b/src/frontend/qt_sdl/PowerManagement/resources/dsi_batteryfull.svg @@ -0,0 +1,171 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + width="12.236976mm" + height="6.2838535mm" + viewBox="0 0 12.236976 6.283854" + version="1.1" + id="svg5" + inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)" + sodipodi:docname="batteryfull.svg" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg"> + <sodipodi:namedview + id="namedview7" + pagecolor="#ff8100" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageshadow="2" + inkscape:pageopacity="1" + inkscape:pagecheckerboard="false" + inkscape:document-units="mm" + showgrid="true" + height="200mm" + showborder="true" + inkscape:showpageshadow="false" + borderlayer="false" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" + inkscape:zoom="10.24" + inkscape:cx="2.7832031" + inkscape:cy="2.0507813" + inkscape:window-width="1920" + inkscape:window-height="1011" + inkscape:window-x="0" + inkscape:window-y="32" + inkscape:window-maximized="1" + inkscape:current-layer="layer1"> + <inkscape:grid + type="xygrid" + id="grid11" + spacingx="0.26458333" + spacingy="0.26458333" + originx="-91.777345" + originy="-47.128916" /> + </sodipodi:namedview> + <defs + id="defs2" /> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(-91.777344,-47.12891)"> + <rect + style="fill:#000000;fill-rule:evenodd;stroke-width:0.0211535" + id="rect153" + width="1.3229166" + height="2.9765623" + x="91.777344" + y="48.782555" /> + <rect + style="fill:#000000;stroke-width:0.0162915" + id="rect177" + width="10.914062" + height="0.66145831" + x="93.100258" + y="47.12891" /> + <rect + style="fill:#000000;stroke-width:0.0165364" + id="rect179" + width="0.66145831" + height="4.9609375" + x="93.100258" + y="47.790367" /> + <rect + style="fill:#000000;stroke-width:0.0162915" + id="rect181" + width="10.914062" + height="0.66145873" + x="93.100258" + y="52.751305" /> + <rect + style="fill:#000000;stroke-width:0.0165364" + id="rect183" + width="0.66145831" + height="4.9609375" + x="103.35286" + y="47.790367" /> + <rect + style="fill:#ffffff;stroke-width:0.0162585" + id="rect318" + width="9.5911455" + height="0.49609375" + x="93.761719" + y="47.790367" /> + <rect + style="fill:#ffffff;stroke-width:0.0158876" + id="rect408" + width="0.49609372" + height="3.96875" + x="93.761719" + y="48.286461" /> + <rect + style="fill:#ffffff;stroke-width:0.015706" + id="rect410" + width="9.5911455" + height="0.49609351" + x="93.761719" + y="52.255211" /> + <rect + style="fill:#ffffff;stroke-width:0.0158876" + id="rect412" + width="0.4960939" + height="3.9687498" + x="102.85677" + y="48.286461" /> + <rect + style="fill:#ffffff;stroke-width:0.0224686" + id="rect414" + width="0.66145849" + height="3.9687498" + x="95.911453" + y="48.286461" /> + <rect + style="fill:#ffffff;stroke-width:0.0158876" + id="rect414-3" + width="0.66145885" + height="3.9687498" + x="98.226562" + y="48.286461" /> + <rect + style="fill:#ffffff;stroke-width:0.0158876" + id="rect414-6" + width="0.66145819" + height="3.9687498" + x="100.54166" + y="48.286461" /> + <rect + style="fill:#00ccff;stroke-width:0.0165364" + id="rect1736" + width="1.6536455" + height="3.9687498" + x="94.257812" + y="48.286461" /> + <rect + style="fill:#00ccff;stroke-width:0.0165364" + id="rect1738" + width="1.6536458" + height="3.96875" + x="96.572914" + y="48.286461" /> + <rect + style="fill:#00ccff;stroke-width:0.0165364" + id="rect1740" + width="1.6536458" + height="3.96875" + x="98.888016" + y="48.286461" /> + <rect + style="fill:#00ccff;stroke-width:0.0165364" + id="rect1742" + width="1.6536458" + height="3.96875" + x="101.20312" + y="48.286461" /> + </g> +</svg> diff --git a/src/frontend/qt_sdl/PowerManagement/resources/dsi_batterylow.svg b/src/frontend/qt_sdl/PowerManagement/resources/dsi_batterylow.svg new file mode 100644 index 0000000..d337675 --- /dev/null +++ b/src/frontend/qt_sdl/PowerManagement/resources/dsi_batterylow.svg @@ -0,0 +1,171 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + width="12.236976mm" + height="6.2838535mm" + viewBox="0 0 12.236976 6.283854" + version="1.1" + id="svg5" + inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)" + sodipodi:docname="batterylow.svg" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg"> + <sodipodi:namedview + id="namedview7" + pagecolor="#ff8100" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageshadow="2" + inkscape:pageopacity="1" + inkscape:pagecheckerboard="false" + inkscape:document-units="mm" + showgrid="true" + height="200mm" + showborder="true" + inkscape:showpageshadow="false" + borderlayer="false" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" + inkscape:zoom="0.45254834" + inkscape:cx="325.93203" + inkscape:cy="232.01941" + inkscape:window-width="1920" + inkscape:window-height="1011" + inkscape:window-x="0" + inkscape:window-y="32" + inkscape:window-maximized="1" + inkscape:current-layer="layer1"> + <inkscape:grid + type="xygrid" + id="grid11" + spacingx="0.26458333" + spacingy="0.26458333" + originx="-91.777345" + originy="-47.128916" /> + </sodipodi:namedview> + <defs + id="defs2" /> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(-91.777344,-47.12891)"> + <rect + style="fill:#000000;fill-rule:evenodd;stroke-width:0.0211535" + id="rect153" + width="1.3229166" + height="2.9765623" + x="91.777344" + y="48.782555" /> + <rect + style="fill:#000000;stroke-width:0.0162915" + id="rect177" + width="10.914062" + height="0.66145831" + x="93.100258" + y="47.12891" /> + <rect + style="fill:#000000;stroke-width:0.0165364" + id="rect179" + width="0.66145831" + height="4.9609375" + x="93.100258" + y="47.790367" /> + <rect + style="fill:#000000;stroke-width:0.0162915" + id="rect181" + width="10.914062" + height="0.66145873" + x="93.100258" + y="52.751305" /> + <rect + style="fill:#000000;stroke-width:0.0165364" + id="rect183" + width="0.66145831" + height="4.9609375" + x="103.35286" + y="47.790367" /> + <rect + style="fill:#ffffff;stroke-width:0.0162585" + id="rect318" + width="9.5911455" + height="0.49609375" + x="93.761719" + y="47.790367" /> + <rect + style="fill:#ffffff;stroke-width:0.0158876" + id="rect408" + width="0.49609372" + height="3.96875" + x="93.761719" + y="48.286461" /> + <rect + style="fill:#ffffff;stroke-width:0.015706" + id="rect410" + width="9.5911455" + height="0.49609351" + x="93.761719" + y="52.255211" /> + <rect + style="fill:#ffffff;stroke-width:0.0158876" + id="rect412" + width="0.4960939" + height="3.9687498" + x="102.85677" + y="48.286461" /> + <rect + style="fill:#ffffff;stroke-width:0.0224686" + id="rect414" + width="0.66145849" + height="3.9687498" + x="95.911453" + y="48.286461" /> + <rect + style="fill:#ffffff;stroke-width:0.0158876" + id="rect414-3" + width="0.66145885" + height="3.9687498" + x="98.226562" + y="48.286461" /> + <rect + style="fill:#ffffff;stroke-width:0.0158876" + id="rect414-6" + width="0.66145819" + height="3.9687498" + x="100.54166" + y="48.286461" /> + <rect + style="fill:#999999;stroke-width:0.0165364" + id="rect1736" + width="1.6536455" + height="3.9687498" + x="94.257812" + y="48.286461" /> + <rect + style="fill:#999999;stroke-width:0.0165364" + id="rect1738" + width="1.6536458" + height="3.96875" + x="96.572914" + y="48.286461" /> + <rect + style="fill:#999999;stroke-width:0.0165364" + id="rect1740" + width="1.6536458" + height="3.96875" + x="98.888016" + y="48.286461" /> + <rect + style="fill:#ff2a2a;stroke-width:0.0165364" + id="rect1742" + width="1.6536458" + height="3.96875" + x="101.20312" + y="48.286461" /> + </g> +</svg> diff --git a/src/frontend/qt_sdl/main.cpp b/src/frontend/qt_sdl/main.cpp index 7454ffc..1296bb9 100644 --- a/src/frontend/qt_sdl/main.cpp +++ b/src/frontend/qt_sdl/main.cpp @@ -62,6 +62,7 @@ #include "ROMInfoDialog.h" #include "RAMInfoDialog.h" #include "TitleManagerDialog.h" +#include "PowerManagement/PowerManagementDialog.h" #include "types.h" #include "version.h" @@ -1429,6 +1430,11 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) menu->addSeparator(); + actPowerManagement = menu->addAction("Power management"); + connect(actPowerManagement, &QAction::triggered, this, &MainWindow::onOpenPowerManagement); + + menu->addSeparator(); + actEnableCheats = menu->addAction("Enable cheats"); actEnableCheats->setCheckable(true); connect(actEnableCheats, &QAction::triggered, this, &MainWindow::onEnableCheats); @@ -1669,6 +1675,8 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) actStop->setEnabled(false); actFrameStep->setEnabled(false); + actPowerManagement->setEnabled(false); + actSetupCheats->setEnabled(false); actTitleManager->setEnabled(!Config::DSiNANDPath.empty()); @@ -2609,6 +2617,11 @@ void MainWindow::onEmuSettingsDialogFinished(int res) actTitleManager->setEnabled(!Config::DSiNANDPath.empty()); } +void MainWindow::onOpenPowerManagement() +{ + PowerManagementDialog* dlg = PowerManagementDialog::openDlg(this); +} + void MainWindow::onOpenInputConfig() { emuThread->emuPause(); @@ -2896,6 +2909,8 @@ void MainWindow::onEmuStart() actStop->setEnabled(true); actFrameStep->setEnabled(true); + actPowerManagement->setEnabled(true); + actTitleManager->setEnabled(false); } @@ -2915,6 +2930,8 @@ void MainWindow::onEmuStop() actStop->setEnabled(false); actFrameStep->setEnabled(false); + actPowerManagement->setEnabled(false); + actTitleManager->setEnabled(!Config::DSiNANDPath.empty()); } diff --git a/src/frontend/qt_sdl/main.h b/src/frontend/qt_sdl/main.h index 6929d69..6466e3b 100644 --- a/src/frontend/qt_sdl/main.h +++ b/src/frontend/qt_sdl/main.h @@ -257,6 +257,7 @@ private slots: void onOpenEmuSettings(); void onEmuSettingsDialogFinished(int res); + void onOpenPowerManagement(); void onOpenInputConfig(); void onInputConfigFinished(int res); void onOpenVideoSettings(); @@ -346,6 +347,7 @@ public: QAction* actTitleManager; QAction* actEmuSettings; + QAction* actPowerManagement; QAction* actInputConfig; QAction* actVideoSettings; QAction* actAudioSettings; |