Skip to content

Commit

Permalink
refactor: clean up style on widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
sithlord48 committed Jun 14, 2024
1 parent e349a77 commit cb56cd5
Show file tree
Hide file tree
Showing 10 changed files with 402 additions and 427 deletions.
404 changes: 208 additions & 196 deletions src/widgets/data/CharEditor.cpp

Large diffs are not rendered by default.

19 changes: 8 additions & 11 deletions src/widgets/data/ChocoboEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ void ChocoboEditor::updateText()
};

if (combo_rating->count() != 0) {
for (int i = 0; i < typelist.count(); i++) {
for (int i = 0; i < typelist.count(); i++)
combo_rating->setItemText(i, typelist.at(i));
}
} else {
combo_rating->addItems(typelist);
}
Expand Down Expand Up @@ -193,7 +192,7 @@ ChocoboEditor::ChocoboEditor(QWidget *parent) :
Final->addWidget(lblSpeedWarning, 8, 0, 2, 2, Qt::AlignCenter);
Final->addWidget(advancedModeBox, 10, 0, 1, 2);
Final->addItem(new QSpacerItem(0, 0, QSizePolicy::Preferred, QSizePolicy::Expanding), 11, 0, 1, 2);
this->setLayout(Final);
setLayout(Final);
init_connections();
}

Expand Down Expand Up @@ -320,15 +319,14 @@ void ChocoboEditor::SetChocobo(FF7CHOCOBO choco, const QString &Processed_Name,
}
void ChocoboEditor::getRank(void)
{
if (choco_data.raceswon < 3) {
if (choco_data.raceswon < 3)
lbl_rank->setText(tr("Rank: C"));
} else if (choco_data.raceswon < 6) {
else if (choco_data.raceswon < 6)
lbl_rank->setText(tr("Rank: B"));
} else if (choco_data.raceswon < 9) {
else if (choco_data.raceswon < 9)
lbl_rank->setText(tr("Rank: A"));
} else {
else
lbl_rank->setText(tr("Rank: S"));
}
}

void ChocoboEditor::setAdvancedMode(bool advancedMode)
Expand Down Expand Up @@ -464,11 +462,10 @@ void ChocoboEditor::setName(const QString &newName)
{
if (choco_name != newName) {
choco_name = newName.mid(0, 6);
if (choco_name.startsWith(QString("\xff"), Qt::CaseInsensitive) || choco_name == QString(6, '\x20')) {
if (choco_name.startsWith(QString("\xff"), Qt::CaseInsensitive) || choco_name == QString(6, '\x20'))
line_name->setText(QString());
} else {
else
line_name->setText(choco_name);
}
}
}

Expand Down
35 changes: 16 additions & 19 deletions src/widgets/data/ChocoboLabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,12 @@ ChocoboLabel::ChocoboLabel(const QString &titleText, bool occupied, QWidget *par
void ChocoboLabel::setType(int type)
{
switch (type) {
case 0: lblType->setPixmap(QPixmap("://chocobo/yellow")); break;
case 1: lblType->setPixmap(QPixmap("://chocobo/green")); break;
case 2: lblType->setPixmap(QPixmap("://chocobo/blue")); break;
case 3: lblType->setPixmap(QPixmap("://chocobo/black")); break;
case 4: lblType->setPixmap(QPixmap("://chocobo/gold")); break;
default: lblType->setPixmap(QPixmap()); break;
case 0: lblType->setPixmap(QPixmap("://chocobo/yellow")); break;
case 1: lblType->setPixmap(QPixmap("://chocobo/green")); break;
case 2: lblType->setPixmap(QPixmap("://chocobo/blue")); break;
case 3: lblType->setPixmap(QPixmap("://chocobo/black")); break;
case 4: lblType->setPixmap(QPixmap("://chocobo/gold")); break;
default: lblType->setPixmap(QPixmap()); break;
}
}

Expand All @@ -178,38 +178,35 @@ void ChocoboLabel::setName(QString decodedName)

void ChocoboLabel::setSex(bool male)
{
if (male) {
if (male)
lblSex->setText(QString::fromUtf8(""));
} else {
else
lblSex->setText(QString::fromUtf8(""));
}
}

void ChocoboLabel::setSex(int sex)
{
if (sex == 0) {
if (sex == 0)
lblSex->setText(QString::fromUtf8(""));
} else if (sex == 1) {
else if (sex == 1)
lblSex->setText(QString::fromUtf8(""));
} else {
else
lblSex->setText(QString());
}
}

void ChocoboLabel::setRank(int wins)
{
m_wins = wins;
if (wins < 0) {
if (wins < 0)
lblRank->setText(QString());
} else if (wins < 3) {
else if (wins < 3)
lblRank->setText(tr("Rank:C"));
} else if (wins < 6) {
else if (wins < 6)
lblRank->setText(tr("Rank:B"));
} else if (wins < 9) {
else if (wins < 9)
lblRank->setText(tr("Rank:A"));
} else {
else
lblRank->setText(tr("Rank:S"));
}
}

void ChocoboLabel::setOccupied(bool occupied)
Expand Down
Loading

0 comments on commit cb56cd5

Please sign in to comment.