Cleanup and polish of the Citation dialog:

- now simple citation insertion can be done with the keyboard only (enter key will close the dialog and insert the chosen key).
- now search also within bib entry information (very fast)
- new case sensitive option
- new regex option.
- QCitation: code simplified, some code went to ControlCitation.
- QCitationDialog: code simplified
- lots of polish in the dialogs...



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17539 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-03-25 01:32:12 +00:00
parent 14f3344f0b
commit 44efd43a1b
7 changed files with 544 additions and 324 deletions

View File

@ -4,6 +4,7 @@
* Licence details can be found in the file COPYING. * Licence details can be found in the file COPYING.
* *
* \author Angus Leeming * \author Angus Leeming
* \author Abdelrazak Younes
* *
* Full author contact details are available in file CREDITS. * Full author contact details are available in file CREDITS.
*/ */
@ -16,6 +17,11 @@
#include "bufferparams.h" #include "bufferparams.h"
#include "debug.h" // temporary #include "debug.h" // temporary
#include "support/lstrings.h"
#include <boost/regex.hpp>
#include <algorithm>
using std::string; using std::string;
using std::vector; using std::vector;
@ -34,22 +40,19 @@ ControlCitation::ControlCitation(Dialog & d)
bool ControlCitation::initialiseParams(string const & data) bool ControlCitation::initialiseParams(string const & data)
{ {
ControlCommand::initialiseParams(data); if (!ControlCommand::initialiseParams(data))
return false;
vector<pair<string, docstring> > blist; biblio::CiteEngine const engine =
kernel().buffer().fillWithBibKeys(blist); kernel().buffer().params().getEngine();
biblio::CiteEngine const engine = kernel().buffer().params().getEngine();
bool use_styles = engine != biblio::ENGINE_BASIC; bool use_styles = engine != biblio::ENGINE_BASIC;
typedef std::map<string, docstring>::value_type InfoMapValue; vector<pair<string, docstring> > blist;
kernel().buffer().fillWithBibKeys(blist);
for (vector<pair<string,string> >::size_type i = 0; bibkeysInfo_.clear();
i < blist.size(); ++i) { for (size_t i = 0; i < blist.size(); ++i)
bibkeysInfo_.insert(InfoMapValue(blist[i].first, bibkeysInfo_[blist[i].first] = blist[i].second;
blist[i].second));
}
if (citeStyles_.empty()) if (citeStyles_.empty())
citeStyles_ = biblio::getCiteStyles(engine); citeStyles_ = biblio::getCiteStyles(engine);
@ -71,18 +74,97 @@ void ControlCitation::clearParams()
} }
biblio::InfoMap const & ControlCitation::bibkeysInfo() const vector<string> const ControlCitation::availableKeys() const
{ {
return bibkeysInfo_; return biblio::getKeys(bibkeysInfo_);
} }
biblio::CiteEngine_enum ControlCitation::getEngine() const biblio::CiteEngine const ControlCitation::getEngine() const
{ {
return kernel().buffer().params().getEngine(); return kernel().buffer().params().getEngine();
} }
docstring const ControlCitation::getInfo(std::string const & key) const
{
if (bibkeysInfo_.empty())
return docstring();
return biblio::getInfo(bibkeysInfo_, key);
}
namespace {
// Escape special chars.
// All characters are literals except: '.|*?+(){}[]^$\'
// These characters are literals when preceded by a "\", which is done here
// @todo: This function should be moved to support, and then the test in tests
// should be moved there as well.
docstring const escape_special_chars(docstring const & expr)
{
// Search for all chars '.|*?+(){}[^$]\'
// Note that '[' and '\' must be escaped.
// This is a limitation of boost::regex, but all other chars in BREs
// are assumed literal.
boost::regex reg("[].|*?+(){}^$\\[\\\\]");
// $& is a perl-like expression that expands to all
// of the current match
// The '$' must be prefixed with the escape character '\' for
// boost to treat it as a literal.
// Thus, to prefix a matched expression with '\', we use:
// FIXME: UNICODE
return from_utf8(boost::regex_replace(to_utf8(expr), reg, "\\\\$&"));
}
} // namespace anon
vector<string> ControlCitation::searchKeys(
vector<string> const & keys_to_search,
docstring const & search_expression,
bool case_sensitive, bool regex)
{
vector<string> foundKeys;
docstring expr = support::trim(search_expression);
if (expr.empty())
return foundKeys;
if (!regex)
// We must escape special chars in the search_expr so that
// it is treated as a simple string by boost::regex.
expr = escape_special_chars(expr);
boost::regex reg_exp(to_utf8(expr), case_sensitive?
boost::regex_constants::normal : boost::regex_constants::icase);
vector<string>::const_iterator it = keys_to_search.begin();
vector<string>::const_iterator end = keys_to_search.end();
for (; it != end; ++it ) {
biblio::InfoMap::const_iterator info = bibkeysInfo_.find(*it);
if (info == bibkeysInfo_.end())
continue;
string data = *it;
// FIXME UNICODE
data += ' ' + to_utf8(info->second);
try {
// Attempts to find a match for the current RE
// somewhere in data.
if (boost::regex_search(data, reg_exp))
foundKeys.push_back(*it);
}
catch (boost::regex_error &) {
return vector<string>();
}
}
return foundKeys;
}
vector<docstring> const ControlCitation::getCiteStrings(string const & key) const vector<docstring> const ControlCitation::getCiteStrings(string const & key) const
{ {
biblio::CiteEngine const engine = kernel().buffer().params().getEngine(); biblio::CiteEngine const engine = kernel().buffer().params().getEngine();

View File

@ -5,6 +5,7 @@
* Licence details can be found in the file COPYING. * Licence details can be found in the file COPYING.
* *
* \author Angus Leeming * \author Angus Leeming
* \author Abdelrazak Younes
* *
* Full author contact details are available in file CREDITS. * Full author contact details are available in file CREDITS.
*/ */
@ -25,9 +26,9 @@ class ControlCitation : public ControlCommand {
public: public:
/// ///
ControlCitation(Dialog &); ControlCitation(Dialog &);
virtual ~ControlCitation() {}
///
virtual bool initialiseParams(std::string const & data); virtual bool initialiseParams(std::string const & data);
/// clean-up on hide. /// clean-up on hide.
virtual void clearParams(); virtual void clearParams();
@ -36,13 +37,24 @@ public:
*/ */
virtual bool disconnectOnApply() const { return true; } virtual bool disconnectOnApply() const { return true; }
/// Returns a reference to the map of stored keys /// \return the list of all available bibliography keys.
biblio::InfoMap const & bibkeysInfo() const; std::vector<std::string> const availableKeys() const;
/// ///
biblio::CiteEngine_enum getEngine() const; biblio::CiteEngine const getEngine() const;
/// Possible citations based on this key /// \return information for this key.
docstring const getInfo(std::string const & key) const;
/// Search a given string within the passed keys.
/// \return the vector of matched keys.
std::vector<std::string> searchKeys(
std::vector<std::string> const & keys_to_search, //< Keys to search.
docstring const & search_expression, //< Search expression (regex possible)
bool case_sensitive = false, // set to true is the search should be case sensitive
bool regex = false /// \set to true if \c search_expression is a regex
); //
/// \return possible citations based on this key.
std::vector<docstring> const getCiteStrings(std::string const & key) const; std::vector<docstring> const getCiteStrings(std::string const & key) const;
/// available CiteStyle-s (depends on availability of Natbib/Jurabib) /// available CiteStyle-s (depends on availability of Natbib/Jurabib)

View File

@ -5,24 +5,21 @@
* *
* \author Angus Leeming * \author Angus Leeming
* \author Kalle Dalheimer * \author Kalle Dalheimer
* \author Abdelrazak Younes
* *
* Full author contact details are available in file CREDITS. * Full author contact details are available in file CREDITS.
*/ */
#include <config.h> #include <config.h>
#include "ControlCitation.h"
#include "QCitation.h" #include "QCitation.h"
#include "Qt2BC.h"
#include "qt_helpers.h" #include "qt_helpers.h"
#include "bufferparams.h"
#include "controllers/ButtonController.h"
#include "controllers/ControlCitation.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "debug.h"
#include <vector> #include <vector>
#include <string> #include <string>
@ -32,7 +29,7 @@ using std::string;
namespace { namespace {
template<typename String> static QStringList toQStringList(vector<String> const & v) template<typename String> static QStringList to_qstring_list(vector<String> const & v)
{ {
QStringList qlist; QStringList qlist;
@ -44,6 +41,18 @@ template<typename String> static QStringList toQStringList(vector<String> const
return qlist; return qlist;
} }
vector<string> const to_string_vector(QStringList const & qlist)
{
vector<string> v;
for (size_t i=0; i != qlist.size(); ++i) {
if (qlist[i].isEmpty())
continue;
v.push_back(lyx::fromqstr(qlist[i]));
}
return v;
}
} }
@ -60,7 +69,7 @@ QCitation::QCitation(Dialog & parent)
void QCitation::apply(int const choice, bool const full, bool const force, void QCitation::apply(int const choice, bool const full, bool const force,
QString before, QString after) QString before, QString after)
{ {
if (selected_keys_.rowCount() == 0) if (cited_keys_.isEmpty())
return; return;
vector<biblio::CiteStyle> const & styles = vector<biblio::CiteStyle> const & styles =
@ -71,7 +80,7 @@ void QCitation::apply(int const choice, bool const full, bool const force,
.asLatexStr(); .asLatexStr();
params().setCmdName(command); params().setCmdName(command);
params()["key"] = qstring_to_ucs4(selected_keys_.stringList().join(",")); params()["key"] = qstring_to_ucs4(cited_keys_.join(","));
params()["before"] = qstring_to_ucs4(before); params()["before"] = qstring_to_ucs4(before);
params()["after"] = qstring_to_ucs4(after); params()["after"] = qstring_to_ucs4(after);
dispatchParams(); dispatchParams();
@ -80,7 +89,8 @@ void QCitation::apply(int const choice, bool const full, bool const force,
void QCitation::clearSelection() void QCitation::clearSelection()
{ {
selected_keys_.setStringList(QStringList()); cited_keys_.clear();
selected_model_.setStringList(cited_keys_);
} }
@ -96,75 +106,122 @@ QString QCitation::textAfter()
} }
void QCitation::updateModel() bool QCitation::initialiseParams(std::string const & data)
{ {
// Make the list of all available bibliography keys if (!ControlCitation::initialiseParams(data))
QStringList keys = toQStringList(biblio::getKeys(bibkeysInfo())); return false;
available_keys_.setStringList(keys); init();
return true;
// Ditto for the keys cited in this inset
QString str = toqstr(params()["key"]);
if (!str.isEmpty()) {
keys = str.split(",");
selected_keys_.setStringList(keys);
}
} }
void QCitation::findKey(QString const & str) void QCitation::init()
{ {
QStringList sl = available_keys_.stringList().filter(str, Qt::CaseInsensitive); // Make the list of all available bibliography keys
found_keys_.setStringList(sl); all_keys_ = to_qstring_list(availableKeys());
available_model_.setStringList(all_keys_);
// Ditto for the keys cited in this inset
QString str = toqstr(params()["key"]);
if (str.isEmpty())
cited_keys_.clear();
else
cited_keys_ = str.split(",");
selected_model_.setStringList(cited_keys_);
}
void QCitation::findKey(QString const & str, bool only_keys,
bool case_sensitive, bool reg_exp)
{
if (str.isEmpty()) {
available_model_.setStringList(all_keys_);
return;
}
// Used for optimisation: store last searched string.
static QString last_searched_string;
// Used to disable the above optimisation.
static bool last_case_sensitive;
static bool last_reg_exp;
// Reset last_searched_string in case of changed option.
if (last_case_sensitive != case_sensitive
|| last_reg_exp != reg_exp) {
lyxerr[Debug::GUI] << "QCitation::findKey: optimisation disabled!" << std::endl;
last_searched_string.clear();
}
// save option for next search.
last_case_sensitive = case_sensitive;
last_reg_exp = reg_exp;
Qt::CaseSensitivity qtcase = case_sensitive?
Qt::CaseSensitive: Qt::CaseInsensitive;
QStringList keys;
// If new string (str) contains the last searched one...
if (!last_searched_string.isEmpty() && str.size() > 1
&& str.contains(last_searched_string, qtcase))
// ... then only search within already found list.
keys = available_model_.stringList();
else
// ... else search all keys.
keys = all_keys_;
// save searched string for next search.
last_searched_string = str;
QStringList result;
if (only_keys)
// Search only within the matching keys:
result = keys.filter(str, qtcase);
else
// Search within matching keys and associated info.
result = to_qstring_list(searchKeys(to_string_vector(keys),
qstring_to_ucs4(str), case_sensitive, reg_exp));
available_model_.setStringList(result);
} }
void QCitation::addKey(QModelIndex const & index) void QCitation::addKey(QModelIndex const & index)
{ {
QStringList keys = selected_keys_.stringList(); cited_keys_.append(index.data().toString());
keys.append(index.data().toString()); selected_model_.setStringList(cited_keys_);
selected_keys_.setStringList(keys);
} }
void QCitation::deleteKey(QModelIndex const & index) void QCitation::deleteKey(QModelIndex const & index)
{ {
QStringList keys = selected_keys_.stringList(); cited_keys_.removeAt(index.row());
keys.removeAt(index.row()); selected_model_.setStringList(cited_keys_);
selected_keys_.setStringList(keys);
} }
void QCitation::upKey(QModelIndex const & index) void QCitation::upKey(QModelIndex const & index)
{ {
QStringList keys = selected_keys_.stringList();
int pos = index.row(); int pos = index.row();
keys.swap(pos, pos - 1); cited_keys_.swap(pos, pos - 1);
selected_keys_.setStringList(keys); selected_model_.setStringList(cited_keys_);
} }
void QCitation::downKey(QModelIndex const & index) void QCitation::downKey(QModelIndex const & index)
{ {
QStringList keys = selected_keys_.stringList();
int pos = index.row(); int pos = index.row();
keys.swap(pos, pos + 1); cited_keys_.swap(pos, pos + 1);
selected_keys_.setStringList(keys); selected_model_.setStringList(cited_keys_);
} }
QStringList QCitation::citationStyles(int sel) QStringList QCitation::citationStyles(int sel)
{ {
string const key = fromqstr(selected_keys_.stringList()[sel]); string const key = fromqstr(cited_keys_[sel]);
return toQStringList(getCiteStrings(key)); return to_qstring_list(getCiteStrings(key));
} }
QString QCitation::getKeyInfo(QString const & sel) QString QCitation::getKeyInfo(QString const & sel)
{ {
if (!bibkeysInfo().empty()) return toqstr(getInfo(fromqstr(sel)));
return toqstr(biblio::getInfo(bibkeysInfo(), fromqstr(sel) ));
return QString();
} }

View File

@ -6,6 +6,7 @@
* *
* \author Angus Leeming * \author Angus Leeming
* \author Kalle Dalheimer * \author Kalle Dalheimer
* \author Abdelrazak Younes
* *
* Full author contact details are available in file CREDITS. * Full author contact details are available in file CREDITS.
*/ */
@ -13,8 +14,9 @@
#ifndef QCITATION_H #ifndef QCITATION_H
#define QCITATION_H #define QCITATION_H
#include "ControlCitation.h" #include "frontends/controllers/ControlCitation.h"
#include <QStringList>
#include <QStringListModel> #include <QStringListModel>
namespace lyx { namespace lyx {
@ -25,14 +27,17 @@ class QCitation : public ControlCitation
public: public:
/// ///
QCitation(Dialog &); QCitation(Dialog &);
virtual ~QCitation() {}
virtual bool initialiseParams(std::string const & data);
///
void init();
/// Available keys /// Available keys
QStringListModel * available() { return &available_keys_; } QStringListModel * available() { return &available_model_; }
/// Selected keys /// Selected keys
QStringListModel * selected() { return &selected_keys_; } QStringListModel * selected() { return &selected_model_; }
/// Found keys
QStringListModel * found() { return &found_keys_; }
/// Text before cite /// Text before cite
QString textBefore(); QString textBefore();
@ -46,8 +51,13 @@ public:
/// Clear selected keys /// Clear selected keys
void clearSelection(); void clearSelection();
/// Find keys containing the string (not case-sens) /// Find keys containing a string.
void findKey(QString const &); void findKey(
QString const & str, //< string expression
bool only_keys, //< set to true if only keys shall be searched.
bool case_sensitive, //< set to true for case sensitive search.
bool reg_exp //< set to true if \c str is a regular expression.
);
/// Add key to selected keys /// Add key to selected keys
void addKey(QModelIndex const &); void addKey(QModelIndex const &);
@ -68,18 +78,18 @@ public:
virtual void apply(int const choice, bool const full, bool const force, virtual void apply(int const choice, bool const full, bool const force,
QString before, QString after); QString before, QString after);
/// Update dialog before/whilst showing it.
virtual void updateModel();
private: private:
/// available keys /// available keys.
QStringListModel available_keys_; QStringListModel available_model_;
/// selected keys /// selected keys.
QStringListModel selected_keys_; QStringListModel selected_model_;
/// found keys /// All keys.
QStringListModel found_keys_; QStringList all_keys_;
/// Cited keys.
QStringList cited_keys_;
}; };

View File

@ -6,6 +6,7 @@
* \author Kalle Dalheimer * \author Kalle Dalheimer
* \author John Levon * \author John Levon
* \author Jürgen Spitzmüller * \author Jürgen Spitzmüller
* \author Abdelrazak Younes
* *
* Full author contact details are available in file CREDITS. * Full author contact details are available in file CREDITS.
*/ */
@ -13,16 +14,15 @@
#include <config.h> #include <config.h>
#include "QCitationDialog.h" #include "QCitationDialog.h"
#include "QCitation.h" #include "QCitation.h"
#include "qt_helpers.h"
#include "bufferparams.h" #include "frontends/controllers/biblio.h"
#include "frontends/controllers/ControlCitation.h"
#include "debug.h"
#include "gettext.h" #include "gettext.h"
#include "controllers/ControlCitation.h"
#include "support/lstrings.h"
#include <vector> #include <vector>
#include <string> #include <string>
@ -33,10 +33,6 @@ using std::vector;
using std::string; using std::string;
namespace lyx { namespace lyx {
using support::getStringFromVector;
using support::getVectorFromString;
namespace frontend { namespace frontend {
@ -119,6 +115,8 @@ void QCitationDialog::hide()
void QCitationDialog::show() void QCitationDialog::show()
{ {
findLE->clear();
availableLV->setFocus();
QDialog::show(); QDialog::show();
} }
@ -152,24 +150,20 @@ void QCitationDialog::on_applyPB_clicked()
void QCitationDialog::on_restorePB_clicked() void QCitationDialog::on_restorePB_clicked()
{ {
form_->init();
update(); update();
} }
void QCitationDialog::update() void QCitationDialog::update()
{ {
form_->updateModel(); if (selectedLV->selectionModel()->selectedIndexes().isEmpty()) {
if (availableLV->selectionModel()->selectedIndexes().isEmpty()
QModelIndex const idxa = availableLV->currentIndex(); && availableLV->model()->rowCount() > 0)
if (form_->available()->rowCount() > 0 && !idxa.isValid())
availableLV->setCurrentIndex(availableLV->model()->index(0,0)); availableLV->setCurrentIndex(availableLV->model()->index(0,0));
QModelIndex const idx = selectedLV->currentIndex();
if (form_->selected()->rowCount() > 0 && !idx.isValid()) {
selectedLV->setCurrentIndex(selectedLV->model()->index(0,0));
updateInfo(selectedLV->currentIndex());
} else
updateInfo(availableLV->currentIndex()); updateInfo(availableLV->currentIndex());
} else
updateInfo(selectedLV->currentIndex());
setButtons(); setButtons();
@ -294,10 +288,8 @@ void QCitationDialog::updateInfo(const QModelIndex & idx)
void QCitationDialog::on_selectedLV_clicked(const QModelIndex & idx) void QCitationDialog::on_selectedLV_clicked(const QModelIndex & idx)
{ {
availableLV->selectionModel()->clear(); availableLV->selectionModel()->reset();
update();
updateInfo(idx);
changed();
} }
@ -306,17 +298,15 @@ void QCitationDialog::selectedChanged(const QModelIndex & idx, const QModelIndex
if (!idx.isValid()) if (!idx.isValid())
return; return;
updateInfo(idx); availableLV->selectionModel()->reset();
changed(); update();
} }
void QCitationDialog::on_availableLV_clicked(const QModelIndex & idx) void QCitationDialog::on_availableLV_clicked(const QModelIndex & idx)
{ {
selectedLV->selectionModel()->clear(); selectedLV->selectionModel()->reset();
update();
updateInfo(idx);
setButtons();
} }
@ -325,8 +315,8 @@ void QCitationDialog::availableChanged(const QModelIndex & idx, const QModelInde
if (!idx.isValid()) if (!idx.isValid())
return; return;
updateInfo(idx); selectedLV->selectionModel()->reset();
setButtons(); update();
} }
@ -335,7 +325,15 @@ void QCitationDialog::on_availableLV_activated(const QModelIndex & idx)
if (isSelected(idx)) if (isSelected(idx))
return; return;
selectedLV->selectionModel()->reset();
on_addPB_clicked(); on_addPB_clicked();
if (selectedLV->model()->rowCount() == 1)
on_okPB_clicked();
}
void QCitationDialog::on_availableLV_entered(const QModelIndex & idx)
{
} }
@ -345,7 +343,8 @@ void QCitationDialog::on_addPB_clicked()
form_->addKey(availableLV->currentIndex()); form_->addKey(availableLV->currentIndex());
if (idx.isValid()) if (idx.isValid())
selectedLV->setCurrentIndex(idx); selectedLV->setCurrentIndex(idx);
changed(); selectedLV->selectionModel()->reset();
update();
} }
@ -362,8 +361,8 @@ void QCitationDialog::on_deletePB_clicked()
if (nrows>1) if (nrows>1)
selectedLV->setCurrentIndex(idx); selectedLV->setCurrentIndex(idx);
updateInfo(selectedLV->currentIndex()); availableLV->selectionModel()->reset();
changed(); update();
} }
@ -372,7 +371,8 @@ void QCitationDialog::on_upPB_clicked()
QModelIndex idx = selectedLV->currentIndex(); QModelIndex idx = selectedLV->currentIndex();
form_->upKey(idx); form_->upKey(idx);
selectedLV->setCurrentIndex(idx.sibling(idx.row() - 1, idx.column())); selectedLV->setCurrentIndex(idx.sibling(idx.row() - 1, idx.column()));
changed(); availableLV->selectionModel()->reset();
update();
} }
@ -381,7 +381,18 @@ void QCitationDialog::on_downPB_clicked()
QModelIndex idx = selectedLV->currentIndex(); QModelIndex idx = selectedLV->currentIndex();
form_->downKey(idx); form_->downKey(idx);
selectedLV->setCurrentIndex(idx.sibling(idx.row() + 1, idx.column())); selectedLV->setCurrentIndex(idx.sibling(idx.row() + 1, idx.column()));
changed(); availableLV->selectionModel()->reset();
update();
}
void QCitationDialog::findText(QString const & text)
{
bool const case_sentitive = caseCB->checkState();
bool const reg_exp = regexCB->checkState();
form_->findKey(text, false, case_sentitive, reg_exp);
selectedLV->selectionModel()->reset();
update();
} }
@ -390,14 +401,19 @@ void QCitationDialog::on_findLE_textChanged(const QString & text)
clearPB->setDisabled(text.isEmpty()); clearPB->setDisabled(text.isEmpty());
if (text.isEmpty()) if (text.isEmpty())
findLE->setFocus(); findLE->setFocus();
findText(text);
}
form_->findKey(text);
if (form_->found()->rowCount() == 0) { void QCitationDialog::on_caseCB_stateChanged(int)
findLE->backspace(); {
return; findText(findLE->text());
} }
availableLV->setModel(form_->found());
changed();
void QCitationDialog::on_regexCB_stateChanged(int)
{
findText(findLE->text());
} }

