Commit cb5cf063 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use auto directly

parent d71b886e
......@@ -100,7 +100,7 @@ void KernelAnalyzerTest::testUbuntuDmesg()
KSystemLogConfig::setDeleteDuplicatedLines(false);
LogMode *logMode = Globals::instance().findLogMode(QStringLiteral("kernelLogMode"));
auto *kernelAnalyzer = new KernelAnalyzerLocalReader(logMode);
auto kernelAnalyzer = new KernelAnalyzerLocalReader(logMode);
LogViewModel *model = testUtil.defineLogViewModel(kernelAnalyzer);
QVERIFY(kernelAnalyzer);
......@@ -134,7 +134,7 @@ void KernelAnalyzerTest::testSuseDmesg()
KSystemLogConfig::setDeleteDuplicatedLines(false);
LogMode *logMode = Globals::instance().findLogMode(QStringLiteral("kernelLogMode"));
auto *kernelAnalyzer = new KernelAnalyzerLocalReader(logMode);
auto kernelAnalyzer = new KernelAnalyzerLocalReader(logMode);
LogViewModel *model = testUtil.defineLogViewModel(kernelAnalyzer);
QVERIFY(kernelAnalyzer);
......
......@@ -56,7 +56,7 @@ void KioLogFileReaderTest::testKioLogFileReader()
QString fixturePath = QFINDTESTDATA("testFiles/logFileReader/file.txt");
LogFile logFile(QUrl::fromLocalFile(fixturePath), Globals::instance().informationLogLevel());
auto *logFileReader = new KioLogFileReader(logFile);
auto logFileReader = new KioLogFileReader(logFile);
logFileReader->open();
connect(logFileReader, &KioLogFileReader::lineRead, this, [=](const QString &line) {
......
......@@ -60,8 +60,8 @@ void TestUtil::registerLogModeFactories() const
LogViewModel *TestUtil::defineLogViewModel(Analyzer *analyzer) const
{
auto *logViewWidget = new LogViewWidget();
auto *model = new LogViewModel(logViewWidget);
auto logViewWidget = new LogViewWidget();
auto model = new LogViewModel(logViewWidget);
analyzer->setLogViewModel(model);
......
......@@ -61,7 +61,7 @@ LevelPrintPage::LevelPrintPage(QWidget *parent)
const auto logLevels = Globals::instance().logLevels();
for (LogLevel *level : logLevels) {
auto *button = new QCheckBox(level->name(), this); //, m_btnGroup, 0
auto button = new QCheckBox(level->name(), this); //, m_btnGroup, 0
mLevelCheckBoxes.append(button);
mBtnGroup->addButton(button, level->id());
......
......@@ -32,11 +32,11 @@
LoadingBar::LoadingBar(QWidget *parent)
: QWidget(parent)
{
auto *widgetLayout = new QHBoxLayout(this);
auto widgetLayout = new QHBoxLayout(this);
widgetLayout->addStretch();
auto *layout = new QVBoxLayout();
auto layout = new QVBoxLayout();
widgetLayout->addLayout(layout);
widgetLayout->addStretch();
......
......@@ -87,7 +87,7 @@ LogModeConfiguration *LogMode::innerConfiguration() const
QAction *LogMode::createDefaultAction()
{
auto *action = new QAction(d->icon, d->name, this);
auto action = new QAction(d->icon, d->name, this);
ActionData data;
data.id = d->id;
action->setData(QVariant::fromValue(data));
......
......@@ -61,7 +61,7 @@ void LogViewExport::sendMail()
int i = 0;
QTreeWidgetItemIterator it(mLogViewWidget, QTreeWidgetItemIterator::Selected);
while (*it) {
auto *item = static_cast<LogViewWidgetItem *>(*it);
auto item = static_cast<LogViewWidgetItem *>(*it);
body += item->logLine()->exportToText();
body += QLatin1Char('\n');
......@@ -114,7 +114,7 @@ void LogViewExport::print(QPrinter *printer)
QTreeWidgetItemIterator it(mLogViewWidget, QTreeWidgetItemIterator::Selected);
while (*it) {
auto *item = static_cast<LogViewWidgetItem *>(*it);
auto item = static_cast<LogViewWidgetItem *>(*it);
const QString body = item->logLine()->exportToText();
painter.setPen(originalPen);
painter.drawText(printView, Qt::AlignLeft | Qt::TextWordWrap, body);
......@@ -153,7 +153,7 @@ void LogViewExport::printSelection()
*/
// initialize the printer using the print dialog
auto *printDialog = new QPrintDialog(&printer, mParent);
auto printDialog = new QPrintDialog(&printer, mParent);
if (!printDialog->exec()) {
delete printDialog;
return;
......@@ -198,7 +198,7 @@ void LogViewExport::copyToClipboard()
QTreeWidgetItemIterator it(mLogViewWidget, QTreeWidgetItemIterator::Selected);
while (*it) {
auto *item = static_cast<LogViewWidgetItem *>(*it);
auto item = static_cast<LogViewWidgetItem *>(*it);
// Copy the item content to the text string
text.append(item->logLine()->exportToText());
......@@ -239,7 +239,7 @@ void LogViewExport::fileSave()
return;
}
auto *ioDev = new QFile(filename);
auto ioDev = new QFile(filename);
if (ioDev->open(QIODevice::WriteOnly)) {
QTextStream stream(ioDev);
......@@ -247,7 +247,7 @@ void LogViewExport::fileSave()
int nbCopied = 0;
while (*it) {
auto *item = static_cast<LogViewWidgetItem *>(*it);
auto item = static_cast<LogViewWidgetItem *>(*it);
// Copy the item content to the stream
stream << item->logLine()->exportToText() << '\n';
......
......@@ -102,7 +102,7 @@ bool LogViewWidgetSearchLine::itemMatches(const QTreeWidgetItem *item, const QSt
LogViewFilterWidget::LogViewFilterWidget(QWidget *parent)
: QWidget(parent)
{
auto *filterBarLayout = new QHBoxLayout(this);
auto filterBarLayout = new QHBoxLayout(this);
filterBarLayout->setContentsMargins(0, 0, 0, 0);
mFilterLine = new LogViewWidgetSearchLine();
......@@ -111,12 +111,12 @@ LogViewFilterWidget::LogViewFilterWidget(QWidget *parent)
mFilterLine->setWhatsThis(i18n("Allows you to only list items that match the content of this text."));
mFilterLine->setPlaceholderText(i18n("Enter your search here..."));
auto *filterIcon = new QLabel();
auto filterIcon = new QLabel();
filterIcon->setPixmap(QIcon::fromTheme(QStringLiteral("view-filter")).pixmap(style()->pixelMetric(QStyle::PM_SmallIconSize)));
filterIcon->setBuddy(mFilterLine);
filterBarLayout->addWidget(filterIcon);
auto *filterLabel = new QLabel(i18n("Filter:"));
auto filterLabel = new QLabel(i18n("Filter:"));
filterLabel->setBuddy(mFilterLine);
filterBarLayout->addWidget(filterLabel);
......@@ -127,7 +127,7 @@ LogViewFilterWidget::LogViewFilterWidget(QWidget *parent)
filterBarLayout->addWidget(mFilterList);
mPrioritiesComboBox = new QComboBox(this);
auto *delegate = new ComboBoxDelegate(mPrioritiesComboBox);
auto delegate = new ComboBoxDelegate(mPrioritiesComboBox);
mPrioritiesComboBox->setItemDelegate(delegate);
filterBarLayout->addWidget(mPrioritiesComboBox);
......@@ -136,7 +136,7 @@ LogViewFilterWidget::LogViewFilterWidget(QWidget *parent)
mPrioritiesModel = new QStandardItemModel(mPrioritiesComboBox);
mPrioritiesComboBox->setModel(mPrioritiesModel);
auto *item = new QStandardItem(i18n("Select priorities"));
auto item = new QStandardItem(i18n("Select priorities"));
item->setSelectable(false);
mPrioritiesModel->appendRow(item);
connect(mPrioritiesModel, &QStandardItemModel::itemChanged, this, &LogViewFilterWidget::prioritiesChanged);
......@@ -146,7 +146,7 @@ LogViewFilterWidget::LogViewFilterWidget(QWidget *parent)
const int id = metaEnum.value(i);
LogLevel *logLevel = Globals::instance().logLevelByPriority(id);
auto *item = new QStandardItem(logLevel->name());
auto item = new QStandardItem(logLevel->name());
item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
item->setData(Qt::Checked, Qt::CheckStateRole);
item->setData(metaEnum.value(i), Qt::UserRole);
......
......@@ -209,7 +209,7 @@ void LogViewModel::removeOldestLogLine()
void LogViewModel::insert(LogLine *line)
{
// The item is automatically added to the LogViewWidget
auto *item = new LogViewWidgetItem(mLogViewWidget, line);
auto item = new LogViewWidgetItem(mLogViewWidget, line);
// Update the oldest item
if (!mOldestItem) {
......
......@@ -136,7 +136,7 @@ void LogViewSearchWidget::internalFind(LogViewWidgetItem *fromItem, Direction di
// Go to the selected position + 1 (if we already found an item)
if (fromItem) {
while (*it) {
auto *item = static_cast<LogViewWidgetItem *>(*it);
auto item = static_cast<LogViewWidgetItem *>(*it);
if (item == fromItem) {
iteratorJump(it, direction);
......@@ -149,7 +149,7 @@ void LogViewSearchWidget::internalFind(LogViewWidgetItem *fromItem, Direction di
// Iterates to fromItem +1 to the last item of the list
while (*it) {
auto *item = static_cast<LogViewWidgetItem *>(*it);
auto item = static_cast<LogViewWidgetItem *>(*it);
bool found = findItem(item);
if (found) {
......@@ -294,7 +294,7 @@ void LogViewSearchWidget::highlightAll()
logDebug() << "Highlighting all";
QTreeWidgetItemIterator it(mLogViewWidget, QTreeWidgetItemIterator::All);
while (*it) {
auto *item = static_cast<LogViewWidgetItem *>(*it);
auto item = static_cast<LogViewWidgetItem *>(*it);
if (compareItem(item)) {
item->setBackground(item->columnCount() - 1, QColor(255, 255, 16 * 8 + 11));
......@@ -313,7 +313,7 @@ void LogViewSearchWidget::unlightAll()
QTreeWidgetItemIterator it(mLogViewWidget, QTreeWidgetItemIterator::All);
while (*it) {
auto *item = static_cast<LogViewWidgetItem *>(*it);
auto item = static_cast<LogViewWidgetItem *>(*it);
// We retrieve the default column background using the first column data, where the background never
// changes
......
......@@ -108,7 +108,7 @@ void LogViewWidget::setColumns(const LogViewColumns &columns)
const auto columnsLst = columns.columns();
for (const LogViewColumn &column : columnsLst) {
auto *action = new QAction(this);
auto action = new QAction(this);
action->setText(column.columnName());
// helloAction->setIcon(QIcon::fromTheme( QLatin1String( "media-playback-start" )));
// helloAction->setShortcut(Qt::CTRL | Qt::Key_M);
......@@ -155,7 +155,7 @@ QList<LogLine *> LogViewWidget::logLines()
QTreeWidgetItemIterator it(this);
while (*it) {
auto *item = static_cast<LogViewWidgetItem *>(*it);
auto item = static_cast<LogViewWidgetItem *>(*it);
logLines.append(item->logLine());
++it;
}
......@@ -169,7 +169,7 @@ LogViewWidgetItem *LogViewWidget::findNewestItem()
QTreeWidgetItemIterator it(this);
while (*it) {
auto *item = static_cast<LogViewWidgetItem *>(*it);
auto item = static_cast<LogViewWidgetItem *>(*it);
if (!newestItem || newestItem->logLine()->isOlderThan(*(item->logLine()))) {
newestItem = item;
}
......@@ -184,7 +184,7 @@ LogViewWidgetItem *LogViewWidget::findItem(LogLine *searchedLogLine)
{
QTreeWidgetItemIterator it(this);
while (*it) {
auto *item = static_cast<LogViewWidgetItem *>(*it);
auto item = static_cast<LogViewWidgetItem *>(*it);
if (item->logLine()->equals(*searchedLogLine)) {
return item;
}
......@@ -265,7 +265,7 @@ void LogViewWidget::toggleToolTip(bool enabled)
QTreeWidgetItemIterator it(this);
while (*it) {
auto *item = static_cast<LogViewWidgetItem *>(*it);
auto item = static_cast<LogViewWidgetItem *>(*it);
item->toggleToolTip(enabled);
++it;
......
......@@ -46,7 +46,7 @@
View::View(QWidget *parent)
: QWidget(parent)
{
auto *topLayout = new QVBoxLayout(this);
auto topLayout = new QVBoxLayout(this);
topLayout->setContentsMargins(2, 2, 2, 2);
topLayout->setSpacing(2);
......
......@@ -180,7 +180,7 @@ void MainWindow::prepareCreatedLogManager(LogManager *manager)
manager->usedView()->logViewWidget()->addAction(mReloadAction);
manager->usedView()->logViewWidget()->addAction(mSelectAllAction);
auto *separator = new QAction(this);
auto separator = new QAction(this);
separator->setSeparator(true);
manager->usedView()->logViewWidget()->addAction(separator);
......@@ -646,7 +646,7 @@ void MainWindow::setupActions()
mTabs->addAction(duplicateTabAction);
actionCollection()->setDefaultShortcut(duplicateTabAction, Qt::SHIFT | Qt::CTRL | Qt::Key_N);
auto *separatorAction = new QAction(this);
auto separatorAction = new QAction(this);
separatorAction->setSeparator(true);
mTabs->addAction(separatorAction);
......@@ -720,7 +720,7 @@ void MainWindow::setupActions()
void MainWindow::selectLogModeAction(bool)
{
auto *action = qobject_cast<QAction *>(sender());
auto action = qobject_cast<QAction *>(sender());
ActionData actionData = action->data().value<ActionData>();
QString selectedModeId = actionData.id;
......@@ -760,8 +760,8 @@ void MainWindow::setupLogModeMenu()
int serviceItems = 0;
int othersItems = 0;
auto *servicesAction = new KActionMenu(QIcon::fromTheme(QStringLiteral("preferences-system-session-services")), i18n("Services"), this);
auto *othersAction = new KActionMenu(QIcon::fromTheme(QStringLiteral("preferences-other")), i18n("Others"), this);
auto servicesAction = new KActionMenu(QIcon::fromTheme(QStringLiteral("preferences-system-session-services")), i18n("Services"), this);
auto othersAction = new KActionMenu(QIcon::fromTheme(QStringLiteral("preferences-other")), i18n("Others"), this);
foreach (LogModeAction *logModeAction, Globals::instance().logModeActions()) {
if (logModeAction->category() == LogModeAction::RootCategory) {
......
......@@ -24,7 +24,7 @@
AcpidConfigurationWidget::AcpidConfigurationWidget()
: LogModeConfigurationWidget(i18n("Acpid Log"), QStringLiteral(ACPID_MODE_ICON), i18n("Acpid Log"))
{
auto *layout = new QHBoxLayout(this);
auto layout = new QHBoxLayout(this);
mFileList = new FileList(this, i18n("<p>These files will be analyzed to show the <b>Acpid log</b>.</p>"));
connect(mFileList, &FileList::fileListChanged, this, &LogModeConfigurationWidget::configurationChanged);
......
......@@ -41,7 +41,7 @@ LogModeAction *AcpidLogModeFactory::createLogModeAction() const
return nullptr;
}
auto *logModeAction = new SimpleAction(logMode->action(), logMode);
auto logModeAction = new SimpleAction(logMode->action(), logMode);
logModeAction->setCategory(LogModeAction::OthersCategory);
return logModeAction;
......
......@@ -24,7 +24,7 @@
ApacheConfigurationWidget::ApacheConfigurationWidget()
: LogModeConfigurationWidget(i18n("Apache Log"), QStringLiteral(APACHE_MODE_ICON), i18n("Apache Log"))
{
auto *layout = new QHBoxLayout(this);
auto layout = new QHBoxLayout(this);
mApacheFileList = new MultipleFileList(this,
i18n("<p>These files will be analyzed to show the <b>Apache log</b> "
......
......@@ -38,7 +38,7 @@ QList<LogMode *> ApacheLogModeFactory::createLogModes() const
// Create the shared configuration and configuration widget between the logModes
QSharedPointer<ApacheConfiguration> logModeConfiguration = QSharedPointer<ApacheConfiguration>(new ApacheConfiguration());
auto *logModeConfigurationWidget = new ApacheConfigurationWidget();
auto logModeConfigurationWidget = new ApacheConfigurationWidget();
QList<LogMode *> logModes;
logModes.append(new ApacheLogMode(logModeConfiguration, logModeConfigurationWidget));
......@@ -59,7 +59,7 @@ LogModeAction *ApacheLogModeFactory::createLogModeAction() const
return nullptr;
}
auto *multipleActions = new MultipleActions(QIcon::fromTheme(QStringLiteral(APACHE_MODE_ICON)), i18n("Apache"), apacheLogMode);
auto multipleActions = new MultipleActions(QIcon::fromTheme(QStringLiteral(APACHE_MODE_ICON)), i18n("Apache"), apacheLogMode);
if (apacheLogsExist) {
multipleActions->addInnerAction(apacheLogMode->action());
}
......
......@@ -24,7 +24,7 @@
AuthenticationConfigurationWidget::AuthenticationConfigurationWidget()
: LogModeConfigurationWidget(i18n("Authentication Log"), QStringLiteral(AUTHENTICATION_MODE_ICON), i18n("Authentication Log"))
{
auto *layout = new QVBoxLayout(this);
auto layout = new QVBoxLayout(this);
mWarningBox = new KMessageWidget(this);
mWarningBox->setVisible(false);
......@@ -34,9 +34,9 @@ AuthenticationConfigurationWidget::AuthenticationConfigurationWidget()
mWarningBox->setIcon(QIcon::fromTheme(QStringLiteral("dialog-warning")));
// Authentication log file
auto *authenticationBox = new QGroupBox(i18n("Authentication Log File"));
auto *authenticationLayout = new QVBoxLayout();
auto *filePathLayout = new QHBoxLayout();
auto authenticationBox = new QGroupBox(i18n("Authentication Log File"));
auto authenticationLayout = new QVBoxLayout();
auto filePathLayout = new QHBoxLayout();
authenticationBox->setLayout(authenticationLayout);
authenticationLayout->addWidget(mWarningBox);
......
......@@ -41,7 +41,7 @@ LogModeAction *AuthenticationLogModeFactory::createLogModeAction() const
return nullptr;
}
auto *logModeAction = new SimpleAction(logMode->action(), logMode);
auto logModeAction = new SimpleAction(logMode->action(), logMode);
return logModeAction;
}
......@@ -59,7 +59,7 @@ FileList::FileList(QWidget *parent, const QString &descriptionText)
mFileListHelper.prepareButton(modify, QIcon::fromTheme(QStringLiteral("document-open")), this, SLOT(modifyItem()), fileList);
// Add a separator in the FileList
auto *separator = new QAction(this);
auto separator = new QAction(this);
separator->setSeparator(true);
fileList->addAction(separator);
......@@ -239,7 +239,7 @@ void FileList::addPaths(const QStringList &paths)
{
bool missingFiles = false;
for (const QString &path : paths) {
auto *item = new QListWidgetItem(path);
auto item = new QListWidgetItem(path);
const QFileInfo checkFile(path);
if (!checkFile.exists()) {
item->setForeground(Qt::red);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment