Indent fixing!

This commit is contained in:
robotbrainify 2013-10-12 13:59:14 -04:00
parent 4c64c3c612
commit c7cc32f1d4

View File

@ -41,7 +41,7 @@ void MCModInfoFrame::updateWithMod(Mod &m)
setModDescription(tr("No description provided in mcmod.info")); setModDescription(tr("No description provided in mcmod.info"));
} }
else else
{ {
setModDescription(m.description()); setModDescription(m.description());
} }
} }
@ -71,40 +71,40 @@ void MCModInfoFrame::setModText(QString text)
void MCModInfoFrame::setModDescription(QString text) void MCModInfoFrame::setModDescription(QString text)
{ {
ui->label_ModDescription->setToolTip(""); ui->label_ModDescription->setToolTip("");
QString intermediatetext = text.trimmed(); QString intermediatetext = text.trimmed();
bool prev(false); bool prev(false);
QChar rem('\n'); QChar rem('\n');
QString finaltext; QString finaltext;
finaltext.reserve(intermediatetext.size()); finaltext.reserve(intermediatetext.size());
foreach(const QChar& c, intermediatetext) foreach(const QChar& c, intermediatetext)
{ {
if(c == rem && prev){ if(c == rem && prev){
continue; continue;
} }
prev = c == rem; prev = c == rem;
finaltext += c; finaltext += c;
} }
QString labeltext; QString labeltext;
labeltext.reserve(300); labeltext.reserve(300);
if(finaltext.length() > 290) if(finaltext.length() > 290)
{ {
ui->label_ModDescription->setOpenExternalLinks(false); ui->label_ModDescription->setOpenExternalLinks(false);
ui->label_ModDescription->setTextFormat(Qt::TextFormat::RichText); ui->label_ModDescription->setTextFormat(Qt::TextFormat::RichText);
desc = text; desc = text;
labeltext.append("<html><body>" + finaltext.left(287) + "<a href=\"#mod_desc\">...</a></body></html>"); labeltext.append("<html><body>" + finaltext.left(287) + "<a href=\"#mod_desc\">...</a></body></html>");
QObject::connect(ui->label_ModDescription, &QLabel::linkActivated, this, &MCModInfoFrame::modDescEllipsisHandler); QObject::connect(ui->label_ModDescription, &QLabel::linkActivated, this, &MCModInfoFrame::modDescEllipsisHandler);
} }
else else
{ {
ui->label_ModDescription->setTextFormat(Qt::TextFormat::PlainText); ui->label_ModDescription->setTextFormat(Qt::TextFormat::PlainText);
labeltext.append(finaltext); labeltext.append(finaltext);
} }
ui->label_ModDescription->setText(labeltext); ui->label_ModDescription->setText(labeltext);
} }
void MCModInfoFrame::modDescEllipsisHandler(const QString &link) void MCModInfoFrame::modDescEllipsisHandler(const QString &link)
{ {
QMessageBox msgbox; QMessageBox msgbox;
msgbox.setText(desc); msgbox.setText(desc);
msgbox.exec(); msgbox.exec();
} }