Example #1
0
void XMLPreferences::save()
{
  // save the user preferences iff they've changed
  if (m_modified & User)
    savePreferences(m_filename, m_userSections);

  // save the user preferences iff they've changed
  if (m_modified & Defaults)
    savePreferences(m_defaultsFilename, m_defaultsSections);
}
Example #2
0
void PreferencesDialog::on_buttonBox_clicked(QAbstractButton *button)
{
    switch (ui->buttonBox->buttonRole(button)) {
    case QDialogButtonBox::AcceptRole:
    case QDialogButtonBox::ApplyRole:
        savePreferences();
        break;
    case QDialogButtonBox::ResetRole:
        restorePreferences();
        break;
    case QDialogButtonBox::RejectRole:
        break;
    case QDialogButtonBox::NRoles: // Number of roles
        qDebug() << "NRoles";
        break;
    case QDialogButtonBox::YesRole:
    case QDialogButtonBox::NoRole:
    case QDialogButtonBox::HelpRole:
    case QDialogButtonBox::ActionRole:
    case QDialogButtonBox::DestructiveRole:
    case QDialogButtonBox::InvalidRole:
        break;
//    default:
//        ui->buttonBox->clicked(button);
    }
}
Example #3
0
Preferences::~Preferences()
{
	savePreferences();

	delete m_midi_map;
	DEBUGLOG( "DESTROY" );
	delete m_pDefaultUIStyle;
}
Example #4
0
void PreferencesDialog::accept() {
    MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
    _lastGoodAvatarURL = myAvatar->getFullAvatarURLFromPreferences();
    _lastGoodAvatarName = myAvatar->getFullAvatarModelName();
    savePreferences();
    close();
    delete _marketplaceWindow;
    _marketplaceWindow = NULL;
}
Example #5
0
void CPlugin::shutEmbed()
{
  savePreferences();

  if(m_hWnd != NULL)
  {
    WinDismissDlg(m_hWnd, IDD_DIALOG_TESTER); //WinDestroyWindow(m_hWnd);
    m_hWnd = NULL;
  }

  m_bPluginReady = FALSE;
}
Example #6
0
static gboolean onQuit(GtkWidget *widget, GdkEvent *ev, gpointer dummy)
{
	/* Unused parameters. */
	(void)widget;
	(void)ev;
	(void)dummy;

	/* When there are unsaved notes, the user may chose not to quit. */
	if (!handleUnsavedNotes())
		return TRUE;

	/* Save preferences. */
	savePreferences();

	gtk_main_quit();
	return FALSE;
}
/**
  * Delete the given profile preference
  *
  */
void CAMProfileSettingsList::on_bDelete_clicked() {
    // Get all selections
   QModelIndexList indexes = ui->tableView->selectionModel()->selection().indexes();

   QList<int> list;
   for (int i = 0; i < indexes.count(); ++i)
   {
       list.append(indexes.at(i).row());
   }

   list=QSet<int>::fromList(list).toList();
   qSort(list.begin(), list.end());
   while (!list.empty()) {
       camProfileDataModel->removeRows(list.takeLast(),1);
   }
   savePreferences();
   ui->tableView->resizeColumnsToContents();

}
KisColorSelectorSettingsDialog::KisColorSelectorSettingsDialog(QWidget *parent) :
    QDialog(parent),
    m_widget(new KisColorSelectorSettings(this))
{
    QLayout* l = new QVBoxLayout(this);
    l->addWidget(m_widget);

    m_widget->loadPreferences();

    QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::RestoreDefaults,
                                                       Qt::Horizontal,
                                                       this);
    l->addWidget(buttonBox);

    connect(buttonBox, SIGNAL(accepted()), m_widget, SLOT(savePreferences()));
    connect(buttonBox, SIGNAL(accepted()), this,     SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this,     SLOT(reject()));
    connect(buttonBox->button(QDialogButtonBox::RestoreDefaults),
            SIGNAL(clicked()),  m_widget, SLOT(loadDefaultPreferences()));
}
/**
  * Edit selected profile preferences
  *
  *
  */
