本文整理汇总了C++中saveConfiguration函数的典型用法代码示例。如果您正苦于以下问题:C++ saveConfiguration函数的具体用法?C++ saveConfiguration怎么用?C++ saveConfiguration使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了saveConfiguration函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CharmWindow
TasksWindow::TasksWindow( QWidget* parent )
: CharmWindow( tr( "Tasks Editor" ), parent )
, m_tasksView( new TasksView( toolBar(), this ) )
{
setWindowNumber( 1 );
setWindowIdentifier( QLatin1String( "window_tasks" ) );
setCentralWidget( m_tasksView );
setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding );
connect( m_tasksView, SIGNAL(emitCommand(CharmCommand*)),
SIGNAL(emitCommand(CharmCommand*)) );
connect( m_tasksView, SIGNAL(emitCommandRollback(CharmCommand*)),
SIGNAL(emitCommandRollback(CharmCommand*)) );
connect( m_tasksView, SIGNAL(saveConfiguration()),
SIGNAL(saveConfiguration()) );
}
示例2: HandleConfig
// Handles HTTP GET & POST /config.html requests
void HandleConfig()
{
// Warning: uses global data
ControllerData *gd = &GD;
// NETWORK_UPDATE
if (gd->switchServer->hasArg("NETWORK_UPDATE"))
{
gd->switchServer->arg("SSID").toCharArray(config.ssid, SSID_LEN);
gd->switchServer->arg("PASS").toCharArray(config.secret, SECRET_LEN);
gd->switchServer->arg("MDNS").toCharArray(config.MDNSHost, MDNS_HOST_LEN);
saveConfiguration(&config, sizeof(ConfigurationData));
// redirect to the same page without arguments
gd->switchServer->sendHeader("Location", String("/config"), true);
gd->switchServer->send(302, TEXT_PLAIN, "");
// Try connecting with new credentials
WiFi.disconnect();
WiFiManager::handleWiFiConnectivity();
}
// Reboot
if (gd->switchServer->hasArg("REBOOT"))
{
gd->switchServer->send(200, TEXT_PLAIN, "Restarting...");
ESP.restart();
}
// GENERAL_UPDATE
if (gd->switchServer->hasArg("GENERAL_UPDATE"))
{
gd->switchServer->arg("OTA_URL").toCharArray(config.OTA_URL, OTA_URL_LEN);
saveConfiguration(&config, sizeof(ConfigurationData));
}
// CHECK_UPDATE_NOW
if (gd->switchServer->hasArg("CHECK_UPDATE_NOW"))
{
Serial.println("Checking software updates available.");
checkSoftwareUpdates();
}
ESPTemplateProcessor(*gd->switchServer).send(
String("/config.html"),
mapConfigParameters);
}
示例3: qDebug
void Core::requestFriendship(const QString& friendAddress, const QString& message)
{
qDebug() << "Core: requesting friendship of "+friendAddress;
CString cMessage(message);
int friendId = tox_add_friend(tox, CFriendAddress(friendAddress).data(), cMessage.data(), cMessage.size());
const QString userId = friendAddress.mid(0, TOX_CLIENT_ID_SIZE * 2);
if (friendId < 0) {
emit failedToAddFriend(userId);
} else {
// Update our friendAddresses
bool found=false;
QList<QString>& friendAddresses = Settings::getInstance().friendAddresses;
for (QString& addr : friendAddresses)
{
if (addr.toUpper().contains(friendAddress))
{
addr = friendAddress;
found = true;
}
}
if (!found)
friendAddresses.append(friendAddress);
emit friendAdded(friendId, userId);
}
saveConfiguration();
}
示例4: return
void Core::saveConfiguration()
{
if (QThread::currentThread() != coreThread)
return (void) QMetaObject::invokeMethod(this, "saveConfiguration");
if (!isReady())
return;
ProfileLocker::assertLock();
QString dir = Settings::getSettingsDirPath();
QDir directory(dir);
if (!directory.exists() && !directory.mkpath(directory.absolutePath()))
{
qCritical() << "Error while creating directory " << dir;
return;
}
QString profile = Settings::getInstance().getCurrentProfile();
if (profile == "")
{ // no profile active; this should only happen on startup, if at all
profile = sanitize(getUsername());
if (profile == "") // happens on creation of a new Tox ID
profile = getIDString();
Settings::getInstance().switchProfile(profile);
}
QString path = directory.filePath(profile + TOX_EXT);
saveConfiguration(path);
}
示例5: switch
void Core::setStatus(Status status)
{
TOX_USERSTATUS userstatus;
switch (status) {
case Status::Online:
userstatus = TOX_USERSTATUS_NONE;
break;
case Status::Away:
userstatus = TOX_USERSTATUS_AWAY;
break;
case Status::Busy:
userstatus = TOX_USERSTATUS_BUSY;
break;
default:
userstatus = TOX_USERSTATUS_INVALID;
break;
}
if (tox_set_user_status(tox, userstatus) == 0) {
saveConfiguration();
emit statusSet(status);
} else {
emit failedToSetStatus(status);
}
}
示例6: getConfiguration
void CanIO::loadConfiguration()
{
CanIOConfiguration *config = (CanIOConfiguration *) getConfiguration();
if (!config) { // as lowest sub-class make sure we have a config object
config = new CanIOConfiguration();
setConfiguration(config);
}
Device::loadConfiguration(); // call parent
Logger::info(this, "CAN I/O configuration:");
#ifdef USE_HARD_CODED
if (false) {
#else
if (prefsHandler->checksumValid()) { //checksum is good, read in the values stored in EEPROM
#endif
// prefsHandler->read(EESYS_, &config->);
} else {
// config-> = 0;
saveConfiguration();
}
// Logger::info(getId(), "xyz: %d", config->);
}
void CanIO::saveConfiguration()
{
// prefsHandler->write(EESYS_, config->);
prefsHandler->saveChecksum();
}
示例7: deleteAllTelescopes
void TelescopeControl::deinit()
{
//Destroy all clients first in order to avoid displaying a TCP error
deleteAllTelescopes();
QHash<int, QProcess*>::const_iterator iterator = telescopeServerProcess.constBegin();
while(iterator != telescopeServerProcess.constEnd())
{
int slotNumber = iterator.key();
#ifdef Q_OS_WIN
telescopeServerProcess[slotNumber]->close();
#else
telescopeServerProcess[slotNumber]->terminate();
#endif
telescopeServerProcess[slotNumber]->waitForFinished();
delete telescopeServerProcess[slotNumber];
qDebug() << "[TelescopeControl] deinit(): Server process at slot" << slotNumber << "terminated successfully.";
++iterator;
}
//TODO: Decide if it should be saved on change
//Save the configuration on exit
saveConfiguration();
}
示例8: getConfigurationDirectory
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;
}
示例9: createDefaultConfiguration
void Input::loadConfiguration()
{
Gorgon::Core::Log::get().writeFormatted("C++ -> Input::loadConfiguration()\n");
std::fstream* file;
file = new std::fstream("data/input.cfg",std::ios::in|std::ios::binary);
if(!file->is_open())
{
Gorgon::Core::Log::get().writeFormatted("C++ -> Input::loadConfiguration(): data/input.cfg ... Error\n");
createDefaultConfiguration();
saveConfiguration();
}
else
{
file->read( (char*)&mKey_start , sizeof(int) );
file->read( (char*)&mKey_up , sizeof(int) );
file->read( (char*)&mKey_down , sizeof(int) );
file->read( (char*)&mKey_left , sizeof(int) );
file->read( (char*)&mKey_right , sizeof(int) );
file->read( (char*)&mKey_button1 , sizeof(int) );
file->read( (char*)&mKey_button2 , sizeof(int) );
file->read( (char*)&mKey_button3 , sizeof(int) );
file->read( (char*)&mKey_button4 , sizeof(int) );
file->read( (char*)&mKey_button5 , sizeof(int) );
file->read( (char*)&mKey_button6 , sizeof(int) );
file->read( (char*)&mKey_button7 , sizeof(int) );
file->read( (char*)&mKey_button8 , sizeof(int) );
Gorgon::Core::Log::get().writeFormatted("C++ -> Input::loadConfiguration(): data/input.cfg ... Done\n");
}
file->close();
delete file;
}
示例10: T
bool CConfiguration::setSensorValue(const int8_t idSensor, T (CSensorConfiguration::*getter)() const,
void (CSensorConfiguration::*setter)(const T), const T& newValue)
{
std::vector<DSensorConfiguration>::iterator it = std::find_if(
sensors.begin(), sensors.end(),
[&](DSensorConfiguration& s){return s->getSensorId() == idSensor;});
if (it == sensors.end())
{
// nie znaleziono czujnika
return false;
}
std::shared_ptr<CSensorConfiguration> s = std::dynamic_pointer_cast<CSensorConfiguration>(*it);
T currentValue = (*s.*getter)();
mutex.lock();
T oldValue = currentValue;
(*s.*setter)(newValue);
bool result = saveConfiguration();
if (!result)
{
// nie udal sie zapis - przywroc stare wartosci
(*s.*setter)(oldValue);
}
else
{
readConfiguration();
}
mutex.unlock();
return result;
}
示例11: saveConfiguration
Core::~Core()
{
if (tox) {
saveConfiguration();
tox_kill(tox);
}
}
示例12: saveConfiguration
void KviTalApplication::commitData(QSessionManager & manager)
{
saveConfiguration();
#if defined(COMPILE_KDE4_SUPPORT)
KApplication::commitData(manager);
#endif //defined(COMPILE_KDE4_SUPPORT)
}
示例13: LOG_DEBUG
CConfigurationMock::CConfigurationMock()
{
LOG_DEBUG("CConfigurationMock - constructor.");
idConcentrator = 1;
sendingPeriod = 8;
checkingSensorPeriod = 4;
saveSDCardIfOnlineEnable = false;
dataPath = ".";
int warningValue = 25;
int alarmValue = 35;
CData warning(EValueType::INT_32, &warningValue);
CData alarm(EValueType::INT_32, &alarmValue);
std::string sensorAddr = "127.0.0.1";
int port = 1502;
for (int8_t i = 0; i < 2; ++i)
{
uint8_t idSensor1 = i;
bool turnOn = true;
DSensorConfiguration s(
new CSensorConfigurationMock(idSensor1, turnOn, warning, alarm, sensorAddr, port));
this->sensors.push_back(s);
port = port + 1;
}
serverUrl = "http://localhost:8080/HallMonitorServer/rest/concentrator/post";
saveConfiguration();
}
示例14: saveConfiguration
ExportNative::~ExportNative(void)
{
saveConfiguration();
while (!m_archiveList.isEmpty())
delete m_archiveList.takeFirst();
m_archiveList.clear();
}
示例15: lock
void Cursynth::processMidi(std::vector<unsigned char>* message) {
if (message->size() < 3)
return;
lock();
int midi_port = message->at(0);
int midi_id = message->at(1);
int midi_val = message->at(2);
std::string selected_control_name = gui_.getCurrentControl();
Control* selected_control = controls_.at(selected_control_name);
if (midi_port >= 144 && midi_port < 160) {
// A MIDI keyboard key was pressed. Play a note.
int midi_note = midi_id;
int midi_velocity = midi_val;
if (midi_velocity)
synth_.noteOn(midi_note, (1.0 * midi_velocity) / MIDI_SIZE);
else
synth_.noteOff(midi_note);
}
else if (midi_port >= 128 && midi_port < 144) {
// A MIDI keyboard key was released. Release that note.
int midi_note = midi_id;
synth_.noteOff(midi_note);
}
else if (midi_port == PITCH_BEND_PORT)
synth_.setPitchWheel((2.0 * midi_val) / (MIDI_SIZE - 1) - 1);
else if (midi_port == SUSTAIN_PORT && midi_id == SUSTAIN_ID) {
if (midi_val)
synth_.sustainOn();
else
synth_.sustainOff();
}
else if (midi_port < 254) {
// Must have gotten MIDI from some knob or other control.
if (state_ == MIDI_LEARN && midi_port < 254) {
// MIDI learn is armed so map this MIDI signal to the current control.
eraseMidiLearn(selected_control);
midi_learn_[midi_id] = selected_control_name;
selected_control->midi_learn(midi_id);
state_ = STANDARD;
gui_.drawControlStatus(selected_control, false);
saveConfiguration();
}
else if (midi_learn_.find(midi_id) != midi_learn_.end()) {
// MIDI learn is enabled for this control. Change the paired control.
Control* midi_control = controls_.at(midi_learn_[midi_id]);
midi_control->setMidi(midi_val);
gui_.drawControl(midi_control, selected_control == midi_control);
gui_.drawControlStatus(midi_control, false);
}
if (midi_id == MOD_WHEEL_ID)
synth_.setModWheel(midi_val);
}
unlock();
}