View File

@ -5,6 +5,7 @@
* Licence details can be found in the file COPYING. * Licence details can be found in the file COPYING.
* *
* \author Kalle Dalheimer * \author Kalle Dalheimer
* \author Abdelrazak Younes
* *
* Full author contact details are available in file CREDITS. * Full author contact details are available in file CREDITS.
*/ */
@ -51,6 +52,7 @@ public:
protected: protected:
void closeEvent (QCloseEvent * e); void closeEvent (QCloseEvent * e);
void keyPressEvent (QKeyEvent * event); void keyPressEvent (QKeyEvent * event);
void findText(QString const & text);
protected Q_SLOTS: protected Q_SLOTS:
@ -63,10 +65,13 @@ protected Q_SLOTS:
void on_upPB_clicked(); void on_upPB_clicked();
void on_downPB_clicked(); void on_downPB_clicked();
void on_findLE_textChanged(const QString & text); void on_findLE_textChanged(const QString & text);
void on_caseCB_stateChanged(int);
void on_regexCB_stateChanged(int);
void on_selectedLV_clicked(const QModelIndex &); void on_selectedLV_clicked(const QModelIndex &);
void selectedChanged(const QModelIndex &, const QModelIndex &); void selectedChanged(const QModelIndex &, const QModelIndex &);
void on_availableLV_clicked(const QModelIndex &); void on_availableLV_clicked(const QModelIndex &);
void on_availableLV_activated(const QModelIndex &); void on_availableLV_activated(const QModelIndex &);
void on_availableLV_entered(const QModelIndex &);
void availableChanged(const QModelIndex &, const QModelIndex &); void availableChanged(const QModelIndex &, const QModelIndex &);
virtual void changed(); virtual void changed();
/// check whether key is already selected /// check whether key is already selected

