add show stats entry to file menu
This commit is contained in:
parent
6f114bf58b
commit
c09ca43fb7
6 changed files with 81 additions and 35 deletions
|
@ -74,6 +74,14 @@ void RclMain::showSpellDialog()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RclMain::showIndexStatistics()
|
||||||
|
{
|
||||||
|
showSpellDialog();
|
||||||
|
if (spellform == 0)
|
||||||
|
return;
|
||||||
|
spellform->setMode(SpellW::TYPECMB_STATS);
|
||||||
|
}
|
||||||
|
|
||||||
void RclMain::showFragButs()
|
void RclMain::showFragButs()
|
||||||
{
|
{
|
||||||
if (fragbuts && fragbuts->isStale(0)) {
|
if (fragbuts && fragbuts->isStale(0)) {
|
||||||
|
|
|
@ -84,6 +84,7 @@
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="showMissingHelpers_Action"/>
|
<addaction name="showMissingHelpers_Action"/>
|
||||||
<addaction name="showActiveTypes_Action"/>
|
<addaction name="showActiveTypes_Action"/>
|
||||||
|
<addaction name="actionShow_index_statistics"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="toggleFullScreenAction"/>
|
<addaction name="toggleFullScreenAction"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
|
@ -374,6 +375,9 @@
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="enbSynAction">
|
<action name="enbSynAction">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Enable synonyms</string>
|
<string>Enable synonyms</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -383,9 +387,6 @@
|
||||||
<property name="name" stdset="0">
|
<property name="name" stdset="0">
|
||||||
<cstring>enbSynAction</cstring>
|
<cstring>enbSynAction</cstring>
|
||||||
</property>
|
</property>
|
||||||
<property name="checkable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</action>
|
</action>
|
||||||
<action name="toggleFullScreenAction">
|
<action name="toggleFullScreenAction">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -521,6 +522,11 @@
|
||||||
<string>Indexing with special options</string>
|
<string>Indexing with special options</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionShow_index_statistics">
|
||||||
|
<property name="text">
|
||||||
|
<string>Show index statistics</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="2" margin="2"/>
|
<layoutdefault spacing="2" margin="2"/>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
|
|
@ -334,7 +334,8 @@ void RclMain::init()
|
||||||
this, SLOT(saveLastQuery()));
|
this, SLOT(saveLastQuery()));
|
||||||
connect(actionLoad_saved_query, SIGNAL(triggered()),
|
connect(actionLoad_saved_query, SIGNAL(triggered()),
|
||||||
this, SLOT(loadSavedQuery()));
|
this, SLOT(loadSavedQuery()));
|
||||||
|
connect(actionShow_index_statistics, SIGNAL(triggered()),
|
||||||
|
this, SLOT(showIndexStatistics()));
|
||||||
connect(helpAbout_RecollAction, SIGNAL(triggered()),
|
connect(helpAbout_RecollAction, SIGNAL(triggered()),
|
||||||
this, SLOT(showAboutDialog()));
|
this, SLOT(showAboutDialog()));
|
||||||
connect(showMissingHelpers_Action, SIGNAL(triggered()),
|
connect(showMissingHelpers_Action, SIGNAL(triggered()),
|
||||||
|
|
|
@ -122,6 +122,7 @@ public slots:
|
||||||
virtual void previewClosed(Preview *w);
|
virtual void previewClosed(Preview *w);
|
||||||
virtual void showAdvSearchDialog();
|
virtual void showAdvSearchDialog();
|
||||||
virtual void showSpellDialog();
|
virtual void showSpellDialog();
|
||||||
|
virtual void showIndexStatistics();
|
||||||
virtual void showFragButs();
|
virtual void showFragButs();
|
||||||
virtual void showSpecIdx();
|
virtual void showSpecIdx();
|
||||||
virtual void showAboutDialog();
|
virtual void showAboutDialog();
|
||||||
|
|
|
@ -22,9 +22,6 @@
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
using std::list;
|
|
||||||
using std::multimap;
|
|
||||||
using std::string;
|
|
||||||
|
|
||||||
#include <qmessagebox.h>
|
#include <qmessagebox.h>
|
||||||
#include <qpushbutton.h>
|
#include <qpushbutton.h>
|
||||||
|
@ -53,6 +50,10 @@ using std::string;
|
||||||
#include "rclaspell.h"
|
#include "rclaspell.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
using std::list;
|
||||||
|
using std::multimap;
|
||||||
|
using std::string;
|
||||||
|
|
||||||
void SpellW::init()
|
void SpellW::init()
|
||||||
{
|
{
|
||||||
m_c2t.clear();
|
m_c2t.clear();
|
||||||
|
@ -73,15 +74,6 @@ void SpellW::init()
|
||||||
expTypeCMB->addItem(tr("Show index statistics"));
|
expTypeCMB->addItem(tr("Show index statistics"));
|
||||||
m_c2t.push_back(TYPECMB_STATS);
|
m_c2t.push_back(TYPECMB_STATS);
|
||||||
|
|
||||||
int typ = prefs.termMatchType;
|
|
||||||
vector<comboboxchoice>::const_iterator it =
|
|
||||||
std::find(m_c2t.begin(), m_c2t.end(), typ);
|
|
||||||
if (it == m_c2t.end())
|
|
||||||
it = m_c2t.begin();
|
|
||||||
int cmbidx = it - m_c2t.begin();
|
|
||||||
|
|
||||||
expTypeCMB->setCurrentIndex(cmbidx);
|
|
||||||
|
|
||||||
// Stemming language combobox
|
// Stemming language combobox
|
||||||
stemLangCMB->clear();
|
stemLangCMB->clear();
|
||||||
vector<string> langs;
|
vector<string> langs;
|
||||||
|
@ -105,7 +97,7 @@ void SpellW::init()
|
||||||
connect(baseWordLE, SIGNAL(returnPressed()), this, SLOT(doExpand()));
|
connect(baseWordLE, SIGNAL(returnPressed()), this, SLOT(doExpand()));
|
||||||
connect(expandPB, SIGNAL(clicked()), this, SLOT(doExpand()));
|
connect(expandPB, SIGNAL(clicked()), this, SLOT(doExpand()));
|
||||||
connect(dismissPB, SIGNAL(clicked()), this, SLOT(close()));
|
connect(dismissPB, SIGNAL(clicked()), this, SLOT(close()));
|
||||||
connect(expTypeCMB, SIGNAL(activated(int)), this, SLOT(modeSet(int)));
|
connect(expTypeCMB, SIGNAL(activated(int)), this, SLOT(onModeChanged(int)));
|
||||||
|
|
||||||
resTW->setShowGrid(0);
|
resTW->setShowGrid(0);
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||||
|
@ -122,11 +114,18 @@ void SpellW::init()
|
||||||
resTW->setColumnWidth(1, 150);
|
resTW->setColumnWidth(1, 150);
|
||||||
resTW->installEventFilter(this);
|
resTW->installEventFilter(this);
|
||||||
|
|
||||||
if (o_index_stripchars) {
|
int idx = cmbIdx((comboboxchoice)prefs.termMatchType);
|
||||||
caseSensCB->setEnabled(false);
|
expTypeCMB->setCurrentIndex(idx);
|
||||||
caseSensCB->setEnabled(false);
|
onModeChanged(idx);
|
||||||
}
|
}
|
||||||
modeSet(cmbidx);
|
|
||||||
|
int SpellW::cmbIdx(comboboxchoice mode)
|
||||||
|
{
|
||||||
|
vector<comboboxchoice>::const_iterator it =
|
||||||
|
std::find(m_c2t.begin(), m_c2t.end(), mode);
|
||||||
|
if (it == m_c2t.end())
|
||||||
|
it = m_c2t.begin();
|
||||||
|
return it - m_c2t.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int maxexpand = 10000;
|
static const int maxexpand = 10000;
|
||||||
|
@ -306,6 +305,8 @@ void SpellW::showStats()
|
||||||
if (!theconfig)
|
if (!theconfig)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
baseWordLE->setText(QString::fromLocal8Bit(theconfig->getDbDir().c_str()));
|
||||||
|
|
||||||
ExecCmd cmd;
|
ExecCmd cmd;
|
||||||
vector<string> args;
|
vector<string> args;
|
||||||
int status;
|
int status;
|
||||||
|
@ -313,9 +314,9 @@ void SpellW::showStats()
|
||||||
args.push_back(theconfig->getDbDir());
|
args.push_back(theconfig->getDbDir());
|
||||||
string output;
|
string output;
|
||||||
status = cmd.doexec("du", args, 0, &output);
|
status = cmd.doexec("du", args, 0, &output);
|
||||||
int dbkbytes = 0;
|
long long dbkbytes = 0;
|
||||||
if (!status) {
|
if (!status) {
|
||||||
dbkbytes = atoi(output.c_str());
|
dbkbytes = atoll(output.c_str());
|
||||||
}
|
}
|
||||||
resTW->setRowCount(row+1);
|
resTW->setRowCount(row+1);
|
||||||
resTW->setItem(row, 0,
|
resTW->setItem(row, 0,
|
||||||
|
@ -372,12 +373,34 @@ void SpellW::textDoubleClicked(int row, int)
|
||||||
emit(wordSelect(item->text()));
|
emit(wordSelect(item->text()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellW::modeSet(int idx)
|
void SpellW::onModeChanged(int idx)
|
||||||
{
|
{
|
||||||
if (idx < 0 || idx > int(m_c2t.size()))
|
if (idx < 0 || idx > int(m_c2t.size()))
|
||||||
return;
|
return;
|
||||||
comboboxchoice mode = m_c2t[idx];
|
comboboxchoice mode = m_c2t[idx];
|
||||||
|
setModeCommon(mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpellW::setMode(comboboxchoice mode)
|
||||||
|
{
|
||||||
|
expTypeCMB->setCurrentIndex(cmbIdx(mode));
|
||||||
|
setModeCommon(mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpellW::setModeCommon(comboboxchoice mode)
|
||||||
|
{
|
||||||
|
if (m_prevmode == TYPECMB_STATS) {
|
||||||
|
baseWordLE->setText("");
|
||||||
|
}
|
||||||
|
m_prevmode = mode;
|
||||||
resTW->setRowCount(0);
|
resTW->setRowCount(0);
|
||||||
|
if (o_index_stripchars) {
|
||||||
|
caseSensCB->setEnabled(false);
|
||||||
|
diacSensCB->setEnabled(false);
|
||||||
|
} else {
|
||||||
|
caseSensCB->setEnabled(true);
|
||||||
|
diacSensCB->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (mode == TYPECMB_STEM) {
|
if (mode == TYPECMB_STEM) {
|
||||||
stemLangCMB->setEnabled(true);
|
stemLangCMB->setEnabled(true);
|
||||||
|
@ -387,8 +410,6 @@ void SpellW::modeSet(int idx)
|
||||||
caseSensCB->setEnabled(false);
|
caseSensCB->setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
stemLangCMB->setEnabled(false);
|
stemLangCMB->setEnabled(false);
|
||||||
diacSensCB->setEnabled(true);
|
|
||||||
caseSensCB->setEnabled(true);
|
|
||||||
}
|
}
|
||||||
if (mode == TYPECMB_STATS)
|
if (mode == TYPECMB_STATS)
|
||||||
baseWordLE->setEnabled(false);
|
baseWordLE->setEnabled(false);
|
||||||
|
@ -400,6 +421,8 @@ void SpellW::modeSet(int idx)
|
||||||
QStringList labels(tr("Item"));
|
QStringList labels(tr("Item"));
|
||||||
labels.push_back(tr("Value"));
|
labels.push_back(tr("Value"));
|
||||||
resTW->setHorizontalHeaderLabels(labels);
|
resTW->setHorizontalHeaderLabels(labels);
|
||||||
|
diacSensCB->setEnabled(false);
|
||||||
|
caseSensCB->setEnabled(false);
|
||||||
doExpand();
|
doExpand();
|
||||||
} else {
|
} else {
|
||||||
QStringList labels(tr("Term"));
|
QStringList labels(tr("Term"));
|
||||||
|
|
|
@ -25,34 +25,41 @@
|
||||||
#include "ui_spell.h"
|
#include "ui_spell.h"
|
||||||
class SpellW : public QWidget, public Ui::SpellBase
|
class SpellW : public QWidget, public Ui::SpellBase
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT;
|
||||||
public:
|
public:
|
||||||
SpellW(QWidget* parent = 0)
|
SpellW(QWidget* parent = 0)
|
||||||
: QWidget(parent)
|
: QWidget(parent), m_prevmode(TYPECMB_NONE) {
|
||||||
{
|
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool eventFilter(QObject *target, QEvent *event );
|
virtual bool eventFilter(QObject *target, QEvent *event );
|
||||||
|
|
||||||
|
enum comboboxchoice {TYPECMB_NONE, TYPECMB_WILD, TYPECMB_REG, TYPECMB_STEM,
|
||||||
|
TYPECMB_ASPELL, TYPECMB_STATS};
|
||||||
public slots:
|
public slots:
|
||||||
virtual void doExpand();
|
virtual void doExpand();
|
||||||
virtual void wordChanged(const QString&);
|
virtual void wordChanged(const QString&);
|
||||||
virtual void textDoubleClicked();
|
virtual void textDoubleClicked();
|
||||||
virtual void textDoubleClicked(int, int);
|
virtual void textDoubleClicked(int, int);
|
||||||
virtual void modeSet(int);
|
virtual void setMode(comboboxchoice);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
virtual void onModeChanged(int);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void wordSelect(QString);
|
void wordSelect(QString);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum comboboxchoice {TYPECMB_WILD, TYPECMB_REG, TYPECMB_STEM,
|
|
||||||
TYPECMB_ASPELL, TYPECMB_STATS};
|
|
||||||
// combobox index to expansion type
|
// combobox index to expansion type
|
||||||
std::vector<comboboxchoice> m_c2t;
|
std::vector<comboboxchoice> m_c2t;
|
||||||
|
comboboxchoice m_prevmode;
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
void copy();
|
void copy();
|
||||||
void showStats();
|
void showStats();
|
||||||
|
int cmbIdx(comboboxchoice mode);
|
||||||
|
void setModeCommon(comboboxchoice mode);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _ASPELL_W_H_INCLUDED_ */
|
#endif /* _ASPELL_W_H_INCLUDED_ */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue