diff --git a/logiconf-gui/Page2.qml b/logiconf-gui/Page2.qml index 8e12054..d6bf10c 100755 --- a/logiconf-gui/Page2.qml +++ b/logiconf-gui/Page2.qml @@ -60,6 +60,10 @@ Page2Form { print("current index: " + DevCom.getDPIIndex() + " list length: "+dpilist.length) if(DevCom.getDPIIndex()+1 > dpilist.length) DevCom.setDPIIndex(dpilist.length-1) + if(DevCom.getDefaultDpi()+1 > dpilist.length) + DevCom.setDefaultDpi(dpilist.length-1) + if(DevCom.getSwitchedDpi()+1 > dpilist.length) + DevCom.setSwitchedDpi(dpilist.length-1) DevCom.applySettings() btnApply.enabled = false; var current = DevCom.getDPIIndex() diff --git a/logiconf-gui/devicecommunicator.cpp b/logiconf-gui/devicecommunicator.cpp index 1030dfe..2a6af70 100755 --- a/logiconf-gui/devicecommunicator.cpp +++ b/logiconf-gui/devicecommunicator.cpp @@ -110,6 +110,26 @@ void DeviceCommunicator::setReportRate(int rate) tmpprofile.settings.at("report_rate") = std::move(HIDPP::Setting(rate)); } +int DeviceCommunicator::getDefaultDpi() +{ + return hidprofile->settings.at("default_dpi").get(); +} + +void DeviceCommunicator::setDefaultDpi(int level) +{ + tmpprofile.settings.at("default_dpi") = std::move(HIDPP::Setting(level)); +} + +int DeviceCommunicator::getSwitchedDpi() +{ + return hidprofile->settings.at("switched_dpi").get(); +} + +void DeviceCommunicator::setSwitchedDpi(int level) +{ + tmpprofile.settings.at("switched_dpi") = std::move(HIDPP::Setting(level)); +} + void DeviceCommunicator::setDPI(int level, int dpi) { tmpprofile.modes[level].at("dpi") = std::move(HIDPP::Setting(dpi)); diff --git a/logiconf-gui/devicecommunicator.h b/logiconf-gui/devicecommunicator.h index fc5d855..f97d101 100755 --- a/logiconf-gui/devicecommunicator.h +++ b/logiconf-gui/devicecommunicator.h @@ -18,6 +18,10 @@ class DeviceCommunicator : public QObject explicit DeviceCommunicator(QObject *parent = 0); Q_INVOKABLE int getReportRate(); Q_INVOKABLE void setReportRate(int rate); + Q_INVOKABLE int getDefaultDpi(); + Q_INVOKABLE void setDefaultDpi(int level); + Q_INVOKABLE int getSwitchedDpi(); + Q_INVOKABLE void setSwitchedDpi(int level); Q_INVOKABLE void setDPI(int level, int dpi); Q_INVOKABLE void removeDPILevel(int level); Q_INVOKABLE void addDPILevel(int dpi);