Esempio n. 1
0
void SettingsDialog::init() {
	/// Settings Window
	connect (mSettingsWindowUi.buttonBox, SIGNAL (accepted()), this, SLOT (onSettingsAccepted()));
	Model::Settings settings;
	{
		SF_SCHNEE_LOCK;
		settings = mController->umodel()->settings();
	}
	sf::String user, server;
	splitUserServer (settings.userId, &user, &server);
	mSettingsWindowUi.usernameEdit->setText (qtString (user));
	mSettingsWindowUi.serverEdit->setEditText(qtString (server));
	mSettingsWindowUi.passwordEdit->setText (qtString (settings.password));
	mSettingsWindowUi.useBoshCheckBox->setCheckState (settings.useBosh ? Qt::Checked : Qt::Unchecked);
	mSettingsWindowUi.fileDestinationEdit->setText (qtString (settings.destinationDirectory));
	mSettingsWindowUi.echoServerIpEdit->setText (qtString (settings.echoServerIp));
	mSettingsWindowUi.echoServerPortEdit->setValue (settings.echoServerPort);
	mSettingsWindowUi.autoConnectCheckBox->setCheckState (settings.autoConnect ? Qt::Checked : Qt::Unchecked);
	::setDefaultServer(server); // TODO Should be done in controller

	if (mController->autostartAvailable()){
		mSettingsWindowUi.autostartCheckBox->setCheckState (mController->autostartInstalled() ? Qt::Checked : Qt::Unchecked);
	} else {
		mSettingsWindowUi.autostartCheckBox->setEnabled (false);
		mSettingsWindowUi.autostartCheckBox->setHidden(true);
	}

	mFileDestinationChooseDialog = new QFileDialog (this, tr ("Choose Directory"));
	mFileDestinationChooseDialog->setAcceptMode (QFileDialog::AcceptOpen);
	mFileDestinationChooseDialog->setModal (true);
	mFileDestinationChooseDialog->setFileMode (QFileDialog::Directory);
	mFileDestinationChooseDialog->setOption (QFileDialog::ShowDirsOnly, true);
	connect (mFileDestinationChooseDialog, SIGNAL (fileSelected (const QString&)), this, SLOT (onFileDestinationSelected(const QString&)));
	connect (mSettingsWindowUi.fileDestinationChooseButton, SIGNAL (clicked()), mFileDestinationChooseDialog, SLOT (show()));
}
TIGLViewerSettingsDialog::TIGLViewerSettingsDialog(TIGLViewerSettings& settings, QWidget *parent)
    : QDialog(parent), _settings(settings)
{
    setupUi(this);

    tessAccuEdit->setText (QString("%1").arg(sliderTesselationAccuracy->value()));
    trianAccuEdit->setText(QString("%1").arg(sliderTriangulationAccuracy->value()));
    settingsList->item(0)->setSelected(true);

    connect(buttonBox, SIGNAL(accepted()), this, SLOT(onSettingsAccepted()));
    connect(sliderTesselationAccuracy,   SIGNAL(valueChanged(int)), this, SLOT(onSliderTesselationChanged(int)));
    connect(sliderTriangulationAccuracy, SIGNAL(valueChanged(int)), this, SLOT(onSliderTriangulationChanged(int)));
    connect(buttonColorChoser, SIGNAL(clicked()), this, SLOT(onColorChoserPushed()));
    connect(settingsList, SIGNAL(currentRowChanged(int)), this, SLOT(onSettingsListChanged(int)));
}
SettingsWidget::SettingsWidget ( SessionContext * context, QWidget * parent, Qt::WindowFlags f )
    : QWidget ( parent, f ),
      _ui ( new Ui::SettingsWidget() ),
      _context ( context ) {

    _ui->setupUi ( this );

    for ( int i = 1; i < QApplication::desktop()->screenCount(); i++ ) {
        this->_ui->screenComboBox->addItem ( QString::number ( i ) );
    }

    this->_ui->serverUriLineEdit->setText ( Settings::instance()->serverUrl().toString() );
    this->_ui->widgetPositionComboBox->setCurrentIndex ( Settings::instance()->widgetPosition() );
    this->_ui->screenComboBox->setCurrentIndex ( Settings::instance()->screen() );

    connect ( this->_ui->buttonBox, SIGNAL ( accepted() ), this, SLOT ( onSettingsAccepted() ) );
    connect ( this->_ui->buttonBox, SIGNAL ( rejected() ), this, SLOT ( onSettingsRejected() ) );
}