Ejemplo n.º 1
0
bool ScopeSync::saveConfigurationAs()
{
    File configurationFileDirectory = getConfigurationDirectory();
    
    FileChooser fileChooser("Save Configuration File As...",
                            configurationFileDirectory,
                            "*.configuration");
    
    if (fileChooser.browseForFileToSave(true))
    {
        String fileName = fileChooser.getResult().getFullPathName();

        if (File::isAbsolutePath(fileName))
        {
            configuration->setLastFailedFile(configuration->getFile());
            configuration->setFile(File(fileName));
            getConfigurationRoot().setProperty(Ids::ID, createAlphaNumericUID(), nullptr);
            saveConfiguration();
        }

        applyConfiguration();

        UserSettings::getInstance()->addActionListener(this);
        UserSettings::getInstance()->rebuildFileLibrary(true, false, false);

        return true;
    }
    else
        return false;
}
Ejemplo n.º 2
0
void ScopeSync::reloadSavedConfiguration()
{
    configuration->loadFrom(configuration->getFile(), true);
    configuration->setMissingDefaultValues();
    applyConfiguration();
    undoManager.clearUndoHistory();
}
Ejemplo n.º 3
0
TagWidget::TagWidget(QWidget *parent): BaseObjectWidget(parent, OBJ_TAG)
{
  Ui_TagWidget::setupUi(this);
  configureFormLayout(tag_grid, OBJ_TAG);

	QStringList attribs={ ParsersAttributes::TABLE_NAME, ParsersAttributes::TABLE_SCHEMA_NAME,
												ParsersAttributes::TABLE_TITLE, ParsersAttributes::TABLE_BODY,
												ParsersAttributes::TABLE_EXT_BODY };
	unsigned color_count=1;
	int row=0;

  for(auto &attr : attribs)
	{
		if(color_count==1 && attr!=ParsersAttributes::TABLE_NAME && attr!=ParsersAttributes::TABLE_SCHEMA_NAME)
			 color_count=3;

		color_pickers[attr]=new ColorPickerWidget(color_count, this);
		colors_grid->addWidget(color_pickers[attr], row, 1);
		colors_grid->addItem(new QSpacerItem(10,10, QSizePolicy::Expanding, QSizePolicy::Fixed), row, 2);
		row++;
	}

	connect(parent_form->apply_ok_btn, SIGNAL(clicked()), this, SLOT(applyConfiguration()));
	parent_form->setMinimumSize(450, 320);
	parent_form->setMaximumHeight(320);
}
Ejemplo n.º 4
0
bool ScopeSync::processConfigurationChange()
{
    if (ScopeSyncApplication::inPluginContext())
        parameterController->storeParameterValues(); 

    String newFileName;

    if (hasConfigurationUpdate(newFileName))
    {
        if (configuration->replaceConfiguration(newFileName))
        {
            applyConfiguration();
            return true;
        }
        else
        {
            setSystemError(configuration->getLastError(), configuration->getLastErrorDetails());
            return false;
        }
    }
    else
    {
        return false;
    }
}
Ejemplo n.º 5
0
void ScopeSync::addConfiguration(File newFile, ValueTree newSettings)
{ 
    configuration->createConfiguration(newFile, newSettings);
    configuration->save(true, true);
    applyConfiguration();

    // Rebuild the library, so we can check whether the new configuration
    // was put into a File Location. We will get an action callback
    // once the rebuild is complete
    UserSettings::getInstance()->addActionListener(this);
    UserSettings::getInstance()->rebuildFileLibrary(true, false, false);
}
Ejemplo n.º 6
0
MainWindow::MainWindow() :
    recentFiles( Persistent<RecentFiles>( "recentFiles" ) ), mainIcon_()
{
    createActions();
    createMenus();
    // createContextMenu();
    createToolBars();
    // createStatusBar();
    createCrawler();

    setAcceptDrops( true );

    // Default geometry
    const QRect geometry = QApplication::desktop()->availableGeometry( this );
    setGeometry( geometry.x() + 20, geometry.y() + 40,
            geometry.width() - 140, geometry.height() - 140 );

    // Send actions to the crawlerwidget
    connect( this, SIGNAL( followSet( bool ) ),
            crawlerWidget, SIGNAL( followSet( bool ) ) );
    connect( this, SIGNAL( optionsChanged() ),
            crawlerWidget, SLOT( applyConfiguration() ) );

    // Actions from the CrawlerWidget
    connect( crawlerWidget, SIGNAL( followDisabled() ),
            this, SLOT( disableFollow() ) );
    connect( crawlerWidget, SIGNAL( updateLineNumber( int ) ),
            this, SLOT( lineNumberHandler( int ) ) );

    readSettings();
    emit optionsChanged();

    // We start with the empty file
    setCurrentFile( "" );

    mainIcon_.addFile( ":/images/hicolor/16x16/glogg.png" );
    mainIcon_.addFile( ":/images/hicolor/24x24/glogg.png" );
    mainIcon_.addFile( ":/images/hicolor/32x32/glogg.png" );
    mainIcon_.addFile( ":/images/hicolor/48x48/glogg.png" );

    // Register for progress status bar
    connect( crawlerWidget, SIGNAL( loadingProgressed( int ) ),
            this, SLOT( updateLoadingProgress( int ) ) );
    connect( crawlerWidget, SIGNAL( loadingFinished( bool ) ),
            this, SLOT( displayNormalStatus( bool ) ) );

    setWindowIcon( mainIcon_ );
    setCentralWidget(crawlerWidget);
}
Ejemplo n.º 7
0
	double PostureIKSolver::lineSearch(int index, VectorXD& direction){
		double energyO = energy();
		direction * lineSearchStepSize;
		do{
			//try step
			applyConfiguration(direction);
			double tmp = energy();
			if(tmp < energyO || lineSearchStepSize < step){
				return lineSearchStepSize;
			}
			restoreSnapshot(index);
			lineSearchStepSize /= 2;
			direction * 0.5;
		}while(1);
	}
