#include "GuiPrefs.h"
-#include "qt_helpers.h"
+#include "FileDialog.h"
#include "GuiApplication.h"
+#include "GuiFontExample.h"
#include "GuiFontLoader.h"
+#include "GuiKeySymbol.h"
+#include "qt_helpers.h"
#include "BufferList.h"
#include "Color.h"
#include "ConverterCache.h"
-#include "FileDialog.h"
#include "FuncRequest.h"
-#include "GuiFontExample.h"
-#include "GuiKeySymbol.h"
#include "KeyMap.h"
#include "KeySequence.h"
+#include "Language.h"
#include "LyXAction.h"
#include "PanelStack.h"
#include "paper.h"
#include <QPixmapCache>
#include <QPushButton>
#include <QSpinBox>
+#include <QStandardItemModel.h>
#include <QString>
#include <QTreeWidget>
#include <QTreeWidgetItem>
QString const & label1, QString const & dir1,
QString const & label2, QString const & dir2)
{
- QString const fname = toqstr(makeAbsPath(
- fromqstr(filename), fromqstr(refpath)).absFilename());
+ QString const fname = makeAbsPath(filename, refpath);
QString const outname =
string const catOutput = N_("Output");
string const catFiles = N_("File Handling");
-static int findPos_helper(QStringList const & vec, QString const & val)
-{
- for (int i = 0; i != vec.size(); ++i)
- if (vec[i] == val)
- return i;
- return 0;
-}
-
-
static void parseFontName(QString const & mangled0,
string & name, string & foundry)
{
defaultLanguageCO->clear();
- // store the lang identifiers for later
- //foreach (LanguagePair const & lpair, languageData(false)) {
- QList<LanguagePair> l = languageData(false);
- foreach (LanguagePair const & lpair, l) {
- defaultLanguageCO->addItem(lpair.first);
- lang_.append(lpair.second);
- }
+ defaultLanguageCO->setModel(guiApp->languageModel());
}
rc.language_package = fromqstr(languagePackageED->text());
rc.language_command_begin = fromqstr(startCommandED->text());
rc.language_command_end = fromqstr(endCommandED->text());
- rc.default_language = fromqstr(lang_[defaultLanguageCO->currentIndex()]);
+ rc.default_language = fromqstr(
+ defaultLanguageCO->itemData(defaultLanguageCO->currentIndex()).toString());
}
startCommandED->setText(toqstr(rc.language_command_begin));
endCommandED->setText(toqstr(rc.language_command_end));
- int const pos = findPos_helper(lang_, toqstr(rc.default_language));
+ int const pos = defaultLanguageCO->findData(toqstr(rc.default_language));
defaultLanguageCO->setCurrentIndex(pos);
}
shortcutsTW->setSortingEnabled(true);
// Multi-selection can be annoying.
// shortcutsTW->setSelectionMode(QAbstractItemView::MultiSelection);
- shortcutsTW->header()->resizeSection(0, 200);
connect(bindFilePB, SIGNAL(clicked()),
this, SLOT(select_bind()));
mathItem_->setFlags(mathItem_->flags() & ~Qt::ItemIsSelectable);
bufferItem_ = new QTreeWidgetItem(shortcutsTW);
- bufferItem_->setText(0, qt_("Buffer and Window"));
+ bufferItem_->setText(0, qt_("Document and Window"));
bufferItem_->setFlags(bufferItem_->flags() & ~Qt::ItemIsSelectable);
layoutItem_ = new QTreeWidgetItem(shortcutsTW);
shortcutsTW->sortItems(0, Qt::AscendingOrder);
QList<QTreeWidgetItem*> items = shortcutsTW->selectedItems();
removePB->setEnabled(!items.isEmpty() && !items[0]->text(1).isEmpty());
+ modifyPB->setEnabled(!items.isEmpty());
+
+ shortcutsTW->resizeColumnToContents(0);
}
{
QList<QTreeWidgetItem*> items = shortcutsTW->selectedItems();
removePB->setEnabled(!items.isEmpty() && !items[0]->text(1).isEmpty());
+ modifyPB->setEnabled(!items.isEmpty());
if (items.isEmpty())
return;
void PrefShortcuts::on_shortcutsTW_itemDoubleClicked()
+{
+ modifyShortcut();
+}
+
+
+void PrefShortcuts::modifyShortcut()
{
QTreeWidgetItem * item = shortcutsTW->currentItem();
if (item->flags() & Qt::ItemIsSelectable) {
shortcut_->lfunLE->setText(item->text(0));
- // clear the shortcut because I assume that a user will enter
- // a new shortcut.
- shortcut_->shortcutLE->reset();
+ shortcut_->shortcutLE->setText(item->text(1));
shortcut_->shortcutLE->setFocus();
shortcut_->exec();
}
}
+void PrefShortcuts::on_modifyPB_pressed()
+{
+ modifyShortcut();
+}
+
+
void PrefShortcuts::on_newPB_pressed()
{
shortcut_->lfunLE->clear();