2015-04-02 16:07:32 +08:00
|
|
|
/* uefitool_main.cpp
|
2022-08-28 18:47:01 +08:00
|
|
|
|
2022-12-08 04:25:57 +08:00
|
|
|
Copyright (c) 2022, Nikolaj Schlej. All rights reserved.
|
2022-08-28 18:47:01 +08:00
|
|
|
This program and the accompanying materials
|
|
|
|
are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
which accompanies this distribution. The full text of the license may be found at
|
|
|
|
http://opensource.org/licenses/bsd-license.php
|
|
|
|
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
|
|
|
|
*/
|
2015-04-02 16:07:32 +08:00
|
|
|
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QString>
|
|
|
|
#include "uefitool.h"
|
|
|
|
|
2019-08-18 10:02:30 +08:00
|
|
|
class UEFIToolApplication : public QApplication
|
|
|
|
{
|
2019-08-20 02:36:02 +08:00
|
|
|
UEFITool* tool;
|
2022-08-28 18:47:01 +08:00
|
|
|
|
2019-08-18 10:02:30 +08:00
|
|
|
public:
|
|
|
|
UEFIToolApplication(int &argc, char **argv)
|
2022-08-28 18:47:01 +08:00
|
|
|
: QApplication(argc, argv)
|
2019-08-18 10:02:30 +08:00
|
|
|
{
|
2022-12-08 04:25:57 +08:00
|
|
|
setOrganizationName("CodeRush");
|
|
|
|
setOrganizationDomain("coderush.me");
|
|
|
|
setApplicationName("UEFITool");
|
2019-08-20 02:36:02 +08:00
|
|
|
|
|
|
|
tool = new UEFITool();
|
2019-08-18 10:02:30 +08:00
|
|
|
}
|
2019-08-20 02:36:02 +08:00
|
|
|
|
|
|
|
virtual ~UEFIToolApplication() {
|
|
|
|
delete tool;
|
2019-08-18 10:02:30 +08:00
|
|
|
}
|
2019-08-20 02:36:02 +08:00
|
|
|
|
|
|
|
virtual bool event(QEvent *event)
|
2019-08-18 10:02:30 +08:00
|
|
|
{
|
|
|
|
if (event->type() == QEvent::FileOpen) {
|
|
|
|
QFileOpenEvent *openEvent = static_cast<QFileOpenEvent *>(event);
|
2019-08-20 02:36:02 +08:00
|
|
|
tool->openImageFile(openEvent->file());
|
2019-08-18 10:02:30 +08:00
|
|
|
}
|
2022-08-28 18:47:01 +08:00
|
|
|
|
2019-08-18 10:02:30 +08:00
|
|
|
return QApplication::event(event);
|
|
|
|
}
|
2019-08-20 02:36:02 +08:00
|
|
|
|
|
|
|
int startup()
|
|
|
|
{
|
|
|
|
tool->setProgramPath(arguments().at(0));
|
|
|
|
if (arguments().length() > 1)
|
|
|
|
tool->openImageFile(arguments().at(1));
|
|
|
|
tool->show();
|
|
|
|
|
|
|
|
return exec();
|
|
|
|
}
|
2019-08-18 10:02:30 +08:00
|
|
|
};
|
|
|
|
|
2015-04-02 16:07:32 +08:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2019-08-18 10:02:30 +08:00
|
|
|
UEFIToolApplication a(argc, argv);
|
|
|
|
return a.startup();
|
|
|
|
}
|