@@ -15,14 +15,20 @@ MainWindow::MainWindow(QWidget *parent) :
1515
1616 QSettings settings (" ./set.ini" , QSettings::IniFormat);
1717 this ->ui ->maintenanceToolLineEdit ->setText (settings.value (" path" ).toString ());
18+ this ->ui ->hasParentWindowCheckBox ->setChecked (settings.value (" hasParent" , true ).toBool ());
1819 this ->ui ->displayLevelComboBox ->setCurrentIndex ((QtAutoUpdater::UpdateController::DisplayLevel)settings.value (" level" , QtAutoUpdater::UpdateController::ProgressLevel).toInt ());
20+ this ->ui ->adminCheckBox ->setChecked (settings.value (" admin" , true ).toBool ());
21+ this ->ui ->userChangecheckBox ->setChecked (settings.value (" adminChangable" , true ).toBool ());
1922}
2023
2124MainWindow::~MainWindow ()
2225{
2326 QSettings settings (" ./set.ini" , QSettings::IniFormat);
2427 settings.setValue (" path" , this ->ui ->maintenanceToolLineEdit ->text ());
28+ settings.setValue (" hasParent" , this ->ui ->hasParentWindowCheckBox ->isChecked ());
2529 settings.setValue (" level" , this ->ui ->displayLevelComboBox ->currentIndex ());
30+ settings.setValue (" admin" , this ->ui ->adminCheckBox ->isChecked ());
31+ settings.setValue (" adminChangable" , this ->ui ->userChangecheckBox ->isChecked ());
2632 delete ui;
2733}
2834
@@ -68,7 +74,8 @@ void MainWindow::on_cancelButton_clicked()
6874void MainWindow::on_activeBox_toggled (bool checked)
6975{
7076 if (checked) {
71- this ->controller = new QtAutoUpdater::UpdateController (this ->ui ->maintenanceToolLineEdit ->text (), this );
77+ this ->controller = new QtAutoUpdater::UpdateController (this ->ui ->maintenanceToolLineEdit ->text (),
78+ this ->ui ->hasParentWindowCheckBox ->isChecked () ? this : NULL );
7279 this ->ui ->menuHelp ->addAction (this ->controller ->getUpdateAction ());
7380 this ->ui ->mainToolBar ->addAction (this ->controller ->getUpdateAction ());
7481 connect (this ->controller , &QtAutoUpdater::UpdateController::runningChanged, this , [this ](bool running){
@@ -81,3 +88,9 @@ void MainWindow::on_activeBox_toggled(bool checked)
8188 this ->statusBar ()->showMessage (" not running" );
8289 }
8390}
91+
92+ void MainWindow::on_hasParentWindowCheckBox_clicked (bool checked)
93+ {
94+ if (this ->controller )
95+ this ->controller ->setParentWindow (checked ? this : NULL );
96+ }
0 commit comments