mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-11 12:54:10 -07:00
[Fix-Warnings] Local variable can be made const
This commit is contained in:
parent
8abd04dab1
commit
f2d3e81331
214 changed files with 1375 additions and 1355 deletions
|
|
@ -24,7 +24,7 @@ void GameFiltersSettings::setHideBuddiesOnlyGames(bool hide)
|
|||
|
||||
bool GameFiltersSettings::isHideBuddiesOnlyGames()
|
||||
{
|
||||
QVariant previous = getValue("hide_buddies_only_games");
|
||||
const QVariant previous = getValue("hide_buddies_only_games");
|
||||
return previous == QVariant() ? false : previous.toBool();
|
||||
}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ void GameFiltersSettings::setHideFullGames(bool hide)
|
|||
|
||||
bool GameFiltersSettings::isHideFullGames()
|
||||
{
|
||||
QVariant previous = getValue("hide_full_games");
|
||||
const QVariant previous = getValue("hide_full_games");
|
||||
return previous == QVariant() ? false : previous.toBool();
|
||||
}
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ void GameFiltersSettings::setHideGamesThatStarted(bool hide)
|
|||
|
||||
bool GameFiltersSettings::isHideGamesThatStarted()
|
||||
{
|
||||
QVariant previous = getValue("hide_games_that_started");
|
||||
const QVariant previous = getValue("hide_games_that_started");
|
||||
return previous == QVariant() ? false : previous.toBool();
|
||||
}
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ void GameFiltersSettings::setHidePasswordProtectedGames(bool hide)
|
|||
|
||||
bool GameFiltersSettings::isHidePasswordProtectedGames()
|
||||
{
|
||||
QVariant previous = getValue("hide_password_protected_games");
|
||||
const QVariant previous = getValue("hide_password_protected_games");
|
||||
return previous == QVariant() ? false : previous.toBool();
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ void GameFiltersSettings::setHideIgnoredUserGames(bool hide)
|
|||
|
||||
bool GameFiltersSettings::isHideIgnoredUserGames()
|
||||
{
|
||||
QVariant previous = getValue("hide_ignored_user_games");
|
||||
const QVariant previous = getValue("hide_ignored_user_games");
|
||||
return previous == QVariant() ? true : previous.toBool();
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ void GameFiltersSettings::setHideNotBuddyCreatedGames(bool hide)
|
|||
|
||||
bool GameFiltersSettings::isHideNotBuddyCreatedGames()
|
||||
{
|
||||
QVariant previous = getValue("hide_not_buddy_created_games");
|
||||
const QVariant previous = getValue("hide_not_buddy_created_games");
|
||||
return previous == QVariant() ? false : previous.toBool();
|
||||
}
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ void GameFiltersSettings::setHideOpenDecklistGames(bool hide)
|
|||
|
||||
bool GameFiltersSettings::isHideOpenDecklistGames()
|
||||
{
|
||||
QVariant previous = getValue("hide_open_decklist_games");
|
||||
const QVariant previous = getValue("hide_open_decklist_games");
|
||||
return previous == QVariant() ? false : previous.toBool();
|
||||
}
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ void GameFiltersSettings::setMinPlayers(int min)
|
|||
|
||||
int GameFiltersSettings::getMinPlayers()
|
||||
{
|
||||
QVariant previous = getValue("min_players");
|
||||
const QVariant previous = getValue("min_players");
|
||||
return previous == QVariant() ? 1 : previous.toInt();
|
||||
}
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ void GameFiltersSettings::setMaxPlayers(int max)
|
|||
|
||||
int GameFiltersSettings::getMaxPlayers()
|
||||
{
|
||||
QVariant previous = getValue("max_players");
|
||||
const QVariant previous = getValue("max_players");
|
||||
return previous == QVariant() ? 99 : previous.toInt();
|
||||
}
|
||||
|
||||
|
|
@ -143,7 +143,7 @@ void GameFiltersSettings::setMaxGameAge(const QTime &maxGameAge)
|
|||
|
||||
QTime GameFiltersSettings::getMaxGameAge()
|
||||
{
|
||||
QVariant previous = getValue("max_game_age_time");
|
||||
const QVariant previous = getValue("max_game_age_time");
|
||||
return previous.toTime();
|
||||
}
|
||||
|
||||
|
|
@ -159,7 +159,7 @@ void GameFiltersSettings::setGameHashedTypeEnabled(QString gametypeHASHED, bool
|
|||
|
||||
bool GameFiltersSettings::isGameTypeEnabled(QString gametype)
|
||||
{
|
||||
QVariant previous = getValue("game_type/" + hashGameType(gametype));
|
||||
const QVariant previous = getValue("game_type/" + hashGameType(gametype));
|
||||
return previous == QVariant() ? false : previous.toBool();
|
||||
}
|
||||
|
||||
|
|
@ -170,7 +170,7 @@ void GameFiltersSettings::setShowOnlyIfSpectatorsCanWatch(bool show)
|
|||
|
||||
bool GameFiltersSettings::isShowOnlyIfSpectatorsCanWatch()
|
||||
{
|
||||
QVariant previous = getValue("show_only_if_spectators_can_watch");
|
||||
const QVariant previous = getValue("show_only_if_spectators_can_watch");
|
||||
return previous == QVariant() ? false : previous.toBool();
|
||||
}
|
||||
|
||||
|
|
@ -181,7 +181,7 @@ void GameFiltersSettings::setShowSpectatorPasswordProtected(bool show)
|
|||
|
||||
bool GameFiltersSettings::isShowSpectatorPasswordProtected()
|
||||
{
|
||||
QVariant previous = getValue("show_spectator_password_protected");
|
||||
const QVariant previous = getValue("show_spectator_password_protected");
|
||||
return previous == QVariant() ? false : previous.toBool();
|
||||
}
|
||||
|
||||
|
|
@ -192,7 +192,7 @@ void GameFiltersSettings::setShowOnlyIfSpectatorsCanChat(bool show)
|
|||
|
||||
bool GameFiltersSettings::isShowOnlyIfSpectatorsCanChat()
|
||||
{
|
||||
QVariant previous = getValue("show_only_if_spectators_can_chat");
|
||||
const QVariant previous = getValue("show_only_if_spectators_can_chat");
|
||||
return previous == QVariant() ? false : previous.toBool();
|
||||
}
|
||||
|
||||
|
|
@ -203,6 +203,6 @@ void GameFiltersSettings::setShowOnlyIfSpectatorsCanSeeHands(bool show)
|
|||
|
||||
bool GameFiltersSettings::isShowOnlyIfSpectatorsCanSeeHands()
|
||||
{
|
||||
QVariant previous = getValue("show_only_if_spectators_can_see_hands");
|
||||
const QVariant previous = getValue("show_only_if_spectators_can_see_hands");
|
||||
return previous == QVariant() ? false : previous.toBool();
|
||||
}
|
||||
|
|
@ -27,7 +27,7 @@ void LayoutsSettings::setDeckEditorGeometry(const QByteArray &value)
|
|||
|
||||
QSize LayoutsSettings::getDeckEditorCardSize()
|
||||
{
|
||||
QVariant previous = getValue("layouts/deckEditor_CardSize");
|
||||
const QVariant previous = getValue("layouts/deckEditor_CardSize");
|
||||
return previous == QVariant() ? QSize(250, 500) : previous.toSize();
|
||||
}
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ void LayoutsSettings::setDeckEditorCardSize(const QSize &value)
|
|||
|
||||
QSize LayoutsSettings::getDeckEditorDeckSize()
|
||||
{
|
||||
QVariant previous = getValue("layouts/deckEditor_DeckSize");
|
||||
const QVariant previous = getValue("layouts/deckEditor_DeckSize");
|
||||
return previous == QVariant() ? QSize(250, 360) : previous.toSize();
|
||||
}
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ void LayoutsSettings::setDeckEditorDeckSize(const QSize &value)
|
|||
|
||||
QSize LayoutsSettings::getDeckEditorPrintingSelectorSize()
|
||||
{
|
||||
QVariant previous = getValue("layouts/deckEditor_PrintingSelectorSize");
|
||||
const QVariant previous = getValue("layouts/deckEditor_PrintingSelectorSize");
|
||||
return previous == QVariant() ? QSize(525, 250) : previous.toSize();
|
||||
}
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ void LayoutsSettings::setDeckEditorPrintingSelectorSize(const QSize &value)
|
|||
|
||||
QSize LayoutsSettings::getDeckEditorFilterSize()
|
||||
{
|
||||
QVariant previous = getValue("layouts/deckEditor_FilterSize");
|
||||
const QVariant previous = getValue("layouts/deckEditor_FilterSize");
|
||||
return previous == QVariant() ? QSize(250, 250) : previous.toSize();
|
||||
}
|
||||
|
||||
|
|
@ -111,7 +111,7 @@ const QByteArray LayoutsSettings::getGamePlayAreaGeometry()
|
|||
|
||||
const QSize LayoutsSettings::getGameCardInfoSize()
|
||||
{
|
||||
QVariant previous = getValue("layouts/gameplayarea_CardInfoSize");
|
||||
const QVariant previous = getValue("layouts/gameplayarea_CardInfoSize");
|
||||
return previous == QVariant() ? QSize(250, 360) : previous.toSize();
|
||||
}
|
||||
|
||||
|
|
@ -122,7 +122,7 @@ void LayoutsSettings::setGameCardInfoSize(const QSize &value)
|
|||
|
||||
const QSize LayoutsSettings::getGameMessageLayoutSize()
|
||||
{
|
||||
QVariant previous = getValue("layouts/gameplayarea_MessageLayoutSize");
|
||||
const QVariant previous = getValue("layouts/gameplayarea_MessageLayoutSize");
|
||||
return previous == QVariant() ? QSize(250, 250) : previous.toSize();
|
||||
}
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ void LayoutsSettings::setGameMessageLayoutSize(const QSize &value)
|
|||
|
||||
const QSize LayoutsSettings::getGamePlayerListSize()
|
||||
{
|
||||
QVariant previous = getValue("layouts/gameplayarea_PlayerListSize");
|
||||
const QVariant previous = getValue("layouts/gameplayarea_PlayerListSize");
|
||||
return previous == QVariant() ? QSize(250, 50) : previous.toSize();
|
||||
}
|
||||
|
||||
|
|
@ -164,7 +164,7 @@ const QByteArray LayoutsSettings::getReplayPlayAreaGeometry()
|
|||
|
||||
const QSize LayoutsSettings::getReplayCardInfoSize()
|
||||
{
|
||||
QVariant previous = getValue("layouts/replayplayarea_CardInfoSize");
|
||||
const QVariant previous = getValue("layouts/replayplayarea_CardInfoSize");
|
||||
return previous == QVariant() ? QSize(250, 360) : previous.toSize();
|
||||
}
|
||||
|
||||
|
|
@ -175,7 +175,7 @@ void LayoutsSettings::setReplayCardInfoSize(const QSize &value)
|
|||
|
||||
const QSize LayoutsSettings::getReplayMessageLayoutSize()
|
||||
{
|
||||
QVariant previous = getValue("layouts/replayplayarea_MessageLayoutSize");
|
||||
const QVariant previous = getValue("layouts/replayplayarea_MessageLayoutSize");
|
||||
return previous == QVariant() ? QSize(250, 200) : previous.toSize();
|
||||
}
|
||||
|
||||
|
|
@ -186,7 +186,7 @@ void LayoutsSettings::setReplayMessageLayoutSize(const QSize &value)
|
|||
|
||||
const QSize LayoutsSettings::getReplayPlayerListSize()
|
||||
{
|
||||
QVariant previous = getValue("layouts/replayplayarea_PlayerListSize");
|
||||
const QVariant previous = getValue("layouts/replayplayarea_PlayerListSize");
|
||||
return previous == QVariant() ? QSize(250, 50) : previous.toSize();
|
||||
}
|
||||
|
||||
|
|
@ -197,7 +197,7 @@ void LayoutsSettings::setReplayPlayerListSize(const QSize &value)
|
|||
|
||||
const QSize LayoutsSettings::getReplayReplaySize()
|
||||
{
|
||||
QVariant previous = getValue("layouts/replayplayarea_ReplaySize");
|
||||
const QVariant previous = getValue("layouts/replayplayarea_ReplaySize");
|
||||
return previous == QVariant() ? QSize(900, 100) : previous.toSize();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ void ServersSettings::setPreviousHostLogin(int previous)
|
|||
|
||||
int ServersSettings::getPreviousHostLogin()
|
||||
{
|
||||
QVariant previous = getValue("previoushostlogin");
|
||||
const QVariant previous = getValue("previoushostlogin");
|
||||
return previous == QVariant() ? 1 : previous.toInt();
|
||||
}
|
||||
|
||||
|
|
@ -36,27 +36,27 @@ void ServersSettings::setPrevioushostName(const QString &name)
|
|||
|
||||
QString ServersSettings::getSaveName(QString defaultname)
|
||||
{
|
||||
int index = getPrevioushostindex(getPrevioushostName());
|
||||
QVariant saveName = getValue(QString("saveName%1").arg(index), "server", "server_details");
|
||||
const int index = getPrevioushostindex(getPrevioushostName());
|
||||
const QVariant saveName = getValue(QString("saveName%1").arg(index), "server", "server_details");
|
||||
return saveName == QVariant() ? std::move(defaultname) : saveName.toString();
|
||||
}
|
||||
|
||||
QString ServersSettings::getSite(QString defaultSite)
|
||||
{
|
||||
int index = getPrevioushostindex(getPrevioushostName());
|
||||
QVariant site = getValue(QString("site%1").arg(index), "server", "server_details");
|
||||
const int index = getPrevioushostindex(getPrevioushostName());
|
||||
const QVariant site = getValue(QString("site%1").arg(index), "server", "server_details");
|
||||
return site == QVariant() ? std::move(defaultSite) : site.toString();
|
||||
}
|
||||
|
||||
QString ServersSettings::getPrevioushostName()
|
||||
{
|
||||
QVariant value = getValue("previoushostName");
|
||||
const QVariant value = getValue("previoushostName");
|
||||
return value == QVariant() ? "Rooster Ranges" : value.toString();
|
||||
}
|
||||
|
||||
int ServersSettings::getPrevioushostindex(const QString &saveName)
|
||||
{
|
||||
int size = getValue("totalServers", "server", "server_details").toInt();
|
||||
const int size = getValue("totalServers", "server", "server_details").toInt();
|
||||
|
||||
for (int i = 0; i <= size; ++i)
|
||||
if (saveName == getValue(QString("saveName%1").arg(i), "server", "server_details").toString())
|
||||
|
|
@ -67,30 +67,30 @@ int ServersSettings::getPrevioushostindex(const QString &saveName)
|
|||
|
||||
QString ServersSettings::getHostname(QString defaultHost)
|
||||
{
|
||||
int index = getPrevioushostindex(getPrevioushostName());
|
||||
QVariant hostname = getValue(QString("server%1").arg(index), "server", "server_details");
|
||||
const int index = getPrevioushostindex(getPrevioushostName());
|
||||
const QVariant hostname = getValue(QString("server%1").arg(index), "server", "server_details");
|
||||
return hostname == QVariant() ? std::move(defaultHost) : hostname.toString();
|
||||
}
|
||||
|
||||
QString ServersSettings::getPort(QString defaultPort)
|
||||
{
|
||||
int index = getPrevioushostindex(getPrevioushostName());
|
||||
QVariant port = getValue(QString("port%1").arg(index), "server", "server_details");
|
||||
const int index = getPrevioushostindex(getPrevioushostName());
|
||||
const QVariant port = getValue(QString("port%1").arg(index), "server", "server_details");
|
||||
qCDebug(ServersSettingsLog) << "getPort() index = " << index << " port.val = " << port.toString();
|
||||
return port == QVariant() ? std::move(defaultPort) : port.toString();
|
||||
}
|
||||
|
||||
QString ServersSettings::getPlayerName(QString defaultName)
|
||||
{
|
||||
int index = getPrevioushostindex(getPrevioushostName());
|
||||
QVariant name = getValue(QString("username%1").arg(index), "server", "server_details");
|
||||
const int index = getPrevioushostindex(getPrevioushostName());
|
||||
const QVariant name = getValue(QString("username%1").arg(index), "server", "server_details");
|
||||
qCDebug(ServersSettingsLog) << "getPlayerName() index = " << index << " name.val = " << name.toString();
|
||||
return name == QVariant() ? std::move(defaultName) : name.toString();
|
||||
}
|
||||
|
||||
QString ServersSettings::getPassword()
|
||||
{
|
||||
int index = getPrevioushostindex(getPrevioushostName());
|
||||
const int index = getPrevioushostindex(getPrevioushostName());
|
||||
|
||||
if (getSavePassword())
|
||||
return getValue(QString("password%1").arg(index), "server", "server_details").toString();
|
||||
|
|
@ -100,8 +100,8 @@ QString ServersSettings::getPassword()
|
|||
|
||||
bool ServersSettings::getSavePassword()
|
||||
{
|
||||
int index = getPrevioushostindex(getPrevioushostName());
|
||||
bool save = getValue(QString("savePassword%1").arg(index), "server", "server_details").toBool();
|
||||
const int index = getPrevioushostindex(getPrevioushostName());
|
||||
const bool save = getValue(QString("savePassword%1").arg(index), "server", "server_details").toBool();
|
||||
return save;
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ void ServersSettings::setAutoConnect(int autoconnect)
|
|||
|
||||
int ServersSettings::getAutoConnect()
|
||||
{
|
||||
QVariant autoconnect = getValue("auto_connect");
|
||||
const QVariant autoconnect = getValue("auto_connect");
|
||||
return autoconnect == QVariant() ? 0 : autoconnect.toInt();
|
||||
}
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ void ServersSettings::setFPHostName(QString hostname)
|
|||
|
||||
QString ServersSettings::getFPHostname(QString defaultHost)
|
||||
{
|
||||
QVariant hostname = getValue("fphostname");
|
||||
const QVariant hostname = getValue("fphostname");
|
||||
return hostname == QVariant() ? std::move(defaultHost) : hostname.toString();
|
||||
}
|
||||
|
||||
|
|
@ -134,7 +134,7 @@ void ServersSettings::setFPPort(QString port)
|
|||
|
||||
QString ServersSettings::getFPPort(QString defaultPort)
|
||||
{
|
||||
QVariant port = getValue("fpport");
|
||||
const QVariant port = getValue("fpport");
|
||||
return port == QVariant() ? std::move(defaultPort) : port.toString();
|
||||
}
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ void ServersSettings::setFPPlayerName(QString playerName)
|
|||
|
||||
QString ServersSettings::getFPPlayerName(QString defaultName)
|
||||
{
|
||||
QVariant name = getValue("fpplayername");
|
||||
const QVariant name = getValue("fpplayername");
|
||||
return name == QVariant() ? std::move(defaultName) : name.toString();
|
||||
}
|
||||
|
||||
|
|
@ -156,7 +156,7 @@ void ServersSettings::setClearDebugLogStatus(bool abIsChecked)
|
|||
|
||||
bool ServersSettings::getClearDebugLogStatus(bool abDefaultValue)
|
||||
{
|
||||
QVariant cbFlushLog = getValue("save_debug_log");
|
||||
const QVariant cbFlushLog = getValue("save_debug_log");
|
||||
return cbFlushLog == QVariant() ? abDefaultValue : cbFlushLog.toBool();
|
||||
}
|
||||
|
||||
|
|
@ -171,7 +171,7 @@ void ServersSettings::addNewServer(const QString &saveName,
|
|||
if (updateExistingServer(saveName, serv, port, username, password, savePassword, site))
|
||||
return;
|
||||
|
||||
int index = getValue("totalServers", "server", "server_details").toInt() + 1;
|
||||
const int index = getValue("totalServers", "server", "server_details").toInt() + 1;
|
||||
|
||||
setValue(saveName, QString("saveName%1").arg(index), "server", "server_details");
|
||||
setValue(serv, QString("server%1").arg(index), "server", "server_details");
|
||||
|
|
@ -185,7 +185,7 @@ void ServersSettings::addNewServer(const QString &saveName,
|
|||
|
||||
void ServersSettings::removeServer(QString servAddr)
|
||||
{
|
||||
int size = getValue("totalServers", "server", "server_details").toInt();
|
||||
const int size = getValue("totalServers", "server", "server_details").toInt();
|
||||
|
||||
bool found = false;
|
||||
for (int i = 0; i <= size; ++i) {
|
||||
|
|
@ -196,7 +196,7 @@ void ServersSettings::removeServer(QString servAddr)
|
|||
}
|
||||
} else {
|
||||
// move all other entries after it one back, overwriting the previous one
|
||||
int previous = i - 1; // we delete only one entry
|
||||
const int previous = i - 1; // we delete only one entry
|
||||
setValue(getValue(QString("server%1").arg(i), "server", "server_details"),
|
||||
QString("server%1").arg(previous), "server", "server_details");
|
||||
setValue(getValue(QString("port%1").arg(i), "server", "server_details"), QString("port%1").arg(previous),
|
||||
|
|
@ -234,7 +234,7 @@ void ServersSettings::removeServer(QString servAddr)
|
|||
*/
|
||||
bool ServersSettings::updateExistingServerWithoutLoss(QString saveName, QString serv, QString port, QString site)
|
||||
{
|
||||
int size = getValue("totalServers", "server", "server_details").toInt();
|
||||
const int size = getValue("totalServers", "server", "server_details").toInt();
|
||||
|
||||
for (int i = 0; i <= size; ++i) {
|
||||
if (serv == getValue(QString("server%1").arg(i), "server", "server_details").toString()) {
|
||||
|
|
@ -262,7 +262,7 @@ bool ServersSettings::updateExistingServer(QString saveName,
|
|||
bool savePassword,
|
||||
QString site)
|
||||
{
|
||||
int size = getValue("totalServers", "server", "server_details").toInt();
|
||||
const int size = getValue("totalServers", "server", "server_details").toInt();
|
||||
|
||||
for (int i = 0; i <= size; ++i) {
|
||||
if (serv == getValue(QString("server%1").arg(i), "server", "server_details").toString()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue