Merge pull request #1128 from pandaninjas/fix-implicit-fallthrough
This commit is contained in:
parent
bab7105820
commit
6f1d594f1c
@ -187,8 +187,8 @@ void LaunchController::login() {
|
|||||||
switch(m_accountToUse->accountState()) {
|
switch(m_accountToUse->accountState()) {
|
||||||
case AccountState::Offline: {
|
case AccountState::Offline: {
|
||||||
m_session->wants_online = false;
|
m_session->wants_online = false;
|
||||||
// NOTE: fallthrough is intentional
|
|
||||||
}
|
}
|
||||||
|
/* fallthrough */
|
||||||
case AccountState::Online: {
|
case AccountState::Online: {
|
||||||
if(!m_session->wants_online) {
|
if(!m_session->wants_online) {
|
||||||
// we ask the user for a player name
|
// we ask the user for a player name
|
||||||
@ -267,8 +267,8 @@ void LaunchController::login() {
|
|||||||
// This means some sort of soft error that we can fix with a refresh ... so let's refresh.
|
// This means some sort of soft error that we can fix with a refresh ... so let's refresh.
|
||||||
case AccountState::Unchecked: {
|
case AccountState::Unchecked: {
|
||||||
m_accountToUse->refresh();
|
m_accountToUse->refresh();
|
||||||
// NOTE: fallthrough intentional
|
|
||||||
}
|
}
|
||||||
|
/* fallthrough */
|
||||||
case AccountState::Working: {
|
case AccountState::Working: {
|
||||||
// refresh is in progress, we need to wait for it to finish to proceed.
|
// refresh is in progress, we need to wait for it to finish to proceed.
|
||||||
ProgressDialog progDialog(m_parentWidget);
|
ProgressDialog progDialog(m_parentWidget);
|
||||||
|
@ -187,35 +187,24 @@ QVariant VersionProxyModel::data(const QModelIndex &index, int role) const
|
|||||||
}
|
}
|
||||||
case Qt::ToolTipRole:
|
case Qt::ToolTipRole:
|
||||||
{
|
{
|
||||||
switch(column)
|
if(column == Name && hasRecommended)
|
||||||
{
|
{
|
||||||
case Name:
|
auto value = sourceModel()->data(parentIndex, BaseVersionList::RecommendedRole);
|
||||||
|
if(value.toBool())
|
||||||
{
|
{
|
||||||
if(hasRecommended)
|
return tr("Recommended");
|
||||||
|
} else if(hasLatest) {
|
||||||
|
auto value = sourceModel()->data(parentIndex, BaseVersionList::LatestRole);
|
||||||
|
if(value.toBool())
|
||||||
{
|
{
|
||||||
auto value = sourceModel()->data(parentIndex, BaseVersionList::RecommendedRole);
|
return tr("Latest");
|
||||||
if(value.toBool())
|
|
||||||
{
|
|
||||||
return tr("Recommended");
|
|
||||||
}
|
|
||||||
else if(hasLatest)
|
|
||||||
{
|
|
||||||
auto value = sourceModel()->data(parentIndex, BaseVersionList::LatestRole);
|
|
||||||
if(value.toBool())
|
|
||||||
{
|
|
||||||
return tr("Latest");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(index.row() == 0)
|
|
||||||
{
|
|
||||||
return tr("Latest");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
} else if(index.row() == 0)
|
||||||
default:
|
|
||||||
{
|
{
|
||||||
return sourceModel()->data(parentIndex, BaseVersionList::VersionIdRole);
|
return tr("Latest");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return sourceModel()->data(parentIndex, BaseVersionList::VersionIdRole);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case Qt::DecorationRole:
|
case Qt::DecorationRole:
|
||||||
|
@ -45,10 +45,10 @@ QVariant Index::data(const QModelIndex &index, int role) const
|
|||||||
switch (role)
|
switch (role)
|
||||||
{
|
{
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
switch (index.column())
|
if (index.column() == 0) {
|
||||||
{
|
return list->humanReadable();
|
||||||
case 0: return list->humanReadable();
|
} else {
|
||||||
default: break;
|
break;
|
||||||
}
|
}
|
||||||
case UidRole: return list->uid();
|
case UidRole: return list->uid();
|
||||||
case NameRole: return list->name();
|
case NameRole: return list->name();
|
||||||
|
@ -328,6 +328,9 @@ QVariant AccountList::data(const QModelIndex &index, int role) const
|
|||||||
case AccountState::Gone: {
|
case AccountState::Gone: {
|
||||||
return tr("Gone", "Account status");
|
return tr("Gone", "Account status");
|
||||||
}
|
}
|
||||||
|
default: {
|
||||||
|
return tr("Unknown", "Account status");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,11 +357,12 @@ QVariant AccountList::data(const QModelIndex &index, int role) const
|
|||||||
return QVariant::fromValue(account);
|
return QVariant::fromValue(account);
|
||||||
|
|
||||||
case Qt::CheckStateRole:
|
case Qt::CheckStateRole:
|
||||||
switch (index.column())
|
if (index.column() == ProfileNameColumn) {
|
||||||
{
|
return account == m_defaultAccount ? Qt::Checked : Qt::Unchecked;
|
||||||
case ProfileNameColumn:
|
} else {
|
||||||
return account == m_defaultAccount ? Qt::Checked : Qt::Unchecked;
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
@ -273,6 +273,7 @@ void Yggdrasil::processReply() {
|
|||||||
AccountTaskState::STATE_FAILED_GONE,
|
AccountTaskState::STATE_FAILED_GONE,
|
||||||
tr("The Mojang account no longer exists. It may have been migrated to a Microsoft account.")
|
tr("The Mojang account no longer exists. It may have been migrated to a Microsoft account.")
|
||||||
);
|
);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
changeState(
|
changeState(
|
||||||
|
@ -74,6 +74,7 @@ std::pair<int, bool> DataPack::compare(const Resource& other, SortType type) con
|
|||||||
auto res = Resource::compare(other, type);
|
auto res = Resource::compare(other, type);
|
||||||
if (res.first != 0)
|
if (res.first != 0)
|
||||||
return res;
|
return res;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case SortType::PACK_FORMAT: {
|
case SortType::PACK_FORMAT: {
|
||||||
auto this_ver = packFormat();
|
auto this_ver = packFormat();
|
||||||
@ -83,6 +84,7 @@ std::pair<int, bool> DataPack::compare(const Resource& other, SortType type) con
|
|||||||
return { 1, type == SortType::PACK_FORMAT };
|
return { 1, type == SortType::PACK_FORMAT };
|
||||||
if (this_ver < other_ver)
|
if (this_ver < other_ver)
|
||||||
return { -1, type == SortType::PACK_FORMAT };
|
return { -1, type == SortType::PACK_FORMAT };
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { 0, false };
|
return { 0, false };
|
||||||
|
@ -89,6 +89,7 @@ std::pair<int, bool> Mod::compare(const Resource& other, SortType type) const
|
|||||||
auto res = Resource::compare(other, type);
|
auto res = Resource::compare(other, type);
|
||||||
if (res.first != 0)
|
if (res.first != 0)
|
||||||
return res;
|
return res;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case SortType::VERSION: {
|
case SortType::VERSION: {
|
||||||
auto this_ver = Version(version());
|
auto this_ver = Version(version());
|
||||||
@ -97,11 +98,13 @@ std::pair<int, bool> Mod::compare(const Resource& other, SortType type) const
|
|||||||
return { 1, type == SortType::VERSION };
|
return { 1, type == SortType::VERSION };
|
||||||
if (this_ver < other_ver)
|
if (this_ver < other_ver)
|
||||||
return { -1, type == SortType::VERSION };
|
return { -1, type == SortType::VERSION };
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case SortType::PROVIDER: {
|
case SortType::PROVIDER: {
|
||||||
auto compare_result = QString::compare(provider().value_or("Unknown"), cast_other->provider().value_or("Unknown"), Qt::CaseInsensitive);
|
auto compare_result = QString::compare(provider().value_or("Unknown"), cast_other->provider().value_or("Unknown"), Qt::CaseInsensitive);
|
||||||
if (compare_result != 0)
|
if (compare_result != 0)
|
||||||
return { compare_result, type == SortType::PROVIDER };
|
return { compare_result, type == SortType::PROVIDER };
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { 0, false };
|
return { 0, false };
|
||||||
|
@ -71,6 +71,7 @@ std::pair<int, bool> Resource::compare(const Resource& other, SortType type) con
|
|||||||
return { 1, type == SortType::ENABLED };
|
return { 1, type == SortType::ENABLED };
|
||||||
if (!enabled() && other.enabled())
|
if (!enabled() && other.enabled())
|
||||||
return { -1, type == SortType::ENABLED };
|
return { -1, type == SortType::ENABLED };
|
||||||
|
break;
|
||||||
case SortType::NAME: {
|
case SortType::NAME: {
|
||||||
QString this_name{ name() };
|
QString this_name{ name() };
|
||||||
QString other_name{ other.name() };
|
QString other_name{ other.name() };
|
||||||
@ -81,12 +82,14 @@ std::pair<int, bool> Resource::compare(const Resource& other, SortType type) con
|
|||||||
auto compare_result = QString::compare(this_name, other_name, Qt::CaseInsensitive);
|
auto compare_result = QString::compare(this_name, other_name, Qt::CaseInsensitive);
|
||||||
if (compare_result != 0)
|
if (compare_result != 0)
|
||||||
return { compare_result, type == SortType::NAME };
|
return { compare_result, type == SortType::NAME };
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case SortType::DATE:
|
case SortType::DATE:
|
||||||
if (dateTimeChanged() > other.dateTimeChanged())
|
if (dateTimeChanged() > other.dateTimeChanged())
|
||||||
return { 1, type == SortType::DATE };
|
return { 1, type == SortType::DATE };
|
||||||
if (dateTimeChanged() < other.dateTimeChanged())
|
if (dateTimeChanged() < other.dateTimeChanged())
|
||||||
return { -1, type == SortType::DATE };
|
return { -1, type == SortType::DATE };
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return { 0, false };
|
return { 0, false };
|
||||||
|
@ -95,6 +95,7 @@ std::pair<int, bool> ResourcePack::compare(const Resource& other, SortType type)
|
|||||||
auto res = Resource::compare(other, type);
|
auto res = Resource::compare(other, type);
|
||||||
if (res.first != 0)
|
if (res.first != 0)
|
||||||
return res;
|
return res;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case SortType::PACK_FORMAT: {
|
case SortType::PACK_FORMAT: {
|
||||||
auto this_ver = packFormat();
|
auto this_ver = packFormat();
|
||||||
@ -104,6 +105,7 @@ std::pair<int, bool> ResourcePack::compare(const Resource& other, SortType type)
|
|||||||
return { 1, type == SortType::PACK_FORMAT };
|
return { 1, type == SortType::PACK_FORMAT };
|
||||||
if (this_ver < other_ver)
|
if (this_ver < other_ver)
|
||||||
return { -1, type == SortType::PACK_FORMAT };
|
return { -1, type == SortType::PACK_FORMAT };
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { 0, false };
|
return { 0, false };
|
||||||
|
@ -470,8 +470,9 @@ void FlameCreationTask::setupDownloadJob(QEventLoop& loop)
|
|||||||
switch (result.type) {
|
switch (result.type) {
|
||||||
case Flame::File::Type::Folder: {
|
case Flame::File::Type::Folder: {
|
||||||
logWarning(tr("This 'Folder' may need extracting: %1").arg(relpath));
|
logWarning(tr("This 'Folder' may need extracting: %1").arg(relpath));
|
||||||
// fall-through intentional, we treat these as plain old mods and dump them wherever.
|
// fallthrough intentional, we treat these as plain old mods and dump them wherever.
|
||||||
}
|
}
|
||||||
|
/* fallthrough */
|
||||||
case Flame::File::Type::SingleFile:
|
case Flame::File::Type::SingleFile:
|
||||||
case Flame::File::Type::Mod: {
|
case Flame::File::Type::Mod: {
|
||||||
if (!result.url.isEmpty()) {
|
if (!result.url.isEmpty()) {
|
||||||
|
@ -455,6 +455,7 @@ QVariant TranslationsModel::data(const QModelIndex& index, int role) const
|
|||||||
return QString("%1%").arg(lang.percentTranslated(), 3, 'f', 1);
|
return QString("%1%").arg(lang.percentTranslated(), 3, 'f', 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
qWarning("TranslationModel::data not implemented when role is DisplayRole");
|
||||||
}
|
}
|
||||||
case Qt::ToolTipRole:
|
case Qt::ToolTipRole:
|
||||||
{
|
{
|
||||||
|
@ -248,8 +248,8 @@ bool AccessibleInstanceView::selectColumn(int column)
|
|||||||
if (view()->selectionBehavior() != QAbstractItemView::SelectColumns && rowCount() > 1) {
|
if (view()->selectionBehavior() != QAbstractItemView::SelectColumns && rowCount() > 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// fallthrough intentional
|
|
||||||
}
|
}
|
||||||
|
/* fallthrough */
|
||||||
case QAbstractItemView::ContiguousSelection: {
|
case QAbstractItemView::ContiguousSelection: {
|
||||||
if ((!column || !view()->selectionModel()->isColumnSelected(column - 1, view()->rootIndex())) && !view()->selectionModel()->isColumnSelected(column + 1, view()->rootIndex())) {
|
if ((!column || !view()->selectionModel()->isColumnSelected(column - 1, view()->rootIndex())) && !view()->selectionModel()->isColumnSelected(column + 1, view()->rootIndex())) {
|
||||||
view()->clearSelection();
|
view()->clearSelection();
|
||||||
|
@ -339,6 +339,7 @@ void WorldListPage::mceditState(LoggedProcess::State state)
|
|||||||
{
|
{
|
||||||
failed = true;
|
failed = true;
|
||||||
}
|
}
|
||||||
|
/* fallthrough */
|
||||||
case LoggedProcess::Running:
|
case LoggedProcess::Running:
|
||||||
case LoggedProcess::Finished:
|
case LoggedProcess::Finished:
|
||||||
{
|
{
|
||||||
|
@ -69,6 +69,7 @@ bool JavaWizardPage::validatePage()
|
|||||||
case JavaSettingsWidget::ValidationStatus::AllOK:
|
case JavaSettingsWidget::ValidationStatus::AllOK:
|
||||||
{
|
{
|
||||||
settings->set("JavaPath", m_java_widget->javaPath());
|
settings->set("JavaPath", m_java_widget->javaPath());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
case JavaSettingsWidget::ValidationStatus::JavaBad:
|
case JavaSettingsWidget::ValidationStatus::JavaBad:
|
||||||
{
|
{
|
||||||
|
@ -89,8 +89,10 @@ void FourBytes_MurmurHash2(const unsigned char* data, IncrementalHashInfo& prev)
|
|||||||
switch (prev.len) {
|
switch (prev.len) {
|
||||||
case 3:
|
case 3:
|
||||||
prev.h ^= data[2] << 16;
|
prev.h ^= data[2] << 16;
|
||||||
|
/* fall through */
|
||||||
case 2:
|
case 2:
|
||||||
prev.h ^= data[1] << 8;
|
prev.h ^= data[1] << 8;
|
||||||
|
/* fall through */
|
||||||
case 1:
|
case 1:
|
||||||
prev.h ^= data[0];
|
prev.h ^= data[0];
|
||||||
prev.h *= m;
|
prev.h *= m;
|
||||||
|
Loading…
Reference in New Issue
Block a user