Skip to content

Commit dae2d5b

Browse files
committed
add QRFL_PORTABILITY_TWEAKS mode
1 parent b5a4239 commit dae2d5b

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ Supported build options (among regular CMake options):
146146
| `CMAKE_BUILD_TYPE` | `Debug`, `Release`, `Coverage` ... | `Release` | |
147147
| `CMAKE_CXX_COMPILER` | `g++`, `clang++` ... | | |
148148
| `QRFL_MINIMAL` | `ON`, `OFF` | `OFF` | Disable GUI and Qt dependency |
149+
| `QRFL_PORTABILITY_TWEAKS` | `ON`, `OFF` | `OFF` | Disable usage of platform native dialogs ([Qt doc](https://doc.qt.io/qt-6/qt.html#ApplicationAttribute-enum)) |
149150

150151
<br>
151152

default.nix

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
, lato
88
, withDoc ? true
99
, withGui ? true
10+
, withPortabilityTweaks ? false
1011
}:
1112

1213
assert lib.asserts.assertMsg (withGui -> withDoc)
@@ -40,8 +41,9 @@ stdenv.mkDerivation {
4041
unset NIX_HARDENING_ENABLE
4142
'';
4243

43-
cmakeFlags = lib.optionals (!withGui) [
44-
"-DQRFL_MINIMAL=ON"
44+
cmakeFlags = [
45+
(lib.cmakeBool "QRFL_MINIMAL" (!withGui))
46+
(lib.cmakeBool "QRFL_PORTABILITY_TWEAKS" withPortabilityTweaks)
4547
];
4648

4749
nativeBuildInputs = [

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ target_compile_definitions( ${PROJECT_NAME}
5050
QRFL_OEMS_TUTORIAL="${QRFL_OEMS_TUTORIAL}"
5151
QRFL_BUGREPORT="${QRFL_BUGREPORT}"
5252
$<$<BOOL:${QRFL_MINIMAL}>:QRFL_MINIMAL>
53+
$<$<BOOL:${QRFL_PORTABILITY_TWEAKS}>:QRFL_PORTABILITY_TWEAKS>
5354
)
5455

5556
target_compile_features( ${PROJECT_NAME}

src/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,11 @@ int main(int argc, char* argv[]) {
232232
if(gui) {
233233
cout << "GUI mode\n";
234234
QApplication a(argc, argv);
235+
236+
#ifdef QRFL_PORTABILITY_TWEAKS
237+
a.setAttribute(Qt::AA_DontUseNativeDialogs);
238+
#endif // QRFL_PORTABILITY_TWEAKS
239+
235240
// Avoid a stold() bug introduced by QApplication() performing setlocale(LC_ALL, "")
236241
setlocale(LC_NUMERIC, "C");
237242
MainWindow w(data, gui_theme);

0 commit comments

Comments
 (0)