It launches but some things are broken now...

This commit is contained in:
Nicolas Mailloux 2024-08-14 12:12:39 -04:00
parent 91517f65e4
commit 201b13a20a
4 changed files with 64 additions and 95 deletions

View file

@ -83,29 +83,8 @@ QString Device::readFile(QString path) {
}
QString Device::getPowerSupplyPath() {
// get the path to the battery so we can check the charge latter
QString result;
QDirIterator supplies("/sys/class/power_supply", QDirIterator::NoIteratorFlags);
while(supplies.hasNext()) {
QString supply = supplies.filePath();
// Badly-classified device by some ntx kernels, ignore
if (supplies.fileName() == "mc13892_charger") {
continue;
}
if(QFile::exists(supply + "/type")) {
QString content = readFile(supply + "/type");
if(content == "Battery"){
result = supply;
break;
}
}
supplies.next();
}
return result;
// Since every or almost every device we support uses this path, we will keep things simple for now
return "/sys/class/power_supply/mc13892_bat/";
}

View file

@ -11,7 +11,6 @@ DeviceKindleTouch::DeviceKindleTouch()
int DeviceKindleTouch::getBatteryLevel() {
if(QFile::exists("/sys/devices/system/yoshi_battery/yoshi_battery0/battery_capacity")) {
return readFile("/sys/devices/system/yoshi_battery/yoshi_battery0/battery_capacity").toInt();
}
return 100;
}

View file

