Settingsdialog::Settingsdialog(QWidget *parent, bool isCanvasVisible) : QDialog(parent), ui(new Ui::Settingsdialog) { ui->setupUi(this); mSettingsFile = QApplication::applicationDirPath() + "editorSettings"; mSettings = new QSettings(mSettingsFile, QSettings::NativeFormat); ui->resoursesPath->setText(mSettings->value("Editor/resourcesPath").toString()); ui->configPath->setText(mSettings->value("Editor/configurationPath").toString()); ui->pluginsPath->setText(mSettings->value("Editor/pluginsPath").toString()); ui->ogreLogPath->setText(mSettings->value("Editor/ogreLogPath").toString()); ui->morphLogPath->setText(mSettings->value("Editor/morphLogPath").toString()); connect(ui->browseBtn, SIGNAL(clicked()), this, SLOT(browseDialog())); connect(ui->confBtn, SIGNAL(clicked()), this, SLOT(confDialog())); connect(ui->pluginsBtn, SIGNAL(clicked()), this, SLOT(pluginsDialog())); connect(ui->ogreBtn, SIGNAL(clicked()), this, SLOT(ogreLogDialog())); connect(ui->morphBtn, SIGNAL(clicked()), this, SLOT(morphLogDialog())); connect(ui->resoursesPath, SIGNAL(textChanged(QString)), this, SLOT(setResourcesPath(QString))); connect(ui->configPath, SIGNAL(textChanged(QString)), this, SLOT(setConfigPath(QString))); connect(ui->pluginsPath, SIGNAL(textChanged(QString)), this, SLOT(setPluginsPath(QString))); connect(ui->ogreLogPath, SIGNAL(textChanged(QString)), this, SLOT(setOgreLogPath(QString))); connect(ui->morphLogPath, SIGNAL(textChanged(QString)), this, SLOT(setMorphLogPath(QString))); connect(ui->buttonsBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(clicked())); if(isCanvasVisible) { ui->renderLayer->addItem("Back"); ui->renderLayer->addItem("Front"); mSize = mSettings->value("Grid/gridPrespectiveSize").toInt(); ui->mPerspSize->setValue(mSize); mDivisions = mSettings->value("Grid/gridDivisions").toInt(); ui->mGridSpacingMenu->setValue(mDivisions); mIndex = mSettings->value("Grid/gridRenderLayer").toInt(); ui->renderLayer->setCurrentIndex(mIndex); mValue = mSettings->value("Grid/gridRenderScale").toBool(); ui->renderScale->setChecked(mValue); mColor = mSettings->value("Grid/gridColor").toString(); connect(ui->modify, SIGNAL(clicked()), this, SLOT(gridColorChanged())); connect(ui->mGridSpacingMenu, SIGNAL(valueChanged(int)), this, SLOT(gridDivisionsChanged(int))); connect(ui->mPerspSize, SIGNAL(valueChanged(int)), this, SLOT(gridPrespectiveSizeChanged(int))); connect(ui->renderLayer, SIGNAL(currentIndexChanged(int)), this, SLOT(gridRenderLayerChanged(int))); connect(ui->renderScale, SIGNAL(clicked(bool)), this, SLOT(gridRenderScaleChanged(bool))); } else {
int ControlApplication::runConfigurator(bool configService, bool isRunAsRequested) { // If not enough rights to configurate service, then restart application requesting // admin access rights. if (configService && (IsUserAnAdmin() == FALSE)) { // If admin rights already requested and application still don't have them, // then show error message and exit. if (isRunAsRequested) { MessageBox(0, StringTable::getString(IDS_ADMIN_RIGHTS_NEEDED), StringTable::getString(IDS_MBC_TVNCONTROL), MB_OK | MB_ICONERROR); return 0; } // Path to tvnserver binary. StringStorage pathToBinary; // Command line for child process. StringStorage childCommandLine; // Get path to tvnserver binary. Environment::getCurrentModulePath(&pathToBinary); // Set -dontelevate flag to tvncontrol know that admin rights already requested. childCommandLine.format(_T("%s -dontelevate"), m_commandLine.getString()); // Start child. try { Shell::runAsAdmin(pathToBinary.getString(), childCommandLine.getString()); } catch (SystemException &sysEx) { if (sysEx.getErrorCode() != ERROR_CANCELLED) { MessageBox(0, sysEx.getMessage(), StringTable::getString(IDS_MBC_TVNCONTROL), MB_OK | MB_ICONERROR); } return 1; } // try / catch. return 0; } Configurator *configurator = Configurator::getInstance(); configurator->setServiceFlag(configService); configurator->load(); ConfigDialog confDialog(configService, 0); return confDialog.showModal(); }