Shortcut editor ok?
This commit is contained in:
parent
ea9a9f511f
commit
d2ce3845d0
@ -34,7 +34,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
#include "recoll.h"
|
#include "recoll.h"
|
||||||
#include "rclconfig.h"
|
#include "rclconfig.h"
|
||||||
@ -42,11 +41,15 @@ using namespace std;
|
|||||||
#include "searchdata.h"
|
#include "searchdata.h"
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
#include "rclhelp.h"
|
#include "rclhelp.h"
|
||||||
|
#include "scbase.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
static const int initclausetypes[] = {1, 3, 0, 2, 5};
|
static const int initclausetypes[] = {1, 3, 0, 2, 5};
|
||||||
static const unsigned int iclausescnt = sizeof(initclausetypes) / sizeof(int);
|
static const unsigned int iclausescnt = sizeof(initclausetypes) / sizeof(int);
|
||||||
static map<QString,QString> cat_translations;
|
static map<QString,QString> cat_translations;
|
||||||
static map<QString,QString> cat_rtranslations;
|
static map<QString,QString> cat_rtranslations;
|
||||||
|
static const QString scbctxt("Advanced Search");
|
||||||
|
|
||||||
void AdvSearch::init()
|
void AdvSearch::init()
|
||||||
{
|
{
|
||||||
@ -78,8 +81,9 @@ void AdvSearch::init()
|
|||||||
connect(addClausePB, SIGNAL(clicked()), this, SLOT(addClause()));
|
connect(addClausePB, SIGNAL(clicked()), this, SLOT(addClause()));
|
||||||
connect(delClausePB, SIGNAL(clicked()), this, SLOT(delClause()));
|
connect(delClausePB, SIGNAL(clicked()), this, SLOT(delClause()));
|
||||||
|
|
||||||
new QShortcut(QKeySequence(Qt::Key_Up), this, SLOT(slotHistoryNext()));;
|
onNewShortcuts();
|
||||||
new QShortcut(QKeySequence(Qt::Key_Down), this, SLOT(slotHistoryPrev()));
|
connect(&SCBase::scBase(), SIGNAL(shortcutsChanged()),
|
||||||
|
this, SLOT(onNewShortcuts()));
|
||||||
|
|
||||||
conjunctCMB->insertItem(1, tr("All clauses"));
|
conjunctCMB->insertItem(1, tr("All clauses"));
|
||||||
conjunctCMB->insertItem(2, tr("Any clause"));
|
conjunctCMB->insertItem(2, tr("Any clause"));
|
||||||
@ -163,6 +167,18 @@ void AdvSearch::saveCnf()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AdvSearch::onNewShortcuts()
|
||||||
|
{
|
||||||
|
SETSHORTCUT("History Next", "Up", m_histnextsc, slotHistoryNext);
|
||||||
|
SETSHORTCUT("History Prev", "Down", m_histprevsc, slotHistoryPrev);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdvSearch::listShortcuts()
|
||||||
|
{
|
||||||
|
LISTSHORTCUT("History Next", "Up", m_histnextsc, slotHistoryNext);
|
||||||
|
LISTSHORTCUT("History Prev", "Down", m_histprevsc, slotHistoryPrev);
|
||||||
|
}
|
||||||
|
|
||||||
void AdvSearch::addClause(bool updsaved)
|
void AdvSearch::addClause(bool updsaved)
|
||||||
{
|
{
|
||||||
addClause(0, updsaved);
|
addClause(0, updsaved);
|
||||||
|
|||||||
@ -30,6 +30,7 @@
|
|||||||
#include "advshist.h"
|
#include "advshist.h"
|
||||||
|
|
||||||
class QDialog;
|
class QDialog;
|
||||||
|
class QShortcut;
|
||||||
|
|
||||||
#include "ui_advsearch.h"
|
#include "ui_advsearch.h"
|
||||||
|
|
||||||
@ -43,6 +44,7 @@ public:
|
|||||||
setupUi(this);
|
setupUi(this);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
static void listShortcuts();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void delFiltypPB_clicked();
|
virtual void delFiltypPB_clicked();
|
||||||
@ -63,7 +65,8 @@ public slots:
|
|||||||
virtual void addClause(int, bool updsaved=true);
|
virtual void addClause(int, bool updsaved=true);
|
||||||
virtual void slotHistoryNext();
|
virtual void slotHistoryNext();
|
||||||
virtual void slotHistoryPrev();
|
virtual void slotHistoryPrev();
|
||||||
|
virtual void onNewShortcuts();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void startSearch(std::shared_ptr<Rcl::SearchData>, bool);
|
void startSearch(std::shared_ptr<Rcl::SearchData>, bool);
|
||||||
void setDescription(QString);
|
void setDescription(QString);
|
||||||
@ -73,6 +76,9 @@ private:
|
|||||||
std::vector<SearchClauseW *> m_clauseWins;
|
std::vector<SearchClauseW *> m_clauseWins;
|
||||||
QStringList m_ignTypes;
|
QStringList m_ignTypes;
|
||||||
bool m_ignByCats;
|
bool m_ignByCats;
|
||||||
|
QShortcut *m_histnextsc{nullptr};
|
||||||
|
QShortcut *m_histprevsc{nullptr};
|
||||||
|
|
||||||
void saveCnf();
|
void saveCnf();
|
||||||
void fillFileTypes();
|
void fillFileTypes();
|
||||||
size_t stringToSize(QString);
|
size_t stringToSize(QString);
|
||||||
|
|||||||
@ -60,12 +60,9 @@
|
|||||||
#include "preview_load.h"
|
#include "preview_load.h"
|
||||||
#include "preview_plaintorich.h"
|
#include "preview_plaintorich.h"
|
||||||
#include "rclmain_w.h"
|
#include "rclmain_w.h"
|
||||||
|
#include "scbase.h"
|
||||||
|
|
||||||
static const QKeySequence closeKS(Qt::Key_Escape);
|
static const QString scbctxt("Preview Window");
|
||||||
static const QKeySequence nextDocInTabKS(Qt::ShiftModifier+Qt::Key_Down);
|
|
||||||
static const QKeySequence prevDocInTabKS(Qt::ShiftModifier+Qt::Key_Up);
|
|
||||||
static const QKeySequence closeTabKS(Qt::ControlModifier+Qt::Key_W);
|
|
||||||
static const QKeySequence printTabKS(Qt::ControlModifier+Qt::Key_P);
|
|
||||||
|
|
||||||
// Make an attempt at trimming wildcard exprs at both ends of string
|
// Make an attempt at trimming wildcard exprs at both ends of string
|
||||||
static void trimwildcards(string& elt)
|
static void trimwildcards(string& elt)
|
||||||
@ -142,22 +139,38 @@ void Preview::init()
|
|||||||
connect(pvTab, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
|
connect(pvTab, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
|
||||||
connect(pvTab, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
|
connect(pvTab, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
|
||||||
|
|
||||||
connect(new QShortcut(closeKS, this), SIGNAL (activated()),
|
onNewShortcuts();
|
||||||
this, SLOT (close()));
|
connect(&SCBase::scBase(), SIGNAL(shortcutsChanged()),
|
||||||
connect(new QShortcut(nextDocInTabKS, this), SIGNAL (activated()),
|
this, SLOT(onNewShortcuts()));
|
||||||
this, SLOT (emitShowNext()));
|
|
||||||
connect(nextInTabPB, SIGNAL (clicked()), this, SLOT (emitShowNext()));
|
|
||||||
connect(new QShortcut(prevDocInTabKS, this), SIGNAL (activated()),
|
|
||||||
this, SLOT (emitShowPrev()));
|
|
||||||
connect(prevInTabPB, SIGNAL (clicked()), this, SLOT (emitShowPrev()));
|
|
||||||
connect(new QShortcut(closeTabKS, this), SIGNAL (activated()),
|
|
||||||
this, SLOT (closeCurrentTab()));
|
|
||||||
connect(new QShortcut(printTabKS, this), SIGNAL (activated()),
|
|
||||||
this, SIGNAL (printCurrentPreviewRequest()));
|
|
||||||
|
|
||||||
|
connect(nextInTabPB, SIGNAL (clicked()), this, SLOT (emitShowNext()));
|
||||||
|
connect(prevInTabPB, SIGNAL (clicked()), this, SLOT (emitShowPrev()));
|
||||||
currentChanged(pvTab->currentIndex());
|
currentChanged(pvTab->currentIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Preview::onNewShortcuts()
|
||||||
|
{
|
||||||
|
SETSHORTCUT("Close Window", "Esc", m_closewinsc, close);
|
||||||
|
SETSHORTCUT("Next doc in tab", "Shift+Down", m_nextdocsc, emitShowNext);
|
||||||
|
SETSHORTCUT("Previous doc in tab", "Shift+Up", m_prevdocsc,emitShowPrev);
|
||||||
|
SETSHORTCUT("Close tab", "Ctrl+W", m_closetabsc, closeCurrentTab);
|
||||||
|
QKeySequence ks = SCBase::scBase().get(scbctxt, "Print tab", "Ctrl+P");
|
||||||
|
if (!ks.isEmpty()) {
|
||||||
|
delete m_printtabsc;
|
||||||
|
m_printtabsc = new QShortcut(ks, this,
|
||||||
|
SIGNAL(printCurrentPreviewRequest()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Preview::listShortcuts()
|
||||||
|
{
|
||||||
|
LISTSHORTCUT("Close Window", "Esc", m_closewinsc, close);
|
||||||
|
LISTSHORTCUT("Next doc in tab", "Shift+Down", m_nextdocsc, emitShowNext);
|
||||||
|
LISTSHORTCUT("Previous doc in tab", "Shift+Up", m_prevdocsc,emitShowPrev);
|
||||||
|
LISTSHORTCUT("Close tab", "Ctrl+W", m_closetabsc, closeCurrentTab);
|
||||||
|
LISTSHORTCUT("Print tab", "Ctrl+P", m_printtabsc, print);
|
||||||
|
}
|
||||||
|
|
||||||
void Preview::emitShowNext()
|
void Preview::emitShowNext()
|
||||||
{
|
{
|
||||||
if (m_loading)
|
if (m_loading)
|
||||||
|
|||||||
@ -113,6 +113,7 @@ private:
|
|||||||
DspType m_curdsp;
|
DspType m_curdsp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class QShortcut;
|
||||||
|
|
||||||
class Preview : public QDialog, public Ui::Preview {
|
class Preview : public QDialog, public Ui::Preview {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -140,6 +141,10 @@ public:
|
|||||||
void emitWordSelect(QString);
|
void emitWordSelect(QString);
|
||||||
friend class PreviewTextEdit;
|
friend class PreviewTextEdit;
|
||||||
|
|
||||||
|
/** List shortcuts so that the prefs can be edited before any preview
|
||||||
|
is created */
|
||||||
|
static void listShortcuts();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
// Search stuff
|
// Search stuff
|
||||||
virtual void searchTextChanged(const QString& text);
|
virtual void searchTextChanged(const QString& text);
|
||||||
@ -158,7 +163,8 @@ public slots:
|
|||||||
virtual void emitSaveDocToFile();
|
virtual void emitSaveDocToFile();
|
||||||
virtual void emitEditRequested();
|
virtual void emitEditRequested();
|
||||||
virtual void togglePlainPre();
|
virtual void togglePlainPre();
|
||||||
|
virtual void onNewShortcuts();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void previewClosed(Preview *);
|
void previewClosed(Preview *);
|
||||||
void wordSelect(QString);
|
void wordSelect(QString);
|
||||||
@ -184,7 +190,12 @@ private:
|
|||||||
bool m_loading{false};
|
bool m_loading{false};
|
||||||
HighlightData m_hData;
|
HighlightData m_hData;
|
||||||
bool m_justCreated{true}; // First tab create is different
|
bool m_justCreated{true}; // First tab create is different
|
||||||
|
QShortcut *m_closewinsc{nullptr};
|
||||||
|
QShortcut *m_nextdocsc{nullptr};
|
||||||
|
QShortcut *m_prevdocsc{nullptr};
|
||||||
|
QShortcut *m_closetabsc{nullptr};
|
||||||
|
QShortcut *m_printtabsc{nullptr};
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
virtual void setCurTabProps(const Rcl::Doc& doc, int docnum);
|
virtual void setCurTabProps(const Rcl::Doc& doc, int docnum);
|
||||||
virtual PreviewTextEdit *editor(int);
|
virtual PreviewTextEdit *editor(int);
|
||||||
|
|||||||
@ -165,9 +165,12 @@ void RclMain::init()
|
|||||||
on_actionShowResultsAsTable_toggled(prefs.showResultsAsTable);
|
on_actionShowResultsAsTable_toggled(prefs.showResultsAsTable);
|
||||||
|
|
||||||
onNewShortcuts();
|
onNewShortcuts();
|
||||||
|
Preview::listShortcuts();
|
||||||
// Compat with old versions
|
SnippetsW::listShortcuts();
|
||||||
new QShortcut(QKeySequence("Ctrl+Shift+s"), sSearch, SLOT(takeFocus()));
|
AdvSearch::listShortcuts();
|
||||||
|
|
||||||
|
connect(&SCBase::scBase(), SIGNAL(shortcutsChanged()),
|
||||||
|
this, SLOT(onNewShortcuts()));
|
||||||
|
|
||||||
connect(&m_watcher, SIGNAL(fileChanged(QString)),
|
connect(&m_watcher, SIGNAL(fileChanged(QString)),
|
||||||
this, SLOT(updateIdxStatus()));
|
this, SLOT(updateIdxStatus()));
|
||||||
@ -342,14 +345,35 @@ void RclMain::onNewShortcuts()
|
|||||||
SCBase& scb = SCBase::scBase();
|
SCBase& scb = SCBase::scBase();
|
||||||
QKeySequence ks;
|
QKeySequence ks;
|
||||||
|
|
||||||
ks = scb.get(scbctxt, "Focus to Search Entry", "Ctrl+l");
|
ks = scb.get(scbctxt, "Focus to Search", "Ctrl+L");
|
||||||
if (!ks.isEmpty())
|
|
||||||
new QShortcut(ks, sSearch, SLOT(takeFocus()));
|
|
||||||
|
|
||||||
ks = scb.get(scbctxt, "Focus to Result Table", "Ctrl+r");
|
|
||||||
if (!ks.isEmpty()) {
|
if (!ks.isEmpty()) {
|
||||||
delete m_tablefocseq;
|
delete m_focustosearchsc;
|
||||||
m_tablefocseq = new QShortcut(ks, this);
|
m_focustosearchsc = new QShortcut(ks, sSearch, SLOT(takeFocus()));
|
||||||
|
}
|
||||||
|
|
||||||
|
ks = scb.get(scbctxt, "Focus to Search, alt.", "Ctrl+Shift+S");
|
||||||
|
if (!ks.isEmpty()) {
|
||||||
|
delete m_focustosearcholdsc;
|
||||||
|
m_focustosearcholdsc = new QShortcut(ks, sSearch, SLOT(takeFocus()));
|
||||||
|
}
|
||||||
|
|
||||||
|
ks = scb.get(scbctxt, "Clear Search", "Ctrl+S");
|
||||||
|
if (!ks.isEmpty()) {
|
||||||
|
delete m_clearsearchsc;
|
||||||
|
m_clearsearchsc = new QShortcut(ks, sSearch, SLOT(clearAll()));
|
||||||
|
}
|
||||||
|
|
||||||
|
ks = scb.get(scbctxt, "Focus to Result Table", "Ctrl+R");
|
||||||
|
if (!ks.isEmpty()) {
|
||||||
|
delete m_focustotablesc;
|
||||||
|
m_focustotablesc = new QShortcut(ks, this);
|
||||||
|
if (displayingTable) {
|
||||||
|
connect(m_focustotablesc, SIGNAL(activated()),
|
||||||
|
restable, SLOT(takeFocus()));
|
||||||
|
} else {
|
||||||
|
disconnect(m_focustotablesc, SIGNAL(activated()),
|
||||||
|
restable, SLOT(takeFocus()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1006,8 +1030,8 @@ void RclMain::on_actionShowResultsAsTable_toggled(bool on)
|
|||||||
if (docnum >= 0) {
|
if (docnum >= 0) {
|
||||||
reslist->resultPageFor(docnum);
|
reslist->resultPageFor(docnum);
|
||||||
}
|
}
|
||||||
if (m_tablefocseq)
|
if (m_focustotablesc)
|
||||||
disconnect(m_tablefocseq, SIGNAL(activated()),
|
disconnect(m_focustotablesc, SIGNAL(activated()),
|
||||||
restable, SLOT(takeFocus()));
|
restable, SLOT(takeFocus()));
|
||||||
sSearch->takeFocus();
|
sSearch->takeFocus();
|
||||||
} else {
|
} else {
|
||||||
@ -1018,8 +1042,8 @@ void RclMain::on_actionShowResultsAsTable_toggled(bool on)
|
|||||||
nextPageAction->setEnabled(false);
|
nextPageAction->setEnabled(false);
|
||||||
prevPageAction->setEnabled(false);
|
prevPageAction->setEnabled(false);
|
||||||
firstPageAction->setEnabled(false);
|
firstPageAction->setEnabled(false);
|
||||||
if (m_tablefocseq)
|
if (m_focustotablesc)
|
||||||
connect(m_tablefocseq, SIGNAL(activated()),
|
connect(m_focustotablesc, SIGNAL(activated()),
|
||||||
restable, SLOT(takeFocus()));
|
restable, SLOT(takeFocus()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -216,7 +216,10 @@ private:
|
|||||||
QComboBox *m_filtCMB{0};
|
QComboBox *m_filtCMB{0};
|
||||||
QButtonGroup *m_filtBGRP{0};
|
QButtonGroup *m_filtBGRP{0};
|
||||||
QMenu *m_filtMN{0};
|
QMenu *m_filtMN{0};
|
||||||
QShortcut *m_tablefocseq{0};
|
QShortcut *m_focustotablesc{0};
|
||||||
|
QShortcut *m_focustosearchsc{0};
|
||||||
|
QShortcut *m_focustosearcholdsc{0};
|
||||||
|
QShortcut *m_clearsearchsc{0};
|
||||||
QFileSystemWatcher m_watcher;
|
QFileSystemWatcher m_watcher;
|
||||||
vector<ExecCmd*> m_viewers;
|
vector<ExecCmd*> m_viewers;
|
||||||
ExecCmd *m_idxproc{0}; // Indexing process
|
ExecCmd *m_idxproc{0}; // Indexing process
|
||||||
|
|||||||
@ -43,6 +43,7 @@ HEADERS += \
|
|||||||
reslist.h \
|
reslist.h \
|
||||||
restable.h \
|
restable.h \
|
||||||
rtitool.h \
|
rtitool.h \
|
||||||
|
scbase.h \
|
||||||
searchclause_w.h \
|
searchclause_w.h \
|
||||||
snippets_w.h \
|
snippets_w.h \
|
||||||
specialindex.h \
|
specialindex.h \
|
||||||
|
|||||||
@ -592,6 +592,8 @@ void ResTable::init()
|
|||||||
tableView->setContextMenuPolicy(Qt::CustomContextMenu);
|
tableView->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
|
||||||
onNewShortcuts();
|
onNewShortcuts();
|
||||||
|
connect(&SCBase::scBase(), SIGNAL(shortcutsChanged()),
|
||||||
|
this, SLOT(onNewShortcuts()));
|
||||||
|
|
||||||
connect(tableView, SIGNAL(customContextMenuRequested(const QPoint&)),
|
connect(tableView, SIGNAL(customContextMenuRequested(const QPoint&)),
|
||||||
this, SLOT(createPopupMenu(const QPoint&)));
|
this, SLOT(createPopupMenu(const QPoint&)));
|
||||||
@ -662,23 +664,10 @@ void ResTable::init()
|
|||||||
|
|
||||||
void ResTable::onNewShortcuts()
|
void ResTable::onNewShortcuts()
|
||||||
{
|
{
|
||||||
SCBase& scb = SCBase::scBase();
|
SETSHORTCUT("Open", "Ctrl+O", m_opensc, menuEdit);
|
||||||
QKeySequence ks;
|
SETSHORTCUT("Open and Quit", "Ctrl+Shift+O", m_openquitsc, menuEditAndQuit);
|
||||||
ks = scb.get(scbctxt, "Open", "Ctrl+o");
|
SETSHORTCUT("Preview", "Ctrl+D", m_previewsc, menuPreview);
|
||||||
if (!ks.isEmpty())
|
SETSHORTCUT("Show Snippets", "Ctrl+E", m_showsnipssc, menuShowSnippets);
|
||||||
new QShortcut(ks, this, SLOT(menuEdit()));
|
|
||||||
|
|
||||||
ks = scb.get(scbctxt, "Open and Quit", "Ctrl+Shift+o");
|
|
||||||
if (!ks.isEmpty())
|
|
||||||
new QShortcut(ks, this, SLOT(menuEditAndQuit()));
|
|
||||||
|
|
||||||
ks = scb.get(scbctxt, "Preview", "Ctrl+d");
|
|
||||||
if (!ks.isEmpty())
|
|
||||||
new QShortcut(ks, this, SLOT(menuPreview()));
|
|
||||||
|
|
||||||
ks = scb.get(scbctxt, "Show Snippets", "Ctrl+e");
|
|
||||||
if (!ks.isEmpty())
|
|
||||||
new QShortcut(ks, this, SLOT(menuShowSnippets()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ResTable::eventFilter(QObject* obj, QEvent* event)
|
bool ResTable::eventFilter(QObject* obj, QEvent* event)
|
||||||
|
|||||||
@ -111,6 +111,7 @@ private:
|
|||||||
class ResTablePager;
|
class ResTablePager;
|
||||||
class QUrl;
|
class QUrl;
|
||||||
class RclMain;
|
class RclMain;
|
||||||
|
class QShortcut;
|
||||||
|
|
||||||
class ResTable : public QWidget, public Ui::ResTable
|
class ResTable : public QWidget, public Ui::ResTable
|
||||||
{
|
{
|
||||||
@ -187,14 +188,18 @@ protected:
|
|||||||
bool eventFilter(QObject* obj, QEvent* event);
|
bool eventFilter(QObject* obj, QEvent* event);
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
RecollModel *m_model;
|
RecollModel *m_model{nullptr};
|
||||||
ResTablePager *m_pager;
|
ResTablePager *m_pager{nullptr};
|
||||||
ResTableDetailArea *m_detail;
|
ResTableDetailArea *m_detail{nullptr};
|
||||||
int m_detaildocnum;
|
int m_detaildocnum;
|
||||||
Rcl::Doc m_detaildoc;
|
Rcl::Doc m_detaildoc;
|
||||||
int m_popcolumn;
|
int m_popcolumn;
|
||||||
RclMain *m_rclmain;
|
RclMain *m_rclmain{nullptr};
|
||||||
bool m_ismainres;
|
bool m_ismainres;
|
||||||
|
QShortcut *m_opensc{nullptr};
|
||||||
|
QShortcut *m_openquitsc{nullptr};
|
||||||
|
QShortcut *m_previewsc{nullptr};
|
||||||
|
QShortcut *m_showsnipssc{nullptr};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2017-2019 J.F.Dockes
|
/* Copyright (C) 2021 J.F.Dockes
|
||||||
*
|
*
|
||||||
* License: GPL 2.1
|
* License: GPL 2.1
|
||||||
*
|
*
|
||||||
@ -39,29 +39,22 @@ struct SCDef {
|
|||||||
class SCBase::Internal {
|
class SCBase::Internal {
|
||||||
public:
|
public:
|
||||||
std::map<QString, SCDef> scdefs;
|
std::map<QString, SCDef> scdefs;
|
||||||
|
QString scBaseSettingsKey() {
|
||||||
|
return "/Recoll/prefs/sckeys";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static QString mapkey(const QString& ctxt, const QString& desc)
|
static QString mapkey(const QString& ctxt, const QString& desc)
|
||||||
{
|
{
|
||||||
return ctxt + "/" + desc;
|
return ctxt + "/" + desc;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
static QString mapkey(const std::string& ctxt, const std::string& desc)
|
|
||||||
{
|
|
||||||
return u8s2qs(ctxt) + "/" + u8s2qs(desc);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QString SCBase::scBaseSettingsKey()
|
|
||||||
{
|
|
||||||
return "/Recoll/prefs/sckeys";
|
|
||||||
}
|
|
||||||
SCBase::SCBase()
|
SCBase::SCBase()
|
||||||
{
|
{
|
||||||
m = new Internal();
|
m = new Internal();
|
||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
auto sl = settings.value(scBaseSettingsKey()).toStringList();
|
auto sl = settings.value(m->scBaseSettingsKey()).toStringList();
|
||||||
|
|
||||||
for (int i = 0; i < sl.size(); ++i) {
|
for (int i = 0; i < sl.size(); ++i) {
|
||||||
auto ssc = qs2utf8s(sl.at(i));
|
auto ssc = qs2utf8s(sl.at(i));
|
||||||
@ -92,7 +85,8 @@ SCBase::~SCBase()
|
|||||||
QKeySequence SCBase::get(const QString& ctxt, const QString& desc,
|
QKeySequence SCBase::get(const QString& ctxt, const QString& desc,
|
||||||
const QString& defks)
|
const QString& defks)
|
||||||
{
|
{
|
||||||
std::cerr << "SCBase::get\n";
|
LOGDEB0("SCBase::get: [" << qs2utf8s(ctxt) << "]/[" <<
|
||||||
|
qs2utf8s(desc) << "], [" << qs2utf8s(defks) << "]\n");
|
||||||
QString key = mapkey(ctxt, desc);
|
QString key = mapkey(ctxt, desc);
|
||||||
auto it = m->scdefs.find(key);
|
auto it = m->scdefs.find(key);
|
||||||
if (it == m->scdefs.end()) {
|
if (it == m->scdefs.end()) {
|
||||||
@ -101,17 +95,32 @@ QKeySequence SCBase::get(const QString& ctxt, const QString& desc,
|
|||||||
}
|
}
|
||||||
QKeySequence qks(defks);
|
QKeySequence qks(defks);
|
||||||
m->scdefs[key] = SCDef{ctxt, desc, qks, qks};
|
m->scdefs[key] = SCDef{ctxt, desc, qks, qks};
|
||||||
std::cerr << "get(" << qs2utf8s(ctxt) << ", " << qs2utf8s(desc) <<
|
LOGDEB0("get(" << qs2utf8s(ctxt) << ", " << qs2utf8s(desc) <<
|
||||||
", " << qs2utf8s(defks) << ") -> " <<
|
", " << qs2utf8s(defks) << ") -> " <<
|
||||||
qs2utf8s(qks.toString()) << "\n";
|
qs2utf8s(qks.toString()) << "\n");
|
||||||
return qks;
|
return qks;
|
||||||
}
|
}
|
||||||
std::cerr << "get(" << qs2utf8s(ctxt) << ", " << qs2utf8s(desc) <<
|
LOGDEB0("SCBase::get(" << qs2utf8s(ctxt) << ", " << qs2utf8s(desc) <<
|
||||||
", " << qs2utf8s(defks) << ") -> " <<
|
", " << qs2utf8s(defks) << ") -> " <<
|
||||||
qs2utf8s(it->second.val.toString()) << "\n";
|
qs2utf8s(it->second.val.toString()) << "\n");
|
||||||
|
it->second.dflt = QKeySequence(defks);
|
||||||
return it->second.val;
|
return it->second.val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SCBase::set(const QString& ctxt, const QString& desc, const QString& newks)
|
||||||
|
{
|
||||||
|
LOGDEB0("SCBase::set: [" << qs2utf8s(ctxt) << "]/[" <<
|
||||||
|
qs2utf8s(desc) << "], [" << qs2utf8s(newks) << "]\n");
|
||||||
|
QString key = mapkey(ctxt, desc);
|
||||||
|
auto it = m->scdefs.find(key);
|
||||||
|
if (it == m->scdefs.end()) {
|
||||||
|
QKeySequence qks(newks);
|
||||||
|
m->scdefs[key] = SCDef{ctxt, desc, qks, QKeySequence()};
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
it->second.val = newks;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList SCBase::getAll()
|
QStringList SCBase::getAll()
|
||||||
{
|
{
|
||||||
QStringList result;
|
QStringList result;
|
||||||
@ -124,15 +133,33 @@ QStringList SCBase::getAll()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SCBase::store()
|
||||||
|
{
|
||||||
|
QStringList slout;
|
||||||
|
for (const auto& entry : m->scdefs) {
|
||||||
|
const SCDef& def = entry.second;
|
||||||
|
if (def.val != def.dflt) {
|
||||||
|
std::string e =
|
||||||
|
stringsToString(std::vector<std::string>{
|
||||||
|
qs2utf8s(def.ctxt), qs2utf8s(def.desc),
|
||||||
|
qs2utf8s(def.val.toString())});
|
||||||
|
LOGDEB0("SCBase::store: storing: [" << e << "]\n");
|
||||||
|
slout.append(u8s2qs(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Note: we emit even if the non-default values are not really
|
||||||
|
// changed, just not worth the trouble doing otherwise.
|
||||||
|
emit shortcutsChanged();
|
||||||
|
QSettings settings;
|
||||||
|
settings.setValue(m->scBaseSettingsKey(), slout);
|
||||||
|
}
|
||||||
|
|
||||||
static SCBase *theBase;
|
static SCBase *theBase;
|
||||||
|
|
||||||
SCBase& SCBase::scBase()
|
SCBase& SCBase::scBase()
|
||||||
{
|
{
|
||||||
std::cerr << "SCBase::scBase()\n";
|
|
||||||
if (nullptr == theBase) {
|
if (nullptr == theBase) {
|
||||||
std::cerr << "SCBase::scBase() creating class\n";
|
|
||||||
theBase = new SCBase();
|
theBase = new SCBase();
|
||||||
}
|
}
|
||||||
std::cerr << "SCBase::scBase() returning " << theBase << "\n";
|
|
||||||
return *theBase;
|
return *theBase;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2017-2019 J.F.Dockes
|
/* Copyright (C) 2021 J.F.Dockes
|
||||||
*
|
*
|
||||||
* License: GPL 2.1
|
* License: GPL 2.1
|
||||||
*
|
*
|
||||||
@ -24,8 +24,10 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QKeySequence>
|
#include <QKeySequence>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
class SCBase {
|
class SCBase : public QObject {
|
||||||
|
Q_OBJECT;
|
||||||
public:
|
public:
|
||||||
~SCBase();
|
~SCBase();
|
||||||
|
|
||||||
@ -34,12 +36,33 @@ public:
|
|||||||
QKeySequence get(const QString& context, const QString& description,
|
QKeySequence get(const QString& context, const QString& description,
|
||||||
const QString& defkeyseq);
|
const QString& defkeyseq);
|
||||||
QStringList getAll();
|
QStringList getAll();
|
||||||
static QString scBaseSettingsKey();
|
void set(const QString& context, const QString& description,
|
||||||
|
const QString& keyseq);
|
||||||
|
void store();
|
||||||
|
|
||||||
class Internal;
|
class Internal;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void shortcutsChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Internal *m{nullptr};
|
Internal *m{nullptr};
|
||||||
SCBase();
|
SCBase();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define SETSHORTCUT(DESCR, SEQ, FLD, SLTFUNC) \
|
||||||
|
do { \
|
||||||
|
QKeySequence ks = SCBase::scBase().get(scbctxt, DESCR, SEQ);\
|
||||||
|
if (!ks.isEmpty()) { \
|
||||||
|
delete FLD; \
|
||||||
|
FLD = new QShortcut(ks, this, SLOT(SLTFUNC())); \
|
||||||
|
} \
|
||||||
|
} while (false);
|
||||||
|
|
||||||
|
#define LISTSHORTCUT(DESCR, SEQ, FLD, SLTFUNC) \
|
||||||
|
do { \
|
||||||
|
SCBase::scBase().get(scbctxt, DESCR, SEQ); \
|
||||||
|
} while (false);
|
||||||
|
|
||||||
|
|
||||||
#endif /* _SCBASE_H_INCLUDED_ */
|
#endif /* _SCBASE_H_INCLUDED_ */
|
||||||
|
|||||||
@ -52,6 +52,7 @@
|
|||||||
#include "rcldb.h"
|
#include "rcldb.h"
|
||||||
#include "rclhelp.h"
|
#include "rclhelp.h"
|
||||||
#include "plaintorich.h"
|
#include "plaintorich.h"
|
||||||
|
#include "scbase.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -63,6 +64,9 @@ using namespace std;
|
|||||||
#define browser ((QTextBrowser*)browserw)
|
#define browser ((QTextBrowser*)browserw)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const QString scbctxt("Snippets Window");
|
||||||
|
|
||||||
|
|
||||||
class PlainToRichQtSnippets : public PlainToRich {
|
class PlainToRichQtSnippets : public PlainToRich {
|
||||||
public:
|
public:
|
||||||
virtual string startMatch(unsigned int) {
|
virtual string startMatch(unsigned int) {
|
||||||
@ -84,15 +88,9 @@ void SnippetsW::init()
|
|||||||
// setWindowFlags(Qt::WindowStaysOnTopHint);
|
// setWindowFlags(Qt::WindowStaysOnTopHint);
|
||||||
searchFM->hide();
|
searchFM->hide();
|
||||||
|
|
||||||
new QShortcut(QKeySequence::Find, this, SLOT(slotEditFind()));
|
onNewShortcuts();
|
||||||
new QShortcut(QKeySequence(Qt::Key_Slash), this, SLOT(slotEditFind()));
|
connect(&SCBase::scBase(), SIGNAL(shortcutsChanged()),
|
||||||
new QShortcut(QKeySequence(Qt::Key_Escape), searchFM, SLOT(hide()));
|
this, SLOT(onNewShortcuts()));
|
||||||
new QShortcut(QKeySequence::FindNext, this, SLOT(slotEditFindNext()));
|
|
||||||
new QShortcut(QKeySequence(Qt::Key_F3), this, SLOT(slotEditFindNext()));
|
|
||||||
new QShortcut(QKeySequence::FindPrevious, this,
|
|
||||||
SLOT(slotEditFindPrevious()));
|
|
||||||
new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F3),
|
|
||||||
this, SLOT(slotEditFindPrevious()));
|
|
||||||
|
|
||||||
QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
|
QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
|
||||||
if (closeButton)
|
if (closeButton)
|
||||||
@ -156,6 +154,24 @@ void SnippetsW::init()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SnippetsW::onNewShortcuts()
|
||||||
|
{
|
||||||
|
SETSHORTCUT("Find", "Ctrl+F", m_find1sc, slotEditFind);
|
||||||
|
SETSHORTCUT("Find (alt)", "/", m_find2sc, slotEditFind);
|
||||||
|
SETSHORTCUT("Find Next", "F3", m_findnextsc, slotEditFindNext);
|
||||||
|
SETSHORTCUT("Find Previous", "Shift+F3", m_findprevsc, slotEditFindPrevious);
|
||||||
|
SETSHORTCUT("Hide", "Esc", m_hidesc, hide);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SnippetsW::listShortcuts()
|
||||||
|
{
|
||||||
|
LISTSHORTCUT("Find", "Ctrl+F", m_find1sc, slotEditFind);
|
||||||
|
LISTSHORTCUT("Find (alt)", "/", m_find2sc, slotEditFind);
|
||||||
|
LISTSHORTCUT("Find Next", "F3", m_find2sc, slotEditFindNext);
|
||||||
|
LISTSHORTCUT("Find Previous", "Shift+F3", m_find2sc, slotEditFindPrevious);
|
||||||
|
LISTSHORTCUT("Hide", "Esc", m_hidesc, hide);
|
||||||
|
}
|
||||||
|
|
||||||
void SnippetsW::createPopupMenu(const QPoint& pos)
|
void SnippetsW::createPopupMenu(const QPoint& pos)
|
||||||
{
|
{
|
||||||
QMenu *popup = new QMenu(this);
|
QMenu *popup = new QMenu(this);
|
||||||
|
|||||||
@ -41,11 +41,16 @@ public:
|
|||||||
onSetDoc(doc, source);
|
onSetDoc(doc, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** List shortcuts so that the prefs can be edited before any preview
|
||||||
|
is created */
|
||||||
|
static void listShortcuts();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void onLinkClicked(const QUrl &);
|
virtual void onLinkClicked(const QUrl &);
|
||||||
virtual void onSetDoc(Rcl::Doc doc, std::shared_ptr<DocSequence> source);
|
virtual void onSetDoc(Rcl::Doc doc, std::shared_ptr<DocSequence> source);
|
||||||
virtual void createPopupMenu(const QPoint& pos);
|
virtual void createPopupMenu(const QPoint& pos);
|
||||||
|
virtual void onNewShortcuts();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual void slotEditFind();
|
virtual void slotEditFind();
|
||||||
virtual void slotEditFindNext();
|
virtual void slotEditFindNext();
|
||||||
@ -62,6 +67,11 @@ private:
|
|||||||
std::shared_ptr<DocSequence> m_source;
|
std::shared_ptr<DocSequence> m_source;
|
||||||
Rcl::Doc m_doc;
|
Rcl::Doc m_doc;
|
||||||
bool m_sortingByPage;
|
bool m_sortingByPage;
|
||||||
|
QShortcut *m_find1sc{nullptr};
|
||||||
|
QShortcut *m_find2sc{nullptr};
|
||||||
|
QShortcut *m_findnextsc{nullptr};
|
||||||
|
QShortcut *m_findprevsc{nullptr};
|
||||||
|
QShortcut *m_hidesc{nullptr};
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef USING_WEBENGINE
|
#ifdef USING_WEBENGINE
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
<string>Clear</string>
|
<string>Clear</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
<property name="shortcut">
|
||||||
<string>Ctrl+S</string>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>1</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
|||||||
@ -277,26 +277,29 @@ void UIPrefsDialog::setFromPrefs()
|
|||||||
|
|
||||||
void UIPrefsDialog::readShortcuts()
|
void UIPrefsDialog::readShortcuts()
|
||||||
{
|
{
|
||||||
|
shortcutsTB->setRowCount(0);
|
||||||
SCBase& scbase = SCBase::scBase();
|
SCBase& scbase = SCBase::scBase();
|
||||||
shortcutsTB->setColumnCount(3);
|
shortcutsTB->setColumnCount(4);
|
||||||
shortcutsTB->setHorizontalHeaderItem(
|
shortcutsTB->setHorizontalHeaderItem(
|
||||||
0, new QTableWidgetItem(tr("Context")));
|
0, new QTableWidgetItem(tr("Context")));
|
||||||
shortcutsTB->setHorizontalHeaderItem(
|
shortcutsTB->setHorizontalHeaderItem(
|
||||||
1, new QTableWidgetItem(tr("Description")));
|
1, new QTableWidgetItem(tr("Description")));
|
||||||
shortcutsTB->setHorizontalHeaderItem(
|
shortcutsTB->setHorizontalHeaderItem(
|
||||||
2, new QTableWidgetItem(tr("Shortcut")));
|
2, new QTableWidgetItem(tr("Shortcut")));
|
||||||
|
shortcutsTB->setHorizontalHeaderItem(
|
||||||
|
3, new QTableWidgetItem(tr("Default")));
|
||||||
QStringList sl = scbase.getAll();
|
QStringList sl = scbase.getAll();
|
||||||
int row = 0;
|
int row = 0;
|
||||||
for (int i = 0; i < sl.size();) {
|
for (int i = 0; i < sl.size();) {
|
||||||
std::cerr << "Inserting row " << qs2utf8s(sl.at(i)) << " " <<
|
LOGDEB0("UIPrefsDialog::readShortcuts: inserting row " <<
|
||||||
qs2utf8s(sl.at(i+1)) << " " <<
|
qs2utf8s(sl.at(i)) << " " << qs2utf8s(sl.at(i+1)) << " " <<
|
||||||
qs2utf8s(sl.at(i+2)) << "\n";
|
qs2utf8s(sl.at(i+2)) << " " << qs2utf8s(sl.at(i+3)) << "\n");
|
||||||
shortcutsTB->insertRow(row);
|
shortcutsTB->insertRow(row);
|
||||||
shortcutsTB->setItem(row, 0, new QTableWidgetItem(sl.at(i++)));
|
shortcutsTB->setItem(row, 0, new QTableWidgetItem(sl.at(i++)));
|
||||||
shortcutsTB->setItem(row, 1, new QTableWidgetItem(sl.at(i++)));
|
shortcutsTB->setItem(row, 1, new QTableWidgetItem(sl.at(i++)));
|
||||||
auto ed = new QKeySequenceEdit(QKeySequence(sl.at(i++)));
|
auto ed = new QKeySequenceEdit(QKeySequence(sl.at(i++)));
|
||||||
shortcutsTB->setCellWidget(row, 2, ed);
|
shortcutsTB->setCellWidget(row, 2, ed);
|
||||||
i++; // Skip dlft, not needed here.
|
shortcutsTB->setItem(row, 3, new QTableWidgetItem(sl.at(i++)));
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
shortcutsTB->resizeColumnsToContents();
|
shortcutsTB->resizeColumnsToContents();
|
||||||
@ -306,23 +309,15 @@ void UIPrefsDialog::readShortcuts()
|
|||||||
void UIPrefsDialog::storeShortcuts()
|
void UIPrefsDialog::storeShortcuts()
|
||||||
{
|
{
|
||||||
SCBase& scbase = SCBase::scBase();
|
SCBase& scbase = SCBase::scBase();
|
||||||
QStringList sl = scbase.getAll();
|
|
||||||
QStringList slout;
|
QStringList slout;
|
||||||
for (int row = 0; row < shortcutsTB->rowCount(); row++) {
|
for (int row = 0; row < shortcutsTB->rowCount(); row++) {
|
||||||
|
QString dflt = shortcutsTB->item(row, 0)->text();
|
||||||
|
QString ctxt = shortcutsTB->item(row, 1)->text();
|
||||||
auto qsce = (QKeySequenceEdit*)(shortcutsTB->cellWidget(row, 2));
|
auto qsce = (QKeySequenceEdit*)(shortcutsTB->cellWidget(row, 2));
|
||||||
QString val = qsce->keySequence().toString();
|
QString val = qsce->keySequence().toString();
|
||||||
QString dflt = sl[4 *row + 3];
|
scbase.set(dflt, ctxt, val);
|
||||||
if (dflt != val) {
|
|
||||||
std::cerr << "Storing changed " << qs2utf8s(dflt) << " -> " <<
|
|
||||||
qs2utf8s(val) << " at row " << row << "\n";
|
|
||||||
std::string e = stringsToString(
|
|
||||||
std::vector<std::string>{qs2utf8s(sl[4*row]),
|
|
||||||
qs2utf8s(sl[4*row+1]), qs2utf8s(val)});
|
|
||||||
slout.append(u8s2qs(e));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
QSettings settings;
|
scbase.store();
|
||||||
settings.setValue(SCBase::scBaseSettingsKey(), slout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIPrefsDialog::setupReslistFontPB()
|
void UIPrefsDialog::setupReslistFontPB()
|
||||||
|
|||||||
@ -264,20 +264,18 @@ template <class T> bool stringToStrings(const string& s, T& tokens,
|
|||||||
|
|
||||||
template <class T> void stringsToString(const T& tokens, string& s)
|
template <class T> void stringsToString(const T& tokens, string& s)
|
||||||
{
|
{
|
||||||
for (auto it = tokens.begin();
|
if (tokens.empty())
|
||||||
it != tokens.end(); it++) {
|
return;
|
||||||
bool hasblanks = false;
|
for (const auto& tok : tokens) {
|
||||||
if (it->find_first_of(" \t\n") != string::npos) {
|
if (tok.empty()) {
|
||||||
hasblanks = true;
|
s.append("\"\" ");
|
||||||
}
|
continue;
|
||||||
if (it != tokens.begin()) {
|
|
||||||
s.append(1, ' ');
|
|
||||||
}
|
}
|
||||||
|
bool hasblanks = tok.find_first_of(" \t\n") != string::npos;
|
||||||
if (hasblanks) {
|
if (hasblanks) {
|
||||||
s.append(1, '"');
|
s.append(1, '"');
|
||||||
}
|
}
|
||||||
for (unsigned int i = 0; i < it->length(); i++) {
|
for (auto car : tok) {
|
||||||
char car = it->at(i);
|
|
||||||
if (car == '"') {
|
if (car == '"') {
|
||||||
s.append(1, '\\');
|
s.append(1, '\\');
|
||||||
s.append(1, car);
|
s.append(1, car);
|
||||||
@ -288,7 +286,9 @@ template <class T> void stringsToString(const T& tokens, string& s)
|
|||||||
if (hasblanks) {
|
if (hasblanks) {
|
||||||
s.append(1, '"');
|
s.append(1, '"');
|
||||||
}
|
}
|
||||||
|
s.append(1, ' ');
|
||||||
}
|
}
|
||||||
|
s.resize(s.size()-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T> string stringsToString(const T& tokens)
|
template <class T> string stringsToString(const T& tokens)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user