@ -19,13 +19,13 @@
<item row="28" column="0">
<widget class="Line" name="line_5">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
<enum>QFrame::Shadow::Plain</enum>
</property>
<property name="lineWidth">
<number>2</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
@ -37,7 +37,7 @@
<item row="0" column="0">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -50,7 +50,7 @@
<item row="0" column="2">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -64,7 +64,6 @@
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -72,7 +71,7 @@
<string>InkBox settings</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
@ -95,10 +94,13 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page">
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
<enum>QLayout::SizeConstraint::SetDefaultConstraint</enum>
</property>
<property name="leftMargin">
<number>0</number>
@ -115,7 +117,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
<enum>QLayout::SizeConstraint::SetDefaultConstraint</enum>
</property>
<property name="bottomMargin">
<number>0</number>
@ -130,7 +132,7 @@
<item>
<spacer name="horizontalSpacer_19">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -152,13 +154,13 @@
<item>
<widget class="Line" name="line_12">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
<enum>QFrame::Shadow::Plain</enum>
</property>
<property name="lineWidth">
<number>2</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
@ -170,7 +172,7 @@
<item>
<widget class="QStackedWidget" name="settingsStackedWidget">
<property name="currentIndex">
<number>5</number>
<number>0</number>
</property>
<widget class="QWidget" name="General">
<layout class="QVBoxLayout" name="verticalLayout_7">
@ -191,7 +193,7 @@
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
<enum>QFrame::Shape::NoFrame</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
@ -201,8 +203,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>457</width>
<height>622</height>
<width>463</width>
<height>587</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
@ -228,10 +230,10 @@
<item>
<widget class="Line" name="line_13">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
<enum>QFrame::Shadow::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
@ -245,10 +247,10 @@
<item>
<widget class="Line" name="line_14">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
<enum>QFrame::Shadow::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
@ -262,10 +264,10 @@
<item>
<widget class="Line" name="line_15">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
<enum>QFrame::Shadow::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
@ -279,10 +281,10 @@
<item>
<widget class="Line" name="line_16">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
<enum>QFrame::Shadow::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
@ -296,10 +298,10 @@
<item>
<widget class="Line" name="line_17">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
<enum>QFrame::Shadow::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
@ -313,7 +315,7 @@
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -330,13 +332,13 @@
<item>
<widget class="Line" name="line_18">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
<enum>QFrame::Shadow::Plain</enum>
</property>
<property name="lineWidth">
<number>2</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
@ -350,13 +352,13 @@
<item>
<widget class="Line" name="line_2">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
<enum>QFrame::Shadow::Plain</enum>
</property>
<property name="lineWidth">
<number>2</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
@ -364,7 +366,6 @@
<widget class="QPushButton" name="okBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -396,10 +397,10 @@ Save &amp;&amp; Quit
<item>
<widget class="QScrollArea" name="scrollArea_2">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
<enum>QFrame::Shape::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Shadow::Sunken</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
@ -409,8 +410,8 @@ Save &amp;&amp; Quit
<rect>
<x>0</x>
<y>0</y>
<width>235</width>
<height>258</height>
<width>425</width>
<height>723</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
@ -456,7 +457,7 @@ Save &amp;&amp; Quit
<item row="1" column="1">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -534,7 +535,7 @@ Save &amp;&amp; Quit
<item row="1" column="0">
<spacer name="horizontalSpacer_11">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -579,7 +580,7 @@ Save &amp;&amp; Quit
<item row="1" column="6">
<spacer name="horizontalSpacer_17">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -606,7 +607,7 @@ Save &amp;&amp; Quit
<item row="0" column="1">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -692,7 +693,6 @@ Save &amp;&amp; Quit
<widget class="QPushButton" name="exportHighlightsBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -704,7 +704,7 @@ Save &amp;&amp; Quit
<item row="0" column="1">
<spacer name="horizontalSpacer_12">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -726,7 +726,7 @@ Save &amp;&amp; Quit
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -782,7 +782,7 @@ Save &amp;&amp; Quit
<item row="5" column="0">
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -822,7 +822,7 @@ Save &amp;&amp; Quit
<item>
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -871,7 +871,6 @@ Save &amp;&amp; Quit
<widget class="QPushButton" name="usbmsBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -883,7 +882,7 @@ Save &amp;&amp; Quit
<item row="1" column="1">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -905,7 +904,7 @@ Save &amp;&amp; Quit
<item row="2" column="0">
<spacer name="verticalSpacer_7">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -959,7 +958,7 @@ Save &amp;&amp; Quit
<item row="0" column="1">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -973,7 +972,6 @@ Save &amp;&amp; Quit
<widget class="QPushButton" name="showSystemInfoBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -993,7 +991,6 @@ Save &amp;&amp; Quit
<widget class="QPushButton" name="generateSystemReportBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -1005,7 +1002,7 @@ Save &amp;&amp; Quit
<item row="0" column="1">
<spacer name="horizontalSpacer_15">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -1040,7 +1037,6 @@ Save &amp;&amp; Quit
<widget class="QPushButton" name="checkOtaUpdateBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -1052,7 +1048,7 @@ Save &amp;&amp; Quit
<item row="1" column="1">
<spacer name="horizontalSpacer_13">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -1080,7 +1076,6 @@ Save &amp;&amp; Quit
<widget class="QPushButton" name="updateBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -1092,7 +1087,7 @@ Save &amp;&amp; Quit
<item row="0" column="1">
<spacer name="horizontalSpacer_10">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -1108,7 +1103,7 @@ Save &amp;&amp; Quit
<string>Update InkBox</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter</set>
</property>
</widget>
</item>
@ -1122,7 +1117,7 @@ Save &amp;&amp; Quit
<item row="0" column="1">
<spacer name="horizontalSpacer_16">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -1147,7 +1142,7 @@ Save &amp;&amp; Quit
<item row="10" column="0">
<spacer name="verticalSpacer_8">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -1165,7 +1160,7 @@ Save &amp;&amp; Quit
<item row="2" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -1186,7 +1181,6 @@ Save &amp;&amp; Quit
<widget class="QPushButton" name="requestLeaseBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -1226,7 +1220,6 @@ Save &amp;&amp; Quit
<widget class="QPushButton" name="resetBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -1238,7 +1231,7 @@ Save &amp;&amp; Quit
<item row="0" column="1">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -1288,7 +1281,7 @@ Save &amp;&amp; Quit
<item row="0" column="1">
<spacer name="horizontalSpacer_14">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -1309,7 +1302,6 @@ Save &amp;&amp; Quit
<widget class="QPushButton" name="repackBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -1328,7 +1320,7 @@ Save &amp;&amp; Quit
<item row="0" column="1">
<spacer name="horizontalSpacer_18">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -1396,10 +1388,10 @@ Save &amp;&amp; Quit
<item row="5" column="0">
<widget class="Line" name="line_10">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
<enum>QFrame::Shadow::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
@ -1411,7 +1403,7 @@ Save &amp;&amp; Quit
<item row="1" column="2">
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -1432,7 +1424,6 @@ Save &amp;&amp; Quit
<widget class="QPushButton" name="setPasscodeBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -1446,7 +1437,7 @@ Save &amp;&amp; Quit
<item row="8" column="0">
<spacer name="verticalSpacer_9">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>

View file

@ -12,7 +12,7 @@ void UI::applyStyle(QWidget &widget, QString styleName) {
styleName = Device::getSingleton()->getStyleSheetPath() + styleName;
}
if(!styleName.endsWith(".qss")) {
styleName = styleName + "qss";
styleName = styleName + ".qss";
}
QFile stylesheetFile(styleName);