void CAMProfileSettingsList::on_bEdit_clicked(const QModelIndex &parent) {
    Q_UNUSED(parent);
    //ui->tableView->selectedItems();

     // Get all selections
    QModelIndexList indexes = ui->tableView->selectionModel()->selection().indexes();

    QList<int> list;
    for (int i = 0; i < indexes.count(); ++i)
    {
        list.append(indexes.at(i).row());
    }
    list=QSet<int>::fromList(list).toList();
    foreach(int row, list)
    {
        CAMProfileSettings cps(this);
        cps.setData(camProfileDataModel->getList().at(row));
        if (cps.exec()==QDialog::Accepted) {
            savePreferences();
        }
    }
    void bottomDisplay::rebind(){
        bool done=false;
        char input;
        contentMat[yNdx][xNdx].setMode(HIGHLIGHTED);
        header=headerHighlighted;
        repaint();
        while(!done){
            input='\0';
            if(kbhit()){
                input=getch();
            }
            if(input==(*keyBindings)[UP]){
                contentMat[yNdx][xNdx].setMode(DEFAULT);
                if(yNdx==1){        // *   * * null
                    if(xNdx<2){     // |\  | |
                        xNdx=0;     // * *|* *
                    }
                    else{
                        xNdx--;
                    }
                }
                if(yNdx>0){
                    yNdx--;
                }
                contentMat[yNdx][xNdx].setMode(HIGHLIGHTED);
                repaint();
            }
            else if(input==(*keyBindings)[DOWN]){
                contentMat[yNdx][xNdx].setMode(DEFAULT);
                if(yNdx==0&&xNdx==1){    //* ** null
                    yNdx=1;              //  |
                    xNdx=2;              //****
                }
                else if(yNdx==0&&xNdx==2){    //* ** null
                    yNdx=1;                   //   |
                    xNdx=3;                   //****
                }
                else if(yNdx<(contentMat.size()-1)){
                    yNdx++;
                }
                contentMat[yNdx][xNdx].setMode(HIGHLIGHTED);
                repaint();
            }
            else if(input==(*keyBindings)[LEFT]){
                contentMat[yNdx][xNdx].setMode(DEFAULT);
                if(xNdx>0){
                    xNdx--;
                }
                contentMat[yNdx][xNdx].setMode(HIGHLIGHTED);
                repaint();
            }
            else if(input==(*keyBindings)[RIGHT]){
                contentMat[yNdx][xNdx].setMode(DEFAULT);
                bool valid=false;
                if(yNdx==0){
                    if(xNdx<2){
                        valid=true;
                    }
                }
                else{
                    if(xNdx<(contentMat[0].size()-1)){
                        valid=true;
                    }
                }
                if(valid){
                    xNdx++;
                }
                contentMat[yNdx][xNdx].setMode(HIGHLIGHTED);
                repaint();
            }
            else if(input==(*keyBindings)[CONFIRM]){//mapping two to same mixes them up make not doable
                header=generateHeaderSelected();
                contentMat[yNdx][xNdx].setMode(SELECTED);
                repaint();
                while(!kbhit());//wait for input
                char newKey=getch();

                BindDisplay* getAlreadyMapped=checkAlreadyMapped(newKey);
                if(newKey!=(*keyBindings)[BACK]){
                    if(getAlreadyMapped!=NULL){
                        getAlreadyMapped->setMode(ERROR);
                        header=headerError;
                        repaint();
                        while(!kbhit());
                        getch();//eat that input so it won't break the next loop
                        getAlreadyMapped->setMode(DEFAULT);
                    }
                    else{
                        setBinding(getKeyNdx(contentMat[yNdx][xNdx].getBound()),newKey);
                        contentMat[yNdx][xNdx].setBound(newKey);
                    }
                }
                contentMat[yNdx][xNdx].setMode(HIGHLIGHTED);
                header=headerHighlighted;
                repaint();
            }
            else if(input==(*keyBindings)[BACK]){
                header=headerDefault;
                contentMat[yNdx][xNdx].setMode(DEFAULT);
                done=true;
            }
            else if(input==(*keyBindings)[SUBMIT]){
                savePreferences();
            }
            else if(input==(*keyBindings)[QUIT]){
                header=headerDefault;
                contentMat[yNdx][xNdx].setMode(DEFAULT);
                done=true;
            }
        }
        header=headerDefault;
    }
Example #11
0
static int
handlePreferencesCommands (int command, void *data) {
  switch (command & BRL_MSK_CMD) {
    {
      static const char modeString_preferences[] = "prf";
      static Preferences savedPreferences;

    case BRL_CMD_PREFMENU: {
      int ok = 0;

      if (isSpecialScreen(SCR_MENU)) {
        if (prefs.saveOnExit) {
          if (savePreferences()) {
            alert(ALERT_COMMAND_DONE);
          }
        }

        deactivateSpecialScreen(SCR_MENU);
        ok = 1;
      } else if (activateSpecialScreen(SCR_MENU)) {
        updateSessionAttributes();
        savedPreferences = prefs;
        ok = 1;
      }

      if (ok) {
        infoMode = 0;
      } else {
        alert(ALERT_COMMAND_REJECTED);
      }

      break;
    }

    case BRL_CMD_PREFSAVE:
      if (isSpecialScreen(SCR_MENU)) {
        if (savePreferences()) alert(ALERT_COMMAND_DONE);
        deactivateSpecialScreen(SCR_MENU);
      } else if (savePreferences()) {
        alert(ALERT_COMMAND_DONE);
      } else {
        alert(ALERT_COMMAND_REJECTED);
      }
      break;

    case BRL_CMD_PREFLOAD:
      if (isSpecialScreen(SCR_MENU)) {
        setPreferences(&savedPreferences);
        message(modeString_preferences, gettext("changes discarded"), 0);
      } else if (loadPreferences()) {
        alert(ALERT_COMMAND_DONE);
      } else {
        alert(ALERT_COMMAND_REJECTED);
      }
      break;
    }

    default: {
      int arg = command & BRL_MSK_ARG;

      switch (command & BRL_MSK_BLK) {
        {
          MenuItem *item;

        case BRL_CMD_BLK(SET_TEXT_TABLE):
          item = getPreferencesMenuItem_textTable();
          goto doSetMenuItem;

        case BRL_CMD_BLK(SET_ATTRIBUTES_TABLE):
          item = getPreferencesMenuItem_attributesTable();
          goto doSetMenuItem;

        case BRL_CMD_BLK(SET_CONTRACTION_TABLE):
          item = getPreferencesMenuItem_contractionTable();
          goto doSetMenuItem;

        case BRL_CMD_BLK(SET_KEYBOARD_TABLE):
          item = getPreferencesMenuItem_keyboardTable();
          goto doSetMenuItem;

        case BRL_CMD_BLK(SET_LANGUAGE_PROFILE):
          item = getPreferencesMenuItem_languageProfile();
          goto doSetMenuItem;

        doSetMenuItem:
          if (item) {
            unsigned int count = brl.textColumns;

            if (count <= arg) count = arg + 1;
            changeMenuItem(item);

            if (changeMenuSettingScaled(getMenuItemMenu(item), arg, count)) {
              break;
            }
          }

          alert(ALERT_COMMAND_REJECTED);
          break;
        }

        default:
          return 0;
      }

      break;
    }
  }

  return 1;
}
Example #12
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    m_scene(new QGraphicsScene),
    m_turtleGraphics(new TurtleCanvasGraphicsItem),
    m_cmds(m_turtleGraphics),
    m_prefsDialog(new PreferencesDialog(this)),
    m_aboutDialog(new AboutDialog(this)),
    m_canvasSaveOptionsDialog(new CanvasSaveOptionsDialog(this)),
    m_settings("settings.ini")
{
    ui->setupUi(this);

    m_scene->addItem(m_turtleGraphics);
    ui->graphicsView->setScene(m_scene);
    ui->graphicsView->centerOn(0.0, 0.0);

    // Add the graphics view actions
    QAction* centerAction = new QAction("&Center View", NULL);
    QAction* clearAction  = new QAction("C&lear Canvas", NULL);
    ui->graphicsView->addAction(centerAction);
    ui->graphicsView->addAction(clearAction);
    connect(centerAction, SIGNAL(triggered()), this, SLOT(centerGraphicsScene()));
    connect(clearAction,  SIGNAL(triggered()), this, SLOT(clearCanvas()));

    ui->graphicsView->setContextMenuPolicy(Qt::ActionsContextMenu);

    ui->errorMessagesTextEdit->setTextColor(Qt::red);

    // These buttons are only enabled while a script is running.
    ui->haltButton->setEnabled(false);
    ui->pauseButton->setEnabled(false);
    ui->resumeButton->setEnabled(false);

    // Messages dock is hidden by default.
    ui->messagesDockWidget->hide();

    connect(m_turtleGraphics, SIGNAL(canvasResized()), this, SLOT(resizeGraphicsScene()));

    connect(ui->runButton,    SIGNAL(clicked()), this, SLOT(runScript()));
    connect(ui->haltButton,   SIGNAL(clicked()), this, SLOT(haltScript()));
    connect(ui->pauseButton,  SIGNAL(clicked()), this, SLOT(pauseScript()));
    connect(ui->resumeButton, SIGNAL(clicked()), this, SLOT(resumeScript()));

    connect(ui->action_Open_Script, SIGNAL(triggered()), this, SLOT(loadScript()));
    connect(ui->action_Save_Script, SIGNAL(triggered()), this, SLOT(saveScript()));
    connect(ui->action_Save_Canvas, SIGNAL(triggered()), this, SLOT(saveCanvas()));
    connect(ui->action_Preferences, SIGNAL(triggered()), m_prefsDialog, SLOT(show()));
    connect(ui->action_About,       SIGNAL(triggered()), m_aboutDialog,  SLOT(show()));

    connect(ui->action_Errors, SIGNAL(triggered(bool)), this, SLOT(showErrors()));
    connect(ui->action_Script_Output, SIGNAL(triggered(bool)),
            this, SLOT(showScriptOutputs()));

    connect(m_prefsDialog, SIGNAL(rejected()), this, SLOT(loadPreferences()));
    connect(m_prefsDialog, SIGNAL(accepted()), this, SLOT(applyPreferences()));
    connect(m_prefsDialog, SIGNAL(accepted()), this, SLOT(savePreferences()));

    connect(&m_cmds, SIGNAL(scriptError(QString)),
            this,    SLOT(showScriptError(QString)),
            Qt::QueuedConnection);

    connect(&m_cmds, SIGNAL(scriptMessageReceived()),
            this,    SLOT(showScriptOutput()),
            Qt::QueuedConnection);

    loadPreferences();
    applyPreferences();

    m_cmds.start();

    m_cmds.setRequirePaths("");
    for (const QString& path : m_settings.requirePaths())
    {
        m_cmds.addRequirePath(path);
    }

    for (const QString& filename : m_settings.startupScripts())
    {
        m_cmds.runScriptFile(filename);
    }

    // Don't connect this until all the startup scripts have run
    // to prevent the error messages box from being cleared by successful scripts.
    connect(&m_cmds, SIGNAL(scriptFinished(bool)),
            this,    SLOT(scriptFinished(bool)),
            Qt::QueuedConnection);
}
Example #13
0
void PreferencesDialog::accept() {
    savePreferences();
    close();
    delete _marketplaceWindow;
    _marketplaceWindow = NULL;
}
Example #14
0
void PreferencesDialogImpl::okButtonCB()
{
    savePreferences();
    Gtk::Main::quit();
}
Example #15
0
///
/// Load the preferences file
///
void Preferences::loadPreferences( bool bGlobal )
{
	bool recreate = false;	// configuration file must be recreated?

	QString sPreferencesDirectory;
	QString sPreferencesFilename;
	QString sDataDirectory;
	if ( bGlobal ) {
		sPreferencesDirectory = DataPath::get_data_path();
		sPreferencesFilename = sPreferencesDirectory + "/composite.default.conf";
		DEBUGLOG( "Loading preferences file (GLOBAL) [" + sPreferencesFilename + "]" );
	} else {
		sPreferencesFilename = m_sPreferencesFilename;
		sPreferencesDirectory = m_sPreferencesDirectory;
		sDataDirectory = QDir::homePath().append( "/.composite/data" );
		DEBUGLOG( "Loading preferences file (USER) [" + sPreferencesFilename + "]" );


	}



	// preferences directory exists?
	QDir prefDir( sPreferencesDirectory );
	if ( !prefDir.exists() ) {
		if ( bGlobal ) {
			WARNINGLOG( "System configuration directory '" + sPreferencesDirectory + "' not found." );
		} else {
			ERRORLOG( "Configuration directory '" + sPreferencesDirectory + "' not found." );
			createPreferencesDirectory();
		}
	}

	// data directory exists?
	QDir dataDir( sDataDirectory );
	if ( !dataDir.exists() ) {
		WARNINGLOG( "Data directory not found." );
		createDataDirectory();
	}

	// soundLibrary directory exists?
	QString sDir = sDataDirectory;
	QString sDrumkitDir;
	QString sSongDir;
	QString sPatternDir;

	DEBUGLOG( "Creating soundLibrary directories in " + sDir );
	
	sDrumkitDir = sDir + "/drumkits";
	sSongDir = sDir + "/songs";
	sPatternDir = sDir + "/patterns";
	
	QDir drumkitDir( sDrumkitDir );
	QDir songDir( sSongDir );
	QDir patternDir( sPatternDir );
	
	if ( ! drumkitDir.exists() || ! songDir.exists() || ! patternDir.exists() )
	{
		createSoundLibraryDirectories();
	}
	
	// pref file exists?
	std::ifstream input( sPreferencesFilename.toLocal8Bit() , std::ios::in | std::ios::binary );
	if ( input ) {

		// read preferences file
		QDomDocument doc = LocalFileMng::openXmlDocument( sPreferencesFilename );
		QDomNode rootNode = doc.firstChildElement( "hydrogen_preferences" );
		
		if ( !rootNode.isNull() ) {

			// version
			QString version = LocalFileMng::readXmlString( rootNode, "version", "" );
			if ( version.isEmpty() ) {
				recreate = true;
			}

			//////// GENERAL ///////////
			//m_sLadspaPath = LocalFileMng::readXmlString( this, rootNode, "ladspaPath", m_sLadspaPath );
			m_bShowDevelWarning = LocalFileMng::readXmlBool( rootNode, "showDevelWarning", m_bShowDevelWarning );
			restoreLastSong = LocalFileMng::readXmlBool( rootNode, "restoreLastSong", restoreLastSong );
			m_bPatternModePlaysSelected = LocalFileMng::readXmlBool( rootNode, "patternModePlaysSelected", TRUE );
			
			hearNewNotes = LocalFileMng::readXmlBool( rootNode, "hearNewNotes", hearNewNotes );
			recordEvents = LocalFileMng::readXmlBool( rootNode, "recordEvents", recordEvents );
			quantizeEvents = LocalFileMng::readXmlBool( rootNode, "quantizeEvents", quantizeEvents );

			QDomNode pRecentUsedSongsNode = rootNode.firstChildElement( "recentUsedSongs" );
			if ( !pRecentUsedSongsNode.isNull() ) {
				QDomElement pSongElement = pRecentUsedSongsNode.firstChildElement( "song" );
				while( !pSongElement.isNull() && !pSongElement.text().isEmpty() ){
					m_recentFiles.push_back( pSongElement.text() );
					pSongElement = pSongElement.nextSiblingElement( "song" );
				}
				
			} else {
				DEBUGLOG( "recentUsedSongs node not found" );
			}

			QDomNode pRecentFXNode = rootNode.firstChildElement( "recentlyUsedEffects" );
			if ( ! pRecentFXNode.isNull() ) {
				QDomElement pFXElement = pRecentFXNode.firstChildElement( "FX" );
				while ( !pFXElement.isNull()  && ! pFXElement.text().isEmpty()) {
					m_recentFX.push_back( pFXElement.text() );
					pFXElement = pFXElement.nextSiblingElement( "FX" );
				}
			} else {
				DEBUGLOG( "recentlyUsedEffects node not found" );
			}

			sServerList.clear();
			QDomNode pServerListNode = rootNode.firstChildElement( "serverList" );
			if ( !pServerListNode.isNull() ) {
				QDomElement pServerElement = pServerListNode.firstChildElement( "server" );
				while ( !pServerElement.isNull() && !pServerElement.text().isEmpty() ) {
					sServerList.push_back( pServerElement.text() );
					pServerElement = pServerElement.nextSiblingElement( "server" );
				}
			} else {
				DEBUGLOG( "serverList node not found" );
			}

			m_patternCategories.clear();
			QDomNode pPatternCategoriesNode = rootNode.firstChildElement( "patternCategories" );
			if ( !pPatternCategoriesNode.isNull() ) {
				QDomElement pPatternCategoriesElement = pPatternCategoriesNode.firstChildElement( "categories" );
				while ( !pPatternCategoriesElement.isNull() && !pPatternCategoriesElement.text().isEmpty() ) {
					m_patternCategories.push_back( pPatternCategoriesElement.text() );
					pPatternCategoriesElement = pPatternCategoriesElement.nextSiblingElement( "categories" );
				}
			} else {
				DEBUGLOG( "patternCategories node not found" );
			}



			m_sLastNews = LocalFileMng::readXmlString( rootNode, "lastNews", "-", true );

			/////////////// AUDIO ENGINE //////////////
			QDomNode audioEngineNode = rootNode.firstChildElement( "audio_engine" );
			if ( audioEngineNode.isNull() ) {
				DEBUGLOG( "audio_engine node not found" );
				recreate = true;
			} else {
				m_sAudioDriver = LocalFileMng::readXmlString( audioEngineNode, "audio_driver", m_sAudioDriver );
				m_bUseMetronome = LocalFileMng::readXmlBool( audioEngineNode, "use_metronome", m_bUseMetronome );
				m_fMetronomeVolume = LocalFileMng::readXmlFloat( audioEngineNode, "metronome_volume", 0.5f );
				m_nMaxNotes = LocalFileMng::readXmlInt( audioEngineNode, "maxNotes", m_nMaxNotes );
				m_nBufferSize = LocalFileMng::readXmlInt( audioEngineNode, "buffer_size", m_nBufferSize );
				m_nSampleRate = LocalFileMng::readXmlInt( audioEngineNode, "samplerate", m_nSampleRate );

				//// JACK DRIVER ////
				QDomNode jackDriverNode = audioEngineNode.firstChildElement( "jack_driver" );
				if ( jackDriverNode.isNull() ) {
					DEBUGLOG( "jack_driver node not found" );
					recreate = true;
				} else {
					m_sJackPortName1 = LocalFileMng::readXmlString( jackDriverNode, "jack_port_name_1", m_sJackPortName1 );
					m_sJackPortName2 = LocalFileMng::readXmlString( jackDriverNode, "jack_port_name_2", m_sJackPortName2 );
					QString sMode = LocalFileMng::readXmlString( jackDriverNode, "jack_transport_mode", "NO_JACK_TRANSPORT" );
					if ( sMode == "NO_JACK_TRANSPORT" ) {
						m_bJackTransportMode = NO_JACK_TRANSPORT;
					} else if ( sMode == "USE_JACK_TRANSPORT" ) {
						m_bJackTransportMode = USE_JACK_TRANSPORT;
					}
					
					//jack time master
					QString tmMode = LocalFileMng::readXmlString( jackDriverNode, "jack_transport_mode_master", "NO_JACK_TIME_MASTER" );
					if ( tmMode == "NO_JACK_TIME_MASTER" ) {
						m_bJackMasterMode = NO_JACK_TIME_MASTER;
					} else if ( tmMode == "USE_JACK_TIME_MASTER" ) {
						m_bJackMasterMode = USE_JACK_TIME_MASTER;
					}
					//~ jack time master

					m_bJackTrackOuts = LocalFileMng::readXmlBool( jackDriverNode, "jack_track_outs", m_bJackTrackOuts );
					m_bJackConnectDefaults = LocalFileMng::readXmlBool( jackDriverNode, "jack_connect_defaults", m_bJackConnectDefaults );

					m_nJackTrackOutputMode = LocalFileMng::readXmlInt( jackDriverNode, "jack_track_output_mode", m_nJackTrackOutputMode );
				}


				/// MIDI DRIVER ///
				QDomNode midiDriverNode = audioEngineNode.firstChildElement( "midi_driver" );
				if ( midiDriverNode.isNull() ) {
					DEBUGLOG( "midi_driver node not found" );
					recreate = true;
				} else {
					m_sMidiDriver = LocalFileMng::readXmlString( midiDriverNode, "driverName", "JackMidi" );
					m_sMidiPortName = LocalFileMng::readXmlString( midiDriverNode, "port_name", "None" );
					m_nMidiChannelFilter = LocalFileMng::readXmlInt( midiDriverNode, "channel_filter", -1 );
					m_bMidiNoteOffIgnore = LocalFileMng::readXmlBool( midiDriverNode, "ignore_note_off", true );
				}



			}

			/////////////// GUI //////////////
			QDomNode guiNode = rootNode.firstChildElement( "gui" );
			if ( guiNode.isNull() ) {
				DEBUGLOG( "gui node not found" );
				recreate = true;
			} else {
				// QT Style
				m_sQTStyle = LocalFileMng::readXmlString( guiNode, "QTStyle", m_sQTStyle, true );

				// Application font family
				applicationFontFamily = LocalFileMng::readXmlString( guiNode, "application_font_family", applicationFontFamily );

				// Application font pointSize
				applicationFontPointSize = LocalFileMng::readXmlInt( guiNode, "application_font_pointsize", applicationFontPointSize );

				// mixer font family
				mixerFontFamily = LocalFileMng::readXmlString( guiNode, "mixer_font_family", mixerFontFamily );

				// mixer font pointSize
				mixerFontPointSize = LocalFileMng::readXmlInt( guiNode, "mixer_font_pointsize", mixerFontPointSize );

				// Mixer falloff speed
				mixerFalloffSpeed = LocalFileMng::readXmlFloat( guiNode, "mixer_falloff_speed", 1.1f );

				// pattern editor grid resolution
				m_nPatternEditorGridResolution = LocalFileMng::readXmlInt( guiNode, "patternEditorGridResolution", m_nPatternEditorGridResolution );
				m_bPatternEditorUsingTriplets = LocalFileMng::readXmlBool( guiNode, "patternEditorUsingTriplets", m_bPatternEditorUsingTriplets );
				m_bShowInstrumentPeaks = LocalFileMng::readXmlBool( guiNode, "showInstrumentPeaks", m_bShowInstrumentPeaks );
				m_bIsFXTabVisible = LocalFileMng::readXmlBool( guiNode, "isFXTabVisible", m_bIsFXTabVisible );


				// pattern editor grid height
				m_nPatternEditorGridHeight = LocalFileMng::readXmlInt( guiNode, "patternEditorGridHeight", m_nPatternEditorGridHeight );

				// pattern editor grid width
				m_nPatternEditorGridWidth = LocalFileMng::readXmlInt( guiNode, "patternEditorGridWidth", m_nPatternEditorGridWidth );

				// mainForm window properties
				setMainFormProperties( readWindowProperties( guiNode, "mainForm_properties", mainFormProperties ) );
				setMixerProperties( readWindowProperties( guiNode, "mixer_properties", mixerProperties ) );
				setPatternEditorProperties( readWindowProperties( guiNode, "patternEditor_properties", patternEditorProperties ) );
				setSongEditorProperties( readWindowProperties( guiNode, "songEditor_properties", songEditorProperties ) );
				setAudioEngineInfoProperties( readWindowProperties( guiNode, "audioEngineInfo_properties", audioEngineInfoProperties ) );



				m_bFollowPlayhead = LocalFileMng::readXmlBool( guiNode, "followPlayhead", true );


				//beatcounter
				QString bcMode = LocalFileMng::readXmlString( guiNode, "bc", "BC_OFF" );
					if ( bcMode == "BC_OFF" ) {
						m_bbc = BC_OFF;
					} else if ( bcMode == "BC_ON" ) {
						m_bbc = BC_ON;
					}


				QString setPlay = LocalFileMng::readXmlString( guiNode, "setplay", "SET_PLAY_OFF" );
					if ( setPlay == "SET_PLAY_OFF" ) {
						m_mmcsetplay = SET_PLAY_OFF;
					} else if ( setPlay == "SET_PLAY_ON" ) {
						m_mmcsetplay = SET_PLAY_ON;
					}
				
				m_countOffset = LocalFileMng::readXmlInt( guiNode, "countoffset", 0 );
				m_startOffset = LocalFileMng::readXmlInt( guiNode, "playoffset", 0 );
				
				//~ beatcounter
				
				//SoundLibraryPanel expand items
				__expandSongItem = LocalFileMng::readXmlBool( guiNode, "expandSongItem", __expandSongItem );
				__expandPatternItem = LocalFileMng::readXmlBool( guiNode, "expandPatternItem", __expandPatternItem ); 

				for ( unsigned nFX = 0; nFX < MAX_FX; nFX++ ) {
					QString sNodeName = QString("ladspaFX_properties%1").arg( nFX );
					setLadspaProperties( nFX, readWindowProperties( guiNode, sNodeName, m_ladspaProperties[nFX] ) );
				}

				QDomNode pUIStyle = guiNode.firstChildElement( "UI_Style" );
				if ( !pUIStyle.isNull() ) {
					readUIStyle( pUIStyle );
				} else {
					DEBUGLOG( "UI_Style node not found" );
					recreate = true;
				}
			}

			/////////////// FILES //////////////
			QDomNode filesNode = rootNode.firstChildElement( "files" );
			if ( filesNode.isNull() ) {
				DEBUGLOG( "files node not found" );
				recreate = true;
			} else {
				// last used song
				lastSongFilename = LocalFileMng::readXmlString( filesNode, "lastSongFilename", lastSongFilename, true );
				m_sDefaultEditor = LocalFileMng::readXmlString( filesNode, "defaulteditor", m_sDefaultEditor, true );
			}

			MidiMap* mM = get_midi_map();
			mM->reset();
			
			QDomNode pMidiEventMapNode = rootNode.firstChildElement( "midiEventMap" );
			if ( !pMidiEventMapNode.isNull() ) {

				QDomNode pMidiEventNode = pMidiEventMapNode.firstChildElement( "midiEvent" );
				
				while ( !pMidiEventNode.isNull() ) {
					
					if( pMidiEventNode.firstChildElement().nodeValue() == QString("mmcEvent")){
						QString event = pMidiEventNode.firstChildElement("mmcEvent").firstChildElement().nodeValue();
						QString s_action = pMidiEventNode.firstChildElement("action").firstChildElement().nodeValue();
						QString s_param = pMidiEventNode.firstChildElement("parameter").firstChildElement().nodeValue();
						Action* pAction = new Action( s_action );
						pAction->setParameter1( s_param );
						mM->registerMMCEvent(event, pAction);
					}

					if( pMidiEventNode.firstChildElement().nodeValue() == QString("noteEvent")){
						QString event = pMidiEventNode.firstChildElement("noteEvent").firstChildElement().nodeValue();
						QString s_action = pMidiEventNode.firstChildElement("action").firstChildElement().nodeValue();
						QString s_param = pMidiEventNode.firstChildElement("parameter").firstChildElement().nodeValue();
						QString s_eventParameter = pMidiEventNode.firstChildElement("eventParameter").firstChildElement().nodeValue();
						Action* pAction = new Action( s_action );
						pAction->setParameter1( s_param );
						mM->registerNoteEvent(s_eventParameter.toInt(), pAction);
					}

					if( pMidiEventNode.firstChildElement().nodeValue() == QString("ccEvent") ){
						QString event = pMidiEventNode.firstChildElement("ccEvent").firstChildElement().nodeValue();
						QString s_action = pMidiEventNode.firstChildElement("action").firstChildElement().nodeValue();
						QString s_param = pMidiEventNode.firstChildElement("parameter").firstChildElement().nodeValue();
						QString s_eventParameter = pMidiEventNode.firstChildElement("eventParameter").firstChildElement().nodeValue();
						Action * pAction = new Action( s_action );
						pAction->setParameter1( s_param );
						mM->registerCCEvent( s_eventParameter.toInt(), pAction );
					}

					pMidiEventNode = pMidiEventNode.nextSiblingElement( "midiEvent" );

				}
			} else {
				DEBUGLOG( "midiMap node not found" );
			}
			
			

		} // rootNode
		else {
			DEBUGLOG( "hydrogen_preferences node not found" );
			recreate = true;
		}
	} else {
		if ( bGlobal ) {
			WARNINGLOG( "System configuration file not found." );
		} else {
			WARNINGLOG( "Configuration file not found." );
			recreate = true;
		}
	}


	// The preferences file should be recreated?
	if ( recreate == true ) {
		WARNINGLOG( "Recreating configuration file." );
		savePreferences();
	}

}
void DialogPreferences::on_pushButtonOk_clicked()
{
    bool changed = false;
    bool urlChanged = false;
    quint8 number;
    QString string;

    string = _ui->lineEditHostlistUrl->text();

    if(!QUrl(string).isValid())
    {
        QMessageBox::critical(NULL, trUtf8("Error"), trUtf8("You have entered an invalid URL."));

        return;
    }

    number = _ui->comboBoxTestMode->currentIndex();

    switch(number)
    {
        case 0:
            number = TestMode::Info;
            break;
        case 1:
            number = TestMode::Ping;
            break;
        case 2:
            number = TestMode::Download;
            break;
        case 3:
            number = TestMode::All;
            break;
        default:
            number = TestMode::All;
    }

    if(number != TESTMODE)
    {
        changed = true;
        TESTMODE = (TestMode::Mode) number;
    }

    number = _ui->spinBoxPingsPerHost->value();

    if(number != PINGSPERHOST)
    {
        changed = true;
        PINGSPERHOST = number;
    }

    number = _ui->spinBoxPingThreads->value();

    if(number != PINGTHREADS)
    {
        changed = true;
        PINGTHREADS = number;
    }

    number = _ui->spinBoxPingTimeout->value();

    if(number != PINGTIMEOUTSECS)
    {
        changed = true;
        PINGTIMEOUTSECS = number;
    }

    number = _ui->spinBoxDownloadTestSecs->value();

    if(number != DOWNLOADTESTSECS)
    {
        changed = true;
        DOWNLOADTESTSECS = number;
    }

    if(string != HOSTLISTURL)
    {
        changed = true;
        urlChanged = true;
        HOSTLISTURL = string;
    }

    if(changed)
    {
        emit savePreferences();
    }

    if(urlChanged)
    {
        emit hostlistUrlChanged();
    }

    close();
}
Example #17
0
void PreferencesDialog::accept() {
    savePreferences();
    close();
}
Example #18
0
MainWindow::MainWindow( QWidget *parent ) : QMainWindow( parent )
{
//  QObject::connect( this, SIGNAL( finishedBuildFilelist( bool ) ), this, SLOT( doIt( bool ) ) );

// **********************************************************************************************

    setWaitCursor();

// **********************************************************************************************
// init

    gi_ActionNumber                         = 1;                 //!< Die ActionNumber wird bei jedem angewandenten Tool um 1 erhoeht.

    gs_Version                              = "unknown";         //!< Aktuelle Version des Programms.

    gsl_FilenameList.clear();

// **********************************************************************************************

    #if defined(Q_OS_LINUX)
        gb_showProgressBar = true;
    #endif

    #if defined(Q_OS_MAC)
        gb_showProgressBar = false;
    #endif

    #if defined(Q_OS_WIN)
        gb_showProgressBar = true;
    #endif

// **********************************************************************************************

    Model       = new QStringListModel( this );
    ListView    = new QListView;

    ListView->setModel( Model );
    ListView->setEditTriggers( QAbstractItemView::NoEditTriggers );

    setCentralWidget( ListView );

    setAcceptDrops( true );

// **********************************************************************************************

    loadPreferences();

    if ( gi_NumOfProgramStarts++ < 1 )
        savePreferences();

    gs_Version = getVersion();

// **********************************************************************************************

    createActions();
    createMenus();
    createStatusBar( gb_showProgressBar );

// **********************************************************************************************

    this->resize( sizeWindow );
    this->move( posWindow );
    this->show();

// **********************************************************************************************

    gsl_FilenameList = expandCommandline();

// **********************************************************************************************

    setWTitle( gi_ActionNumber, gs_FilenameFormat, gi_Extension, gsl_FilenameList );

    setStatusBar( tr( "Ready" ), 2 );
    setNormalCursor();
}
Example #19
0
void PreferencesDialogImpl::applyButtonCB()
{
    savePreferences();
}
Example #20
0
CPlugin::~CPlugin()
{
  savePreferences();
}