Merge branch 'master' into 'master'
a bunch of micro-optimizations See merge request medoc92/recoll!9
This commit is contained in:
commit
c1bec06711
@ -416,7 +416,7 @@ void rwSettings(bool writing)
|
||||
} else {
|
||||
vector<string> tl = g_dynconf->getStringEntries<vector>(asbdSk);
|
||||
for (const auto& dbd: tl) {
|
||||
prefs.asearchSubdirHist.push_back(u8s2qs(dbd.c_str()));
|
||||
prefs.asearchSubdirHist.push_back(u8s2qs(dbd));
|
||||
}
|
||||
}
|
||||
if (!writing) {
|
||||
|
||||
@ -26,12 +26,11 @@
|
||||
#include <qthread.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <qcombobox.h>
|
||||
#include <QLocale>
|
||||
#include <QLibraryInfo>
|
||||
#include <QFileDialog>
|
||||
#include <QUrl>
|
||||
#include <QSettings>
|
||||
#include <memory>
|
||||
|
||||
#include "rcldb.h"
|
||||
#include "rclconfig.h"
|
||||
@ -100,7 +99,7 @@ bool maybeOpenDb(string &reason, bool force, bool *maindberror)
|
||||
LOGDEB1("maybeOpenDb: force " << force << "\n");
|
||||
|
||||
if (force || nullptr == rcldb) {
|
||||
rcldb = std::shared_ptr<Rcl::Db>(new Rcl::Db(theconfig));
|
||||
rcldb = std::make_shared<Rcl::Db>(theconfig);
|
||||
}
|
||||
rcldb->rmQueryDb("");
|
||||
auto edbs = &prefs.activeExtraDbs;
|
||||
|
||||
@ -782,8 +782,9 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
|
||||
connect(<hr, SIGNAL(finished()), &loop, SLOT(quit()));
|
||||
|
||||
bool canGetRawText = rcldb && rcldb->storesDocText();
|
||||
auto it = prefs.preferStoredTextMimes.find(idoc.mimetype);
|
||||
bool preferStoredText = (it != prefs.preferStoredTextMimes.end());
|
||||
bool preferStoredText = std::find(prefs.preferStoredTextMimes.begin(),
|
||||
prefs.preferStoredTextMimes.end(),
|
||||
idoc.mimetype) != prefs.preferStoredTextMimes.end();
|
||||
bool loadok{false};
|
||||
|
||||
if (!preferStoredText || !canGetRawText) {
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
#include <memory>
|
||||
|
||||
#include "qxtconfirmationmessage.h"
|
||||
|
||||
@ -75,7 +76,7 @@ void RclMain::viewUrl()
|
||||
Rcl::Query *query = new Rcl::Query(rcldb.get());
|
||||
DocSequenceDb *src = new DocSequenceDb(
|
||||
rcldb, std::shared_ptr<Rcl::Query>(query), "",
|
||||
std::shared_ptr<Rcl::SearchData>(new Rcl::SearchData));
|
||||
std::make_shared<Rcl::SearchData>());
|
||||
m_source = std::shared_ptr<DocSequence>(src);
|
||||
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ inline std::string qs2u8s(const QString& qs)
|
||||
{
|
||||
return std::string((const char *)qs.toUtf8());
|
||||
}
|
||||
inline QString u8s2qs(const std::string us)
|
||||
inline QString u8s2qs(const std::string& us)
|
||||
{
|
||||
return QString::fromUtf8(us.c_str());
|
||||
}
|
||||
|
||||
@ -35,7 +35,6 @@
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QTextDocument>
|
||||
#include <QPainter>
|
||||
#include <QSplitter>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QTimer>
|
||||
@ -488,7 +487,7 @@ void RecollModel::sort(int column, Qt::SortOrder order)
|
||||
if (!stringlowercmp("date", spec.field) ||
|
||||
!stringlowercmp("datetime", spec.field))
|
||||
spec.field = "mtime";
|
||||
spec.desc = order == Qt::AscendingOrder ? false : true;
|
||||
spec.desc = (order != Qt::AscendingOrder);
|
||||
}
|
||||
emit sortDataChanged(spec);
|
||||
}
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "recoll.h"
|
||||
|
||||
@ -218,8 +218,8 @@ void SpellW::doExpand()
|
||||
resTW->setItem(0, 0, new QTableWidgetItem(tr("No expansion found")));
|
||||
} else {
|
||||
int row = 0;
|
||||
|
||||
if (maxexpand > 0 && int(res.entries.size()) >= maxexpand) {
|
||||
// maxexpand is static const, thus guaranteed to be >0
|
||||
if (int(res.entries.size()) >= maxexpand) {
|
||||
resTW->setRowCount(row + 1);
|
||||
resTW->setSpan(row, 0, 1, 2);
|
||||
resTW->setItem(row++, 0,
|
||||
|
||||
@ -610,7 +610,6 @@ bool SSearch::fromXML(const SSearchDef& fxml)
|
||||
|
||||
|
||||
if (!checkExtIndexes(fxml.extindexes)) {
|
||||
std::string asString;
|
||||
stringsToString(fxml.extindexes, asString);
|
||||
QMessageBox::warning(
|
||||
0, "Recoll",
|
||||
|
||||
@ -22,6 +22,8 @@
|
||||
#include "guiutils.h"
|
||||
#include "log.h"
|
||||
#include "xmltosd.h"
|
||||
|
||||
#include <memory>
|
||||
#include "smallut.h"
|
||||
#include "recoll.h"
|
||||
#include "picoxml.h"
|
||||
@ -51,7 +53,7 @@ public:
|
||||
}
|
||||
resetTemps();
|
||||
// A new search descriptor. Allocate data structure
|
||||
sd = std::shared_ptr<SearchData>(new SearchData);
|
||||
sd = std::make_shared<SearchData>();
|
||||
if (!sd) {
|
||||
LOGERR("SDHXMLHandler::startElement: out of memory\n");
|
||||
contentsOk = false;
|
||||
|
||||
@ -50,7 +50,7 @@ bool StopList::setFile(const string &filename)
|
||||
// faster than find() in this case.
|
||||
bool StopList::isStop(const string &term) const
|
||||
{
|
||||
return m_stops.empty() ? false : m_stops.find(term) != m_stops.end();
|
||||
return !m_stops.empty() && m_stops.find(term) != m_stops.end();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user