Skip to content

Commit

Permalink
Add simple CLI (#94)
Browse files Browse the repository at this point in the history
* Add simple CLI

* switch to qMax
  • Loading branch information
Neverous authored Jul 22, 2023
1 parent 0fdb60d commit 45d631a
Show file tree
Hide file tree
Showing 13 changed files with 1,758 additions and 859 deletions.
20 changes: 11 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,14 @@ target_sources(${PROJECT_NAME} PRIVATE
src/bootentrylistmodel.cpp
src/bootentrylistview.cpp
src/bootentrywidget.cpp
src/filepathdelegate.cpp
src/filepathdialog.cpp
src/devicepathview.cpp
src/devicepathproxymodel.cpp
src/devicepathview.cpp
src/driveinfo.cpp
src/efibootdata.cpp
src/efibooteditor.cpp
src/efibooteditorcli.cpp
src/filepathdelegate.cpp
src/filepathdialog.cpp
)

if(UNIX AND NOT APPLE)
Expand Down Expand Up @@ -249,20 +250,21 @@ target_sources(${PROJECT_NAME} PRIVATE
include/bootentrywidget.h
include/commands.h
include/compat.h
include/disableundoredo.h
include/filepathdelegate.h
include/filepathdialog.h
include/devicepathview.h
include/devicepathproxymodel.h
include/devicepathview.h
include/disableundoredo.h
include/driveinfo.h
include/efiboot.h
include/efibootdata.h
include/efibooteditor.h
include/efibooteditorcli.h
include/efivar-lite/efiboot-loadopt.h
include/efivar-lite/efivar-dp.h
include/efivar-lite/efivar.h
include/qlabelwrapped.h
include/filepathdelegate.h
include/filepathdialog.h
include/qindicatorwidget.h
include/qlabelwrapped.h
include/qresizabletabwidget.h
include/qwidgetitemdelegate.h
)
Expand All @@ -271,8 +273,8 @@ target_sources(${PROJECT_NAME} PRIVATE
target_sources(${PROJECT_NAME} PRIVATE
src/form/bootentryform.ui
src/form/bootentrywidget.ui
src/form/filepathdialog.ui
src/form/efibooteditor.ui
src/form/filepathdialog.ui
)

# Resources:
Expand Down
4 changes: 2 additions & 2 deletions include/efibooteditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ class EFIBootEditor: public QMainWindow
std::unique_ptr<QMessageBox> confirmation;
std::unique_ptr<QMessageBox> error;
std::unique_ptr<QProgressDialog> progress;
std::unique_ptr<DisableUndoRedo> disableUndoRedo;
std::unique_ptr<DisableUndoRedo> disable_undo_redo;

QUndoStack undo_stack{this};

public:
explicit EFIBootEditor(QWidget *parent = nullptr);
explicit EFIBootEditor(const std::optional<std::tstring> &efi_error_message, QWidget *parent = nullptr);
EFIBootEditor(const EFIBootEditor &) = delete;
EFIBootEditor &operator=(const EFIBootEditor &) = delete;
~EFIBootEditor() override;
Expand Down
28 changes: 28 additions & 0 deletions include/efibooteditorcli.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
#include <QCommandLineParser>
#include <QCoreApplication>

#include "compat.h"
#include "efibootdata.h"

class EFIBootEditorCLI: public QObject
{
Q_OBJECT

QCommandLineParser parser{};
EFIBootData data{this};
bool efi_supported;

public:
explicit EFIBootEditorCLI(const std::optional<std::tstring> &efi_error_message, QObject *parent = nullptr);
EFIBootEditorCLI(const EFIBootEditorCLI &) = delete;
EFIBootEditorCLI &operator=(const EFIBootEditorCLI &) = delete;
~EFIBootEditorCLI() override;

bool process(QCoreApplication &app);

public slots:
void showError(const QString &message, const QString &details);
void showProgress(size_t step, size_t total, const QString &details);
void hideProgress();
};
Loading

0 comments on commit 45d631a

Please sign in to comment.