MCPcopy Create free account
hub / github.com/baldurk/renderdoc / on_toggleGlobal_clicked

Method on_toggleGlobal_clicked

qrenderdoc/Windows/Dialogs/CaptureDialog.cpp:755–865  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

753}
754
755void CaptureDialog::on_toggleGlobal_clicked()
756{
757 if(!ui->toggleGlobal->isEnabled())
758 return;
759
760 ui->toggleGlobal->setEnabled(false);
761
762 QList<QWidget *> enableDisableWidgets = {ui->exePath, ui->exePathBrowse, ui->workDirPath,
763 ui->workDirBrowse, ui->cmdline, ui->launch,
764 ui->saveSettings, ui->loadSettings};
765
766 for(QWidget *o : ui->optionsGroup->findChildren<QWidget *>(QString(), Qt::FindDirectChildrenOnly))
767 if(o)
768 enableDisableWidgets << o;
769
770 for(QWidget *o : ui->actionGroup->findChildren<QWidget *>(QString(), Qt::FindDirectChildrenOnly))
771 if(o)
772 enableDisableWidgets << o;
773
774 if(ui->toggleGlobal->isChecked())
775 {
776 if(!IsRunningAsAdmin())
777 {
778 QMessageBox::StandardButton res = RDDialog::question(
779 this, tr("Restart as admin?"),
780 tr("RenderDoc needs to restart with administrator privileges. Restart?"),
781 RDDialog::YesNoCancel);
782
783 if(res == QMessageBox::Yes)
784 {
785 QString capfile = QDir::temp().absoluteFilePath(lit("global.cap"));
786
787 bool wasChecked = ui->AutoStart->isChecked();
788 ui->AutoStart->setChecked(false);
789
790 SaveSettings(capfile);
791
792 ui->AutoStart->setChecked(wasChecked);
793
794 // save the config here explicitly
795 m_Ctx.Config().Save();
796
797 bool success = RunProcessAsAdmin(qApp->applicationFilePath(), QStringList() << capfile);
798
799 if(success)
800 {
801 // close the config so that when we're shutting down we don't conflict with new process
802 // loading
803 m_Ctx.Config().Close();
804 m_Ctx.GetMainWindow()->Widget()->close();
805 return;
806 }
807
808 // don't restart if it failed for some reason (e.g. user clicked no to the elevation prompt)
809 ui->toggleGlobal->setChecked(false);
810 ui->toggleGlobal->setEnabled(true);
811 return;
812 }

Callers

nothing calls this directly

Calls 15

IsRunningAsAdminFunction · 0.85
questionFunction · 0.85
RunProcessAsAdminFunction · 0.85
setEnabledMultipleFunction · 0.85
RENDERDOC_StopGlobalHookFunction · 0.85
SettingsEnum · 0.85
criticalFunction · 0.85
isEnabledMethod · 0.80
QStringFunction · 0.50
trFunction · 0.50

Tested by

no test coverage detected