]>
glassweightruler.freedombox.rocks Git - Ventoy.git/blob - LinuxGUI/Ventoy2Disk/QT/main.cpp
1 #include "ventoy2diskwindow.h"
3 #include <QApplication>
7 #include <QDesktopWidget>
10 #include <sys/types.h>
13 #include "ventoy_define.h"
14 #include "ventoy_util.h"
15 #include "ventoy_qt.h"
20 char g_log_file
[4096];
21 char g_ini_file
[4096];
23 int main(int argc
, char *argv
[])
26 QApplication
a(argc
, argv
);
32 QMessageBox::critical(NULL
, "Error", "Permission denied!\nPlease run with root privileges.");
37 if (!QFileInfo::exists("./boot/boot.img"))
39 QMessageBox::critical(NULL
, "Error", "Please run under the correct directory.");
45 snprintf(g_log_file
, sizeof(g_log_file
), "./log.txt");
46 snprintf(g_ini_file
, sizeof(g_ini_file
), "./Ventoy2Disk.ini");
47 for (int i
= 0; i
< argc
; i
++)
49 if (argv
[i
] && argv
[i
+ 1] && strcmp(argv
[i
], "-l") == 0)
51 snprintf(g_log_file
, sizeof(g_log_file
), "%s", argv
[i
+ 1]);
53 else if (argv
[i
] && argv
[i
+ 1] && strcmp(argv
[i
], "-i") == 0)
55 snprintf(g_ini_file
, sizeof(g_ini_file
), "%s", argv
[i
+ 1]);
59 vlog("===================================================\n");
60 vlog("===== Ventoy2Disk %s powered by QT %s =====\n", ventoy_get_local_version(), qVersion());
61 vlog("===================================================\n");
66 w
.setGeometry(QStyle::alignedRect(Qt::LeftToRight
,
69 a
.desktop()->availableGeometry()));
76 data
= (const uchar
*)get_window_icon_raw_data(&len
);
77 pix
.loadFromData(data
, len
);
79 w
.setWindowIcon(icon
);
82 w
.setFixedSize(w
.size());
89 vlog("######## Ventoy2Disk QT %s exit ########\n", ventoy_get_local_version());
91 /* log exit must at the end */