示例#1
0
void ServerWindow::apply()
{
    QSettings settings("config", QSettings::IniFormat);
    settings.setValue("server_private", serverPrivate->currentIndex());
    settings.setValue("server_name", serverName->text());
    settings.setValue("server_description", serverDesc->toPlainText());
    settings.setValue("server_maxplayers", serverPlayerMax->text());
    settings.setValue("server_port", serverPort->text());
    settings.setValue("server_announcement", serverAnnouncement->toPlainText());
    settings.setValue("show_log_messages", saveLogs->isChecked());
    settings.setValue("logs_channel_files", channelFileLog->isChecked());
    settings.setValue("logs_battle_files", channelFileLog->isChecked());
    settings.setValue("mainchanname", mainChan->text());
    settings.setValue("low_TCP_delay", lowLatency->isChecked());
    settings.setValue("safe_scripts", safeScripts->isChecked());
    settings.setValue("proxyservers", proxyServers->text());

    emit descChanged(serverDesc->toPlainText());
    emit nameChanged(serverName->text());
    emit maxChanged(serverPlayerMax->value());
    emit announcementChanged(serverAnnouncement->toPlainText());
    emit privacyChanged(serverPrivate->currentIndex());
    emit logSavingChanged(saveLogs->isChecked());
    emit useChannelFileLogChanged(channelFileLog->isChecked());
    emit useBattleFileLogChanged(battleFileLog->isChecked());
    if (mainChan->text().length() > 0)
        emit mainChanChanged(mainChan->text());
    emit latencyChanged(lowLatency->isChecked());
    emit safeScriptsChanged(safeScripts->isChecked());
    emit proxyServersChanged(proxyServers->text());

    close();
}
示例#2
0
void ServerWindow::apply()
{
    if (usePassword->isChecked() && serverPassword->text().length() == 0) {
        QMessageBox msgBox;
        msgBox.setText("You need to set the server password if you require it.");
        msgBox.exec();
        return;
    }

    QSettings settings("config", QSettings::IniFormat);
    settings.setValue("Server/Private", serverPrivate->currentIndex());
    settings.setValue("Server/Name", serverName->text());
    settings.setValue("Server/Description", serverDesc->toPlainText());
    settings.setValue("Server/MaxPlayers", serverPlayerMax->text());
    settings.setValue("Network/Ports", serverPort->text());
    settings.setValue("Server/Announcement", serverAnnouncement->toPlainText());
    settings.setValue("GUI/ShowLogMessages", saveLogs->isChecked());
    settings.setValue("Channels/LoggingEnabled", channelFileLog->isChecked());
    settings.setValue("Players/InactiveThresholdInDays", deleteInactive->text());
    settings.setValue("Channels/MainChannel", mainChan->text());
    settings.setValue("Network/LowTCPDelay", lowLatency->isChecked());
    settings.setValue("Scripts/SafeMode", safeScripts->isChecked());
    settings.setValue("GUI/MinimizeToTray", minimizeToTray->isChecked());
    settings.setValue("GUI/ShowTrayPopup", trayPopup->isChecked());
    settings.setValue("GUI/DoubleClickIcon", doubleClick->isChecked());
    settings.setValue("AntiDOS/ShowOveractiveMessages", showOveractive->isChecked());
    settings.setValue("Network/ProxyServers", proxyServers->text());
    settings.setValue("Server/Password", serverPassword->text());
    settings.setValue("Server/RequirePassword", usePassword->isChecked());
    settings.setValue("Server/MinimumHTML", minHtml->currentIndex() - 1);

    emit descChanged(serverDesc->toPlainText());
    emit nameChanged(serverName->text());
    emit maxChanged(serverPlayerMax->value());
    emit announcementChanged(serverAnnouncement->toPlainText());
    emit privacyChanged(serverPrivate->currentIndex());
    emit logSavingChanged(saveLogs->isChecked());
    emit useChannelFileLogChanged(channelFileLog->isChecked());
    emit mainChanChanged(mainChan->text());
    emit inactivePlayersDeleteDaysChanged(deleteInactive->value());
    emit latencyChanged(lowLatency->isChecked());
    emit safeScriptsChanged(safeScripts->isChecked());
    emit overactiveToggleChanged(showOveractive->isChecked());
    emit proxyServersChanged(proxyServers->text());
    emit serverPasswordChanged(serverPassword->text());
    emit usePasswordChanged(usePassword->isChecked());
    emit minimizeToTrayChanged(minimizeToTray->isChecked());
    emit showTrayPopupChanged(trayPopup->isChecked());
    emit clickConditionChanged(doubleClick->isChecked());
    emit minHtmlChanged(minHtml->currentIndex() - 1);

    close();
}