| 
									
										
										
										
											2023-11-19 06:43:20 +01:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | // Copyright (C) 2015-2020, 2022 Edouard Griffiths, F4EXB <f4exb06@gmail.com>        //
 | 
					
						
							|  |  |  | // Copyright (C) 2020, 2023 Jon Beniston, M7RCE <jon@beniston.com>                   //
 | 
					
						
							|  |  |  | //                                                                                   //
 | 
					
						
							|  |  |  | // This program is free software; you can redistribute it and/or modify              //
 | 
					
						
							|  |  |  | // it under the terms of the GNU General Public License as published by              //
 | 
					
						
							|  |  |  | // the Free Software Foundation as version 3 of the License, or                      //
 | 
					
						
							|  |  |  | // (at your option) any later version.                                               //
 | 
					
						
							|  |  |  | //                                                                                   //
 | 
					
						
							|  |  |  | // This program is distributed in the hope that it will be useful,                   //
 | 
					
						
							|  |  |  | // but WITHOUT ANY WARRANTY; without even the implied warranty of                    //
 | 
					
						
							|  |  |  | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                      //
 | 
					
						
							|  |  |  | // GNU General Public License V3 for more details.                                   //
 | 
					
						
							|  |  |  | //                                                                                   //
 | 
					
						
							|  |  |  | // You should have received a copy of the GNU General Public License                 //
 | 
					
						
							|  |  |  | // along with this program. If not, see <http://www.gnu.org/licenses/>.              //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | #include <QSettings>
 | 
					
						
							|  |  |  | #include <QStringList>
 | 
					
						
							| 
									
										
										
										
											2020-09-08 15:47:20 +01:00
										 |  |  | #include <QDebug>
 | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-19 06:13:32 +02:00
										 |  |  | #include <algorithm>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | #include "settings/mainsettings.h"
 | 
					
						
							| 
									
										
										
										
											2018-01-04 11:11:53 +01:00
										 |  |  | #include "commands/command.h"
 | 
					
						
							| 
									
										
										
										
											2019-07-20 23:25:00 +02:00
										 |  |  | #include "audio/audiodevicemanager.h"
 | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-20 23:25:00 +02:00
										 |  |  | MainSettings::MainSettings() : | 
					
						
							| 
									
										
										
										
											2022-05-25 00:13:40 +02:00
										 |  |  |     m_audioDeviceManager(nullptr) | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | { | 
					
						
							|  |  |  | 	resetToDefaults(); | 
					
						
							| 
									
										
										
										
											2019-01-17 11:17:28 +01:00
										 |  |  |     qInfo("MainSettings::MainSettings: settings file: format: %d location: %s", getFileFormat(), qPrintable(getFileLocation())); | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | MainSettings::~MainSettings() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-09-24 05:38:05 +02:00
										 |  |  | 	for (int i = 0; i < m_presets.count(); ++i) | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | 	{ | 
					
						
							|  |  |  | 		delete m_presets[i]; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-01-04 11:11:53 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-24 05:38:05 +02:00
										 |  |  | 	for (int i = 0; i < m_commands.count(); ++i) | 
					
						
							| 
									
										
										
										
											2018-01-04 11:11:53 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         delete m_commands[i]; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2020-09-24 05:38:05 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	for (int i = 0; i < m_featureSetPresets.count(); ++i) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         delete m_featureSetPresets[i]; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-08-24 15:51:50 +01:00
										 |  |  |     for (int i = 0; i < m_pluginPresets.count(); ++i) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         delete m_pluginPresets[i]; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-17 11:22:38 +01:00
										 |  |  | QString MainSettings::getFileLocation() const | 
					
						
							| 
									
										
										
										
											2019-01-17 11:17:28 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     QSettings s; | 
					
						
							|  |  |  |     return s.fileName(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int MainSettings::getFileFormat() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QSettings s; | 
					
						
							|  |  |  |     return (int) s.format(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-24 05:38:05 +02:00
										 |  |  | void MainSettings::load() | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | { | 
					
						
							|  |  |  | 	QSettings s; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	m_preferences.deserialize(qUncompress(QByteArray::fromBase64(s.value("preferences").toByteArray()))); | 
					
						
							| 
									
										
										
										
											2022-04-05 16:26:57 +02:00
										 |  |  | 	// m_workingPreset.deserialize(qUncompress(QByteArray::fromBase64(s.value("current").toByteArray())));
 | 
					
						
							|  |  |  | 	// m_workingFeatureSetPreset.deserialize(qUncompress(QByteArray::fromBase64(s.value("current-featureset").toByteArray())));
 | 
					
						
							|  |  |  |     m_workingConfiguration.deserialize(qUncompress(QByteArray::fromBase64(s.value("current-configuration").toByteArray()))); | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-20 23:25:00 +02:00
										 |  |  | 	if (m_audioDeviceManager) { | 
					
						
							| 
									
										
										
										
											2018-03-23 18:08:38 +01:00
										 |  |  | 	    m_audioDeviceManager->deserialize(qUncompress(QByteArray::fromBase64(s.value("audio").toByteArray()))); | 
					
						
							| 
									
										
										
										
											2017-01-06 18:56:46 +01:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | 	QStringList groups = s.childGroups(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-24 05:38:05 +02:00
										 |  |  | 	for (int i = 0; i < groups.size(); ++i) | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-01-04 11:11:53 +01:00
										 |  |  | 		if (groups[i].startsWith("preset")) | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | 		{ | 
					
						
							|  |  |  | 			s.beginGroup(groups[i]); | 
					
						
							|  |  |  | 			Preset* preset = new Preset; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-24 05:38:05 +02:00
										 |  |  | 			if (preset->deserialize(qUncompress(QByteArray::fromBase64(s.value("data").toByteArray())))) | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | 			{ | 
					
						
							|  |  |  | 				m_presets.append(preset); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			else | 
					
						
							|  |  |  | 			{ | 
					
						
							|  |  |  | 				delete preset; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			s.endGroup(); | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2018-01-04 11:11:53 +01:00
										 |  |  | 		else if (groups[i].startsWith("command")) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             s.beginGroup(groups[i]); | 
					
						
							|  |  |  |             Command* command = new Command; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-24 05:38:05 +02:00
										 |  |  |             if (command->deserialize(qUncompress(QByteArray::fromBase64(s.value("data").toByteArray())))) | 
					
						
							| 
									
										
										
										
											2018-01-04 11:11:53 +01:00
										 |  |  |             { | 
					
						
							|  |  |  |                 m_commands.append(command); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             else | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 delete command; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-24 05:38:05 +02:00
										 |  |  |             s.endGroup(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 		else if (groups[i].startsWith("featureset")) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             s.beginGroup(groups[i]); | 
					
						
							|  |  |  |             FeatureSetPreset* featureSetPreset = new FeatureSetPreset; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             if (featureSetPreset->deserialize(qUncompress(QByteArray::fromBase64(s.value("data").toByteArray())))) | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 m_featureSetPresets.append(featureSetPreset); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             else | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 delete featureSetPreset; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-24 15:51:50 +01:00
										 |  |  |             s.endGroup(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         else if (groups[i].startsWith("pluginpreset")) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             s.beginGroup(groups[i]); | 
					
						
							|  |  |  |             PluginPreset* pluginPreset = new PluginPreset; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             if (pluginPreset->deserialize(qUncompress(QByteArray::fromBase64(s.value("data").toByteArray())))) | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 m_pluginPresets.append(pluginPreset); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             else | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 delete pluginPreset; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-05 16:26:57 +02:00
										 |  |  |             s.endGroup(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 		else if (groups[i].startsWith("configuration")) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             s.beginGroup(groups[i]); | 
					
						
							|  |  |  |             Configuration* configuration = new Configuration; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             if (configuration->deserialize(qUncompress(QByteArray::fromBase64(s.value("data").toByteArray())))) | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 m_configurations.append(configuration); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             else | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 delete configuration; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-04 11:11:53 +01:00
										 |  |  |             s.endGroup(); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2019-06-12 18:50:53 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     m_hardwareDeviceUserArgs.deserialize(qUncompress(QByteArray::fromBase64(s.value("hwDeviceUserArgs").toByteArray()))); | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-24 05:38:05 +02:00
										 |  |  | void MainSettings::save() const | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | { | 
					
						
							|  |  |  | 	QSettings s; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	s.setValue("preferences", qCompress(m_preferences.serialize()).toBase64()); | 
					
						
							| 
									
										
										
										
											2022-04-05 16:26:57 +02:00
										 |  |  |     s.setValue("current-configuration", qCompress(m_workingConfiguration.serialize()).toBase64()); | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-20 23:25:00 +02:00
										 |  |  | 	if (m_audioDeviceManager) { | 
					
						
							| 
									
										
										
										
											2018-03-23 18:08:38 +01:00
										 |  |  | 	    s.setValue("audio", qCompress(m_audioDeviceManager->serialize()).toBase64()); | 
					
						
							| 
									
										
										
										
											2017-01-06 18:56:46 +01:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | 	QStringList groups = s.childGroups(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	for(int i = 0; i < groups.size(); ++i) | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-01-04 11:11:53 +01:00
										 |  |  | 		if ((groups[i].startsWith("preset")) || (groups[i].startsWith("command"))) | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | 		{ | 
					
						
							|  |  |  | 			s.remove(groups[i]); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-04 11:11:53 +01:00
										 |  |  | 	for (int i = 0; i < m_presets.count(); ++i) | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | 	{ | 
					
						
							|  |  |  | 		QString group = QString("preset-%1").arg(i + 1); | 
					
						
							|  |  |  | 		s.beginGroup(group); | 
					
						
							|  |  |  | 		s.setValue("data", qCompress(m_presets[i]->serialize()).toBase64()); | 
					
						
							|  |  |  | 		s.endGroup(); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-01-04 11:11:53 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     for (int i = 0; i < m_commands.count(); ++i) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         QString group = QString("command-%1").arg(i + 1); | 
					
						
							|  |  |  |         s.beginGroup(group); | 
					
						
							|  |  |  |         s.setValue("data", qCompress(m_commands[i]->serialize()).toBase64()); | 
					
						
							|  |  |  |         s.endGroup(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-06-12 18:50:53 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-24 05:38:05 +02:00
										 |  |  | 	for (int i = 0; i < m_featureSetPresets.count(); ++i) | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		QString group = QString("featureset-%1").arg(i + 1); | 
					
						
							|  |  |  | 		s.beginGroup(group); | 
					
						
							|  |  |  | 		s.setValue("data", qCompress(m_featureSetPresets[i]->serialize()).toBase64()); | 
					
						
							|  |  |  | 		s.endGroup(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-24 15:51:50 +01:00
										 |  |  |     for (int i = 0; i < m_pluginPresets.count(); ++i) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         QString group = QString("pluginpreset-%1").arg(i + 1); | 
					
						
							|  |  |  |         s.beginGroup(group); | 
					
						
							|  |  |  |         s.setValue("data", qCompress(m_pluginPresets[i]->serialize()).toBase64()); | 
					
						
							|  |  |  |         s.endGroup(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-05 16:26:57 +02:00
										 |  |  | 	for (int i = 0; i < m_configurations.count(); ++i) | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		QString group = QString("configuration-%1").arg(i + 1); | 
					
						
							|  |  |  | 		s.beginGroup(group); | 
					
						
							|  |  |  | 		s.setValue("data", qCompress(m_configurations[i]->serialize()).toBase64()); | 
					
						
							|  |  |  | 		s.endGroup(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-12 18:50:53 +02:00
										 |  |  |     s.setValue("hwDeviceUserArgs", qCompress(m_hardwareDeviceUserArgs.serialize()).toBase64()); | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-06 08:48:14 +02:00
										 |  |  | void MainSettings::initialize() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     resetToDefaults(); | 
					
						
							|  |  |  |     clearCommands(); | 
					
						
							|  |  |  |     clearPresets(); | 
					
						
							| 
									
										
										
										
											2020-09-24 05:38:05 +02:00
										 |  |  |     clearFeatureSetPresets(); | 
					
						
							| 
									
										
										
										
											2023-08-24 15:51:50 +01:00
										 |  |  |     clearPluginPresets(); | 
					
						
							| 
									
										
										
										
											2022-04-05 16:26:57 +02:00
										 |  |  |     clearConfigurations(); | 
					
						
							| 
									
										
										
										
											2019-08-06 08:48:14 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | void MainSettings::resetToDefaults() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	m_preferences.resetToDefaults(); | 
					
						
							|  |  |  | 	m_workingPreset.resetToDefaults(); | 
					
						
							| 
									
										
										
										
											2020-09-24 05:38:05 +02:00
										 |  |  |     m_workingFeatureSetPreset.resetToDefaults(); | 
					
						
							| 
									
										
										
										
											2023-08-24 15:51:50 +01:00
										 |  |  |     m_workingPluginPreset.resetToDefaults(); | 
					
						
							| 
									
										
										
										
											2022-04-05 16:26:57 +02:00
										 |  |  |     m_workingConfiguration.resetToDefaults(); | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-24 05:38:05 +02:00
										 |  |  | // DeviceSet presets
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | Preset* MainSettings::newPreset(const QString& group, const QString& description) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Preset* preset = new Preset(); | 
					
						
							|  |  |  | 	preset->setGroup(group); | 
					
						
							|  |  |  | 	preset->setDescription(description); | 
					
						
							| 
									
										
										
										
											2019-08-06 08:48:14 +02:00
										 |  |  | 	addPreset(preset); | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | 	return preset; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-06 08:48:14 +02:00
										 |  |  | void MainSettings::addPreset(Preset *preset) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_presets.append(preset); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-02 04:04:38 +02:00
										 |  |  | void MainSettings::deletePreset(const Preset* preset) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	m_presets.removeAll((Preset*)preset); | 
					
						
							|  |  |  | 	delete (Preset*)preset; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2016-09-11 18:58:40 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-08 19:33:10 +02:00
										 |  |  | QByteArray MainSettings::serializePreset(const Preset* preset) const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return preset->serialize(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool MainSettings::deserializePreset(const QByteArray& blob, Preset* preset) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return preset->deserialize(blob); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-06 20:02:08 +01:00
										 |  |  | void MainSettings::deletePresetGroup(const QString& groupName) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Presets::iterator it = m_presets.begin(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     while (it != m_presets.end()) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if ((*it)->getGroup() == groupName) { | 
					
						
							|  |  |  |             it = m_presets.erase(it); | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             ++it; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-11 18:58:40 +02:00
										 |  |  | void MainSettings::sortPresets() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-04-19 06:13:32 +02:00
										 |  |  |     std::sort(m_presets.begin(), m_presets.end(), Preset::presetCompare); | 
					
						
							| 
									
										
										
										
											2016-09-11 18:58:40 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2017-11-25 16:08:18 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-05 11:45:20 +01:00
										 |  |  | void MainSettings::renamePresetGroup(const QString& oldGroupName, const QString& newGroupName) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     int nbPresets = getPresetCount(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     for (int i = 0; i < nbPresets; i++) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if (getPreset(i)->getGroup() == oldGroupName) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             Preset *preset_mod = const_cast<Preset*>(getPreset(i)); | 
					
						
							|  |  |  |             preset_mod->setGroup(newGroupName); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-09 01:12:40 +02:00
										 |  |  | const Preset* MainSettings::getPreset(const QString& groupName, quint64 centerFrequency, const QString& description, const QString& type) const | 
					
						
							| 
									
										
										
										
											2017-11-25 16:08:18 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     int nbPresets = getPresetCount(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     for (int i = 0; i < nbPresets; i++) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if ((getPreset(i)->getGroup() == groupName) && | 
					
						
							|  |  |  |             (getPreset(i)->getCenterFrequency() == centerFrequency) && | 
					
						
							|  |  |  |             (getPreset(i)->getDescription() == description)) | 
					
						
							|  |  |  |         { | 
					
						
							| 
									
										
										
										
											2019-05-09 01:12:40 +02:00
										 |  |  |             if (type == "R" && getPreset(i)->isSourcePreset()) { | 
					
						
							|  |  |  |                 return getPreset(i); | 
					
						
							| 
									
										
										
										
											2019-09-13 13:40:31 +02:00
										 |  |  |             } else if (type == "T" && getPreset(i)->isSinkPreset()) { | 
					
						
							|  |  |  |                 return getPreset(i); | 
					
						
							|  |  |  |             } else if (type == "M" && getPreset(i)->isMIMOPreset()) { | 
					
						
							| 
									
										
										
										
											2019-05-09 01:12:40 +02:00
										 |  |  |                 return getPreset(i); | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2017-11-25 16:08:18 +01:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-24 05:38:05 +02:00
										 |  |  |     return nullptr; | 
					
						
							| 
									
										
										
										
											2017-11-25 16:08:18 +01:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2018-01-04 11:11:53 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-06 08:48:14 +02:00
										 |  |  | void MainSettings::clearPresets() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     foreach (Preset *preset, m_presets) { | 
					
						
							|  |  |  |         delete preset; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     m_presets.clear(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-24 05:38:05 +02:00
										 |  |  | // Commands
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-04 11:11:53 +01:00
										 |  |  | void MainSettings::addCommand(Command *command) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_commands.append(command); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MainSettings::deleteCommand(const Command* command) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_commands.removeAll((Command*)command); | 
					
						
							|  |  |  |     delete (Command*)command; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-06 20:02:08 +01:00
										 |  |  | void MainSettings::deleteCommandGroup(const QString& groupName) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Commands::iterator it = m_commands.begin(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     while (it != m_commands.end()) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if ((*it)->getGroup() == groupName) { | 
					
						
							|  |  |  |             it = m_commands.erase(it); | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             ++it; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-04 11:11:53 +01:00
										 |  |  | void MainSettings::sortCommands() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-04-19 06:13:32 +02:00
										 |  |  |     std::sort(m_commands.begin(), m_commands.end(), Command::commandCompare); | 
					
						
							| 
									
										
										
										
											2018-01-04 11:11:53 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-05 11:45:20 +01:00
										 |  |  | void MainSettings::renameCommandGroup(const QString& oldGroupName, const QString& newGroupName) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     int nbCommands = getCommandCount(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     for (int i = 0; i < nbCommands; i++) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if (getCommand(i)->getGroup() == oldGroupName) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             Command *command_mod = const_cast<Command*>(getCommand(i)); | 
					
						
							|  |  |  |             command_mod->setGroup(newGroupName); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-04 11:11:53 +01:00
										 |  |  | const Command* MainSettings::getCommand(const QString& groupName, const QString& description) const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     int nbCommands = getCommandCount(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     for (int i = 0; i < nbCommands; i++) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if ((getCommand(i)->getGroup() == groupName) && | 
					
						
							|  |  |  |             (getCommand(i)->getDescription() == description)) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             return getCommand(i); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-24 05:38:05 +02:00
										 |  |  |     return nullptr; | 
					
						
							| 
									
										
										
										
											2018-01-04 11:11:53 +01:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2019-08-06 08:48:14 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | void MainSettings::clearCommands() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     foreach (Command *command, m_commands) { | 
					
						
							|  |  |  |         delete command; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     m_commands.clear(); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2020-09-24 05:38:05 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | // FeatureSet presets
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | FeatureSetPreset* MainSettings::newFeatureSetPreset(const QString& group, const QString& description) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	FeatureSetPreset* preset = new FeatureSetPreset(); | 
					
						
							|  |  |  | 	preset->setGroup(group); | 
					
						
							|  |  |  | 	preset->setDescription(description); | 
					
						
							|  |  |  | 	addFeatureSetPreset(preset); | 
					
						
							|  |  |  | 	return preset; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MainSettings::addFeatureSetPreset(FeatureSetPreset *preset) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_featureSetPresets.append(preset); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MainSettings::deleteFeatureSetPreset(const FeatureSetPreset* preset) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	m_featureSetPresets.removeAll((FeatureSetPreset*) preset); | 
					
						
							|  |  |  | 	delete (FeatureSetPreset*) preset; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MainSettings::deleteFeatureSetPresetGroup(const QString& groupName) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     FeatureSetPresets::iterator it = m_featureSetPresets.begin(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     while (it != m_featureSetPresets.end()) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if ((*it)->getGroup() == groupName) { | 
					
						
							|  |  |  |             it = m_featureSetPresets.erase(it); | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             ++it; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MainSettings::sortFeatureSetPresets() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     std::sort(m_featureSetPresets.begin(), m_featureSetPresets.end(), FeatureSetPreset::presetCompare); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MainSettings::renameFeatureSetPresetGroup(const QString& oldGroupName, const QString& newGroupName) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     int nbPresets = getFeatureSetPresetCount(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     for (int i = 0; i < nbPresets; i++) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2022-04-05 16:26:57 +02:00
										 |  |  |         if (getFeatureSetPreset(i)->getGroup() == oldGroupName) | 
					
						
							| 
									
										
										
										
											2020-09-24 05:38:05 +02:00
										 |  |  |         { | 
					
						
							|  |  |  |             FeatureSetPreset *preset_mod = const_cast<FeatureSetPreset*>(getFeatureSetPreset(i)); | 
					
						
							|  |  |  |             preset_mod->setGroup(newGroupName); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const FeatureSetPreset* MainSettings::getFeatureSetPreset(const QString& groupName, const QString& description) const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     int nbPresets = getFeatureSetPresetCount(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     for (int i = 0; i < nbPresets; i++) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if ((getFeatureSetPreset(i)->getGroup() == groupName) && | 
					
						
							|  |  |  |             (getFeatureSetPreset(i)->getDescription() == description)) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             return getFeatureSetPreset(i); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return nullptr; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MainSettings::clearFeatureSetPresets() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     foreach (FeatureSetPreset *preset, m_featureSetPresets) { | 
					
						
							|  |  |  |         delete preset; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     m_featureSetPresets.clear(); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2022-04-05 16:26:57 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-24 15:51:50 +01:00
										 |  |  | // FeatureSet presets
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | PluginPreset* MainSettings::newPluginPreset(const QString& group, const QString& description) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	PluginPreset* preset = new PluginPreset(); | 
					
						
							|  |  |  | 	preset->setGroup(group); | 
					
						
							|  |  |  | 	preset->setDescription(description); | 
					
						
							|  |  |  | 	addPluginPreset(preset); | 
					
						
							|  |  |  | 	return preset; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MainSettings::addPluginPreset(PluginPreset *preset) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_pluginPresets.append(preset); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MainSettings::deletePluginPreset(const PluginPreset* preset) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	m_pluginPresets.removeAll((PluginPreset*) preset); | 
					
						
							|  |  |  | 	delete (PluginPreset*) preset; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MainSettings::deletePluginPresetGroup(const QString& groupName) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     PluginPresets::iterator it = m_pluginPresets.begin(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     while (it != m_pluginPresets.end()) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if ((*it)->getGroup() == groupName) { | 
					
						
							|  |  |  |             it = m_pluginPresets.erase(it); | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             ++it; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MainSettings::sortPluginPresets() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     std::sort(m_pluginPresets.begin(), m_pluginPresets.end(), PluginPreset::presetCompare); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MainSettings::renamePluginPresetGroup(const QString& oldGroupName, const QString& newGroupName) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     int nbPresets = getPluginPresetCount(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     for (int i = 0; i < nbPresets; i++) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if (getPluginPreset(i)->getGroup() == oldGroupName) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             PluginPreset *preset_mod = const_cast<PluginPreset*>(getPluginPreset(i)); | 
					
						
							|  |  |  |             preset_mod->setGroup(newGroupName); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const PluginPreset* MainSettings::getPluginPreset(const QString& groupName, const QString& description) const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     int nbPresets = getPluginPresetCount(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     for (int i = 0; i < nbPresets; i++) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if ((getPluginPreset(i)->getGroup() == groupName) && | 
					
						
							|  |  |  |             (getPluginPreset(i)->getDescription() == description)) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             return getPluginPreset(i); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return nullptr; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MainSettings::clearPluginPresets() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     foreach (PluginPreset *preset, m_pluginPresets) { | 
					
						
							|  |  |  |         delete preset; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     m_pluginPresets.clear(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-05 16:26:57 +02:00
										 |  |  | // Configurations
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Configuration* MainSettings::newConfiguration(const QString& group, const QString& description) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Configuration* configuration = new Configuration(); | 
					
						
							|  |  |  | 	configuration->setGroup(group); | 
					
						
							|  |  |  | 	configuration->setDescription(description); | 
					
						
							|  |  |  |     m_configurations.append(configuration); | 
					
						
							|  |  |  | 	return configuration; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MainSettings::addConfiguration(Configuration *configuration) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_configurations.append(configuration); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MainSettings::deleteConfiguration(const Configuration *configuration) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	m_configurations.removeAll((Configuration*) configuration); | 
					
						
							|  |  |  | 	delete (Configuration*) configuration; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-08 19:33:10 +02:00
										 |  |  | QByteArray MainSettings::serializeConfiguration(const Configuration *configuration) const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return configuration->serialize(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool MainSettings::deserializeConfiguration(const QByteArray& blob, Configuration *configuration) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return configuration->deserialize(blob); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-05 16:26:57 +02:00
										 |  |  | const Configuration* MainSettings::getConfiguration(const QString& groupName, const QString& description) const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     int nbConfigurations = getConfigurationCount(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     for (int i = 0; i < nbConfigurations; i++) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if ((getConfiguration(i)->getGroup() == groupName) && | 
					
						
							|  |  |  |             (getConfiguration(i)->getDescription() == description)) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             return getConfiguration(i); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return nullptr; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MainSettings::sortConfigurations() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     std::sort(m_configurations.begin(), m_configurations.end(), Configuration::configCompare); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MainSettings::renameConfigurationGroup(const QString& oldGroupName, const QString& newGroupName) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     int nbConfigurations = getConfigurationCount(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     for (int i = 0; i < nbConfigurations; i++) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if (getConfiguration(i)->getGroup() == oldGroupName) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             Configuration *configuration_mod = const_cast<Configuration*>(getConfiguration(i)); | 
					
						
							|  |  |  |             configuration_mod->setGroup(newGroupName); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MainSettings::deleteConfigurationGroup(const QString& groupName) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Configurations::iterator it = m_configurations.begin(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     while (it != m_configurations.end()) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if ((*it)->getGroup() == groupName) { | 
					
						
							|  |  |  |             it = m_configurations.erase(it); | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             ++it; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MainSettings::clearConfigurations() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     foreach (Configuration *configuration, m_configurations) { | 
					
						
							|  |  |  |         delete configuration; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     m_configurations.clear(); | 
					
						
							|  |  |  | } |