Parent: [34ab3a] (diff)

Child: [baf32f] (diff)

Download this file

uiprefs.ui.h    130 lines (116 with data), 3.8 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you want to add, delete, or rename functions or slots, use
** Qt Designer to update this file, preserving your code.
**
** You should not define a constructor or destructor in this file.
** Instead, write your code in functions called init() and destroy().
** These will automatically be called by the form's constructor and
** destructor.
*****************************************************************************/
#include "qfontdialog.h"
#include "qspinbox.h"
#include "qmessagebox.h"
#include "recoll.h"
#include "guiutils.h"
void UIPrefsDialog::init()
{
// Entries per result page spinbox
pageLenSB->setValue(prefs.respagesize);
// Show icons checkbox
useIconsCB->setChecked(prefs.showicons);
// Result list font family and size
reslistFontFamily = prefs.reslistfontfamily;
reslistFontSize = prefs.reslistfontsize;
QString s;
if (prefs.reslistfontfamily.length() == 0) {
reslistFontPB->setText(this->font().family() + "-" +
s.setNum(this->font().pointSize()));
} else {
reslistFontPB->setText(reslistFontFamily + "-" +
s.setNum(reslistFontSize));
}
// Stemming language combobox
stemLangCMB->insertItem("(no stemming)");
list<string> langs;
string reason;
if (!maybeOpenDb(reason)) {
QMessageBox::critical(0, "Recoll", QString(reason.c_str()));
exit(1);
}
langs = rcldb->getStemLangs();
int i = 0, cur = -1;
for (list<string>::const_iterator it = langs.begin();
it != langs.end(); it++) {
stemLangCMB->
insertItem(QString::fromAscii(it->c_str(), it->length()));
i++;
if (cur == -1) {
if (!strcmp(prefs.queryStemLang.ascii(), it->c_str()))
cur = i;
}
}
if (cur < 0)
cur = 0;
stemLangCMB->setCurrentItem(cur);
buildAbsCB->setDown(prefs.queryBuildAbstract);
if (!prefs.queryBuildAbstract) {
replAbsCB->setEnabled(false);
}
replAbsCB->setDown(prefs.queryReplaceAbstract);
connect(reslistFontPB, SIGNAL(clicked()), this, SLOT(showFontDialog()));
connect(resetFontPB, SIGNAL(clicked()), this, SLOT(resetReslistFont()));
}
void UIPrefsDialog::accept()
{
prefs.showicons = useIconsCB->isChecked();
prefs.respagesize = pageLenSB->value();
prefs.reslistfontfamily = reslistFontFamily;
prefs.reslistfontsize = reslistFontSize;
if (stemLangCMB->currentItem() == 0) {
prefs.queryStemLang = "";
} else {
prefs.queryStemLang = stemLangCMB->currentText();
}
prefs.queryBuildAbstract = buildAbsCB->isChecked();
prefs.queryReplaceAbstract = buildAbsCB->isChecked() &&
replAbsCB->isChecked();
rwSettings(true);
string reason;
maybeOpenDb(reason, true);
emit uiprefsDone();
QDialog::accept();
}
void UIPrefsDialog::showFontDialog()
{
bool ok;
QFont font;
if (prefs.reslistfontfamily.length()) {
font.setFamily(prefs.reslistfontfamily);
font.setPointSize(prefs.reslistfontsize);
}
font = QFontDialog::getFont(&ok, font, this );
if (ok) {
// Check if the default font was set, in which case we
// erase the preference
if (font.family().compare(this->font().family()) ||
font.pointSize() != this->font().pointSize()) {
reslistFontFamily = font.family();
reslistFontSize = font.pointSize();
QString s;
reslistFontPB->setText(reslistFontFamily + "-" +
s.setNum(reslistFontSize));
} else {
reslistFontFamily = "";
reslistFontSize = 0;
}
}
}
void UIPrefsDialog::resetReslistFont()
{
reslistFontFamily = "";
reslistFontSize = 0;
reslistFontPB->setText(this->font().family() + "-" +
QString().setNum(this->font().pointSize()));
}