From ec3aaac23e8403616764224e30ec8d652e80fa61 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Wed, 3 Aug 2016 09:22:27 +0200 Subject: [PATCH] c++11 initializers --- src/qtgui/rclm_idx.cpp | 62 ++++++++++++------------------------------ 1 file changed, 18 insertions(+), 44 deletions(-) diff --git a/src/qtgui/rclm_idx.cpp b/src/qtgui/rclm_idx.cpp index e86f3767..c4b15173 100644 --- a/src/qtgui/rclm_idx.cpp +++ b/src/qtgui/rclm_idx.cpp @@ -179,22 +179,14 @@ void RclMain::periodic100() bool RclMain::checkIdxPaths() { - vector args; - string badpaths; - args.push_back("recollindex"); - args.push_back("-E"); - args.push_back("-c"); - args.push_back(theconfig->getConfDir()); + vector args {"recollindex", "-c", theconfig->getConfDir(), "-E"}; ExecCmd::backtick(args, badpaths); if (!badpaths.empty()) { - int rep = - QMessageBox::warning(0, tr("Bad paths"), - tr("Bad paths in configuration file:\n") + - QString::fromLocal8Bit(badpaths.c_str()), - QMessageBox::Ok, - QMessageBox::Cancel, - QMessageBox::NoButton); + int rep = QMessageBox::warning( + 0, tr("Bad paths"), tr("Bad paths in configuration file:\n") + + QString::fromLocal8Bit(badpaths.c_str()), + QMessageBox::Ok, QMessageBox::Cancel, QMessageBox::NoButton); if (rep == QMessageBox::Cancel) return false; } @@ -223,18 +215,15 @@ void RclMain::toggleIndexing() tr("The current indexing process " "was not started from this " "interface, can't kill it"), - QMessageBox::Ok, - QMessageBox::NoButton); + QMessageBox::Ok, QMessageBox::NoButton); #else int rep = - QMessageBox::information(0, tr("Warning"), - tr("The current indexing process " - "was not started from this " - "interface. Click Ok to kill it " - "anyway, or Cancel to leave it alone"), - QMessageBox::Ok, - QMessageBox::Cancel, - QMessageBox::NoButton); + QMessageBox::information( + 0, tr("Warning"), + tr("The current indexing process was not started from this " + "interface. Click Ok to kill it " + "anyway, or Cancel to leave it alone"), + QMessageBox::Ok, QMessageBox::Cancel, QMessageBox::NoButton); if (rep == QMessageBox::Ok) { Pidfile pidfile(theconfig->getPidfile()); pid_t pid = pidfile.open(); @@ -255,9 +244,7 @@ void RclMain::toggleIndexing() if (!checkIdxPaths()) { return; } - vector args; - args.push_back("-c"); - args.push_back(theconfig->getConfDir()); + vector args{"-c", theconfig->getConfDir()}; m_idxproc = new ExecCmd; m_idxproc->startExec("recollindex", args, false, false); } @@ -306,10 +293,7 @@ void RclMain::rebuildIndex() return; } - vector args; - args.push_back("-c"); - args.push_back(theconfig->getConfDir()); - args.push_back("-z"); + vector args{"-c", theconfig->getConfDir(), "-z"}; m_idxproc = new ExecCmd; m_idxproc->startExec("recollindex", args, false, false); } @@ -386,9 +370,7 @@ void RclMain::specialIndex() if (!specidx) // ?? return; - vector args; - args.push_back("-c"); - args.push_back(theconfig->getConfDir()); + vector args{"-c", theconfig->getConfDir()}; string top = specidx->toptarg(); if (!top.empty()) { @@ -419,8 +401,7 @@ void RclMain::specialIndex() QMessageBox::warning(0, tr("Selection patterns need topdir"), tr("Selection patterns can only be used with a " "start directory"), - QMessageBox::Ok, - QMessageBox::NoButton); + QMessageBox::Ok, QMessageBox::NoButton); return; } @@ -442,18 +423,13 @@ void RclMain::updateIdxForDocs(vector& docs) if (m_idxproc) { QMessageBox::warning(0, tr("Warning"), tr("Can't update index: indexer running"), - QMessageBox::Ok, - QMessageBox::NoButton); + QMessageBox::Ok, QMessageBox::NoButton); return; } vector paths; if (ConfIndexer::docsToPaths(docs, paths)) { - vector args; - args.push_back("-c"); - args.push_back(theconfig->getConfDir()); - args.push_back("-e"); - args.push_back("-i"); + vector args{"-c", theconfig->getConfDir(), "-e", "-i"}; args.insert(args.end(), paths.begin(), paths.end()); m_idxproc = new ExecCmd; m_idxproc->startExec("recollindex", args, false, false); @@ -462,5 +438,3 @@ void RclMain::updateIdxForDocs(vector& docs) fileToggleIndexingAction->setEnabled(false); actionSpecial_Indexing->setEnabled(false); } - -