View File

@ -31,6 +31,45 @@
<number>6</number> <number>6</number>
</property> </property>
<item row="1" column="0" > <item row="1" column="0" >
<widget class="QTextBrowser" name="infoML" />
</item>
<item row="2" column="0" >
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>Search Citation</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="0" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QCheckBox" name="caseCB" >
<property name="text" >
<string>Case Sensitive</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="regexCB" >
<property name="text" >
<string>Regular Expression</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0" >
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<property name="margin" > <property name="margin" >
<number>0</number> <number>0</number>
@ -70,182 +109,9 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="4" column="0" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QPushButton" name="restorePB" >
<property name="text" >
<string>&amp;Restore</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="okPB" >
<property name="text" >
<string>&amp;OK</string>
</property>
<property name="autoDefault" >
<bool>true</bool>
</property>
<property name="default" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="applyPB" >
<property name="text" >
<string>A&amp;pply</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelPB" >
<property name="text" >
<string>&amp;Cancel</string>
</property>
<property name="autoDefault" >
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0" >
<widget class="QGroupBox" name="styleGB" >
<property name="title" >
<string>Formatting</string>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="1" colspan="2" >
<widget class="QComboBox" name="citationStyleCO" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>3</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Natbib citation style to use</string>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="citationStyleLA" >
<property name="text" >
<string>Citation &amp;style:</string>
</property>
<property name="buddy" >
<cstring>citationStyleCO</cstring>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2" >
<widget class="QCheckBox" name="fulllistCB" >
<property name="toolTip" >
<string>List all authors</string>
</property>
<property name="text" >
<string>&amp;Full author list</string>
</property>
</widget>
</item>
<item row="3" column="2" >
<widget class="QCheckBox" name="forceuppercaseCB" >
<property name="toolTip" >
<string>Force upper case in citation</string>
</property>
<property name="text" >
<string>Force &amp;upper case</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="textAfterLA" >
<property name="text" >
<string>&amp;Text after:</string>
</property>
<property name="buddy" >
<cstring>textAfterED</cstring>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2" >
<widget class="QLineEdit" name="textAfterED" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Text to place after citation</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="textBeforeLA" >
<property name="text" >
<string>Text &amp;before:</string>
</property>
<property name="buddy" >
<cstring>textAfterED</cstring>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2" >
<widget class="QLineEdit" name="textBeforeED" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Text to place before citation</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="2" column="0" >
<widget class="QTextBrowser" name="infoML" />
</item>
<item row="0" column="0" > <item row="0" column="0" >
<layout class="QGridLayout" > <layout class="QGridLayout" >
<property name="margin" > <property name="margin" >
@ -365,6 +231,179 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="3" column="0" >
<widget class="QGroupBox" name="styleGB" >
<property name="title" >
<string>Formatting</string>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="1" colspan="2" >
<widget class="QComboBox" name="citationStyleCO" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>3</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Natbib citation style to use</string>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="citationStyleLA" >
<property name="text" >
<string>Citation &amp;style:</string>
</property>
<property name="buddy" >
<cstring>citationStyleCO</cstring>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2" >
<widget class="QCheckBox" name="fulllistCB" >
<property name="toolTip" >
<string>List all authors</string>
</property>
<property name="text" >
<string>&amp;Full author list</string>
</property>
</widget>
</item>
<item row="3" column="2" >
<widget class="QCheckBox" name="forceuppercaseCB" >
<property name="toolTip" >
<string>Force upper case in citation</string>
</property>
<property name="text" >
<string>Force &amp;upper case</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="textAfterLA" >
<property name="text" >
<string>&amp;Text after:</string>
</property>
<property name="buddy" >
<cstring>textAfterED</cstring>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2" >
<widget class="QLineEdit" name="textAfterED" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Text to place after citation</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="textBeforeLA" >
<property name="text" >
<string>Text &amp;before:</string>
</property>
<property name="buddy" >
<cstring>textAfterED</cstring>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2" >
<widget class="QLineEdit" name="textBeforeED" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Text to place before citation</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="0" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QPushButton" name="restorePB" >
<property name="text" >
<string>&amp;Restore</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="okPB" >
<property name="text" >
<string>&amp;OK</string>
</property>
<property name="autoDefault" >
<bool>true</bool>
</property>
<property name="default" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="applyPB" >
<property name="text" >
<string>A&amp;pply</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelPB" >
<property name="text" >
<string>&amp;Cancel</string>
</property>
<property name="autoDefault" >
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
<tabstops> <tabstops>
@ -374,7 +413,6 @@
<tabstop>deletePB</tabstop> <tabstop>deletePB</tabstop>
<tabstop>upPB</tabstop> <tabstop>upPB</tabstop>
<tabstop>downPB</tabstop> <tabstop>downPB</tabstop>
<tabstop>findLE</tabstop>
<tabstop>infoML</tabstop> <tabstop>infoML</tabstop>
<tabstop>citationStyleCO</tabstop> <tabstop>citationStyleCO</tabstop>
<tabstop>textBeforeED</tabstop> <tabstop>textBeforeED</tabstop>