Skip to content
Permalink
Browse files

Add uninstall button for mac to GUI

  • Loading branch information...
tatokis committed Apr 19, 2019
1 parent a2b5061 commit fe7ef326046959ba455143faafb83b77bf2936aa
Showing with 29 additions and 0 deletions.
  1. +4 −0 macos/uninstall.sh
  2. +17 −0 src/gui/settingswidget.cpp
  3. +1 −0 src/gui/settingswidget.h
  4. +7 −0 src/gui/settingswidget.ui
@@ -1,10 +1,13 @@
#!/usr/bin/env bash

echo "ckb-next uninstaller"

echo "Stopping GUI"
open -a 'ckb' --args --close
open -a 'ckb-next' --args --close

echo "Stopping the daemon and removing service file"
echo "Please enter your password"
sudo launchctl unload /Library/LaunchDaemons/ckb-next-daemon.plist
sudo launchctl unload /Library/LaunchDaemons/com.ckb.daemon.plist
sudo launchctl unload /Library/LaunchDaemons/org.ckb-next.daemon.plist
@@ -15,3 +18,4 @@ sudo rm -f /Library/LaunchDaemons/org.ckb-next.daemon.plist
echo "Removing GUI, daemon and support files"
sudo rm -rf /Applications/ckb{,-next}.app
sudo rm "/Library/Application Support/ckb-next-daemon"
echo "Finished!"
@@ -22,6 +22,11 @@ SettingsWidget::SettingsWidget(QWidget *parent) :
ui(new Ui::SettingsWidget)
{
ui->setupUi(this);

#ifndef Q_OS_MACOS
ui->uninstallButton->hide();
#endif

CkbSettings settings("Program");

// Load modifier remap
@@ -262,3 +267,15 @@ void SettingsWidget::setUpdateButtonText(QString text){
updateRequestedByUser = false;
}
}

void SettingsWidget::on_uninstallButton_clicked()
{
#ifdef Q_OS_MACOS
if(QMessageBox::warning(this, tr("Uninstall ckb-next"), tr("WARNING: Clicking OK will uninstall ckb-next and any older versions of the software from your system.\n\n"
"Your settings and lighting profiles will be preserved."), QMessageBox::Cancel, QMessageBox::Ok) != QMessageBox::Ok)
return;

// Open a terminal and run the uninstall script
QProcess::execute("open", QStringList() << "-a" << "Terminal" << "/Applications/ckb-next.app/Contents/Resources/uninstall.sh");
#endif
}
@@ -46,6 +46,7 @@ private slots:
void devDetectDestroyed();
void on_autoUpdBox_clicked(bool checked);
void on_pushButton_2_clicked();
void on_uninstallButton_clicked();

private:
QProcess* devDetect;
@@ -483,6 +483,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="uninstallButton">
<property name="text">
<string>Uninstall ckb-next</string>
</property>
</widget>
</item>
</layout>
</item>
<item>

0 comments on commit fe7ef32

Please sign in to comment.
You can’t perform that action at this time.