mirror of
https://github.com/Snigdha-OS/snigdhaos-assistant.git
synced 2025-09-20 19:45:01 +02:00
chore(users): fixed all the possible bugs and enhanced ui.
This commit is contained in:
@@ -70,7 +70,7 @@ void SnigdhaOSAssistant::doInternetUpRequest(){
|
||||
|
||||
|
||||
void SnigdhaOSAssistant::doUpdate(){
|
||||
if (qEnvironmentVariableIsSet("SETUP_ASSISTANT_SELFUPDATE")) {
|
||||
if (qEnvironmentVariableIsSet("SNIGDHAOS_ASSISTANT_SELFUPDATE")) {
|
||||
updateState(State::SELECT);
|
||||
return;
|
||||
}
|
||||
@@ -78,7 +78,7 @@ void SnigdhaOSAssistant::doUpdate(){
|
||||
QTemporaryFile* file = new QTemporaryFile(this);
|
||||
file->open();
|
||||
file->setAutoRemove(true);
|
||||
process->start("/usr/bin/gnome-terminal", QStringList() << QString("sudo pacman -Syyu" + file->fileName() + "\"; read -p 'Press enter to exit'"));
|
||||
process->start("/usr/lib/snigdhaos/launch-terminal", QStringList() << QString("sudo pacman -Syyu 2>&1 && rm \"" + file->fileName() + "\"; read -p 'Press enter to exit'"));
|
||||
connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this, process, file](int exitcode, QProcess::ExitStatus status) {
|
||||
process->deleteLater();
|
||||
file->deleteLater();
|
||||
@@ -140,7 +140,7 @@ void SnigdhaOSAssistant::doApply(){
|
||||
setupFile->close();
|
||||
|
||||
auto process = new QProcess(this);
|
||||
process->start("/usr/bin/gnome-terminal", QStringList() << QString("/usr/lib/snigdhaos-assistant/apply.sh \"") + prepareFile->fileName() + "\" \"" + packagesFile->fileName() + "\" \"" + setupFile->fileName() + "\"");
|
||||
process->start("/usr/lib/snigdhaos/launch-terminal", QStringList() << QString("/usr/lib/snigdhaos-assistant/apply.sh \"") + prepareFile->fileName() + "\" \"" + packagesFile->fileName() + "\" \"" + setupFile->fileName() + "\"");
|
||||
connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this, process, prepareFile, packagesFile, setupFile](int exitcode, QProcess::ExitStatus status) {
|
||||
process->deleteLater();
|
||||
prepareFile->deleteLater();
|
||||
@@ -148,44 +148,44 @@ void SnigdhaOSAssistant::doApply(){
|
||||
setupFile->deleteLater();
|
||||
|
||||
if (exitcode == 0 && !packagesFile->exists()) {
|
||||
updateState(State::SUCCESS);
|
||||
updateState(State::SELECT);
|
||||
} else {
|
||||
updateState(State::APPLY_RETRY);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void SnigdhaOSAssistant::doNvidiaCheck(){
|
||||
auto process = new QProcess(this);
|
||||
process->start("mhwd", QStringList() << "-li"
|
||||
<< "--pci");
|
||||
connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this, process](int exitcode, QProcess::ExitStatus status) {
|
||||
process->deleteLater();
|
||||
if (exitcode == 0 && !QString(process->readAllStandardOutput()).contains("nvidia")) {
|
||||
auto process2 = new QProcess(this);
|
||||
process2->start("mhwd", QStringList() << "-l"
|
||||
<< "--pci");
|
||||
connect(process2, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this, process2](int exitcode, QProcess::ExitStatus status) {
|
||||
process2->deleteLater();
|
||||
if (exitcode == 0 && QString(process2->readAllStandardOutput()).contains("nvidia"))
|
||||
updateState(State::NVIDIA);
|
||||
else
|
||||
updateState(State::SELECT);
|
||||
});
|
||||
} else {
|
||||
updateState(State::SELECT);
|
||||
}
|
||||
});
|
||||
}
|
||||
// void SnigdhaOSAssistant::doNvidiaCheck(){
|
||||
// auto process = new QProcess(this);
|
||||
// process->start("mhwd", QStringList() << "-li"
|
||||
// << "--pci");
|
||||
// connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this, process](int exitcode, QProcess::ExitStatus status) {
|
||||
// process->deleteLater();
|
||||
// if (exitcode == 0 && !QString(process->readAllStandardOutput()).contains("nvidia")) {
|
||||
// auto process2 = new QProcess(this);
|
||||
// process2->start("mhwd", QStringList() << "-l"
|
||||
// << "--pci");
|
||||
// connect(process2, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this, process2](int exitcode, QProcess::ExitStatus status) {
|
||||
// process2->deleteLater();
|
||||
// if (exitcode == 0 && QString(process2->readAllStandardOutput()).contains("nvidia"))
|
||||
// updateState(State::NVIDIA);
|
||||
// else
|
||||
// updateState(State::SELECT);
|
||||
// });
|
||||
// } else {
|
||||
// updateState(State::SELECT);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
void SnigdhaOSAssistant::doNvidiaApply(){
|
||||
auto process = new QProcess(this);
|
||||
process->start("/usr/bin/gnome-terminal", QStringList() << "sudo mhwd -a pci nonfree 0300; echo; read -p 'Press enter to exit'");
|
||||
connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this, process](int exitcode, QProcess::ExitStatus status) {
|
||||
process->deleteLater();
|
||||
updateState(State::SELECT);
|
||||
});
|
||||
}
|
||||
// void SnigdhaOSAssistant::doNvidiaApply(){
|
||||
// auto process = new QProcess(this);
|
||||
// process->start("/usr/lib/snigdhaos/launch-terminal", QStringList() << "sudo mhwd -a pci nonfree 0300; echo; read -p 'Press enter to exit'");
|
||||
// connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this, process](int exitcode, QProcess::ExitStatus status) {
|
||||
// process->deleteLater();
|
||||
// updateState(State::SELECT);
|
||||
// });
|
||||
// }
|
||||
|
||||
void SnigdhaOSAssistant::populateSelectWidget(){
|
||||
if (ui->selectWidget_tabs->count() > 1)
|
||||
@@ -280,21 +280,21 @@ void SnigdhaOSAssistant::updateState(State state){
|
||||
ui->textStackedWidget->setCurrentWidget(ui->textWidget_updateRetry);
|
||||
ui->textWidget_buttonBox->setStandardButtons(QDialogButtonBox::Yes | QDialogButtonBox::No);
|
||||
break;
|
||||
case State::NVIDIA_CHECK:
|
||||
ui->mainStackedWidget->setCurrentWidget(ui->waitingWidget);
|
||||
ui->waitingWidget_text->setText("Checking for NVIDIA drivers...");
|
||||
doNvidiaCheck();
|
||||
break;
|
||||
case State::NVIDIA:
|
||||
ui->mainStackedWidget->setCurrentWidget(ui->textWidget);
|
||||
ui->textStackedWidget->setCurrentWidget(ui->textWidget_nvidia);
|
||||
ui->textWidget_buttonBox->setStandardButtons(QDialogButtonBox::Yes | QDialogButtonBox::No);
|
||||
break;
|
||||
case State::NVIDIA_APPLY:
|
||||
ui->mainStackedWidget->setCurrentWidget(ui->waitingWidget);
|
||||
ui->waitingWidget_text->setText("Installing NVIDIA drivers...");
|
||||
doNvidiaApply();
|
||||
break;
|
||||
// case State::NVIDIA_CHECK:
|
||||
// ui->mainStackedWidget->setCurrentWidget(ui->waitingWidget);
|
||||
// ui->waitingWidget_text->setText("Checking for NVIDIA drivers...");
|
||||
// doNvidiaCheck();
|
||||
// break;
|
||||
// case State::NVIDIA:
|
||||
// ui->mainStackedWidget->setCurrentWidget(ui->textWidget);
|
||||
// ui->textStackedWidget->setCurrentWidget(ui->textWidget_nvidia);
|
||||
// ui->textWidget_buttonBox->setStandardButtons(QDialogButtonBox::Yes | QDialogButtonBox::No);
|
||||
// break;
|
||||
// case State::NVIDIA_APPLY:
|
||||
// ui->mainStackedWidget->setCurrentWidget(ui->waitingWidget);
|
||||
// ui->waitingWidget_text->setText("Installing NVIDIA drivers...");
|
||||
// doNvidiaApply();
|
||||
// break;
|
||||
case State::QUIT:
|
||||
ui->mainStackedWidget->setCurrentWidget(ui->textWidget);
|
||||
ui->textStackedWidget->setCurrentWidget(ui->textWidget_quit);
|
||||
@@ -325,7 +325,7 @@ void SnigdhaOSAssistant::updateState(State state){
|
||||
|
||||
void SnigdhaOSAssistant::updateState(QString state){
|
||||
if (state == "POST_UPDATE")
|
||||
updateState(State::NVIDIA_CHECK);
|
||||
updateState(State::SELECT);
|
||||
else if (state == "UPDATE_RETRY")
|
||||
updateState(State::UPDATE_RETRY);
|
||||
else
|
||||
@@ -354,12 +354,12 @@ void SnigdhaOSAssistant::on_textWidget_buttonBox_clicked(QAbstractButton* button
|
||||
updateState(State::INTERNET);
|
||||
}
|
||||
break;
|
||||
case State::NVIDIA:
|
||||
if (ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::Yes)
|
||||
updateState(State::NVIDIA_APPLY);
|
||||
else
|
||||
updateState(State::SELECT);
|
||||
return;
|
||||
// case State::NVIDIA:
|
||||
// if (ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::Yes)
|
||||
// updateState(State::NVIDIA_APPLY);
|
||||
// else
|
||||
// updateState(State::SELECT);
|
||||
// return;
|
||||
case State::APPLY_RETRY:
|
||||
if (ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::Yes) {
|
||||
updateState(State::APPLY);
|
||||
|
@@ -28,9 +28,9 @@ public:
|
||||
INTERNET,
|
||||
UPDATE,
|
||||
UPDATE_RETRY,
|
||||
NVIDIA_CHECK,
|
||||
NVIDIA,
|
||||
NVIDIA_APPLY,
|
||||
// NVIDIA_CHECK,
|
||||
// NVIDIA,
|
||||
// NVIDIA_APPLY,
|
||||
SELECT,
|
||||
APPLY,
|
||||
APPLY_RETRY,
|
||||
@@ -52,8 +52,8 @@ private:
|
||||
void doInternetUpRequest();
|
||||
void doUpdate();
|
||||
void doApply();
|
||||
void doNvidiaCheck();
|
||||
void doNvidiaApply();
|
||||
// void doNvidiaCheck();
|
||||
// void doNvidiaApply();
|
||||
void populateSelectWidget();
|
||||
void populateSelectWidget(QString filename, QString label);
|
||||
void updateState(State state);
|
||||
|
@@ -18,7 +18,7 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QStackedWidget" name="mainStackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="textWidget">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
@@ -30,12 +30,15 @@
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set>
|
||||
</property>
|
||||
<property name="centerButtons">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QStackedWidget" name="textStackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>4</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="textWidget_welcome">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
@@ -48,7 +51,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-size:24pt;">Welcome to Snigdha OS!</span><br/>This interactive assistant will help you set up your system to your wishes.</p><p>Before the setup assistant can continue, initial system updates have to be applied and the Snigdha OS Assistant updated.<br/>Make sure you have a working internet connection before you continue.</p></body></html></string>
|
||||
<string><html><head/><body><p><span style=" font-size:24pt;">Welcome to <b>Snigdha OS!</b>😊</span><br/><b>Snigdha OS Assistant</b> will help you set up your system to your wishes.</p><p>Before the Snigdha OS Assistant can continue, initial system updates have to be applied and the Snigdha OS Assistant is updated.<br/>Make sure you have a working internet connection before you continue.</p></br>This application is inspired from <b>Garuda Linux</b></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::TextFormat::RichText</enum>
|
||||
@@ -77,7 +80,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-size:20pt;">Update failed!</span><br/>System update failed. Try again?</p><p><a href="https://forum.snigdhaos.org"><span style=" text-decoration: underline; color:#754ffe;">Visit the Snigdha OS Forum</span></a> if further issues occour.<br/>Finishing this update via the Snigdha OS Assistant is highly recommended in order to apply release-specific fixes.</p></body></html></string>
|
||||
<string><html><head/><body><p><span style=" font-size:20pt;">Update failed!😒</span><br/>System update failed. Try again?😬</p><p><a href="https://forum.snigdhaos.org"><span style=" text-decoration: underline; color:#754ffe;">Visit the Snigdha OS Forum</span></a> if further issues occour.<br/>Finishing this update via the Snigdha OS Assistant is highly recommended in order to apply release-specific fixes.</p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::TextFormat::RichText</enum>
|
||||
@@ -173,7 +176,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-size:20pt;">Success!</span><br/>Your system is set up and ready to go!</p><p><a href="https://forum.snigdhais.org"><span style=" text-decoration: underline; color:#754ffe;">Visit the Snigdha OS Forum</span></a> if issues occour.<br/><a href="https://snigdhaos.org/"><span style=" text-decoration: underline; color:#754ffe;">Snigdha OS Documentation<br/></span></a><a href="https://wiki.archlinux.org/"><span style=" text-decoration: underline; color:#754ffe;">Arch Linux Wiki</span></a></p></body></html></string>
|
||||
<string><html><head/><body><p><span style=" font-size:20pt;">Success!😎</span><br/>Your system is set up and ready to go!</p><p><a href="https://forum.snigdhais.org"><span style=" text-decoration: underline; color:#754ffe;">Visit the Snigdha OS Forum</span></a> if issues occour.<br/><a href="https://snigdhaos.org/"><span style=" text-decoration: underline; color:#754ffe;">Snigdha OS Documentation<br/></span></a><a href="https://wiki.archlinux.org/"><span style=" text-decoration: underline; color:#754ffe;">Arch Linux Wiki</span></a></p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::TextFormat::RichText</enum>
|
||||
@@ -205,7 +208,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-size:20pt;">Before you go</span></p><p>You can restart the setup assistant at any time.<br/>Finishing the Snigdha OS Assistant is recommended in order to apply release-specific fixes.</p><p><a href="https://forum.snigdhaos.org"><span style=" text-decoration: underline; color:#754ffe;">Visit the Snigdha OS Forum</span></a> if issues occour.<br/><a href="https://snigdhaos.org/documentation/"><span style=" text-decoration: underline; color:#754ffe;">Snigdha OS Documentation<br/></span></a><a href="https://wiki.archlinux.org/"><span style=" text-decoration: underline; color:#754ffe;">Arch Linux Wiki</span></a></p></body></html></string>
|
||||
<string><html><head/><body><p><span style=" font-size:20pt;">Before you go🧸</span></p><p>You can restart the Snigdha OS Assistant at any time.<br/>Finishing the Snigdha OS Assistant is recommended in order to apply release-specific fixes.</p><p><a href="https://forum.snigdhaos.org"><span style=" text-decoration: underline; color:#754ffe;">Visit the Snigdha OS Forum</span></a> if issues occour.<br/><a href="https://snigdhaos.org/documentation/"><span style=" text-decoration: underline; color:#754ffe;">Snigdha OS Documentation<br/></span></a><a href="https://wiki.archlinux.org/"><span style=" text-decoration: underline; color:#754ffe;">Arch Linux Wiki</span></a></p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::TextFormat::RichText</enum>
|
||||
@@ -321,7 +324,6 @@
|
||||
</property>
|
||||
<property name="packages" stdset="0">
|
||||
<stringlist notr="true">
|
||||
<string>garuda-blackarch</string>
|
||||
<string>blackarch-keyring</string>
|
||||
<string>blackarch-menus</string>
|
||||
<string>blackarch-mirrorlist</string>
|
||||
|
@@ -9,7 +9,7 @@ echo ""
|
||||
echo "Installing packages.."
|
||||
echo ""
|
||||
installable_packages=$(comm -12 <(pacman -Slq | sort) <(sed s/\\s/\\n/g - <$2 | sort))
|
||||
sudo pacman -S --needed $installable_packages && rm $2 || { read -p "Error! Press enter to return to setup assistant."; exit; }
|
||||
sudo pacman -S --needed $installable_packages && rm $2 || { read -p "Error! Press enter to return to Snigdha OS Assistant."; exit; }
|
||||
|
||||
if [ -e "$3" ]; then
|
||||
echo ""
|
||||
@@ -19,4 +19,4 @@ if [ -e "$3" ]; then
|
||||
fi
|
||||
|
||||
echo ""
|
||||
read -p "Press enter to return to setup assistant."
|
||||
read -p "Press enter to return to Snigdha OS Assistant."
|
||||
|
Reference in New Issue
Block a user