Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup #27

Merged
merged 3 commits into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/MsgPopup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Popup {

property alias title: msgpopupheader.text
property alias text: msgpopupbody.text
property alias body: msgpopupbody
property bool continueButton: true
property bool quitButton: false
property bool yesButton: false
Expand Down
6 changes: 0 additions & 6 deletions src/UnraidOptionsPopup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ Popup {
spacing: -10

RowLayout {
Layout.fillWidth: True
Text {
text : "Server Name:"
color: !fieldServername.acceptableInput ? "red" : "white"
Expand All @@ -114,10 +113,6 @@ Popup {
maximumLength: 15
validator: RegExpValidator { regExp: /^[A-Za-z0-9]([A-Za-z0-9\-\.]{0,13}[A-Za-z0-9])?$/ }
}
ImCheckBox {
id: checkboxLegacyBoot
text: "Enable Legacy Boot"
}
}

RowLayout {
Expand Down Expand Up @@ -283,7 +278,6 @@ Popup {
settings.dns = dnsField.fullAddress
settings.netmask = fieldNetmask.currentText
settings.servername = fieldServername.text
settings.legacyboot = checkboxLegacyBoot.checked
imageWriter.setSavedCustomizationSettings(settings)


Expand Down
18 changes: 4 additions & 14 deletions src/downloadextractthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,23 +417,13 @@ void DownloadExtractThread::extractMultiFileRun()
QFile::copy(":/unraid/syslinux/syslinux.exe", folder + "/syslinux/syslinux.exe");
}

QString permitUEFI{"Y"};
if(_imgWriterSettings.contains("legacyboot") && _imgWriterSettings["legacyboot"].toBool()) {
// if legacy boot is enabled, tell make bootable script not to permite uefi
permitUEFI = "N";
}

#ifdef Q_OS_WIN
QString makeBootableScriptName{"make_bootable.bat"};
QString program{"cmd.exe"};
QStringList args;
args << "/C" << "echo " + permitUEFI + " | make_bootable.bat";
args << "/C" << "echo Y | make_bootable.bat";
#elif defined(Q_OS_DARWIN)
QString makeBootableScriptName{"make_bootable_mac");
QString program{"echo " + permitUEFI + " | ./" + makeBootableScriptName};
#elif defined(Q_OS_LINUX)
QString makeBootableScriptName{"make_bootable_linux");
QString program{"echo " + permitUEFI + " | ./" + makeBootableScriptName};
#else
throw runtime_error(tr("Formatting not implemented for this platform"));
#endif
Expand All @@ -450,10 +440,10 @@ void DownloadExtractThread::extractMultiFileRun()
proc.waitForFinished();

QByteArray output = proc.readAllStandardOutput();
qDebug() << output;
std::cout << output.toStdString() << std::endl;
output = proc.readAllStandardError();
qDebug() << output;
qDebug() << "Done running make_bootable script. Exit status code =" << proc.exitCode();
std::cout << output.toStdString() << std::endl;
std::cout << "Done running make_bootable script. Exit status code =" << proc.exitCode() << std::endl;

if (proc.exitCode())
{
Expand Down
13 changes: 9 additions & 4 deletions src/imagewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <QDebug>
#include <QVersionNumber>
#include <QtNetwork>
#include <QDesktopServices>
#ifndef QT_NO_WIDGETS
#include <QFileDialog>
#include <QApplication>
Expand Down Expand Up @@ -218,7 +219,7 @@ void ImageWriter::setSrc(const QUrl &url, quint64 downloadLen, quint64 extrLen,
}
if (url.isLocalFile())
{
_initFormat = "auto";
_initFormat = "UNRAID";
}
}

Expand Down Expand Up @@ -615,14 +616,14 @@ QByteArray ImageWriter::getFilteredOSlist() {

reference_os_list_array.append(QJsonObject({
{"name", QApplication::translate("main", "Erase")},
{"description", QApplication::translate("main", "Format card as FAT32")},
{"description", QApplication::translate("main", "Format USB Drive as FAT32")},
{"icon", "icons/erase.png"},
{"url", "internal://format"},
}));

reference_os_list_array.append(QJsonObject({
{"name", QApplication::translate("main", "Use custom")},
{"description", QApplication::translate("main", "Select a custom .img from your computer")},
{"description", QApplication::translate("main", "Select an Unraid .zip file from your computer")},
{"icon", "icons/use_custom.png"},
{"url", ""},
}));
Expand Down Expand Up @@ -807,7 +808,7 @@ void ImageWriter::openFileDialog()

QFileDialog *fd = new QFileDialog(nullptr, tr("Select image"),
path,
"Image files (*.img *.zip *.iso *.gz *.xz *.zst);;All files (*)");
"Unraid Image files (*.zip)");
connect(fd, SIGNAL(fileSelected(QString)), SLOT(onFileSelected(QString)));

if (_engine)
Expand Down Expand Up @@ -1498,3 +1499,7 @@ bool ImageWriter::getDstGuidValid()
return _guidValid;
}

bool ImageWriter::openUrl(const QString& url)
{
return QDesktopServices::openUrl(QUrl(url, QUrl::TolerantMode));
}
1 change: 1 addition & 0 deletions src/imagewriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ class ImageWriter : public QObject
Q_INVOKABLE QString getInitFormat();
Q_INVOKABLE QString getDstDevice();
Q_INVOKABLE bool getDstGuidValid();
Q_INVOKABLE bool openUrl(const QString& url);

signals:
/* We are emiting signals with QVariant as parameters because QML likes it that way */
Expand Down
Loading