Gui: Use auto and range-based for (#7481)
* On lines where the variable type is obvious from inspection, avoid repeating the type using auto. * When possible use a ranged for loop instead of begin() and end() iterators
This commit is contained in:
@@ -68,7 +68,7 @@ public:
|
||||
|
||||
// allow to customize text position and color
|
||||
const std::map<std::string,std::string>& cfg = App::GetApplication().Config();
|
||||
std::map<std::string,std::string>::const_iterator al = cfg.find("SplashAlignment");
|
||||
auto al = cfg.find("SplashAlignment");
|
||||
if (al != cfg.end()) {
|
||||
QString alt = QString::fromLatin1(al->second.c_str());
|
||||
int align=0;
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
}
|
||||
|
||||
// choose text color
|
||||
std::map<std::string,std::string>::const_iterator tc = cfg.find("SplashTextColor");
|
||||
auto tc = cfg.find("SplashTextColor");
|
||||
if (tc != cfg.end()) {
|
||||
QColor col; col.setNamedColor(QString::fromLatin1(tc->second.c_str()));
|
||||
if (col.isValid())
|
||||
@@ -390,11 +390,11 @@ void AboutDialog::showCredits()
|
||||
return;
|
||||
}
|
||||
|
||||
QWidget* tab_credits = new QWidget();
|
||||
auto tab_credits = new QWidget();
|
||||
tab_credits->setObjectName(QString::fromLatin1("tab_credits"));
|
||||
ui->tabWidget->addTab(tab_credits, tr("Credits"));
|
||||
QVBoxLayout* hlayout = new QVBoxLayout(tab_credits);
|
||||
QTextBrowser* textField = new QTextBrowser(tab_credits);
|
||||
auto hlayout = new QVBoxLayout(tab_credits);
|
||||
auto textField = new QTextBrowser(tab_credits);
|
||||
textField->setOpenExternalLinks(false);
|
||||
textField->setOpenLinks(false);
|
||||
hlayout->addWidget(textField);
|
||||
@@ -442,11 +442,11 @@ void AboutDialog::showLicenseInformation()
|
||||
|
||||
ui->tabWidget->removeTab(1); // Hide the license placeholder widget
|
||||
|
||||
QWidget* tab_license = new QWidget();
|
||||
auto tab_license = new QWidget();
|
||||
tab_license->setObjectName(QString::fromLatin1("tab_license"));
|
||||
ui->tabWidget->addTab(tab_license, tr("License"));
|
||||
QVBoxLayout* hlayout = new QVBoxLayout(tab_license);
|
||||
QTextBrowser* textField = new QTextBrowser(tab_license);
|
||||
auto hlayout = new QVBoxLayout(tab_license);
|
||||
auto textField = new QTextBrowser(tab_license);
|
||||
textField->setOpenExternalLinks(true);
|
||||
textField->setOpenLinks(true);
|
||||
hlayout->addWidget(textField);
|
||||
@@ -481,11 +481,11 @@ QString AboutDialog::getAdditionalLicenseInformation() const
|
||||
|
||||
void AboutDialog::showLibraryInformation()
|
||||
{
|
||||
QWidget *tab_library = new QWidget();
|
||||
auto tab_library = new QWidget();
|
||||
tab_library->setObjectName(QString::fromLatin1("tab_library"));
|
||||
ui->tabWidget->addTab(tab_library, tr("Libraries"));
|
||||
QVBoxLayout* hlayout = new QVBoxLayout(tab_library);
|
||||
QTextBrowser* textField = new QTextBrowser(tab_library);
|
||||
auto hlayout = new QVBoxLayout(tab_library);
|
||||
auto textField = new QTextBrowser(tab_library);
|
||||
textField->setOpenExternalLinks(false);
|
||||
textField->setOpenLinks(false);
|
||||
hlayout->addWidget(textField);
|
||||
@@ -648,11 +648,11 @@ void AboutDialog::showCollectionInformation()
|
||||
if (!QFile::exists(path))
|
||||
return;
|
||||
|
||||
QWidget *tab_collection = new QWidget();
|
||||
auto tab_collection = new QWidget();
|
||||
tab_collection->setObjectName(QString::fromLatin1("tab_collection"));
|
||||
ui->tabWidget->addTab(tab_collection, tr("Collection"));
|
||||
QVBoxLayout* hlayout = new QVBoxLayout(tab_collection);
|
||||
QTextBrowser* textField = new QTextBrowser(tab_collection);
|
||||
auto hlayout = new QVBoxLayout(tab_collection);
|
||||
auto textField = new QTextBrowser(tab_collection);
|
||||
textField->setOpenExternalLinks(true);
|
||||
hlayout->addWidget(textField);
|
||||
textField->setSource(path);
|
||||
@@ -660,7 +660,7 @@ void AboutDialog::showCollectionInformation()
|
||||
|
||||
void AboutDialog::linkActivated(const QUrl& link)
|
||||
{
|
||||
LicenseView* licenseView = new LicenseView();
|
||||
auto licenseView = new LicenseView();
|
||||
licenseView->setAttribute(Qt::WA_DeleteOnClose);
|
||||
licenseView->show();
|
||||
QString title = tr("License");
|
||||
|
||||
Reference in New Issue
Block a user