Ejemplo n.º 8
0
Network::Network(const RuntimeEnvironment *renv,uint64_t nwid,void *uptr) :
	RR(renv),
	_uPtr(uptr),
	_id(nwid),
	_mac(renv->identity.address(),nwid),
	_enabled(true),
	_portInitialized(false),
	_lastConfigUpdate(0),
	_destroyed(false),
	_netconfFailure(NETCONF_FAILURE_NONE),
	_portError(0)
{
	char confn[128],mcdbn[128];
	Utils::snprintf(confn,sizeof(confn),"networks.d/%.16llx.conf",_id);
	Utils::snprintf(mcdbn,sizeof(mcdbn),"networks.d/%.16llx.mcerts",_id);

	// These files are no longer used, so clean them.
	RR->node->dataStoreDelete(mcdbn);

	if (_id == ZT_TEST_NETWORK_ID) {
		applyConfiguration(NetworkConfig::createTestNetworkConfig(RR->identity.address()));

		// Save a one-byte CR to persist membership in the test network
		RR->node->dataStorePut(confn,"\n",1,false);
	} else {
		bool gotConf = false;
		try {
			std::string conf(RR->node->dataStoreGet(confn));
			if (conf.length()) {
				setConfiguration(Dictionary(conf),false);
				_lastConfigUpdate = 0; // we still want to re-request a new config from the network
				gotConf = true;
			}
		} catch ( ... ) {} // ignore invalids, we'll re-request

		if (!gotConf) {
			// Save a one-byte CR to persist membership while we request a real netconf
			RR->node->dataStorePut(confn,"\n",1,false);
		}
	}

	if (!_portInitialized) {
		ZT_VirtualNetworkConfig ctmp;
		_externalConfig(&ctmp);
		_portError = RR->node->configureVirtualNetworkPort(_id,&_uPtr,ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_UP,&ctmp);
		_portInitialized = true;
	}
}
Ejemplo n.º 9
0
void ConfigureInput::restoreDefaults() {
    for (int button_id = 0; button_id < Settings::NativeButton::NumButtons; button_id++) {
        buttons_param[button_id] = Common::ParamPackage{
            InputCommon::GenerateKeyboardParam(Config::default_buttons[button_id])};
    }

    for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; analog_id++) {
        for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; sub_button_id++) {
            Common::ParamPackage params{InputCommon::GenerateKeyboardParam(
                Config::default_analogs[analog_id][sub_button_id])};
            SetAnalogButton(params, analogs_param[analog_id], analog_sub_buttons[sub_button_id]);
        }
    }
    updateButtonLabels();
    applyConfiguration();
}
Ejemplo n.º 10
0
void ScopeSync::initialise()
{
	parameterController = new BCMParameterController(this);

    parameterController->getParameterByScopeCode("cfg")->mapToUIValue(configurationID);
    configurationID.addListener(this);

    showEditToolbar = false;
    commandManager = new ApplicationCommandManager();

    configuration = new Configuration();
    applyConfiguration();

	ScopeSyncOSCServer::getInstance()->setup();

	initialised = true;
}
void AntistringConfigurationUiHandler::mainConfigurationWindowCreated(MainConfigurationWindow *mainConfigurationWindow)
{
	ConfigGroupBox *groupBox = mainConfigurationWindow->widget()->configGroupBox("Chat", "Antistring", "Conditions");

	QWidget *widget = new QWidget(groupBox->widget());
	widget->setContentsMargins(0, 0, 0, 0);

	QGridLayout *layout = new QGridLayout(widget);

	ConditionListWidget = new QListWidget(widget);
	layout->addWidget(ConditionListWidget, 0, 0, 1, 4);

	ConditionWidget = new QLineEdit(widget);
	layout->addWidget(new QLabel(tr("Condition"), widget), 1, 0);
	layout->addWidget(ConditionWidget, 1, 1, 1, 3);

	FactorWidget = new QSpinBox(widget);
	FactorWidget->setMinimum(0);
	FactorWidget->setMaximum(5);
	FactorWidget->setSpecialValueText(tr("Don't use"));
	layout->addWidget(new QLabel(tr("Factor"), widget), 2, 0);
	layout->addWidget(FactorWidget, 2, 1, 1, 3);

	QPushButton *addConditionButton = new QPushButton(tr("Add"), widget);
	QPushButton *changeConditionButton = new QPushButton(tr("Change"), widget);
	QPushButton *deleteConditionButton = new QPushButton(tr("Delete"), widget);
	layout->addWidget(addConditionButton, 3, 1);
	layout->addWidget(changeConditionButton, 3, 2);
	layout->addWidget(deleteConditionButton, 3, 3);

	groupBox->addWidget(widget);

	connect(ConditionListWidget, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(wordSelected(QListWidgetItem *)));
	connect(addConditionButton, SIGNAL(clicked()), this, SLOT(addCondition()));
	connect(changeConditionButton, SIGNAL(clicked()), this, SLOT(changeCondition()));
	connect(deleteConditionButton, SIGNAL(clicked()), this, SLOT(deleteCondition()));

	updateConditionList();

	connect(mainConfigurationWindow, SIGNAL(configurationWindowApplied()), this, SLOT(applyConfiguration()));
}
Ejemplo n.º 12
0
int Network::setConfiguration(const Dictionary &conf,bool saveToDisk)
{
	try {
		const SharedPtr<NetworkConfig> newConfig(new NetworkConfig(conf)); // throws if invalid
		{
			Mutex::Lock _l(_lock);
			if ((_config)&&(*_config == *newConfig))
				return 1; // OK config, but duplicate of what we already have
		}
		if (applyConfiguration(newConfig)) {
			if (saveToDisk) {
				char n[128];
				Utils::snprintf(n,sizeof(n),"networks.d/%.16llx.conf",_id);
				RR->node->dataStorePut(n,conf.toString(),true);
			}
			return 2; // OK and configuration has changed
		}
	} catch ( ... ) {
		TRACE("ignored invalid configuration for network %.16llx (dictionary decode failed)",(unsigned long long)_id);
	}
	return 0;
}
Ejemplo n.º 13
0
// Opens the 'Options' modal dialog box
void MainWindow::options()
{
    OptionsDialog dialog(this);
    connect(&dialog, SIGNAL( optionsChanged() ), crawlerWidget, SLOT( applyConfiguration() ));
    dialog.exec();
}
Ejemplo n.º 14
0
static void cb_OK(Fl_Button*, void*) {
  writeConfiguration();
  applyConfiguration();
  exit(0);
}
Ejemplo n.º 15
0
static void cb_Apply(Fl_Button*, void*) {
  writeConfiguration();
  applyConfiguration();
}
Ejemplo n.º 16
0
void ScopeSync::unloadConfiguration()
{
    configuration->replaceConfiguration(String::empty);
    applyConfiguration();
}
void RemoveTrackModal::onApplyButtonEvent(ofxDatGuiButtonEvent e){
    applyConfiguration();
    hide();
}