├── .gitignore
├── CMakeLists.txt
├── LICENSE
├── README.md
├── cmake_uninstall.cmake.in
├── desktop
└── corevantage.desktop
├── icon
├── 128x128.png
├── 16x16.png
├── 22x22.png
├── 256x256.png
├── 32x32.png
├── 48x48.png
├── 512x512.png
├── 64x64.png
├── aboutIcon.png
└── corevantage.svg
├── polkit
├── org.jagoli.nvramtool.policy
└── org.jagoli.reboot.policy
├── screenshots
└── corevantage-1.0.png
└── src
├── t420
├── aboutwindow.cpp
├── aboutwindow.h
├── aboutwindow.ui
├── corevantage.cpp
├── corevantage.h
├── corevantage.ui
├── infowindow.cpp
├── infowindow.h
├── infowindow.ui
├── main.cpp
├── readcfg.cpp
└── readcfg.h
├── t430
├── aboutwindow.cpp
├── aboutwindow.h
├── aboutwindow.ui
├── corevantage.cpp
├── corevantage.h
├── corevantage.ui
├── infowindow.cpp
├── infowindow.h
├── infowindow.ui
├── main.cpp
├── readcfg.cpp
└── readcfg.h
├── x200
├── aboutwindow.cpp
├── aboutwindow.h
├── aboutwindow.ui
├── corevantage.cpp
├── corevantage.h
├── corevantage.ui
├── infowindow.cpp
├── infowindow.h
├── infowindow.ui
├── main.cpp
├── readcfg.cpp
└── readcfg.h
├── x201
├── aboutwindow.cpp
├── aboutwindow.h
├── aboutwindow.ui
├── corevantage.cpp
├── corevantage.h
├── corevantage.ui
├── infowindow.cpp
├── infowindow.h
├── infowindow.ui
├── main.cpp
├── readcfg.cpp
└── readcfg.h
├── x220
├── aboutwindow.cpp
├── aboutwindow.h
├── aboutwindow.ui
├── corevantage.cpp
├── corevantage.h
├── corevantage.ui
├── infowindow.cpp
├── infowindow.h
├── infowindow.ui
├── main.cpp
├── readcfg.cpp
└── readcfg.h
└── x230
├── aboutwindow.cpp
├── aboutwindow.h
├── aboutwindow.ui
├── corevantage.cpp
├── corevantage.h
├── corevantage.ui
├── infowindow.cpp
├── infowindow.h
├── infowindow.ui
├── main.cpp
├── readcfg.cpp
└── readcfg.h
/.gitignore:
--------------------------------------------------------------------------------
1 | *.user
2 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.5)
2 |
3 | project(corevantage LANGUAGES CXX)
4 |
5 | set(CMAKE_INCLUDE_CURRENT_DIR ON)
6 |
7 | set(CMAKE_AUTOUIC ON)
8 | set(CMAKE_AUTOMOC ON)
9 | set(CMAKE_AUTORCC ON)
10 |
11 | set(CMAKE_CXX_STANDARD 11)
12 | set(CMAKE_CXX_STANDARD_REQUIRED ON)
13 |
14 | set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true)
15 |
16 | INCLUDE(GNUInstallDirs)
17 |
18 |
19 | #Set default prefix to /usr
20 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
21 | set(CMAKE_INSTALL_PREFIX "/usr")
22 | endif()
23 |
24 | # uninstall target
25 | if(NOT TARGET uninstall)
26 | configure_file(
27 | "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
28 | "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
29 | IMMEDIATE @ONLY)
30 |
31 | add_custom_target(uninstall
32 | COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
33 | endif()
34 |
35 | find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED)
36 | find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED)
37 |
38 | set(X200_SOURCES
39 | src/x200/main.cpp
40 | src/x200/readcfg.h
41 | src/x200/readcfg.cpp
42 | src/x200/corevantage.cpp
43 | src/x200/corevantage.h
44 | src/x200/corevantage.ui
45 | src/x200/infowindow.cpp
46 | src/x200/infowindow.h
47 | src/x200/infowindow.ui
48 | src/x200/aboutwindow.cpp
49 | src/x200/aboutwindow.h
50 | src/x200/aboutwindow.ui
51 | )
52 |
53 | if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
54 | qt_add_executable(x200
55 | ${X200_SOURCES}
56 | )
57 | else()
58 | if(ANDROID)
59 | add_library(x200 SHARED
60 | ${X200_SOURCES}
61 | )
62 | else()
63 | add_executable(x200
64 | ${X200_SOURCES}
65 | )
66 | endif()
67 | endif()
68 |
69 |
70 | target_link_libraries(x200 PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
71 | set_target_properties(x200 PROPERTIES OUTPUT_NAME corevantage)
72 |
73 |
74 | set(X201_SOURCES
75 | src/x201/main.cpp
76 | src/x201/readcfg.h
77 | src/x201/readcfg.cpp
78 | src/x201/corevantage.cpp
79 | src/x201/corevantage.h
80 | src/x201/corevantage.ui
81 | src/x201/infowindow.cpp
82 | src/x201/infowindow.h
83 | src/x201/infowindow.ui
84 | src/x201/aboutwindow.cpp
85 | src/x201/aboutwindow.h
86 | src/x201/aboutwindow.ui
87 | )
88 |
89 | if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
90 | qt_add_executable(x201
91 | ${X201_SOURCES}
92 | )
93 | else()
94 | if(ANDROID)
95 | add_library(x201 SHARED
96 | ${X201_SOURCES}
97 | )
98 | else()
99 | add_executable(x201
100 | ${X201_SOURCES}
101 | )
102 | endif()
103 | endif()
104 |
105 | target_link_libraries(x201 PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
106 | set_target_properties(x201 PROPERTIES OUTPUT_NAME corevantage)
107 |
108 |
109 | set(X220_SOURCES
110 | src/x220/main.cpp
111 | src/x220/readcfg.h
112 | src/x220/readcfg.cpp
113 | src/x220/corevantage.cpp
114 | src/x220/corevantage.h
115 | src/x220/corevantage.ui
116 | src/x220/infowindow.cpp
117 | src/x220/infowindow.h
118 | src/x220/infowindow.ui
119 | src/x220/aboutwindow.cpp
120 | src/x220/aboutwindow.h
121 | src/x220/aboutwindow.ui
122 | )
123 |
124 | if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
125 | qt_add_executable(x220
126 | ${X220_SOURCES}
127 | )
128 | else()
129 | if(ANDROID)
130 | add_library(x220 SHARED
131 | ${X220_SOURCES}
132 | )
133 | else()
134 | add_executable(x220
135 | ${X220_SOURCES}
136 | )
137 | endif()
138 | endif()
139 |
140 | target_link_libraries(x220 PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
141 | set_target_properties(x220 PROPERTIES OUTPUT_NAME corevantage)
142 |
143 | set(X230_SOURCES
144 | src/x230/main.cpp
145 | src/x230/readcfg.h
146 | src/x230/readcfg.cpp
147 | src/x230/corevantage.cpp
148 | src/x230/corevantage.h
149 | src/x230/corevantage.ui
150 | src/x230/infowindow.cpp
151 | src/x230/infowindow.h
152 | src/x230/infowindow.ui
153 | src/x230/aboutwindow.cpp
154 | src/x230/aboutwindow.h
155 | src/x230/aboutwindow.ui
156 | )
157 |
158 | if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
159 | qt_add_executable(x230
160 | ${X230_SOURCES}
161 | )
162 | else()
163 | if(ANDROID)
164 | add_library(x230 SHARED
165 | ${X230_SOURCES}
166 | )
167 | else()
168 | add_executable(x230
169 | ${X230_SOURCES}
170 | )
171 | endif()
172 | endif()
173 |
174 | target_link_libraries(x230 PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
175 | set_target_properties(x230 PROPERTIES OUTPUT_NAME corevantage)
176 |
177 |
178 | set(T420_SOURCES
179 | src/t420/main.cpp
180 | src/t420/readcfg.h
181 | src/t420/readcfg.cpp
182 | src/t420/corevantage.cpp
183 | src/t420/corevantage.h
184 | src/t420/corevantage.ui
185 | src/t420/infowindow.cpp
186 | src/t420/infowindow.h
187 | src/t420/infowindow.ui
188 | src/t420/aboutwindow.cpp
189 | src/t420/aboutwindow.h
190 | src/t420/aboutwindow.ui
191 | )
192 |
193 | if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
194 | qt_add_executable(t420
195 | ${T420_SOURCES}
196 | )
197 | else()
198 | if(ANDROID)
199 | add_library(t420 SHARED
200 | ${T420_SOURCES}
201 | )
202 | else()
203 | add_executable(t420
204 | ${T420_SOURCES}
205 | )
206 | endif()
207 | endif()
208 |
209 | target_link_libraries(t420 PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
210 | set_target_properties(t420 PROPERTIES OUTPUT_NAME corevantage)
211 |
212 |
213 | set(T430_SOURCES
214 | src/t430/main.cpp
215 | src/t430/readcfg.h
216 | src/t430/readcfg.cpp
217 | src/t430/corevantage.cpp
218 | src/t430/corevantage.h
219 | src/t430/corevantage.ui
220 | src/t430/infowindow.cpp
221 | src/t430/infowindow.h
222 | src/t430/infowindow.ui
223 | src/t430/aboutwindow.cpp
224 | src/t430/aboutwindow.h
225 | src/t430/aboutwindow.ui
226 | )
227 |
228 | if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
229 | qt_add_executable(t430
230 | ${T430_SOURCES}
231 | )
232 | else()
233 | if(ANDROID)
234 | add_library(t430 SHARED
235 | ${T430_SOURCES}
236 | )
237 | else()
238 | add_executable(t430
239 | ${T430_SOURCES}
240 | )
241 | endif()
242 | endif()
243 |
244 | target_link_libraries(t430 PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
245 | set_target_properties(t430 PROPERTIES OUTPUT_NAME corevantage)
246 |
247 | install(TARGETS x200 x201 x220 x230 t420 t430 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
248 |
249 | install(FILES icon/16x16.png
250 | DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/16x16/apps
251 | RENAME corevantage.png)
252 | install(FILES icon/22x22.png
253 | DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/22x22/apps
254 | RENAME corevantage.png)
255 | install(FILES icon/32x32.png
256 | DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/32x32/apps
257 | RENAME corevantage.png)
258 | install(FILES icon/48x48.png
259 | DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/48x48/apps
260 | RENAME corevantage.png)
261 | install(FILES icon/64x64.png
262 | DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/64x64/apps
263 | RENAME corevantage.png)
264 | install(FILES icon/128x128.png
265 | DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps
266 | RENAME corevantage.png)
267 | install(FILES icon/256x256.png
268 | DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/256x256/apps
269 | RENAME corevantage.png)
270 | install(FILES icon/512x512.png
271 | DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/512x512/apps
272 | RENAME corevantage.png)
273 |
274 | install(FILES icon/aboutIcon.png
275 | DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/corevantage)
276 |
277 | install(FILES desktop/corevantage.desktop
278 | DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
279 |
280 | install(FILES polkit/org.jagoli.nvramtool.policy polkit/org.jagoli.reboot.policy
281 | DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/polkit-1/actions)
282 |
283 | ##set default target to null
284 | add_executable(ALL)
285 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Corevantage
2 | A graphical interface to set options on devices with coreboot firmware.
3 | 
4 | ## Introduction
5 | This is a utility that allows users to view and modify coreboot settings usually accessed with `nvramtool` or `nvramcui`. Usage of the application is pretty straight-forward: once the settings have been modified, hit _Save_ and the user will be prompted to reboot the computer. The bios settings will then take effect on reboot. The code for the application has been designed with modularity in mind, in order to port it to many more devices supported by coreboot in the future. As of now, however, it has only been tested to work with the ThinkPad X200 running the latest version of libreboot that can be found at this git repository: https://github.com/JaGoLi/Libreboot-X200-Updated
6 | To get more information about the effects of any individual setting in the application, the user can access the _Information_ window under the _Help_ dropdown menu.
7 | ## Installation
8 | IMPORTANT: To be able to run this application, the kernel parameter `iomem=relaxed` must be included in the bootloader configuration.
9 | For grub, it must be in the `GRUB_CMDLINE_LINUX` parameter of the file `/etc/default/grub`.
10 | ### Distribution-Specific Packages (Arch Linux, Ubuntu 20.04 and 21.04)
11 | On Arch-based systems: the user can install the application using an aur helper such as `yay`:
12 | `yay -S corevantage-x200`
13 | On Ubuntu-based systems: the user can add a ppa and install the application using `apt`:
14 | `sudo add-apt-repository ppa:mordec13/corevantage`
15 | `sudo apt update && sudo apt install corevantage-x200`
16 | ### Compilation from source
17 | To compile and run this application, the user needs `cmake`, the basic qt5 development libraries, and `nvramtool`
18 | First, the user needs to compile `nvramtool`:
19 | `git clone http://review.coreboot.org/coreboot.git`
20 | `cd coreboot/util/nvramtool`
21 | `make -j$(nproc)`
22 | `sudo make PREFIX=/usr install`
23 | Then compile Corevantage by doing as such:
24 | `git clone https://github.com/JaGoLi/corevantage.git && cd corevantage`
25 | `mkdir build && cd build`
26 | `make -j$(nproc) x200`
27 | `sudo make install`
28 | ## Donations
29 | If you appreciate this work, and would like to see this application ported to more devices as well as the continued support of libreboot, feel free to donate at this link: [PayPal](https://www.paypal.com/donate/?hosted_button_id=2W3JGPJ5RKAAA)
30 |
--------------------------------------------------------------------------------
/cmake_uninstall.cmake.in:
--------------------------------------------------------------------------------
1 | if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
2 | message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
3 | endif()
4 |
5 | file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
6 | string(REGEX REPLACE "\n" ";" files "${files}")
7 | foreach(file ${files})
8 | message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
9 | if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
10 | exec_program(
11 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
12 | OUTPUT_VARIABLE rm_out
13 | RETURN_VALUE rm_retval
14 | )
15 | if(NOT "${rm_retval}" STREQUAL 0)
16 | message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
17 | endif()
18 | else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
19 | message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
20 | endif()
21 | endforeach()
22 |
--------------------------------------------------------------------------------
/desktop/corevantage.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Name=Corevantage
3 | StartupWMCLass=Corevantage
4 | Exec=/usr/bin/corevantage
5 | Icon=corevantage
6 | Type=Application
7 | Categories=Settings;System
8 | Comment=A graphical interface to set options on devices with coreboot firmware.
9 | Keywords=Coreboot;BIOS
10 |
--------------------------------------------------------------------------------
/icon/128x128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JaGoLi/corevantage/fab1dec1c16c7ddcc2b8917b18062a49b5a32a8b/icon/128x128.png
--------------------------------------------------------------------------------
/icon/16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JaGoLi/corevantage/fab1dec1c16c7ddcc2b8917b18062a49b5a32a8b/icon/16x16.png
--------------------------------------------------------------------------------
/icon/22x22.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JaGoLi/corevantage/fab1dec1c16c7ddcc2b8917b18062a49b5a32a8b/icon/22x22.png
--------------------------------------------------------------------------------
/icon/256x256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JaGoLi/corevantage/fab1dec1c16c7ddcc2b8917b18062a49b5a32a8b/icon/256x256.png
--------------------------------------------------------------------------------
/icon/32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JaGoLi/corevantage/fab1dec1c16c7ddcc2b8917b18062a49b5a32a8b/icon/32x32.png
--------------------------------------------------------------------------------
/icon/48x48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JaGoLi/corevantage/fab1dec1c16c7ddcc2b8917b18062a49b5a32a8b/icon/48x48.png
--------------------------------------------------------------------------------
/icon/512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JaGoLi/corevantage/fab1dec1c16c7ddcc2b8917b18062a49b5a32a8b/icon/512x512.png
--------------------------------------------------------------------------------
/icon/64x64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JaGoLi/corevantage/fab1dec1c16c7ddcc2b8917b18062a49b5a32a8b/icon/64x64.png
--------------------------------------------------------------------------------
/icon/aboutIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JaGoLi/corevantage/fab1dec1c16c7ddcc2b8917b18062a49b5a32a8b/icon/aboutIcon.png
--------------------------------------------------------------------------------
/icon/corevantage.svg:
--------------------------------------------------------------------------------
1 |
2 |
20 |
22 |
26 |
31 |
35 |
40 |
46 |
50 |
55 |
61 |
65 |
70 |
76 |
82 |
87 |
92 |
98 |
99 |
103 |
108 |
113 |
118 |
125 |
130 |
137 |
141 |
142 |
147 |
155 |
160 |
167 |
172 |
177 |
182 |
187 |
194 |
199 |
206 |
210 |
211 |
216 |
224 |
229 |
236 |
237 |
238 |
258 |
260 |
261 |
263 | image/svg+xml
264 |
266 |
267 |
268 |
269 |
270 |
274 |
278 |
281 |
287 |
291 |
295 |
296 |
297 |
298 |
299 |
--------------------------------------------------------------------------------
/polkit/org.jagoli.nvramtool.policy:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 | Authentication is required to read and write to coreboot settings.
9 |
10 | auth_admin_keep
11 |
12 | /usr/sbin/nvramtool
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/polkit/org.jagoli.reboot.policy:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 | yes
10 |
11 | /usr/sbin/reboot
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/screenshots/corevantage-1.0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JaGoLi/corevantage/fab1dec1c16c7ddcc2b8917b18062a49b5a32a8b/screenshots/corevantage-1.0.png
--------------------------------------------------------------------------------
/src/t420/aboutwindow.cpp:
--------------------------------------------------------------------------------
1 | #include "aboutwindow.h"
2 | #include "ui_aboutwindow.h"
3 |
4 | #include
5 | #include
6 |
7 | aboutWindow::aboutWindow(QWidget *parent) :
8 | QWidget(parent),
9 | ui(new Ui::aboutWindow)
10 | {
11 | ui->setupUi(this);
12 |
13 | //set window title and icon
14 | this->setWindowTitle("About");
15 | this->setWindowIcon(QIcon::fromTheme("corevantage"));
16 |
17 | //Center window on screen
18 | move(QGuiApplication::screens().at(0)->geometry().center() - frameGeometry().center());
19 |
20 | //connect OK to closing window
21 | connect(ui->okButton, &QDialogButtonBox::accepted, this, &QWidget::close);
22 | }
23 |
24 | aboutWindow::~aboutWindow()
25 | {
26 | delete ui;
27 | }
28 |
--------------------------------------------------------------------------------
/src/t420/aboutwindow.h:
--------------------------------------------------------------------------------
1 | #ifndef ABOUTWINDOW_H
2 | #define ABOUTWINDOW_H
3 |
4 | #include
5 |
6 | namespace Ui {
7 | class aboutWindow;
8 | }
9 |
10 | class aboutWindow : public QWidget
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | explicit aboutWindow(QWidget *parent = nullptr);
16 | ~aboutWindow();
17 |
18 | private:
19 | Ui::aboutWindow *ui;
20 | };
21 |
22 | #endif // ABOUTWINDOW_H
23 |
--------------------------------------------------------------------------------
/src/t420/aboutwindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | aboutWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 475
10 | 245
11 |
12 |
13 |
14 |
15 | 475
16 | 245
17 |
18 |
19 |
20 |
21 | 475
22 | 245
23 |
24 |
25 |
26 | Form
27 |
28 |
29 | -
30 |
31 | -
32 |
33 |
34 |
35 |
36 |
37 | ../../../../usr/share/corevantage/aboutIcon.png
38 |
39 |
40 | Qt::AlignCenter
41 |
42 |
43 |
44 | -
45 |
46 | -
47 |
48 |
49 |
50 | DejaVu Sans
51 | 16
52 | 75
53 | true
54 |
55 |
56 |
57 | Corevantage
58 |
59 |
60 | Qt::AlignCenter
61 |
62 |
63 |
64 | -
65 |
66 | -
67 |
68 |
69 |
70 | DejaVu Sans
71 | 75
72 | true
73 |
74 |
75 |
76 | Written By:
77 |
78 |
79 | Qt::AlignCenter
80 |
81 |
82 |
83 | -
84 |
85 |
86 |
87 | 0
88 | 30
89 |
90 |
91 |
92 | Jason Goulet-Lipman
93 |
94 |
95 | Qt::AlignHCenter|Qt::AlignTop
96 |
97 |
98 |
99 | -
100 |
101 |
102 | and all current and future
103 |
104 |
105 | Qt::AlignCenter
106 |
107 |
108 |
109 | -
110 |
111 |
112 | open source contributors
113 |
114 |
115 | Qt::AlignCenter
116 |
117 |
118 |
119 |
120 |
121 | -
122 |
123 | -
124 |
125 |
126 |
127 | 100
128 | 0
129 |
130 |
131 |
132 |
133 | DejaVu Sans
134 | 75
135 | true
136 |
137 |
138 |
139 | Donate:
140 |
141 |
142 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
143 |
144 |
145 |
146 | -
147 |
148 |
149 |
150 | 0
151 | 0
152 |
153 |
154 |
155 |
156 | 91
157 | 0
158 |
159 |
160 |
161 | <html><head/><body><p><a href="https://www.paypal.com/donate?hosted_button_id=2W3JGPJ5RKAAA"><span style=" text-decoration: underline; color:#0000ff;">PayPal</span></a></p></body></html>
162 |
163 |
164 | Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
165 |
166 |
167 | true
168 |
169 |
170 |
171 |
172 |
173 | -
174 |
175 |
176 |
177 | 0
178 | 0
179 |
180 |
181 |
182 | QDialogButtonBox::Ok
183 |
184 |
185 | true
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
--------------------------------------------------------------------------------
/src/t420/corevantage.h:
--------------------------------------------------------------------------------
1 | #ifndef COREVANTAGE_H
2 | #define COREVANTAGE_H
3 |
4 | #include
5 | #include "readcfg.h"
6 | #include "infowindow.h"
7 | #include "aboutwindow.h"
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 | QT_BEGIN_NAMESPACE
16 | namespace Ui { class corevantage; }
17 | QT_END_NAMESPACE
18 |
19 | class corevantage : public QMainWindow
20 | {
21 | Q_OBJECT
22 |
23 | public:
24 | corevantage(QWidget *parent = nullptr);
25 | readCfg* init_config;
26 | QString cfgpath_q;
27 | std::string cfgpath_s;
28 | ~corevantage();
29 |
30 | //String lists
31 | QStringList gfx_options;
32 | QStringList sata_options;
33 | QStringList battery_options;
34 | QStringList boot_options;
35 | QStringList boot_defaults;
36 | QStringList me_options;
37 | QStringList debug_options;
38 | QStringList gfxCard_options;
39 | QStringList usb_always_on;
40 |
41 | //maps
42 | std::map gfx_map;
43 | std::map gfxCard_map;
44 | std::map usbAO_map;
45 |
46 | //windows
47 | QMessageBox error_win;
48 | infoWindow info_win;
49 | aboutWindow about_win;
50 |
51 |
52 | protected:
53 | void showEvent(QShowEvent *ev);
54 | void closeEvent(QCloseEvent *ev);
55 |
56 | public slots:
57 | //closing window
58 | void closeWindow(int result);
59 | void saveAndClose();
60 |
61 | //slider connections
62 | void setVolValue();
63 | void setRebootValue();
64 | void setMeValue();
65 |
66 | //read settings
67 | void getSettings();
68 | void getFromFile();
69 | void displaySettings(int result);
70 |
71 | //write settings
72 | void writeSettings();
73 | void writeToFile(std::string out_file);
74 |
75 |
76 | private:
77 | //read settings
78 | void textToDisplay(QStringList str_list, std::string in_string, QComboBox* box);
79 | void checkToDisplay(std::string in_string, QCheckBox* box);
80 | void hexToSlider(std::string in_string, QSlider* slider);
81 |
82 | //write settings
83 | void checkToFile(std::fstream& output, std::string precursor, QCheckBox* box);
84 | void comboToFile(std::fstream& output, std::string precursor, QComboBox* box, std::string successor);
85 | void sliderToFile(std::fstream& output, std::string precursor, QSlider* slider);
86 | void lineToFile(std::fstream& output, QLineEdit* line);
87 |
88 | Ui::corevantage *ui;
89 | };
90 | #endif // COREVANTAGE_H
91 |
--------------------------------------------------------------------------------
/src/t420/infowindow.cpp:
--------------------------------------------------------------------------------
1 | #include "infowindow.h"
2 | #include "ui_infowindow.h"
3 |
4 | #include
5 | #include
6 |
7 | infoWindow::infoWindow(QWidget *parent) :
8 | QWidget(parent),
9 | ui(new Ui::infoWindow)
10 | {
11 | ui->setupUi(this);
12 |
13 | //set window title and icon
14 | this->setWindowTitle("Information");
15 | this->setWindowIcon(QIcon::fromTheme("corevantage"));
16 |
17 | //Center window on screen
18 | move(QGuiApplication::screens().at(0)->geometry().center() - frameGeometry().center());
19 |
20 | //connect OK to closing window
21 | connect(ui->closeButton, &QDialogButtonBox::accepted, this, &QWidget::close);
22 | }
23 |
24 | infoWindow::~infoWindow()
25 | {
26 | delete ui;
27 | }
28 |
--------------------------------------------------------------------------------
/src/t420/infowindow.h:
--------------------------------------------------------------------------------
1 | #ifndef INFOWINDOW_H
2 | #define INFOWINDOW_H
3 |
4 | #include
5 |
6 | namespace Ui {
7 | class infoWindow;
8 | }
9 |
10 | class infoWindow : public QWidget
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | explicit infoWindow(QWidget *parent = nullptr);
16 | ~infoWindow();
17 |
18 | private:
19 | Ui::infoWindow *ui;
20 | };
21 |
22 | #endif // INFOWINDOW_H
23 |
--------------------------------------------------------------------------------
/src/t420/infowindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | infoWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 430
10 | 420
11 |
12 |
13 |
14 |
15 | 0
16 | 0
17 |
18 |
19 |
20 |
21 | 430
22 | 420
23 |
24 |
25 |
26 |
27 | 430
28 | 420
29 |
30 |
31 |
32 | Form
33 |
34 |
35 | -
36 |
37 |
38 |
39 | DejaVu Sans
40 | 11
41 |
42 |
43 |
44 | Description of Settings
45 |
46 |
47 | Qt::AlignCenter
48 |
49 |
50 |
51 | -
52 |
53 |
54 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
55 | <html><head><meta name="qrichtext" content="1" /><style type="text/css">
56 | p, li { white-space: pre-wrap; }
57 | </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
58 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Graphics Framebuffer Size (M): </span>Selects the amount of system memory reserved for the integrated graphics card.</p>
59 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
60 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Sata Mode: </span>Choose between the newer AHCI standard which offers better drive performance, and compatibility mode which supports legacy IDE hard drives.</p>
61 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
62 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Volume: </span>Sets the default speaker volume level. This value is often overrriden by the operating system at startup.</p>
63 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
64 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Wireless LAN: </span>Sets the enablement state of the wifi card at boot.</p>
65 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
66 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Bluetooth:</span> Sets the enablement state of the bluetooth card at boot.</p>
67 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
68 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Wireless WAN:</span> Sets the enablement state of the cellular modem card at boot.</p>
69 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
70 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Trackpoint:</span> Changes whether the trackpoint is recognized as an input device by the operating system.</p>
71 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
72 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Touchpad:</span> Changes whether the touchpad is recognized as an input device by the operating system.</p>
73 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
74 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Function-Control Swap: </span>Swaps the position of the function and control keys in the lower right corner of the keyboard.</p>
75 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
76 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Sticky Function Key: </span>Sets a delay after having pressed the fuction key. Enables the user to access a secondary function of a key without holding down the FN key.</p>
77 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
78 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Hybrid Graphics Mode: </span>Selects which graphics cards will be in use during device operation.</p>
79 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
80 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Power Management Beeps:</span> Toggles whether there are audible beeps upon inserting and removing the charger from the computer.</p>
81 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
82 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">USB Always On: </span>Selects whether the USB charge port is enabled while on AC power and battery power, only on AC, or not at all.</p>
83 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
84 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">First Battery: </span>Selects which battery gets discharged first. This applies to systems with an add-on battery.</p>
85 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
86 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Boot Option: </span>If a secondary test image is included in the device's coreboot rom, selecting "Normal" will make the system start from the test image. Otherwise, the standard fallback image will be used.</p>
87 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
88 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Power On AC Attach:</span> If enabled, the system is supposed to power itself when the AC adapter is plugged in and it is not already on.</p>
89 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
90 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Reboot Counter: </span>Sets the amount of times rebooting from a test image will be allowed before trying to boot from fallback.</p>
91 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
92 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Management Engine (ME) State: </span>Selects whether the management engine is fully enabled, or soft-disabled. This setting only has an effect on systems that have not had <span style=" font-style:italic;">me_cleaner</span> run on them.</p>
93 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
94 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">ME Reset Counter: </span>Sets the amount of times after which the management engine state will revert to default in the event of a CMOS failure.</p>
95 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
96 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Debug Level: </span>Sets the amount of debug information to be outputed. "Spew" is the least amount and "Emergency" gives the most information.</p>
97 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
98 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Non-Maskable Interrupts: </span>Selects whether the system reports critical hardware errors to the operating system. It is important to leave this enabled unless for specific debugging purposes.</p>
99 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
100 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
101 | <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">For more information, please visit:</p>
102 | <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://doc.coreboot.org/"><span style=" text-decoration: underline; color:#0000ff;">https://doc.coreboot.org/</span></a></p>
103 | <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://www.coreboot.org/Nvramtool"><span style=" text-decoration: underline; color:#0000ff;">https://www.coreboot.org/Nvramtool</span></a></p></body></html>
104 |
105 |
106 | true
107 |
108 |
109 | true
110 |
111 |
112 |
113 | -
114 |
115 |
116 | QDialogButtonBox::Ok
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
--------------------------------------------------------------------------------
/src/t420/main.cpp:
--------------------------------------------------------------------------------
1 | #include "corevantage.h"
2 |
3 | #include
4 |
5 | int main(int argc, char *argv[])
6 | {
7 | QApplication a(argc, argv);
8 | corevantage w;
9 | w.show();
10 | return a.exec();
11 | }
12 |
--------------------------------------------------------------------------------
/src/t420/readcfg.cpp:
--------------------------------------------------------------------------------
1 | #include "readcfg.h"
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | readCfg::readCfg(std::string in_file) {
9 | this->in_file = in_file;
10 | }
11 |
12 | std::string readCfg::shrink_string(std::string input) {
13 | size_t last_pos = input.find_last_of(' ');
14 | if (last_pos == input.size() - 1) {
15 | input = input.substr(0, input.size() - 1);
16 | return shrink_string(input);
17 | }
18 | else {
19 | return input;
20 | }
21 | }
22 |
23 |
24 | void readCfg::get_values() {
25 | std::fstream curr_file;
26 | std::string curr_line;
27 | std::string curr_word;
28 |
29 | curr_file.open(in_file, std::ios::in);
30 |
31 | if (curr_file.is_open() ) {
32 | int counter = 0;
33 | while (getline(curr_file, curr_line)) {
34 | std::string shrunken = shrink_string(curr_line);
35 | int last_space = shrunken.find_last_of(' ');
36 | values[counter++] = shrunken.substr(last_space + 1, shrunken.size() - last_space);
37 | if (values[counter - 1] == "=") {
38 | values[counter - 1] = "";
39 | }
40 | else if (values[counter - 1] == "only" || values[counter - 1] == "Only") {
41 | shrunken = shrunken.substr(0, last_space);
42 | int space_before = shrunken.find_last_of(' ');
43 | values[counter - 1] = shrunken.substr(space_before + 1, shrunken.size() - space_before);
44 | }
45 | }
46 | }
47 | curr_file.close();
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/t420/readcfg.h:
--------------------------------------------------------------------------------
1 | #ifndef READCFG_H
2 | #define READCFG_H
3 |
4 | #include
5 |
6 | class readCfg : public QObject
7 | {
8 | Q_OBJECT
9 | public:
10 | explicit readCfg(std::string in_file);
11 |
12 | std::string values[21];
13 | void get_values();
14 |
15 | private:
16 | std::string in_file;
17 | std::string shrink_string(std::string input);
18 |
19 | signals:
20 |
21 | };
22 |
23 | #endif // READCFG_H
24 |
--------------------------------------------------------------------------------
/src/t430/aboutwindow.cpp:
--------------------------------------------------------------------------------
1 | #include "aboutwindow.h"
2 | #include "ui_aboutwindow.h"
3 |
4 | #include
5 | #include
6 |
7 | aboutWindow::aboutWindow(QWidget *parent) :
8 | QWidget(parent),
9 | ui(new Ui::aboutWindow)
10 | {
11 | ui->setupUi(this);
12 |
13 | //set window title and icon
14 | this->setWindowTitle("About");
15 | this->setWindowIcon(QIcon::fromTheme("corevantage"));
16 |
17 | //Center window on screen
18 | move(QGuiApplication::screens().at(0)->geometry().center() - frameGeometry().center());
19 |
20 | //connect OK to closing window
21 | connect(ui->okButton, &QDialogButtonBox::accepted, this, &QWidget::close);
22 | }
23 |
24 | aboutWindow::~aboutWindow()
25 | {
26 | delete ui;
27 | }
28 |
--------------------------------------------------------------------------------
/src/t430/aboutwindow.h:
--------------------------------------------------------------------------------
1 | #ifndef ABOUTWINDOW_H
2 | #define ABOUTWINDOW_H
3 |
4 | #include
5 |
6 | namespace Ui {
7 | class aboutWindow;
8 | }
9 |
10 | class aboutWindow : public QWidget
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | explicit aboutWindow(QWidget *parent = nullptr);
16 | ~aboutWindow();
17 |
18 | private:
19 | Ui::aboutWindow *ui;
20 | };
21 |
22 | #endif // ABOUTWINDOW_H
23 |
--------------------------------------------------------------------------------
/src/t430/aboutwindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | aboutWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 475
10 | 245
11 |
12 |
13 |
14 |
15 | 475
16 | 245
17 |
18 |
19 |
20 |
21 | 475
22 | 245
23 |
24 |
25 |
26 | Form
27 |
28 |
29 | -
30 |
31 | -
32 |
33 |
34 |
35 |
36 |
37 | ../../../../usr/share/corevantage/aboutIcon.png
38 |
39 |
40 | Qt::AlignCenter
41 |
42 |
43 |
44 | -
45 |
46 | -
47 |
48 |
49 |
50 | DejaVu Sans
51 | 16
52 | 75
53 | true
54 |
55 |
56 |
57 | Corevantage
58 |
59 |
60 | Qt::AlignCenter
61 |
62 |
63 |
64 | -
65 |
66 | -
67 |
68 |
69 |
70 | DejaVu Sans
71 | 75
72 | true
73 |
74 |
75 |
76 | Written By:
77 |
78 |
79 | Qt::AlignCenter
80 |
81 |
82 |
83 | -
84 |
85 |
86 |
87 | 0
88 | 30
89 |
90 |
91 |
92 | Jason Goulet-Lipman
93 |
94 |
95 | Qt::AlignHCenter|Qt::AlignTop
96 |
97 |
98 |
99 | -
100 |
101 |
102 | and all current and future
103 |
104 |
105 | Qt::AlignCenter
106 |
107 |
108 |
109 | -
110 |
111 |
112 | open source contributors
113 |
114 |
115 | Qt::AlignCenter
116 |
117 |
118 |
119 |
120 |
121 | -
122 |
123 | -
124 |
125 |
126 |
127 | 100
128 | 0
129 |
130 |
131 |
132 |
133 | DejaVu Sans
134 | 75
135 | true
136 |
137 |
138 |
139 | Donate:
140 |
141 |
142 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
143 |
144 |
145 |
146 | -
147 |
148 |
149 |
150 | 0
151 | 0
152 |
153 |
154 |
155 |
156 | 91
157 | 0
158 |
159 |
160 |
161 | <html><head/><body><p><a href="https://www.paypal.com/donate?hosted_button_id=2W3JGPJ5RKAAA"><span style=" text-decoration: underline; color:#0000ff;">PayPal</span></a></p></body></html>
162 |
163 |
164 | Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
165 |
166 |
167 | true
168 |
169 |
170 |
171 |
172 |
173 | -
174 |
175 |
176 |
177 | 0
178 | 0
179 |
180 |
181 |
182 | QDialogButtonBox::Ok
183 |
184 |
185 | true
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
--------------------------------------------------------------------------------
/src/t430/corevantage.h:
--------------------------------------------------------------------------------
1 | #ifndef COREVANTAGE_H
2 | #define COREVANTAGE_H
3 |
4 | #include
5 | #include "readcfg.h"
6 | #include "infowindow.h"
7 | #include "aboutwindow.h"
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 | QT_BEGIN_NAMESPACE
16 | namespace Ui { class corevantage; }
17 | QT_END_NAMESPACE
18 |
19 | class corevantage : public QMainWindow
20 | {
21 | Q_OBJECT
22 |
23 | public:
24 | corevantage(QWidget *parent = nullptr);
25 | readCfg* init_config;
26 | QString cfgpath_q;
27 | std::string cfgpath_s;
28 | ~corevantage();
29 |
30 | //String lists
31 | QStringList gfx_options;
32 | QStringList sata_options;
33 | QStringList battery_options;
34 | QStringList boot_options;
35 | QStringList boot_defaults;
36 | QStringList me_options;
37 | QStringList debug_options;
38 | QStringList gfxCard_options;
39 | QStringList backlight_options;
40 | QStringList usb_always_on;
41 |
42 | //maps
43 | std::map gfx_map;
44 | std::map gfxCard_map;
45 | std::map backlight_map;
46 | std::map usbAO_map;
47 |
48 | //windows
49 | QMessageBox error_win;
50 | infoWindow info_win;
51 | aboutWindow about_win;
52 |
53 |
54 | protected:
55 | void showEvent(QShowEvent *ev);
56 | void closeEvent(QCloseEvent *ev);
57 |
58 | public slots:
59 | //closing window
60 | void closeWindow(int result);
61 | void saveAndClose();
62 |
63 | //slider connections
64 | void setVolValue();
65 | void setRebootValue();
66 | void setMeValue();
67 |
68 | //read settings
69 | void getSettings();
70 | void getFromFile();
71 | void displaySettings(int result);
72 |
73 | //write settings
74 | void writeSettings();
75 | void writeToFile(std::string out_file);
76 |
77 |
78 | private:
79 | //read settings
80 | void textToDisplay(QStringList str_list, std::string in_string, QComboBox* box);
81 | void checkToDisplay(std::string in_string, QCheckBox* box);
82 | void hexToSlider(std::string in_string, QSlider* slider);
83 |
84 | //write settings
85 | void checkToFile(std::fstream& output, std::string precursor, QCheckBox* box);
86 | void comboToFile(std::fstream& output, std::string precursor, QComboBox* box, std::string successor);
87 | void sliderToFile(std::fstream& output, std::string precursor, QSlider* slider);
88 | void lineToFile(std::fstream& output, QLineEdit* line);
89 |
90 | Ui::corevantage *ui;
91 | };
92 | #endif // COREVANTAGE_H
93 |
--------------------------------------------------------------------------------
/src/t430/infowindow.cpp:
--------------------------------------------------------------------------------
1 | #include "infowindow.h"
2 | #include "ui_infowindow.h"
3 |
4 | #include
5 | #include
6 |
7 | infoWindow::infoWindow(QWidget *parent) :
8 | QWidget(parent),
9 | ui(new Ui::infoWindow)
10 | {
11 | ui->setupUi(this);
12 |
13 | //set window title and icon
14 | this->setWindowTitle("Information");
15 | this->setWindowIcon(QIcon::fromTheme("corevantage"));
16 |
17 | //Center window on screen
18 | move(QGuiApplication::screens().at(0)->geometry().center() - frameGeometry().center());
19 |
20 | //connect OK to closing window
21 | connect(ui->closeButton, &QDialogButtonBox::accepted, this, &QWidget::close);
22 | }
23 |
24 | infoWindow::~infoWindow()
25 | {
26 | delete ui;
27 | }
28 |
--------------------------------------------------------------------------------
/src/t430/infowindow.h:
--------------------------------------------------------------------------------
1 | #ifndef INFOWINDOW_H
2 | #define INFOWINDOW_H
3 |
4 | #include
5 |
6 | namespace Ui {
7 | class infoWindow;
8 | }
9 |
10 | class infoWindow : public QWidget
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | explicit infoWindow(QWidget *parent = nullptr);
16 | ~infoWindow();
17 |
18 | private:
19 | Ui::infoWindow *ui;
20 | };
21 |
22 | #endif // INFOWINDOW_H
23 |
--------------------------------------------------------------------------------
/src/t430/infowindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | infoWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 430
10 | 420
11 |
12 |
13 |
14 |
15 | 0
16 | 0
17 |
18 |
19 |
20 |
21 | 430
22 | 420
23 |
24 |
25 |
26 |
27 | 430
28 | 420
29 |
30 |
31 |
32 | Form
33 |
34 |
35 | -
36 |
37 |
38 |
39 | DejaVu Sans
40 | 11
41 |
42 |
43 |
44 | Description of Settings
45 |
46 |
47 | Qt::AlignCenter
48 |
49 |
50 |
51 | -
52 |
53 |
54 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
55 | <html><head><meta name="qrichtext" content="1" /><style type="text/css">
56 | p, li { white-space: pre-wrap; }
57 | </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
58 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Graphics Framebuffer Size (M): </span>Selects the amount of system memory reserved for the integrated graphics card.</p>
59 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
60 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Sata Mode: </span>Choose between the newer AHCI standard which offers better drive performance, and compatibility mode which supports legacy IDE hard drives.</p>
61 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
62 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Volume: </span>Sets the default speaker volume level. This value is often overrriden by the operating system at startup.</p>
63 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
64 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Wireless LAN: </span>Sets the enablement state of the wifi card at boot.</p>
65 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
66 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Bluetooth:</span> Sets the enablement state of the bluetooth card at boot.</p>
67 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
68 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Wireless WAN:</span> Sets the enablement state of the cellular modem card at boot.</p>
69 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
70 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Trackpoint:</span> Changes whether the trackpoint is recognized as an input device by the operating system.</p>
71 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
72 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Touchpad:</span> Changes whether the touchpad is recognized as an input device by the operating system.</p>
73 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
74 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Function-Control Swap: </span>Swaps the position of the function and control keys in the lower right corner of the keyboard.</p>
75 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
76 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Sticky Function Key: </span>Sets a delay after having pressed the fuction key. Enables the user to access a secondary function of a key without holding down the FN key.</p>
77 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
78 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Hybrid Graphics Mode: </span>Selects which graphics cards will be in use during device operation.</p>
79 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
80 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Backlights Enabled: </span>Selects which keyboard illumination lights can be enabled when pressing the backlight special function key.</p>
81 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
82 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">USB Always On: </span>Selects whether the USB charge port is enabled while on AC power and battery power, only on AC, or not at all.</p>
83 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
84 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">First Battery: </span>Selects which battery gets discharged first. This applies to systems with an add-on battery.</p>
85 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
86 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Boot Option: </span>If a secondary test image is included in the device's coreboot rom, selecting "Normal" will make the system start from the test image. Otherwise, the standard fallback image will be used.</p>
87 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
88 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Power On AC Attach:</span> If enabled, the system is supposed to power itself when the AC adapter is plugged in and it is not already on.</p>
89 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
90 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Reboot Counter: </span>Sets the amount of times rebooting from a test image will be allowed before trying to boot from fallback.</p>
91 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
92 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Management Engine (ME) State: </span>Selects whether the management engine is fully enabled, or soft-disabled. This setting only has an effect on systems that have not had <span style=" font-style:italic;">me_cleaner</span> run on them.</p>
93 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
94 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">ME Reset Counter: </span>Sets the amount of times after which the management engine state will revert to default in the event of a CMOS failure.</p>
95 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
96 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Debug Level: </span>Sets the amount of debug information to be outputed. "Spew" is the least amount and "Emergency" gives the most information.</p>
97 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
98 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Non-Maskable Interrupts: </span>Selects whether the system reports critical hardware errors to the operating system. It is important to leave this enabled unless for specific debugging purposes.</p>
99 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
100 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
101 | <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">For more information, please visit:</p>
102 | <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://doc.coreboot.org/"><span style=" text-decoration: underline; color:#0000ff;">https://doc.coreboot.org/</span></a></p>
103 | <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://www.coreboot.org/Nvramtool"><span style=" text-decoration: underline; color:#0000ff;">https://www.coreboot.org/Nvramtool</span></a></p></body></html>
104 |
105 |
106 | true
107 |
108 |
109 | true
110 |
111 |
112 |
113 | -
114 |
115 |
116 | QDialogButtonBox::Ok
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
--------------------------------------------------------------------------------
/src/t430/main.cpp:
--------------------------------------------------------------------------------
1 | #include "corevantage.h"
2 |
3 | #include
4 |
5 | int main(int argc, char *argv[])
6 | {
7 | QApplication a(argc, argv);
8 | corevantage w;
9 | w.show();
10 | return a.exec();
11 | }
12 |
--------------------------------------------------------------------------------
/src/t430/readcfg.cpp:
--------------------------------------------------------------------------------
1 | #include "readcfg.h"
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | readCfg::readCfg(std::string in_file) {
9 | this->in_file = in_file;
10 | }
11 |
12 | std::string readCfg::shrink_string(std::string input) {
13 | size_t last_pos = input.find_last_of(' ');
14 | if (last_pos == input.size() - 1) {
15 | input = input.substr(0, input.size() - 1);
16 | return shrink_string(input);
17 | }
18 | else {
19 | return input;
20 | }
21 | }
22 |
23 |
24 | void readCfg::get_values() {
25 | std::fstream curr_file;
26 | std::string curr_line;
27 | std::string curr_word;
28 |
29 | curr_file.open(in_file, std::ios::in);
30 |
31 | if (curr_file.is_open() ) {
32 | int counter = 0;
33 | while (getline(curr_file, curr_line)) {
34 | std::string shrunken = shrink_string(curr_line);
35 | int last_space = shrunken.find_last_of(' ');
36 | values[counter++] = shrunken.substr(last_space + 1, shrunken.size() - last_space);
37 | if (values[counter - 1] == "=") {
38 | values[counter - 1] = "";
39 | }
40 | else if (values[counter - 1] == "only" || values[counter - 1] == "Only") {
41 | shrunken = shrunken.substr(0, last_space);
42 | int space_before = shrunken.find_last_of(' ');
43 | values[counter - 1] = shrunken.substr(space_before + 1, shrunken.size() - space_before);
44 | }
45 | }
46 | }
47 | curr_file.close();
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/t430/readcfg.h:
--------------------------------------------------------------------------------
1 | #ifndef READCFG_H
2 | #define READCFG_H
3 |
4 | #include
5 |
6 | class readCfg : public QObject
7 | {
8 | Q_OBJECT
9 | public:
10 | explicit readCfg(std::string in_file);
11 |
12 | std::string values[21];
13 | void get_values();
14 |
15 | private:
16 | std::string in_file;
17 | std::string shrink_string(std::string input);
18 |
19 | signals:
20 |
21 | };
22 |
23 | #endif // READCFG_H
24 |
--------------------------------------------------------------------------------
/src/x200/aboutwindow.cpp:
--------------------------------------------------------------------------------
1 | #include "aboutwindow.h"
2 | #include "ui_aboutwindow.h"
3 |
4 | #include
5 | #include
6 |
7 | aboutWindow::aboutWindow(QWidget *parent) :
8 | QWidget(parent),
9 | ui(new Ui::aboutWindow)
10 | {
11 | ui->setupUi(this);
12 |
13 | //set window title and icon
14 | this->setWindowTitle("About");
15 | this->setWindowIcon(QIcon::fromTheme("corevantage"));
16 |
17 | //Center window on screen
18 | move(QGuiApplication::screens().at(0)->geometry().center() - frameGeometry().center());
19 |
20 | //connect OK to closing window
21 | connect(ui->okButton, &QDialogButtonBox::accepted, this, &QWidget::close);
22 | }
23 |
24 | aboutWindow::~aboutWindow()
25 | {
26 | delete ui;
27 | }
28 |
--------------------------------------------------------------------------------
/src/x200/aboutwindow.h:
--------------------------------------------------------------------------------
1 | #ifndef ABOUTWINDOW_H
2 | #define ABOUTWINDOW_H
3 |
4 | #include
5 |
6 | namespace Ui {
7 | class aboutWindow;
8 | }
9 |
10 | class aboutWindow : public QWidget
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | explicit aboutWindow(QWidget *parent = nullptr);
16 | ~aboutWindow();
17 |
18 | private:
19 | Ui::aboutWindow *ui;
20 | };
21 |
22 | #endif // ABOUTWINDOW_H
23 |
--------------------------------------------------------------------------------
/src/x200/aboutwindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | aboutWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 475
10 | 245
11 |
12 |
13 |
14 |
15 | 475
16 | 245
17 |
18 |
19 |
20 |
21 | 475
22 | 245
23 |
24 |
25 |
26 | Form
27 |
28 |
29 | -
30 |
31 | -
32 |
33 |
34 |
35 |
36 |
37 | ../../../../usr/share/corevantage/aboutIcon.png
38 |
39 |
40 | Qt::AlignCenter
41 |
42 |
43 |
44 | -
45 |
46 | -
47 |
48 |
49 |
50 | DejaVu Sans
51 | 16
52 | 75
53 | true
54 |
55 |
56 |
57 | Corevantage
58 |
59 |
60 | Qt::AlignCenter
61 |
62 |
63 |
64 | -
65 |
66 | -
67 |
68 |
69 |
70 | DejaVu Sans
71 | 75
72 | true
73 |
74 |
75 |
76 | Written By:
77 |
78 |
79 | Qt::AlignCenter
80 |
81 |
82 |
83 | -
84 |
85 |
86 |
87 | 0
88 | 30
89 |
90 |
91 |
92 | Jason Goulet-Lipman
93 |
94 |
95 | Qt::AlignHCenter|Qt::AlignTop
96 |
97 |
98 |
99 | -
100 |
101 |
102 | and all current and future
103 |
104 |
105 | Qt::AlignCenter
106 |
107 |
108 |
109 | -
110 |
111 |
112 | open source contributors
113 |
114 |
115 | Qt::AlignCenter
116 |
117 |
118 |
119 |
120 |
121 | -
122 |
123 | -
124 |
125 |
126 |
127 | 100
128 | 0
129 |
130 |
131 |
132 |
133 | DejaVu Sans
134 | 75
135 | true
136 |
137 |
138 |
139 | Donate:
140 |
141 |
142 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
143 |
144 |
145 |
146 | -
147 |
148 |
149 |
150 | 0
151 | 0
152 |
153 |
154 |
155 |
156 | 91
157 | 0
158 |
159 |
160 |
161 | <html><head/><body><p><a href="https://www.paypal.com/donate?hosted_button_id=2W3JGPJ5RKAAA"><span style=" text-decoration: underline; color:#0000ff;">PayPal</span></a></p></body></html>
162 |
163 |
164 | Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
165 |
166 |
167 | true
168 |
169 |
170 |
171 |
172 |
173 | -
174 |
175 |
176 |
177 | 0
178 | 0
179 |
180 |
181 |
182 | QDialogButtonBox::Ok
183 |
184 |
185 | true
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
--------------------------------------------------------------------------------
/src/x200/corevantage.h:
--------------------------------------------------------------------------------
1 | #ifndef COREVANTAGE_H
2 | #define COREVANTAGE_H
3 |
4 | #include
5 | #include "readcfg.h"
6 | #include "infowindow.h"
7 | #include "aboutwindow.h"
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 | QT_BEGIN_NAMESPACE
16 | namespace Ui { class corevantage; }
17 | QT_END_NAMESPACE
18 |
19 | class corevantage : public QMainWindow
20 | {
21 | Q_OBJECT
22 |
23 | public:
24 | corevantage(QWidget *parent = nullptr);
25 | readCfg* init_config;
26 | QString cfgpath_q;
27 | std::string cfgpath_s;
28 | ~corevantage();
29 |
30 | //String lists
31 | QStringList gfx_options;
32 | QStringList sata_options;
33 | QStringList battery_options;
34 | QStringList boot_options;
35 | QStringList boot_defaults;
36 | QStringList debug_options;
37 |
38 | //maps
39 | std::map gfx_map;
40 | std::map device_map;
41 |
42 | //windows
43 | QMessageBox error_win;
44 | infoWindow info_win;
45 | aboutWindow about_win;
46 |
47 |
48 | protected:
49 | void showEvent(QShowEvent *ev);
50 | void closeEvent(QCloseEvent *ev);
51 |
52 | public slots:
53 | //closing window
54 | void closeWindow(int result);
55 | void saveAndClose();
56 |
57 | //slider connections
58 | void setVolValue();
59 | void setRebootValue();
60 |
61 | //read settings
62 | void getSettings();
63 | void getFromFile();
64 | void displaySettings(int result);
65 |
66 | //write settings
67 | void writeSettings();
68 | void writeToFile(std::string out_file);
69 |
70 |
71 | private:
72 | //read settings
73 | void textToDisplay(QStringList str_list, std::string in_string, QComboBox* box);
74 | void checkToDisplay(std::string in_string, QCheckBox* box);
75 | void hexToSlider(std::string in_string, QSlider* slider);
76 |
77 | //write settings
78 | void checkToFile(std::fstream& output, std::string precursor, QCheckBox* box);
79 | void comboToFile(std::fstream& output, std::string precursor, QComboBox* box, std::string successor);
80 | void sliderToFile(std::fstream& output, std::string precursor, QSlider* slider);
81 | void lineToFile(std::fstream& output, QLineEdit* line);
82 |
83 | Ui::corevantage *ui;
84 | };
85 | #endif // COREVANTAGE_H
86 |
--------------------------------------------------------------------------------
/src/x200/infowindow.cpp:
--------------------------------------------------------------------------------
1 | #include "infowindow.h"
2 | #include "ui_infowindow.h"
3 |
4 | #include
5 | #include
6 |
7 | infoWindow::infoWindow(QWidget *parent) :
8 | QWidget(parent),
9 | ui(new Ui::infoWindow)
10 | {
11 | ui->setupUi(this);
12 |
13 | //set window title and icon
14 | this->setWindowTitle("Information");
15 | this->setWindowIcon(QIcon::fromTheme("corevantage"));
16 |
17 | //Center window on screen
18 | move(QGuiApplication::screens().at(0)->geometry().center() - frameGeometry().center());
19 |
20 | //connect OK to closing window
21 | connect(ui->closeButton, &QDialogButtonBox::accepted, this, &QWidget::close);
22 | }
23 |
24 | infoWindow::~infoWindow()
25 | {
26 | delete ui;
27 | }
28 |
--------------------------------------------------------------------------------
/src/x200/infowindow.h:
--------------------------------------------------------------------------------
1 | #ifndef INFOWINDOW_H
2 | #define INFOWINDOW_H
3 |
4 | #include
5 |
6 | namespace Ui {
7 | class infoWindow;
8 | }
9 |
10 | class infoWindow : public QWidget
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | explicit infoWindow(QWidget *parent = nullptr);
16 | ~infoWindow();
17 |
18 | private:
19 | Ui::infoWindow *ui;
20 | };
21 |
22 | #endif // INFOWINDOW_H
23 |
--------------------------------------------------------------------------------
/src/x200/infowindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | infoWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 430
10 | 420
11 |
12 |
13 |
14 |
15 | 0
16 | 0
17 |
18 |
19 |
20 |
21 | 430
22 | 420
23 |
24 |
25 |
26 |
27 | 430
28 | 420
29 |
30 |
31 |
32 | Form
33 |
34 |
35 | -
36 |
37 |
38 |
39 | DejaVu Sans
40 | 11
41 |
42 |
43 |
44 | Description of Settings
45 |
46 |
47 | Qt::AlignCenter
48 |
49 |
50 |
51 | -
52 |
53 |
54 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
55 | <html><head><meta name="qrichtext" content="1" /><style type="text/css">
56 | p, li { white-space: pre-wrap; }
57 | </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
58 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Graphics Framebuffer Size (M): </span>Selects the amount of system memory reserved for the integrated graphics card.</p>
59 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
60 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Sata Mode: </span>Choose between the newer AHCI standard which offers better drive performance, and compatibility mode which supports legacy IDE hard drives.</p>
61 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
62 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Volume: </span>Sets the default speaker volume level. This value is often overrriden by the operating system at startup.</p>
63 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
64 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Wireless LAN: </span>Sets the enablement state of the wifi card at boot.</p>
65 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
66 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Bluetooth:</span> Sets the enablement state of the bluetooth card at boot.</p>
67 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
68 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Wireless WAN:</span> Sets the enablement state of the cellular modem card at boot.</p>
69 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
70 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Trackpoint:</span> Changes whether the trackpoint is recognized as an input device by the operating system.</p>
71 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
72 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Function-Control Swap: </span>Swaps the position of the function and control keys in the lower right corner of the keyboard.</p>
73 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
74 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Sticky Function Key: </span>Sets a delay after having pressed the fuction key. Enables the user to access a secondary function of a key without holding down the FN key.</p>
75 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
76 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Power Management Beeps: </span>Toggles whether there are audible beeps upon inserting and removing the charger from the computer.</p>
77 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
78 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Low Battery Beep: </span>Toggles whether there is a beep to let the user know that the battery is at a critically low state.</p>
79 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
80 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Power On AC Attach: </span>If enabled, the system is supposed to power itself when the AC adapter is plugged in and it is not already on.</p>
81 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
82 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">First Battery: </span>Selects which battery gets discharged first. This applies to systems with an add-on battery.</p>
83 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
84 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Boot Option: </span>If a secondary test image is included in the device's coreboot rom, selecting "Normal" will make the system start from the test image. Otherwise, the standard fallback image will be used.</p>
85 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
86 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Reboot Counter: </span>Sets the amount of times rebooting from a test image will be allowed before trying to boot from fallback.</p>
87 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
88 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Devices: </span>Some specialized payloads require a list of boot devices to determine the boot sequence. They can be set in cmos through this option.</p>
89 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
90 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Default Device: </span>Selects the device in the boot order of which to boot from by default.</p>
91 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
92 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Debug Level: </span>Sets the amount of debug information to be outputed. "Spew" is the least amount and "Emergency" gives the most information.</p>
93 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
94 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Third miniPCIe slot (UWB): </span>Selects whether the third PCIe slot is powered on or not.</p>
95 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
96 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
97 | <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">For more information, please visit:</p>
98 | <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://doc.coreboot.org/"><span style=" text-decoration: underline; color:#0000ff;">https://doc.coreboot.org/</span></a></p>
99 | <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://www.coreboot.org/Nvramtool"><span style=" text-decoration: underline; color:#0000ff;">https://www.coreboot.org/Nvramtool</span></a></p></body></html>
100 |
101 |
102 | true
103 |
104 |
105 | true
106 |
107 |
108 |
109 | -
110 |
111 |
112 | QDialogButtonBox::Ok
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
--------------------------------------------------------------------------------
/src/x200/main.cpp:
--------------------------------------------------------------------------------
1 | #include "corevantage.h"
2 |
3 | #include
4 |
5 | int main(int argc, char *argv[])
6 | {
7 | QApplication a(argc, argv);
8 | corevantage w;
9 | w.show();
10 | return a.exec();
11 | }
12 |
--------------------------------------------------------------------------------
/src/x200/readcfg.cpp:
--------------------------------------------------------------------------------
1 | #include "readcfg.h"
2 | #include
3 | #include
4 | #include
5 |
6 | readCfg::readCfg(std::string in_file) {
7 | this->in_file = in_file;
8 | }
9 |
10 | std::string readCfg::shrink_string(std::string input) {
11 | size_t last_pos = input.find_last_of(' ');
12 | if (last_pos == input.size() - 1) {
13 | input = input.substr(0, input.size() - 1);
14 | return shrink_string(input);
15 | }
16 | else {
17 | return input;
18 | }
19 | }
20 |
21 |
22 | void readCfg::get_values() {
23 | std::fstream curr_file;
24 | std::string curr_line;
25 | std::string curr_word;
26 |
27 | curr_file.open(in_file, std::ios::in);
28 |
29 | if (curr_file.is_open() ) {
30 | int counter = 0;
31 | while (getline(curr_file, curr_line)) {
32 | std::string shrunken = shrink_string(curr_line);
33 | int last_space = shrunken.find_last_of(' ');
34 | values[counter++] = shrunken.substr(last_space + 1, shrunken.size() - last_space);
35 | if (values[counter - 1] == "=") {
36 | values[counter - 1] = "";
37 | }
38 | }
39 | }
40 | curr_file.close();
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/src/x200/readcfg.h:
--------------------------------------------------------------------------------
1 | #ifndef READCFG_H
2 | #define READCFG_H
3 |
4 | #include
5 |
6 | class readCfg : public QObject
7 | {
8 | Q_OBJECT
9 | public:
10 | explicit readCfg(std::string in_file);
11 |
12 | std::string values[19];
13 | void get_values();
14 |
15 | private:
16 | std::string in_file;
17 | std::string shrink_string(std::string input);
18 |
19 | signals:
20 |
21 | };
22 |
23 | #endif // READCFG_H
24 |
--------------------------------------------------------------------------------
/src/x201/aboutwindow.cpp:
--------------------------------------------------------------------------------
1 | #include "aboutwindow.h"
2 | #include "ui_aboutwindow.h"
3 |
4 | #include
5 | #include
6 |
7 | aboutWindow::aboutWindow(QWidget *parent) :
8 | QWidget(parent),
9 | ui(new Ui::aboutWindow)
10 | {
11 | ui->setupUi(this);
12 |
13 | //set window title and icon
14 | this->setWindowTitle("About");
15 | this->setWindowIcon(QIcon::fromTheme("corevantage"));
16 |
17 | //Center window on screen
18 | move(QGuiApplication::screens().at(0)->geometry().center() - frameGeometry().center());
19 |
20 | //connect OK to closing window
21 | connect(ui->okButton, &QDialogButtonBox::accepted, this, &QWidget::close);
22 | }
23 |
24 | aboutWindow::~aboutWindow()
25 | {
26 | delete ui;
27 | }
28 |
--------------------------------------------------------------------------------
/src/x201/aboutwindow.h:
--------------------------------------------------------------------------------
1 | #ifndef ABOUTWINDOW_H
2 | #define ABOUTWINDOW_H
3 |
4 | #include
5 |
6 | namespace Ui {
7 | class aboutWindow;
8 | }
9 |
10 | class aboutWindow : public QWidget
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | explicit aboutWindow(QWidget *parent = nullptr);
16 | ~aboutWindow();
17 |
18 | private:
19 | Ui::aboutWindow *ui;
20 | };
21 |
22 | #endif // ABOUTWINDOW_H
23 |
--------------------------------------------------------------------------------
/src/x201/aboutwindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | aboutWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 475
10 | 245
11 |
12 |
13 |
14 |
15 | 475
16 | 245
17 |
18 |
19 |
20 |
21 | 475
22 | 245
23 |
24 |
25 |
26 | Form
27 |
28 |
29 | -
30 |
31 | -
32 |
33 |
34 |
35 |
36 |
37 | ../../../../usr/share/corevantage/aboutIcon.png
38 |
39 |
40 | Qt::AlignCenter
41 |
42 |
43 |
44 | -
45 |
46 | -
47 |
48 |
49 |
50 | DejaVu Sans
51 | 16
52 | 75
53 | true
54 |
55 |
56 |
57 | Corevantage
58 |
59 |
60 | Qt::AlignCenter
61 |
62 |
63 |
64 | -
65 |
66 | -
67 |
68 |
69 |
70 | DejaVu Sans
71 | 75
72 | true
73 |
74 |
75 |
76 | Written By:
77 |
78 |
79 | Qt::AlignCenter
80 |
81 |
82 |
83 | -
84 |
85 |
86 |
87 | 0
88 | 30
89 |
90 |
91 |
92 | Jason Goulet-Lipman
93 |
94 |
95 | Qt::AlignHCenter|Qt::AlignTop
96 |
97 |
98 |
99 | -
100 |
101 |
102 | and all current and future
103 |
104 |
105 | Qt::AlignCenter
106 |
107 |
108 |
109 | -
110 |
111 |
112 | open source contributors
113 |
114 |
115 | Qt::AlignCenter
116 |
117 |
118 |
119 |
120 |
121 | -
122 |
123 | -
124 |
125 |
126 |
127 | 100
128 | 0
129 |
130 |
131 |
132 |
133 | DejaVu Sans
134 | 75
135 | true
136 |
137 |
138 |
139 | Donate:
140 |
141 |
142 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
143 |
144 |
145 |
146 | -
147 |
148 |
149 |
150 | 0
151 | 0
152 |
153 |
154 |
155 |
156 | 91
157 | 0
158 |
159 |
160 |
161 | <html><head/><body><p><a href="https://www.paypal.com/donate?hosted_button_id=2W3JGPJ5RKAAA"><span style=" text-decoration: underline; color:#0000ff;">PayPal</span></a></p></body></html>
162 |
163 |
164 | Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
165 |
166 |
167 | true
168 |
169 |
170 |
171 |
172 |
173 | -
174 |
175 |
176 |
177 | 0
178 | 0
179 |
180 |
181 |
182 | QDialogButtonBox::Ok
183 |
184 |
185 | true
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
--------------------------------------------------------------------------------
/src/x201/corevantage.cpp:
--------------------------------------------------------------------------------
1 | #include "corevantage.h"
2 | #include "./ui_corevantage.h"
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 |
14 | corevantage::corevantage(QWidget *parent)
15 | : QMainWindow(parent)
16 | , ui(new Ui::corevantage)
17 | {
18 | ui->setupUi(this);
19 |
20 | //set window title and icon
21 | this->setWindowTitle("Corevantage");
22 | this->setWindowIcon(QIcon::fromTheme("corevantage"));
23 |
24 | //construct maps
25 |
26 | //gfx_map
27 | gfx_map["32M"] = 0;
28 | gfx_map["48M"] = 1;
29 | gfx_map["64M"] = 2;
30 | gfx_map["96M"] = 3;
31 | gfx_map["128M"] = 4;
32 | gfx_map["160M"] = 5;
33 |
34 | //usbAO_map
35 | usbAO_map["Disable"] = 0;
36 | usbAO_map["battery"] = 1;
37 | usbAO_map["only"] = 2;
38 |
39 | //add menu items
40 |
41 | //gfx_uma_size
42 | gfx_options << "32" << "48" << "64" << "96" << "128" << "160";
43 | ui->gfxCombo->addItems(gfx_options);
44 |
45 | //sata_mode
46 | sata_options << "AHCI" << "Compatible" ;
47 | ui->sataCombo->addItems(sata_options);
48 |
49 | //usb_always_on
50 | usb_always_on << "Disable" << "AC and battery" << "AC only";
51 | ui->usbAOCombo->addItems(usb_always_on);
52 |
53 | //first_battery
54 | battery_options << "Primary" << "Secondary";
55 | ui->batteryCombo->addItems(battery_options);
56 |
57 | //boot_option
58 | boot_options << "Normal" << "Fallback";
59 | ui->bootCombo->addItems(boot_options);
60 |
61 | //debug_level
62 | debug_options << "Spew" << "Debug" << "Info" << "Notice" << "Warning" << "Error" << "Critical" << "Alert" << "Emergency";
63 | ui->debugCombo->addItems(debug_options);
64 |
65 |
66 | //define error window
67 | error_win.setWindowTitle("Error Occurred");
68 | error_win.setWindowIcon(QIcon::fromTheme("corevantage"));
69 | error_win.setText("An error has occurred");
70 | error_win.setInformativeText("Nvramtool was not able to access cmos settings. Look at documentation for possible causes of errors.");
71 | error_win.setIcon(QMessageBox::Critical);
72 |
73 | //connect information window to information button
74 | connect(ui->actionInformation, &QAction::triggered, this, [=](){info_win.show();});
75 |
76 | //connect about window to about button
77 | connect(ui->actionAbout_2, &QAction::triggered, this, [=](){about_win.show();});
78 |
79 |
80 | //Center window on screen
81 | move(QGuiApplication::screens().at(0)->geometry().center() - frameGeometry().center());
82 |
83 | //Connect enter key to OK button
84 | QShortcut* returnAction = new QShortcut(QKeySequence("Return"), this);
85 | connect(returnAction, &QShortcut::activated, this, &corevantage::saveAndClose);
86 |
87 | //slider connections
88 | connect(ui->volumeSlider, &QSlider::valueChanged, this, &corevantage::setVolValue);
89 | connect(ui->rebootSlider, &QSlider::valueChanged, this, &corevantage::setRebootValue);
90 |
91 | //read and save to file connections
92 | connect(ui->actionImport_from_File, &QAction::triggered, this, &corevantage::getFromFile);
93 | connect(ui->actionSave_to_File, &QAction::triggered, this, &corevantage::writeSettings);
94 |
95 |
96 | //close connections
97 | connect(ui->confirmBox, &QDialogButtonBox::rejected, this, &QMainWindow::close);
98 | connect(ui->confirmBox, &QDialogButtonBox::accepted, this, &corevantage::saveAndClose);
99 |
100 | connect(ui->actionExit, &QAction::triggered, this, &QMainWindow::close);
101 | connect(ui->actionSave_and_Exit, &QAction::triggered, this, &corevantage::saveAndClose);
102 | }
103 |
104 | corevantage::~corevantage()
105 | {
106 | delete ui;
107 | }
108 |
109 | //OVERRIDES
110 | void corevantage::showEvent(QShowEvent *ev)
111 | {
112 | QMainWindow::showEvent(ev);
113 | getSettings();
114 | }
115 |
116 | void corevantage::closeEvent(QCloseEvent *ev)
117 | {
118 | info_win.close();
119 | about_win.close();
120 | QMainWindow::closeEvent(ev);
121 | }
122 |
123 | //SLOTS
124 |
125 | void corevantage::closeWindow(int result) {
126 | //debug return value
127 | qDebug() << "Nvram write return code: " << result;
128 |
129 | if (result == 0) {
130 | QMessageBox reboot_win;
131 |
132 | reboot_win.setWindowTitle("Reboot System");
133 | reboot_win.setWindowIcon(QIcon::fromTheme("corevantage"));
134 | reboot_win.setText("Do you want to reboot your system now?");
135 | reboot_win.setInformativeText("Changes to bios settings have been successfully applied");
136 | reboot_win.setIcon(QMessageBox::Question);
137 |
138 | QPushButton* reboot_but = reboot_win.addButton("Reboot Now", QMessageBox::YesRole);
139 | reboot_win.addButton("Reboot Later", QMessageBox::NoRole);
140 |
141 | reboot_win.exec();
142 | if (reboot_win.clickedButton() == reboot_but) {
143 | //reboot computer
144 | QProcess* reboot_proc = new QProcess(this);
145 | QStringList args;
146 | args << "/usr/sbin/reboot";
147 | reboot_proc->start("pkexec", args);
148 | }
149 | else {
150 | this->close();
151 | }
152 | }
153 |
154 | //handle error
155 | else {
156 | error_win.exec();
157 | this->close();
158 | }
159 | }
160 |
161 | void corevantage::saveAndClose() {
162 | //save visible config to file
163 | writeToFile(cfgpath_s);
164 |
165 | //info and args
166 | QProcess* nvram_write = new QProcess(this);
167 | QString sudo_prog = "pkexec";
168 | QStringList args = {"/usr/sbin/nvramtool", "-p", cfgpath_q};
169 |
170 | //connections
171 | connect(nvram_write, static_cast(&QProcess::finished), this, [=](int num){closeWindow(num);});
172 |
173 | //exec
174 | nvram_write->start(sudo_prog, args);
175 |
176 | }
177 |
178 | void corevantage::setRebootValue() {
179 | ui->rebootValue->setText(QString::number(ui->rebootSlider->value()));
180 | }
181 |
182 | void corevantage::setVolValue() {
183 | ui->volumeValue->setText(QString::number(ui->volumeSlider->value()));
184 | }
185 |
186 | void corevantage::getFromFile(){
187 | //setup dialog box
188 | QFileDialog diag(this, "Select File", QDir::homePath(), "Coreboot Configuration Files (*.cfg)");
189 | diag.setWindowIcon(QIcon::fromTheme("corevantage"));
190 | diag.setDefaultSuffix(".cfg");
191 |
192 | //exec
193 | diag.exec();
194 |
195 | //result
196 | if (diag.result() == QDialog::Accepted) {
197 | //convert string
198 | QString user_file = diag.selectedFiles().constFirst();
199 | std::string selected_file = user_file.toUtf8().constData();
200 |
201 | delete init_config;
202 | init_config = new readCfg(selected_file);
203 | displaySettings(0);
204 | }
205 | }
206 |
207 | void corevantage::writeSettings() {
208 | //setup dialog box
209 | QFileDialog diag(this, "Enter File to Save", QDir::homePath(), "Coreboot Configuration Files (*.cfg)");
210 | diag.setWindowIcon(QIcon::fromTheme("corevantage"));
211 | diag.setDefaultSuffix(".cfg");
212 |
213 | //exec
214 | diag.exec();
215 |
216 | //result
217 | if (diag.result() == QDialog::Accepted) {
218 | //convert string
219 | QString user_file = diag.selectedFiles().constFirst();
220 | std::string selected_file = user_file.toUtf8().constData();
221 |
222 | writeToFile(selected_file);
223 | }
224 | }
225 |
226 | void corevantage::getSettings() {
227 | //Program Details
228 | QProcess* nvram_a = new QProcess(this);
229 | QString sudo_prog = "pkexec";
230 | QStringList args = {"/usr/sbin/nvramtool", "-a"};
231 |
232 | //Configuration directory
233 | QString user_dir = QDir::homePath() + "/.config/corevantage/";
234 | if (!QDir(user_dir).exists()) {
235 | QDir().mkdir(user_dir);
236 | }
237 |
238 | //Config file location
239 | cfgpath_q = user_dir + "nvramtool.cfg";
240 | cfgpath_s = cfgpath_q.toUtf8().constData();
241 | nvram_a->setStandardOutputFile(cfgpath_q);
242 |
243 | //remove config file if exists
244 | if (QFile::exists(cfgpath_q)) {
245 | QFile::remove(cfgpath_q);
246 | }
247 |
248 | connect(nvram_a, static_cast(&QProcess::finished), this, [=](int num){displaySettings(num);});
249 |
250 | //start
251 | init_config = new readCfg(cfgpath_s);
252 | nvram_a->start(sudo_prog, args);
253 | }
254 |
255 | void corevantage::textToDisplay(QStringList str_list, std::string in_string, QComboBox* box) {
256 | QString q_string = QString::fromStdString(in_string);
257 | int index = str_list.indexOf(q_string, 0);
258 | if (index != -1) {
259 | box->setCurrentIndex(index);
260 | }
261 | }
262 |
263 | void corevantage::checkToDisplay(std::string in_string, QCheckBox* box) {
264 | if (in_string.compare("Enable") == 0) {
265 | box->setCheckState(Qt::Checked);
266 | }
267 | else {
268 | box->setCheckState(Qt::Unchecked);
269 | }
270 | }
271 |
272 | void corevantage::hexToSlider(std::string in_string, QSlider* slider) {
273 | int init_str_size = in_string.size();
274 | if (init_str_size >= 3) {
275 | std::string str_num = in_string.substr(2, init_str_size - 2);
276 | int str_int = std::stoi(str_num);
277 |
278 | slider->setValue(str_int);
279 | }
280 | }
281 |
282 | void corevantage::displaySettings(int result) {
283 | qDebug() << "Nvram Read return code: " << result;
284 |
285 | if (result == 0) {
286 | init_config->get_values();
287 |
288 |
289 | //display text combos
290 | textToDisplay(boot_options, init_config->values[0], ui->bootCombo);
291 | textToDisplay(debug_options, init_config->values[2], ui->debugCombo);
292 | textToDisplay(battery_options, init_config->values[5], ui->batteryCombo);
293 | textToDisplay(sata_options, init_config->values[15], ui->sataCombo);
294 | ui->usbAOCombo->setCurrentIndex(usbAO_map[init_config->values[16]]);
295 | ui->gfxCombo->setCurrentIndex(gfx_map[init_config->values[17]]);
296 |
297 | //display slider values
298 | hexToSlider(init_config->values[1], ui->rebootSlider);
299 | hexToSlider(init_config->values[18], ui->volumeSlider);
300 |
301 | //display checkbox states
302 | checkToDisplay(init_config->values[3], ui->nmiBox);
303 | checkToDisplay(init_config->values[4], ui->acAttachBox);
304 | checkToDisplay(init_config->values[6], ui->btBox);
305 | checkToDisplay(init_config->values[7], ui->wwanBox);
306 | checkToDisplay(init_config->values[8], ui->touchpadBox);
307 | checkToDisplay(init_config->values[9], ui->wlanBox);
308 | checkToDisplay(init_config->values[10], ui->trackpointBox);
309 | checkToDisplay(init_config->values[11], ui->swapBox);
310 | checkToDisplay(init_config->values[12], ui->stickyBox);
311 | checkToDisplay(init_config->values[13], ui->pmbeepBox);
312 | checkToDisplay(init_config->values[14], ui->lbbeepBox);
313 |
314 | }
315 |
316 | //handle error
317 | else {
318 | error_win.exec();
319 | this->close();
320 | }
321 | }
322 |
323 | void corevantage::comboToFile(std::fstream& output, std::string precursor, QComboBox* box, std::string successor = "") {
324 | std::string box_val = box->currentText().toUtf8().constData();
325 | output << precursor + box_val + successor << std::endl;
326 | }
327 |
328 | void corevantage::sliderToFile(std::fstream& output, std::string precursor, QSlider* slider) {
329 | std::string slider_val = std::to_string(slider->value());
330 | output << precursor + slider_val << std::endl;
331 | }
332 |
333 | void corevantage::checkToFile(std::fstream& output, std::string precursor, QCheckBox* box) {
334 | std::string status;
335 | if (box->isChecked()) {
336 | status = "Enable";
337 | }
338 | else {
339 | status = "Disable";
340 | }
341 | output << precursor + status << std::endl;
342 | }
343 |
344 | void corevantage::writeToFile(std::string out_file) {
345 | //clear file
346 | remove(out_file.c_str());
347 |
348 | //setup file for writing
349 | std::fstream out_stream;
350 | out_stream.open(out_file, std::ios_base::out);
351 |
352 | //start writing
353 | if(out_stream.is_open()) {
354 |
355 | comboToFile(out_stream, "boot_option = ", ui->bootCombo);
356 | sliderToFile(out_stream, "reboot_counter = 0x", ui->rebootSlider);
357 | comboToFile(out_stream, "debug_level = ", ui->debugCombo);
358 | checkToFile(out_stream, "nmi = ", ui->nmiBox);
359 | checkToFile(out_stream, "power_on_after_fail = ", ui->acAttachBox);
360 | comboToFile(out_stream, "first_battery = ", ui->batteryCombo);
361 | checkToFile(out_stream, "bluetooth = ", ui->btBox);
362 | checkToFile(out_stream, "wwan = ", ui->wwanBox);
363 | checkToFile(out_stream, "touchpad = ", ui->touchpadBox);
364 | checkToFile(out_stream, "wlan = ", ui->wlanBox);
365 | checkToFile(out_stream, "trackpoint = ", ui->trackpointBox);
366 | checkToFile(out_stream, "fn_ctrl_swap = ", ui->swapBox);
367 | checkToFile(out_stream, "sticky_fn = ", ui->stickyBox);
368 | checkToFile(out_stream, "power_management_beeps = ", ui->pmbeepBox);
369 | checkToFile(out_stream, "low_battery_beep = ", ui->lbbeepBox);
370 | comboToFile(out_stream, "sata_mode = ", ui->sataCombo);
371 | comboToFile(out_stream, "usb_always_on = ", ui->usbAOCombo);
372 | comboToFile(out_stream, "gfx_uma_size = ", ui->gfxCombo, "M");
373 | sliderToFile(out_stream, "volume = 0x", ui->volumeSlider);
374 |
375 | }
376 |
377 | else {
378 | qDebug() << "Failed to write to file";
379 | }
380 |
381 | out_stream.close();
382 | }
383 |
--------------------------------------------------------------------------------
/src/x201/corevantage.h:
--------------------------------------------------------------------------------
1 | #ifndef COREVANTAGE_H
2 | #define COREVANTAGE_H
3 |
4 | #include
5 | #include "readcfg.h"
6 | #include "infowindow.h"
7 | #include "aboutwindow.h"
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 | QT_BEGIN_NAMESPACE
16 | namespace Ui { class corevantage; }
17 | QT_END_NAMESPACE
18 |
19 | class corevantage : public QMainWindow
20 | {
21 | Q_OBJECT
22 |
23 | public:
24 | corevantage(QWidget *parent = nullptr);
25 | readCfg* init_config;
26 | QString cfgpath_q;
27 | std::string cfgpath_s;
28 | ~corevantage();
29 |
30 | //String lists
31 | QStringList gfx_options;
32 | QStringList sata_options;
33 | QStringList battery_options;
34 | QStringList boot_options;
35 | QStringList boot_defaults;
36 | QStringList debug_options;
37 | QStringList usb_always_on;
38 |
39 | //maps
40 | std::map gfx_map;
41 | std::map usbAO_map;
42 |
43 | //windows
44 | QMessageBox error_win;
45 | infoWindow info_win;
46 | aboutWindow about_win;
47 |
48 |
49 | protected:
50 | void showEvent(QShowEvent *ev);
51 | void closeEvent(QCloseEvent *ev);
52 |
53 | public slots:
54 | //closing window
55 | void closeWindow(int result);
56 | void saveAndClose();
57 |
58 | //slider connections
59 | void setVolValue();
60 | void setRebootValue();
61 |
62 | //read settings
63 | void getSettings();
64 | void getFromFile();
65 | void displaySettings(int result);
66 |
67 | //write settings
68 | void writeSettings();
69 | void writeToFile(std::string out_file);
70 |
71 |
72 | private:
73 | //read settings
74 | void textToDisplay(QStringList str_list, std::string in_string, QComboBox* box);
75 | void checkToDisplay(std::string in_string, QCheckBox* box);
76 | void hexToSlider(std::string in_string, QSlider* slider);
77 |
78 | //write settings
79 | void checkToFile(std::fstream& output, std::string precursor, QCheckBox* box);
80 | void comboToFile(std::fstream& output, std::string precursor, QComboBox* box, std::string successor);
81 | void sliderToFile(std::fstream& output, std::string precursor, QSlider* slider);
82 | void lineToFile(std::fstream& output, QLineEdit* line);
83 |
84 | Ui::corevantage *ui;
85 | };
86 | #endif // COREVANTAGE_H
87 |
--------------------------------------------------------------------------------
/src/x201/infowindow.cpp:
--------------------------------------------------------------------------------
1 | #include "infowindow.h"
2 | #include "ui_infowindow.h"
3 |
4 | #include
5 | #include
6 |
7 | infoWindow::infoWindow(QWidget *parent) :
8 | QWidget(parent),
9 | ui(new Ui::infoWindow)
10 | {
11 | ui->setupUi(this);
12 |
13 | //set window title and icon
14 | this->setWindowTitle("Information");
15 | this->setWindowIcon(QIcon::fromTheme("corevantage"));
16 |
17 | //Center window on screen
18 | move(QGuiApplication::screens().at(0)->geometry().center() - frameGeometry().center());
19 |
20 | //connect OK to closing window
21 | connect(ui->closeButton, &QDialogButtonBox::accepted, this, &QWidget::close);
22 | }
23 |
24 | infoWindow::~infoWindow()
25 | {
26 | delete ui;
27 | }
28 |
--------------------------------------------------------------------------------
/src/x201/infowindow.h:
--------------------------------------------------------------------------------
1 | #ifndef INFOWINDOW_H
2 | #define INFOWINDOW_H
3 |
4 | #include
5 |
6 | namespace Ui {
7 | class infoWindow;
8 | }
9 |
10 | class infoWindow : public QWidget
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | explicit infoWindow(QWidget *parent = nullptr);
16 | ~infoWindow();
17 |
18 | private:
19 | Ui::infoWindow *ui;
20 | };
21 |
22 | #endif // INFOWINDOW_H
23 |
--------------------------------------------------------------------------------
/src/x201/infowindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | infoWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 430
10 | 420
11 |
12 |
13 |
14 |
15 | 0
16 | 0
17 |
18 |
19 |
20 |
21 | 430
22 | 420
23 |
24 |
25 |
26 |
27 | 430
28 | 420
29 |
30 |
31 |
32 | Form
33 |
34 |
35 | -
36 |
37 |
38 |
39 | DejaVu Sans
40 | 11
41 |
42 |
43 |
44 | Description of Settings
45 |
46 |
47 | Qt::AlignCenter
48 |
49 |
50 |
51 | -
52 |
53 |
54 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
55 | <html><head><meta name="qrichtext" content="1" /><style type="text/css">
56 | p, li { white-space: pre-wrap; }
57 | </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
58 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Graphics Framebuffer Size (M): </span>Selects the amount of system memory reserved for the integrated graphics card.</p>
59 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
60 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Sata Mode: </span>Choose between the newer AHCI standard which offers better drive performance, and compatibility mode which supports legacy IDE hard drives.</p>
61 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
62 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Volume: </span>Sets the default speaker volume level. This value is often overrriden by the operating system at startup.</p>
63 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
64 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Wireless LAN: </span>Sets the enablement state of the wifi card at boot.</p>
65 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
66 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Bluetooth:</span> Sets the enablement state of the bluetooth card at boot.</p>
67 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
68 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Wireless WAN:</span> Sets the enablement state of the cellular modem card at boot.</p>
69 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
70 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Trackpoint:</span> Changes whether the trackpoint is recognized as an input device by the operating system.</p>
71 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
72 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Touchpad:</span> Changes whether the touchpad is recognized as an input device by the operating system.</p>
73 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
74 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Function-Control Swap: </span>Swaps the position of the function and control keys in the lower right corner of the keyboard.</p>
75 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
76 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Sticky Function Key: </span>Sets a delay after having pressed the fuction key. Enables the user to access a secondary function of a key without holding down the FN key.</p>
77 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
78 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Power Management Beeps: </span>Toggles whether there are audible beeps upon inserting and removing the charger from the computer.</p>
79 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
80 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Low Battery Beep: </span>Toggles whether there is a beep to let the user know that the battery is at a critically low state.</p>
81 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
82 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">USB Always On: </span>Selects whether the USB charge port is enabled while on AC power and battery power, only on AC, or not at all.</p>
83 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
84 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">First Battery: </span>Selects which battery gets discharged first. This applies to systems with an add-on battery.</p>
85 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
86 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Boot Option: </span>If a secondary test image is included in the device's coreboot rom, selecting "Normal" will make the system start from the test image. Otherwise, the standard fallback image will be used.</p>
87 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
88 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Power On AC Attach:</span> If enabled, the system is supposed to power itself when the AC adapter is plugged in and it is not already on.</p>
89 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
90 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Reboot Counter: </span>Sets the amount of times rebooting from a test image will be allowed before trying to boot from fallback.</p>
91 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
92 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Debug Level: </span>Sets the amount of debug information to be outputed. "Spew" is the least amount and "Emergency" gives the most information.</p>
93 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
94 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Non-Maskable Interrupts: </span>Selects whether the system reports critical hardware errors to the operating system. It is important to leave this enabled unless for specific debugging purposes.</p>
95 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
96 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
97 | <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">For more information, please visit:</p>
98 | <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://doc.coreboot.org/"><span style=" text-decoration: underline; color:#0000ff;">https://doc.coreboot.org/</span></a></p>
99 | <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://www.coreboot.org/Nvramtool"><span style=" text-decoration: underline; color:#0000ff;">https://www.coreboot.org/Nvramtool</span></a></p></body></html>
100 |
101 |
102 | true
103 |
104 |
105 | true
106 |
107 |
108 |
109 | -
110 |
111 |
112 | QDialogButtonBox::Ok
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
--------------------------------------------------------------------------------
/src/x201/main.cpp:
--------------------------------------------------------------------------------
1 | #include "corevantage.h"
2 |
3 | #include
4 |
5 | int main(int argc, char *argv[])
6 | {
7 | QApplication a(argc, argv);
8 | corevantage w;
9 | w.show();
10 | return a.exec();
11 | }
12 |
--------------------------------------------------------------------------------
/src/x201/readcfg.cpp:
--------------------------------------------------------------------------------
1 | #include "readcfg.h"
2 | #include
3 | #include
4 | #include
5 |
6 | readCfg::readCfg(std::string in_file) {
7 | this->in_file = in_file;
8 | }
9 |
10 | std::string readCfg::shrink_string(std::string input) {
11 | size_t last_pos = input.find_last_of(' ');
12 | if (last_pos == input.size() - 1) {
13 | input = input.substr(0, input.size() - 1);
14 | return shrink_string(input);
15 | }
16 | else {
17 | return input;
18 | }
19 | }
20 |
21 |
22 | void readCfg::get_values() {
23 | std::fstream curr_file;
24 | std::string curr_line;
25 | std::string curr_word;
26 |
27 | curr_file.open(in_file, std::ios::in);
28 |
29 | if (curr_file.is_open() ) {
30 | int counter = 0;
31 | while (getline(curr_file, curr_line)) {
32 | std::string shrunken = shrink_string(curr_line);
33 | int last_space = shrunken.find_last_of(' ');
34 | values[counter++] = shrunken.substr(last_space + 1, shrunken.size() - last_space);
35 | if (values[counter - 1] == "=") {
36 | values[counter - 1] = "";
37 | }
38 | }
39 | }
40 | curr_file.close();
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/src/x201/readcfg.h:
--------------------------------------------------------------------------------
1 | #ifndef READCFG_H
2 | #define READCFG_H
3 |
4 | #include
5 |
6 | class readCfg : public QObject
7 | {
8 | Q_OBJECT
9 | public:
10 | explicit readCfg(std::string in_file);
11 |
12 | std::string values[19];
13 | void get_values();
14 |
15 | private:
16 | std::string in_file;
17 | std::string shrink_string(std::string input);
18 |
19 | signals:
20 |
21 | };
22 |
23 | #endif // READCFG_H
24 |
--------------------------------------------------------------------------------
/src/x220/aboutwindow.cpp:
--------------------------------------------------------------------------------
1 | #include "aboutwindow.h"
2 | #include "ui_aboutwindow.h"
3 |
4 | #include
5 | #include
6 |
7 | aboutWindow::aboutWindow(QWidget *parent) :
8 | QWidget(parent),
9 | ui(new Ui::aboutWindow)
10 | {
11 | ui->setupUi(this);
12 |
13 | //set window title and icon
14 | this->setWindowTitle("About");
15 | this->setWindowIcon(QIcon::fromTheme("corevantage"));
16 |
17 | //Center window on screen
18 | move(QGuiApplication::screens().at(0)->geometry().center() - frameGeometry().center());
19 |
20 | //connect OK to closing window
21 | connect(ui->okButton, &QDialogButtonBox::accepted, this, &QWidget::close);
22 | }
23 |
24 | aboutWindow::~aboutWindow()
25 | {
26 | delete ui;
27 | }
28 |
--------------------------------------------------------------------------------
/src/x220/aboutwindow.h:
--------------------------------------------------------------------------------
1 | #ifndef ABOUTWINDOW_H
2 | #define ABOUTWINDOW_H
3 |
4 | #include
5 |
6 | namespace Ui {
7 | class aboutWindow;
8 | }
9 |
10 | class aboutWindow : public QWidget
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | explicit aboutWindow(QWidget *parent = nullptr);
16 | ~aboutWindow();
17 |
18 | private:
19 | Ui::aboutWindow *ui;
20 | };
21 |
22 | #endif // ABOUTWINDOW_H
23 |
--------------------------------------------------------------------------------
/src/x220/aboutwindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | aboutWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 475
10 | 245
11 |
12 |
13 |
14 |
15 | 475
16 | 245
17 |
18 |
19 |
20 |
21 | 475
22 | 245
23 |
24 |
25 |
26 | Form
27 |
28 |
29 | -
30 |
31 | -
32 |
33 |
34 |
35 |
36 |
37 | ../../../../usr/share/corevantage/aboutIcon.png
38 |
39 |
40 | Qt::AlignCenter
41 |
42 |
43 |
44 | -
45 |
46 | -
47 |
48 |
49 |
50 | DejaVu Sans
51 | 16
52 | 75
53 | true
54 |
55 |
56 |
57 | Corevantage
58 |
59 |
60 | Qt::AlignCenter
61 |
62 |
63 |
64 | -
65 |
66 | -
67 |
68 |
69 |
70 | DejaVu Sans
71 | 75
72 | true
73 |
74 |
75 |
76 | Written By:
77 |
78 |
79 | Qt::AlignCenter
80 |
81 |
82 |
83 | -
84 |
85 |
86 |
87 | 0
88 | 30
89 |
90 |
91 |
92 | Jason Goulet-Lipman
93 |
94 |
95 | Qt::AlignHCenter|Qt::AlignTop
96 |
97 |
98 |
99 | -
100 |
101 |
102 | and all current and future
103 |
104 |
105 | Qt::AlignCenter
106 |
107 |
108 |
109 | -
110 |
111 |
112 | open source contributors
113 |
114 |
115 | Qt::AlignCenter
116 |
117 |
118 |
119 |
120 |
121 | -
122 |
123 | -
124 |
125 |
126 |
127 | 100
128 | 0
129 |
130 |
131 |
132 |
133 | DejaVu Sans
134 | 75
135 | true
136 |
137 |
138 |
139 | Donate:
140 |
141 |
142 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
143 |
144 |
145 |
146 | -
147 |
148 |
149 |
150 | 0
151 | 0
152 |
153 |
154 |
155 |
156 | 91
157 | 0
158 |
159 |
160 |
161 | <html><head/><body><p><a href="https://www.paypal.com/donate?hosted_button_id=2W3JGPJ5RKAAA"><span style=" text-decoration: underline; color:#0000ff;">PayPal</span></a></p></body></html>
162 |
163 |
164 | Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
165 |
166 |
167 | true
168 |
169 |
170 |
171 |
172 |
173 | -
174 |
175 |
176 |
177 | 0
178 | 0
179 |
180 |
181 |
182 | QDialogButtonBox::Ok
183 |
184 |
185 | true
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
--------------------------------------------------------------------------------
/src/x220/corevantage.cpp:
--------------------------------------------------------------------------------
1 | #include "corevantage.h"
2 | #include "./ui_corevantage.h"
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 |
14 | corevantage::corevantage(QWidget *parent)
15 | : QMainWindow(parent)
16 | , ui(new Ui::corevantage)
17 | {
18 | ui->setupUi(this);
19 |
20 | //set window title and icon
21 | this->setWindowTitle("Corevantage");
22 | this->setWindowIcon(QIcon::fromTheme("corevantage"));
23 |
24 | //construct maps
25 |
26 | //gfx_map
27 | gfx_map["32M"] = 0;
28 | gfx_map["64M"] = 1;
29 | gfx_map["96M"] = 2;
30 | gfx_map["128M"] = 3;
31 | gfx_map["160M"] = 4;
32 | gfx_map["192M"] = 5;
33 | gfx_map["224M"] = 6;
34 |
35 | //usbAO_map
36 | usbAO_map["Disable"] = 0;
37 | usbAO_map["battery"] = 1;
38 | usbAO_map["only"] = 2;
39 |
40 | //add menu items
41 |
42 | //gfx_uma_size
43 | gfx_options << "32" << "64" << "96" << "128" << "160" << "192" << "224";
44 | ui->gfxCombo->addItems(gfx_options);
45 |
46 | //sata_mode
47 | sata_options << "AHCI" << "Compatible" ;
48 | ui->sataCombo->addItems(sata_options);
49 |
50 | //usb_always_on
51 | usb_always_on << "Disable" << "AC and battery" << "AC only";
52 | ui->usbAOCombo->addItems(usb_always_on);
53 |
54 | //first_battery
55 | battery_options << "Primary" << "Secondary";
56 | ui->batteryCombo->addItems(battery_options);
57 |
58 | //boot_option
59 | boot_options << "Normal" << "Fallback";
60 | ui->bootCombo->addItems(boot_options);
61 |
62 | //me_state
63 | me_options << "Normal" << "Disabled";
64 | ui->meStateCombo->addItems(me_options);
65 |
66 | //debug_level
67 | debug_options << "Spew" << "Debug" << "Info" << "Notice" << "Warning" << "Error" << "Critical" << "Alert" << "Emergency";
68 | ui->debugCombo->addItems(debug_options);
69 |
70 |
71 | //define error window
72 | error_win.setWindowTitle("Error Occurred");
73 | error_win.setWindowIcon(QIcon::fromTheme("corevantage"));
74 | error_win.setText("An error has occurred");
75 | error_win.setInformativeText("Nvramtool was not able to access cmos settings. Look at documentation for possible causes of errors.");
76 | error_win.setIcon(QMessageBox::Critical);
77 |
78 | //connect information window to information button
79 | connect(ui->actionInformation, &QAction::triggered, this, [=](){info_win.show();});
80 |
81 | //connect about window to about button
82 | connect(ui->actionAbout_2, &QAction::triggered, this, [=](){about_win.show();});
83 |
84 |
85 | //Center window on screen
86 | move(QGuiApplication::screens().at(0)->geometry().center() - frameGeometry().center());
87 |
88 | //Connect enter key to OK button
89 | QShortcut* returnAction = new QShortcut(QKeySequence("Return"), this);
90 | connect(returnAction, &QShortcut::activated, this, &corevantage::saveAndClose);
91 |
92 | //slider connections
93 | connect(ui->volumeSlider, &QSlider::valueChanged, this, &corevantage::setVolValue);
94 | connect(ui->rebootSlider, &QSlider::valueChanged, this, &corevantage::setRebootValue);
95 | connect(ui->meResetSlider, &QSlider::valueChanged, this, &corevantage::setMeValue);
96 |
97 | //read and save to file connections
98 | connect(ui->actionImport_from_File, &QAction::triggered, this, &corevantage::getFromFile);
99 | connect(ui->actionSave_to_File, &QAction::triggered, this, &corevantage::writeSettings);
100 |
101 |
102 | //close connections
103 | connect(ui->confirmBox, &QDialogButtonBox::rejected, this, &QMainWindow::close);
104 | connect(ui->confirmBox, &QDialogButtonBox::accepted, this, &corevantage::saveAndClose);
105 |
106 | connect(ui->actionExit, &QAction::triggered, this, &QMainWindow::close);
107 | connect(ui->actionSave_and_Exit, &QAction::triggered, this, &corevantage::saveAndClose);
108 | }
109 |
110 | corevantage::~corevantage()
111 | {
112 | delete ui;
113 | }
114 |
115 | //OVERRIDES
116 | void corevantage::showEvent(QShowEvent *ev)
117 | {
118 | QMainWindow::showEvent(ev);
119 | getSettings();
120 | }
121 |
122 | void corevantage::closeEvent(QCloseEvent *ev)
123 | {
124 | info_win.close();
125 | about_win.close();
126 | QMainWindow::closeEvent(ev);
127 | }
128 |
129 | //SLOTS
130 |
131 | void corevantage::closeWindow(int result) {
132 | //debug return value
133 | qDebug() << "Nvram write return code: " << result;
134 |
135 | if (result == 0) {
136 | QMessageBox reboot_win;
137 |
138 | reboot_win.setWindowTitle("Reboot System");
139 | reboot_win.setWindowIcon(QIcon::fromTheme("corevantage"));
140 | reboot_win.setText("Do you want to reboot your system now?");
141 | reboot_win.setInformativeText("Changes to bios settings have been successfully applied");
142 | reboot_win.setIcon(QMessageBox::Question);
143 |
144 | QPushButton* reboot_but = reboot_win.addButton("Reboot Now", QMessageBox::YesRole);
145 | reboot_win.addButton("Reboot Later", QMessageBox::NoRole);
146 |
147 | reboot_win.exec();
148 | if (reboot_win.clickedButton() == reboot_but) {
149 | //reboot computer
150 | QProcess* reboot_proc = new QProcess(this);
151 | QStringList args;
152 | args << "/usr/sbin/reboot";
153 | reboot_proc->start("pkexec", args);
154 | }
155 | else {
156 | this->close();
157 | }
158 | }
159 |
160 | //handle error
161 | else {
162 | error_win.exec();
163 | this->close();
164 | }
165 | }
166 |
167 | void corevantage::saveAndClose() {
168 | //save visible config to file
169 | writeToFile(cfgpath_s);
170 |
171 | //info and args
172 | QProcess* nvram_write = new QProcess(this);
173 | QString sudo_prog = "pkexec";
174 | QStringList args = {"/usr/sbin/nvramtool", "-p", cfgpath_q};
175 |
176 | //connections
177 | connect(nvram_write, static_cast(&QProcess::finished), this, [=](int num){closeWindow(num);});
178 |
179 | //exec
180 | nvram_write->start(sudo_prog, args);
181 |
182 | }
183 |
184 | void corevantage::setRebootValue() {
185 | ui->rebootValue->setText(QString::number(ui->rebootSlider->value()));
186 | }
187 |
188 | void corevantage::setVolValue() {
189 | ui->volumeValue->setText(QString::number(ui->volumeSlider->value()));
190 | }
191 |
192 | void corevantage::setMeValue() {
193 | ui->meResetValue->setText(QString::number(ui->meResetSlider->value()));
194 | }
195 |
196 | void corevantage::getFromFile(){
197 | //setup dialog box
198 | QFileDialog diag(this, "Select File", QDir::homePath(), "Coreboot Configuration Files (*.cfg)");
199 | diag.setWindowIcon(QIcon::fromTheme("corevantage"));
200 | diag.setDefaultSuffix(".cfg");
201 |
202 | //exec
203 | diag.exec();
204 |
205 | //result
206 | if (diag.result() == QDialog::Accepted) {
207 | //convert string
208 | QString user_file = diag.selectedFiles().constFirst();
209 | std::string selected_file = user_file.toUtf8().constData();
210 |
211 | delete init_config;
212 | init_config = new readCfg(selected_file);
213 | displaySettings(0);
214 | }
215 | }
216 |
217 | void corevantage::writeSettings() {
218 | //setup dialog box
219 | QFileDialog diag(this, "Enter File to Save", QDir::homePath(), "Coreboot Configuration Files (*.cfg)");
220 | diag.setWindowIcon(QIcon::fromTheme("corevantage"));
221 | diag.setDefaultSuffix(".cfg");
222 |
223 | //exec
224 | diag.exec();
225 |
226 | //result
227 | if (diag.result() == QDialog::Accepted) {
228 | //convert string
229 | QString user_file = diag.selectedFiles().constFirst();
230 | std::string selected_file = user_file.toUtf8().constData();
231 |
232 | writeToFile(selected_file);
233 | }
234 | }
235 |
236 | void corevantage::getSettings() {
237 | //Program Details
238 | QProcess* nvram_a = new QProcess(this);
239 | QString sudo_prog = "pkexec";
240 | QStringList args = {"/usr/sbin/nvramtool", "-a"};
241 |
242 | //Configuration directory
243 | QString user_dir = QDir::homePath() + "/.config/corevantage/";
244 | if (!QDir(user_dir).exists()) {
245 | QDir().mkdir(user_dir);
246 | }
247 |
248 | //Config file location
249 | cfgpath_q = user_dir + "nvramtool.cfg";
250 | cfgpath_s = cfgpath_q.toUtf8().constData();
251 | nvram_a->setStandardOutputFile(cfgpath_q);
252 |
253 | //remove config file if exists
254 | if (QFile::exists(cfgpath_q)) {
255 | QFile::remove(cfgpath_q);
256 | }
257 |
258 | connect(nvram_a, static_cast(&QProcess::finished), this, [=](int num){displaySettings(num);});
259 |
260 | //start
261 | init_config = new readCfg(cfgpath_s);
262 | nvram_a->start(sudo_prog, args);
263 | }
264 |
265 | void corevantage::textToDisplay(QStringList str_list, std::string in_string, QComboBox* box) {
266 | QString q_string = QString::fromStdString(in_string);
267 | int index = str_list.indexOf(q_string, 0);
268 | if (index != -1) {
269 | box->setCurrentIndex(index);
270 | }
271 | }
272 |
273 | void corevantage::checkToDisplay(std::string in_string, QCheckBox* box) {
274 | if (in_string.compare("Enable") == 0) {
275 | box->setCheckState(Qt::Checked);
276 | }
277 | else {
278 | box->setCheckState(Qt::Unchecked);
279 | }
280 | }
281 |
282 | void corevantage::hexToSlider(std::string in_string, QSlider* slider) {
283 | int init_str_size = in_string.size();
284 | if (init_str_size >= 3) {
285 | std::string str_num = in_string.substr(2, init_str_size - 2);
286 | int str_int = std::stoi(str_num);
287 |
288 | slider->setValue(str_int);
289 | }
290 | }
291 |
292 | void corevantage::displaySettings(int result) {
293 | qDebug() << "Nvram Read return code: " << result;
294 |
295 | if (result == 0) {
296 | init_config->get_values();
297 |
298 |
299 | //display text combos
300 | textToDisplay(boot_options, init_config->values[0], ui->bootCombo);
301 | textToDisplay(debug_options, init_config->values[2], ui->debugCombo);
302 | textToDisplay(battery_options, init_config->values[5], ui->batteryCombo);
303 | textToDisplay(sata_options, init_config->values[14], ui->sataCombo);
304 | textToDisplay(me_options, init_config->values[16], ui->meStateCombo);
305 | ui->usbAOCombo->setCurrentIndex(usbAO_map[init_config->values[15]]);
306 | ui->gfxCombo->setCurrentIndex(gfx_map[init_config->values[18]]);
307 |
308 | //display slider values
309 | hexToSlider(init_config->values[1], ui->rebootSlider);
310 | hexToSlider(init_config->values[17], ui->meResetSlider);
311 | hexToSlider(init_config->values[19], ui->volumeSlider);
312 |
313 | //display checkbox states
314 | checkToDisplay(init_config->values[3], ui->nmiBox);
315 | checkToDisplay(init_config->values[4], ui->acAttachBox);
316 | checkToDisplay(init_config->values[6], ui->btBox);
317 | checkToDisplay(init_config->values[7], ui->wwanBox);
318 | checkToDisplay(init_config->values[8], ui->touchpadBox);
319 | checkToDisplay(init_config->values[9], ui->wlanBox);
320 | checkToDisplay(init_config->values[10], ui->trackpointBox);
321 | checkToDisplay(init_config->values[11], ui->swapBox);
322 | checkToDisplay(init_config->values[12], ui->stickyBox);
323 | checkToDisplay(init_config->values[13], ui->pmbeepBox);
324 |
325 | }
326 |
327 | //handle error
328 | else {
329 | error_win.exec();
330 | this->close();
331 | }
332 | }
333 |
334 | void corevantage::comboToFile(std::fstream& output, std::string precursor, QComboBox* box, std::string successor = "") {
335 | std::string box_val = box->currentText().toUtf8().constData();
336 | output << precursor + box_val + successor << std::endl;
337 | }
338 |
339 | void corevantage::sliderToFile(std::fstream& output, std::string precursor, QSlider* slider) {
340 | std::string slider_val = std::to_string(slider->value());
341 | output << precursor + slider_val << std::endl;
342 | }
343 |
344 | void corevantage::checkToFile(std::fstream& output, std::string precursor, QCheckBox* box) {
345 | std::string status;
346 | if (box->isChecked()) {
347 | status = "Enable";
348 | }
349 | else {
350 | status = "Disable";
351 | }
352 | output << precursor + status << std::endl;
353 | }
354 |
355 | void corevantage::writeToFile(std::string out_file) {
356 | //clear file
357 | remove(out_file.c_str());
358 |
359 | //setup file for writing
360 | std::fstream out_stream;
361 | out_stream.open(out_file, std::ios_base::out);
362 |
363 | //start writing
364 | if(out_stream.is_open()) {
365 |
366 | comboToFile(out_stream, "boot_option = ", ui->bootCombo);
367 | sliderToFile(out_stream, "reboot_counter = 0x", ui->rebootSlider);
368 | comboToFile(out_stream, "debug_level = ", ui->debugCombo);
369 | checkToFile(out_stream, "nmi = ", ui->nmiBox);
370 | checkToFile(out_stream, "power_on_after_fail = ", ui->acAttachBox);
371 | comboToFile(out_stream, "first_battery = ", ui->batteryCombo);
372 | checkToFile(out_stream, "bluetooth = ", ui->btBox);
373 | checkToFile(out_stream, "wwan = ", ui->wwanBox);
374 | checkToFile(out_stream, "touchpad = ", ui->touchpadBox);
375 | checkToFile(out_stream, "wlan = ", ui->wlanBox);
376 | checkToFile(out_stream, "trackpoint = ", ui->trackpointBox);
377 | checkToFile(out_stream, "fn_ctrl_swap = ", ui->swapBox);
378 | checkToFile(out_stream, "sticky_fn = ", ui->stickyBox);
379 | checkToFile(out_stream, "power_management_beeps = ", ui->pmbeepBox);
380 | comboToFile(out_stream, "sata_mode = ", ui->sataCombo);
381 | comboToFile(out_stream, "usb_always_on = ", ui->usbAOCombo);
382 | comboToFile(out_stream, "me_state = ", ui->meStateCombo);
383 | sliderToFile(out_stream, "me_state_prev = 0x", ui->meResetSlider);
384 | comboToFile(out_stream, "gfx_uma_size = ", ui->gfxCombo, "M");
385 | sliderToFile(out_stream, "volume = 0x", ui->volumeSlider);
386 |
387 | }
388 |
389 | else {
390 | qDebug() << "Failed to write to file";
391 | }
392 |
393 | out_stream.close();
394 | }
395 |
--------------------------------------------------------------------------------
/src/x220/corevantage.h:
--------------------------------------------------------------------------------
1 | #ifndef COREVANTAGE_H
2 | #define COREVANTAGE_H
3 |
4 | #include
5 | #include "readcfg.h"
6 | #include "infowindow.h"
7 | #include "aboutwindow.h"
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 | QT_BEGIN_NAMESPACE
16 | namespace Ui { class corevantage; }
17 | QT_END_NAMESPACE
18 |
19 | class corevantage : public QMainWindow
20 | {
21 | Q_OBJECT
22 |
23 | public:
24 | corevantage(QWidget *parent = nullptr);
25 | readCfg* init_config;
26 | QString cfgpath_q;
27 | std::string cfgpath_s;
28 | ~corevantage();
29 |
30 | //String lists
31 | QStringList gfx_options;
32 | QStringList sata_options;
33 | QStringList battery_options;
34 | QStringList boot_options;
35 | QStringList boot_defaults;
36 | QStringList me_options;
37 | QStringList debug_options;
38 | QStringList usb_always_on;
39 |
40 | //maps
41 | std::map gfx_map;
42 | std::map usbAO_map;
43 |
44 | //windows
45 | QMessageBox error_win;
46 | infoWindow info_win;
47 | aboutWindow about_win;
48 |
49 |
50 | protected:
51 | void showEvent(QShowEvent *ev);
52 | void closeEvent(QCloseEvent *ev);
53 |
54 | public slots:
55 | //closing window
56 | void closeWindow(int result);
57 | void saveAndClose();
58 |
59 | //slider connections
60 | void setVolValue();
61 | void setRebootValue();
62 | void setMeValue();
63 |
64 | //read settings
65 | void getSettings();
66 | void getFromFile();
67 | void displaySettings(int result);
68 |
69 | //write settings
70 | void writeSettings();
71 | void writeToFile(std::string out_file);
72 |
73 |
74 | private:
75 | //read settings
76 | void textToDisplay(QStringList str_list, std::string in_string, QComboBox* box);
77 | void checkToDisplay(std::string in_string, QCheckBox* box);
78 | void hexToSlider(std::string in_string, QSlider* slider);
79 |
80 | //write settings
81 | void checkToFile(std::fstream& output, std::string precursor, QCheckBox* box);
82 | void comboToFile(std::fstream& output, std::string precursor, QComboBox* box, std::string successor);
83 | void sliderToFile(std::fstream& output, std::string precursor, QSlider* slider);
84 | void lineToFile(std::fstream& output, QLineEdit* line);
85 |
86 | Ui::corevantage *ui;
87 | };
88 | #endif // COREVANTAGE_H
89 |
--------------------------------------------------------------------------------
/src/x220/infowindow.cpp:
--------------------------------------------------------------------------------
1 | #include "infowindow.h"
2 | #include "ui_infowindow.h"
3 |
4 | #include
5 | #include
6 |
7 | infoWindow::infoWindow(QWidget *parent) :
8 | QWidget(parent),
9 | ui(new Ui::infoWindow)
10 | {
11 | ui->setupUi(this);
12 |
13 | //set window title and icon
14 | this->setWindowTitle("Information");
15 | this->setWindowIcon(QIcon::fromTheme("corevantage"));
16 |
17 | //Center window on screen
18 | move(QGuiApplication::screens().at(0)->geometry().center() - frameGeometry().center());
19 |
20 | //connect OK to closing window
21 | connect(ui->closeButton, &QDialogButtonBox::accepted, this, &QWidget::close);
22 | }
23 |
24 | infoWindow::~infoWindow()
25 | {
26 | delete ui;
27 | }
28 |
--------------------------------------------------------------------------------
/src/x220/infowindow.h:
--------------------------------------------------------------------------------
1 | #ifndef INFOWINDOW_H
2 | #define INFOWINDOW_H
3 |
4 | #include
5 |
6 | namespace Ui {
7 | class infoWindow;
8 | }
9 |
10 | class infoWindow : public QWidget
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | explicit infoWindow(QWidget *parent = nullptr);
16 | ~infoWindow();
17 |
18 | private:
19 | Ui::infoWindow *ui;
20 | };
21 |
22 | #endif // INFOWINDOW_H
23 |
--------------------------------------------------------------------------------
/src/x220/infowindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | infoWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 430
10 | 420
11 |
12 |
13 |
14 |
15 | 0
16 | 0
17 |
18 |
19 |
20 |
21 | 430
22 | 420
23 |
24 |
25 |
26 |
27 | 430
28 | 420
29 |
30 |
31 |
32 | Form
33 |
34 |
35 | -
36 |
37 |
38 |
39 | DejaVu Sans
40 | 11
41 |
42 |
43 |
44 | Description of Settings
45 |
46 |
47 | Qt::AlignCenter
48 |
49 |
50 |
51 | -
52 |
53 |
54 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
55 | <html><head><meta name="qrichtext" content="1" /><style type="text/css">
56 | p, li { white-space: pre-wrap; }
57 | </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
58 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Graphics Framebuffer Size (M): </span>Selects the amount of system memory reserved for the integrated graphics card.</p>
59 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
60 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Sata Mode: </span>Choose between the newer AHCI standard which offers better drive performance, and compatibility mode which supports legacy IDE hard drives.</p>
61 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
62 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Volume: </span>Sets the default speaker volume level. This value is often overrriden by the operating system at startup.</p>
63 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
64 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Wireless LAN: </span>Sets the enablement state of the wifi card at boot.</p>
65 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
66 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Bluetooth:</span> Sets the enablement state of the bluetooth card at boot.</p>
67 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
68 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Wireless WAN:</span> Sets the enablement state of the cellular modem card at boot.</p>
69 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
70 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Trackpoint:</span> Changes whether the trackpoint is recognized as an input device by the operating system.</p>
71 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
72 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Touchpad:</span> Changes whether the touchpad is recognized as an input device by the operating system.</p>
73 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
74 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Function-Control Swap: </span>Swaps the position of the function and control keys in the lower right corner of the keyboard.</p>
75 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
76 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Sticky Function Key: </span>Sets a delay after having pressed the fuction key. Enables the user to access a secondary function of a key without holding down the FN key.</p>
77 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
78 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Power Management Beeps: </span>Toggles whether there are audible beeps upon inserting and removing the charger from the computer.</p>
79 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
80 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">USB Always On: </span>Selects whether the USB charge port is enabled while on AC power and battery power, only on AC, or not at all.</p>
81 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
82 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">First Battery: </span>Selects which battery gets discharged first. This applies to systems with an add-on battery.</p>
83 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
84 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Boot Option: </span>If a secondary test image is included in the device's coreboot rom, selecting "Normal" will make the system start from the test image. Otherwise, the standard fallback image will be used.</p>
85 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
86 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Power On AC Attach:</span> If enabled, the system is supposed to power itself when the AC adapter is plugged in and it is not already on.</p>
87 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
88 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Reboot Counter: </span>Sets the amount of times rebooting from a test image will be allowed before trying to boot from fallback.</p>
89 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
90 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Management Engine (ME) State: </span>Selects whether the management engine is fully enabled, or soft-disabled. This setting only has an effect on systems that have not had <span style=" font-style:italic;">me_cleaner</span> run on them.</p>
91 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
92 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">ME Reset Counter: </span>Sets the amount of times after which the management engine state will revert to default in the event of a CMOS failure.</p>
93 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
94 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Debug Level: </span>Sets the amount of debug information to be outputed. "Spew" is the least amount and "Emergency" gives the most information.</p>
95 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
96 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Non-Maskable Interrupts: </span>Selects whether the system reports critical hardware errors to the operating system. It is important to leave this enabled unless for specific debugging purposes.</p>
97 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
98 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
99 | <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">For more information, please visit:</p>
100 | <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://doc.coreboot.org/"><span style=" text-decoration: underline; color:#0000ff;">https://doc.coreboot.org/</span></a></p>
101 | <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://www.coreboot.org/Nvramtool"><span style=" text-decoration: underline; color:#0000ff;">https://www.coreboot.org/Nvramtool</span></a></p></body></html>
102 |
103 |
104 | true
105 |
106 |
107 | true
108 |
109 |
110 |
111 | -
112 |
113 |
114 | QDialogButtonBox::Ok
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
--------------------------------------------------------------------------------
/src/x220/main.cpp:
--------------------------------------------------------------------------------
1 | #include "corevantage.h"
2 |
3 | #include
4 |
5 | int main(int argc, char *argv[])
6 | {
7 | QApplication a(argc, argv);
8 | corevantage w;
9 | w.show();
10 | return a.exec();
11 | }
12 |
--------------------------------------------------------------------------------
/src/x220/readcfg.cpp:
--------------------------------------------------------------------------------
1 | #include "readcfg.h"
2 | #include
3 | #include
4 | #include
5 |
6 | readCfg::readCfg(std::string in_file) {
7 | this->in_file = in_file;
8 | }
9 |
10 | std::string readCfg::shrink_string(std::string input) {
11 | size_t last_pos = input.find_last_of(' ');
12 | if (last_pos == input.size() - 1) {
13 | input = input.substr(0, input.size() - 1);
14 | return shrink_string(input);
15 | }
16 | else {
17 | return input;
18 | }
19 | }
20 |
21 |
22 | void readCfg::get_values() {
23 | std::fstream curr_file;
24 | std::string curr_line;
25 | std::string curr_word;
26 |
27 | curr_file.open(in_file, std::ios::in);
28 |
29 | if (curr_file.is_open() ) {
30 | int counter = 0;
31 | while (getline(curr_file, curr_line)) {
32 | std::string shrunken = shrink_string(curr_line);
33 | int last_space = shrunken.find_last_of(' ');
34 | values[counter++] = shrunken.substr(last_space + 1, shrunken.size() - last_space);
35 | if (values[counter - 1] == "=") {
36 | values[counter - 1] = "";
37 | }
38 | }
39 | }
40 | curr_file.close();
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/src/x220/readcfg.h:
--------------------------------------------------------------------------------
1 | #ifndef READCFG_H
2 | #define READCFG_H
3 |
4 | #include
5 |
6 | class readCfg : public QObject
7 | {
8 | Q_OBJECT
9 | public:
10 | explicit readCfg(std::string in_file);
11 |
12 | std::string values[20];
13 | void get_values();
14 |
15 | private:
16 | std::string in_file;
17 | std::string shrink_string(std::string input);
18 |
19 | signals:
20 |
21 | };
22 |
23 | #endif // READCFG_H
24 |
--------------------------------------------------------------------------------
/src/x230/aboutwindow.cpp:
--------------------------------------------------------------------------------
1 | #include "aboutwindow.h"
2 | #include "ui_aboutwindow.h"
3 |
4 | #include
5 | #include
6 |
7 | aboutWindow::aboutWindow(QWidget *parent) :
8 | QWidget(parent),
9 | ui(new Ui::aboutWindow)
10 | {
11 | ui->setupUi(this);
12 |
13 | //set window title and icon
14 | this->setWindowTitle("About");
15 | this->setWindowIcon(QIcon::fromTheme("corevantage"));
16 |
17 | //Center window on screen
18 | move(QGuiApplication::screens().at(0)->geometry().center() - frameGeometry().center());
19 |
20 | //connect OK to closing window
21 | connect(ui->okButton, &QDialogButtonBox::accepted, this, &QWidget::close);
22 | }
23 |
24 | aboutWindow::~aboutWindow()
25 | {
26 | delete ui;
27 | }
28 |
--------------------------------------------------------------------------------
/src/x230/aboutwindow.h:
--------------------------------------------------------------------------------
1 | #ifndef ABOUTWINDOW_H
2 | #define ABOUTWINDOW_H
3 |
4 | #include
5 |
6 | namespace Ui {
7 | class aboutWindow;
8 | }
9 |
10 | class aboutWindow : public QWidget
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | explicit aboutWindow(QWidget *parent = nullptr);
16 | ~aboutWindow();
17 |
18 | private:
19 | Ui::aboutWindow *ui;
20 | };
21 |
22 | #endif // ABOUTWINDOW_H
23 |
--------------------------------------------------------------------------------
/src/x230/aboutwindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | aboutWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 475
10 | 245
11 |
12 |
13 |
14 |
15 | 475
16 | 245
17 |
18 |
19 |
20 |
21 | 475
22 | 245
23 |
24 |
25 |
26 | Form
27 |
28 |
29 | -
30 |
31 | -
32 |
33 |
34 |
35 |
36 |
37 | ../../../../usr/share/corevantage/aboutIcon.png
38 |
39 |
40 | Qt::AlignCenter
41 |
42 |
43 |
44 | -
45 |
46 | -
47 |
48 |
49 |
50 | DejaVu Sans
51 | 16
52 | 75
53 | true
54 |
55 |
56 |
57 | Corevantage
58 |
59 |
60 | Qt::AlignCenter
61 |
62 |
63 |
64 | -
65 |
66 | -
67 |
68 |
69 |
70 | DejaVu Sans
71 | 75
72 | true
73 |
74 |
75 |
76 | Written By:
77 |
78 |
79 | Qt::AlignCenter
80 |
81 |
82 |
83 | -
84 |
85 |
86 |
87 | 0
88 | 30
89 |
90 |
91 |
92 | Jason Goulet-Lipman
93 |
94 |
95 | Qt::AlignHCenter|Qt::AlignTop
96 |
97 |
98 |
99 | -
100 |
101 |
102 | and all current and future
103 |
104 |
105 | Qt::AlignCenter
106 |
107 |
108 |
109 | -
110 |
111 |
112 | open source contributors
113 |
114 |
115 | Qt::AlignCenter
116 |
117 |
118 |
119 |
120 |
121 | -
122 |
123 | -
124 |
125 |
126 |
127 | 100
128 | 0
129 |
130 |
131 |
132 |
133 | DejaVu Sans
134 | 75
135 | true
136 |
137 |
138 |
139 | Donate:
140 |
141 |
142 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
143 |
144 |
145 |
146 | -
147 |
148 |
149 |
150 | 0
151 | 0
152 |
153 |
154 |
155 |
156 | 91
157 | 0
158 |
159 |
160 |
161 | <html><head/><body><p><a href="https://www.paypal.com/donate?hosted_button_id=2W3JGPJ5RKAAA"><span style=" text-decoration: underline; color:#0000ff;">PayPal</span></a></p></body></html>
162 |
163 |
164 | Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
165 |
166 |
167 | true
168 |
169 |
170 |
171 |
172 |
173 | -
174 |
175 |
176 |
177 | 0
178 | 0
179 |
180 |
181 |
182 | QDialogButtonBox::Ok
183 |
184 |
185 | true
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
--------------------------------------------------------------------------------
/src/x230/corevantage.h:
--------------------------------------------------------------------------------
1 | #ifndef COREVANTAGE_H
2 | #define COREVANTAGE_H
3 |
4 | #include
5 | #include "readcfg.h"
6 | #include "infowindow.h"
7 | #include "aboutwindow.h"
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 | QT_BEGIN_NAMESPACE
16 | namespace Ui { class corevantage; }
17 | QT_END_NAMESPACE
18 |
19 | class corevantage : public QMainWindow
20 | {
21 | Q_OBJECT
22 |
23 | public:
24 | corevantage(QWidget *parent = nullptr);
25 | readCfg* init_config;
26 | QString cfgpath_q;
27 | std::string cfgpath_s;
28 | ~corevantage();
29 |
30 | //String lists
31 | QStringList gfx_options;
32 | QStringList sata_options;
33 | QStringList battery_options;
34 | QStringList boot_options;
35 | QStringList boot_defaults;
36 | QStringList me_options;
37 | QStringList debug_options;
38 | QStringList backlight_options;
39 | QStringList usb_always_on;
40 |
41 | //maps
42 | std::map gfx_map;
43 | std::map backlight_map;
44 | std::map usbAO_map;
45 |
46 | //windows
47 | QMessageBox error_win;
48 | infoWindow info_win;
49 | aboutWindow about_win;
50 |
51 |
52 | protected:
53 | void showEvent(QShowEvent *ev);
54 | void closeEvent(QCloseEvent *ev);
55 |
56 | public slots:
57 | //closing window
58 | void closeWindow(int result);
59 | void saveAndClose();
60 |
61 | //slider connections
62 | void setVolValue();
63 | void setRebootValue();
64 | void setMeValue();
65 |
66 | //read settings
67 | void getSettings();
68 | void getFromFile();
69 | void displaySettings(int result);
70 |
71 | //write settings
72 | void writeSettings();
73 | void writeToFile(std::string out_file);
74 |
75 |
76 | private:
77 | //read settings
78 | void textToDisplay(QStringList str_list, std::string in_string, QComboBox* box);
79 | void checkToDisplay(std::string in_string, QCheckBox* box);
80 | void hexToSlider(std::string in_string, QSlider* slider);
81 |
82 | //write settings
83 | void checkToFile(std::fstream& output, std::string precursor, QCheckBox* box);
84 | void comboToFile(std::fstream& output, std::string precursor, QComboBox* box, std::string successor);
85 | void sliderToFile(std::fstream& output, std::string precursor, QSlider* slider);
86 | void lineToFile(std::fstream& output, QLineEdit* line);
87 |
88 | Ui::corevantage *ui;
89 | };
90 | #endif // COREVANTAGE_H
91 |
--------------------------------------------------------------------------------
/src/x230/infowindow.cpp:
--------------------------------------------------------------------------------
1 | #include "infowindow.h"
2 | #include "ui_infowindow.h"
3 |
4 | #include
5 | #include
6 |
7 | infoWindow::infoWindow(QWidget *parent) :
8 | QWidget(parent),
9 | ui(new Ui::infoWindow)
10 | {
11 | ui->setupUi(this);
12 |
13 | //set window title and icon
14 | this->setWindowTitle("Information");
15 | this->setWindowIcon(QIcon::fromTheme("corevantage"));
16 |
17 | //Center window on screen
18 | move(QGuiApplication::screens().at(0)->geometry().center() - frameGeometry().center());
19 |
20 | //connect OK to closing window
21 | connect(ui->closeButton, &QDialogButtonBox::accepted, this, &QWidget::close);
22 | }
23 |
24 | infoWindow::~infoWindow()
25 | {
26 | delete ui;
27 | }
28 |
--------------------------------------------------------------------------------
/src/x230/infowindow.h:
--------------------------------------------------------------------------------
1 | #ifndef INFOWINDOW_H
2 | #define INFOWINDOW_H
3 |
4 | #include
5 |
6 | namespace Ui {
7 | class infoWindow;
8 | }
9 |
10 | class infoWindow : public QWidget
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | explicit infoWindow(QWidget *parent = nullptr);
16 | ~infoWindow();
17 |
18 | private:
19 | Ui::infoWindow *ui;
20 | };
21 |
22 | #endif // INFOWINDOW_H
23 |
--------------------------------------------------------------------------------
/src/x230/infowindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | infoWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 430
10 | 420
11 |
12 |
13 |
14 |
15 | 0
16 | 0
17 |
18 |
19 |
20 |
21 | 430
22 | 420
23 |
24 |
25 |
26 |
27 | 430
28 | 420
29 |
30 |
31 |
32 | Form
33 |
34 |
35 | -
36 |
37 |
38 |
39 | DejaVu Sans
40 | 11
41 |
42 |
43 |
44 | Description of Settings
45 |
46 |
47 | Qt::AlignCenter
48 |
49 |
50 |
51 | -
52 |
53 |
54 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
55 | <html><head><meta name="qrichtext" content="1" /><style type="text/css">
56 | p, li { white-space: pre-wrap; }
57 | </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
58 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Graphics Framebuffer Size (M): </span>Selects the amount of system memory reserved for the integrated graphics card.</p>
59 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
60 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Sata Mode: </span>Choose between the newer AHCI standard which offers better drive performance, and compatibility mode which supports legacy IDE hard drives.</p>
61 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
62 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Volume: </span>Sets the default speaker volume level. This value is often overrriden by the operating system at startup.</p>
63 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
64 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Wireless LAN: </span>Sets the enablement state of the wifi card at boot.</p>
65 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
66 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Bluetooth:</span> Sets the enablement state of the bluetooth card at boot.</p>
67 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
68 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Wireless WAN:</span> Sets the enablement state of the cellular modem card at boot.</p>
69 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
70 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Trackpoint:</span> Changes whether the trackpoint is recognized as an input device by the operating system.</p>
71 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
72 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Touchpad:</span> Changes whether the touchpad is recognized as an input device by the operating system.</p>
73 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
74 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">F1 to F12 As Primary Function: </span>Selects whether the function keys serve their primary function, or their secondary funtion (i.e. changing the volume) by default.</p>
75 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
76 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Function-Control Swap: </span>Swaps the position of the function and control keys in the lower right corner of the keyboard.</p>
77 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
78 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Sticky Function Key: </span>Sets a delay after having pressed the fuction key. Enables the user to access a secondary function of a key without holding down the FN key.</p>
79 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
80 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Backlights Enabled: </span>Selects which keyboard illumination lights can be enabled when pressing the backlight special function key.</p>
81 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
82 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">USB Always On: </span>Selects whether the USB charge port is enabled while on AC power and battery power, only on AC, or not at all.</p>
83 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
84 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">First Battery: </span>Selects which battery gets discharged first. This applies to systems with an add-on battery.</p>
85 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
86 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Boot Option: </span>If a secondary test image is included in the device's coreboot rom, selecting "Normal" will make the system start from the test image. Otherwise, the standard fallback image will be used.</p>
87 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
88 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Power On AC Attach:</span> If enabled, the system is supposed to power itself when the AC adapter is plugged in and it is not already on.</p>
89 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
90 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Reboot Counter: </span>Sets the amount of times rebooting from a test image will be allowed before trying to boot from fallback.</p>
91 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
92 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Management Engine (ME) State: </span>Selects whether the management engine is fully enabled, or soft-disabled. This setting only has an effect on systems that have not had <span style=" font-style:italic;">me_cleaner</span> run on them.</p>
93 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
94 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">ME Reset Counter: </span>Sets the amount of times after which the management engine state will revert to default in the event of a CMOS failure.</p>
95 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
96 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Debug Level: </span>Sets the amount of debug information to be outputed. "Spew" is the least amount and "Emergency" gives the most information.</p>
97 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
98 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Non-Maskable Interrupts: </span>Selects whether the system reports critical hardware errors to the operating system. It is important to leave this enabled unless for specific debugging purposes.</p>
99 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
100 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
101 | <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">For more information, please visit:</p>
102 | <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://doc.coreboot.org/"><span style=" text-decoration: underline; color:#0000ff;">https://doc.coreboot.org/</span></a></p>
103 | <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://www.coreboot.org/Nvramtool"><span style=" text-decoration: underline; color:#0000ff;">https://www.coreboot.org/Nvramtool</span></a></p></body></html>
104 |
105 |
106 | true
107 |
108 |
109 | true
110 |
111 |
112 |
113 | -
114 |
115 |
116 | QDialogButtonBox::Ok
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
--------------------------------------------------------------------------------
/src/x230/main.cpp:
--------------------------------------------------------------------------------
1 | #include "corevantage.h"
2 |
3 | #include
4 |
5 | int main(int argc, char *argv[])
6 | {
7 | QApplication a(argc, argv);
8 | corevantage w;
9 | w.show();
10 | return a.exec();
11 | }
12 |
--------------------------------------------------------------------------------
/src/x230/readcfg.cpp:
--------------------------------------------------------------------------------
1 | #include "readcfg.h"
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | readCfg::readCfg(std::string in_file) {
9 | this->in_file = in_file;
10 | }
11 |
12 | std::string readCfg::shrink_string(std::string input) {
13 | size_t last_pos = input.find_last_of(' ');
14 | if (last_pos == input.size() - 1) {
15 | input = input.substr(0, input.size() - 1);
16 | return shrink_string(input);
17 | }
18 | else {
19 | return input;
20 | }
21 | }
22 |
23 |
24 | void readCfg::get_values() {
25 | std::fstream curr_file;
26 | std::string curr_line;
27 | std::string curr_word;
28 |
29 | curr_file.open(in_file, std::ios::in);
30 |
31 | if (curr_file.is_open() ) {
32 | int counter = 0;
33 | while (getline(curr_file, curr_line)) {
34 | std::string shrunken = shrink_string(curr_line);
35 | int last_space = shrunken.find_last_of(' ');
36 | values[counter++] = shrunken.substr(last_space + 1, shrunken.size() - last_space);
37 | if (values[counter - 1] == "=") {
38 | values[counter - 1] = "";
39 | }
40 | else if (values[counter - 1] == "only") {
41 | shrunken = shrunken.substr(0, last_space);
42 | int space_before = shrunken.find_last_of(' ');
43 | values[counter - 1] = shrunken.substr(space_before + 1, shrunken.size() - space_before);
44 | }
45 | }
46 | }
47 | curr_file.close();
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/x230/readcfg.h:
--------------------------------------------------------------------------------
1 | #ifndef READCFG_H
2 | #define READCFG_H
3 |
4 | #include
5 |
6 | class readCfg : public QObject
7 | {
8 | Q_OBJECT
9 | public:
10 | explicit readCfg(std::string in_file);
11 |
12 | std::string values[21];
13 | void get_values();
14 |
15 | private:
16 | std::string in_file;
17 | std::string shrink_string(std::string input);
18 |
19 | signals:
20 |
21 | };
22 |
23 | #endif // READCFG_H
24 |
--------------------------------------------------------------------------------