#include "controllers/frnt_lang.h"
-#include <QLabel>
-#include <QLineEdit>
-#include <QPushButton>
-#include <QRadioButton>
-#include <QCheckBox>
-#include <QSlider>
-#include <QPixmap>
-#include <QColor>
-#include <QColorDialog>
-#include <QValidator>
-
using lyx::support::token;
using lyx::support::bformat;
using lyx::support::getVectorFromString;
-using std::string;
-
-
using std::distance;
using std::vector;
using std::string;
}
-/*
-QDocumentDialog::getTextClass()
-{
- return latexModule->classCO->currentItem();
-}
-*/
-
QDocumentDialog::QDocumentDialog(QDocument * form)
- : form_(form),
+ : form_(form),
lang_(getSecond(getLanguageData(false)))
{
setupUi(this);
form, SLOT(slotClose()));
connect(restorePB, SIGNAL(clicked()),
form, SLOT(slotRestore()));
-
- connect( savePB, SIGNAL( clicked() ), this, SLOT( saveDefaultClicked() ) );
- connect( defaultPB, SIGNAL( clicked() ), this, SLOT( useDefaultsClicked() ) );
+
+ connect(savePB, SIGNAL( clicked() ),
+ this, SLOT( saveDefaultClicked() ) );
+ connect(defaultPB, SIGNAL( clicked() ),
+ this, SLOT( useDefaultsClicked() ) );
// Manage the restore, ok, apply, restore and cancel/close buttons
form_->bcview().setOK(okPB);
qt_("Double"), Spacing::Double);
textLayoutModule->lspacingCO->insertItem(
qt_("Custom"), Spacing::Other);
-
+
// initialize the length validator
addCheckedLineEdit(form_->bcview(), textLayoutModule->skipLE);
-
-
+
+
pageLayoutModule = new UiWidget<Ui::PageLayoutUi>;
// page layout
connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)), this, SLOT(setCustomPapersize(int)));
pageLayoutModule->paperheightL);
addCheckedLineEdit(form_->bcview(), pageLayoutModule->paperwidthLE,
pageLayoutModule->paperwidthL);
-
+
// paper
QComboBox * cb = pageLayoutModule->papersizeCO;
cb->insertItem(qt_("Default"));
connect(marginsModule->headsepLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
connect(marginsModule->headsepUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(marginsModule->footskipLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
- connect(marginsModule->footskipUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
+ connect(marginsModule->footskipUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
marginsModule->topLE->setValidator(unsignedLengthValidator(
marginsModule->topLE));
marginsModule->bottomLE->setValidator(unsignedLengthValidator(
marginsModule->footskipL);
-
+
langModule = new UiWidget<Ui::LanguageUi>;
connect(numberingModule->tocSL, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
connect(numberingModule->depthSL, SIGNAL(valueChanged(int)), this, SLOT(updateNumbering()));
connect(numberingModule->tocSL, SIGNAL(valueChanged(int)), this, SLOT(updateNumbering()));
- numberingModule->tocLV->setSorting(-1);
-
+ numberingModule->tocTW->setColumnCount(3);
+ numberingModule->tocTW->headerItem()->setText(0, qt_("Example"));
+ numberingModule->tocTW->headerItem()->setText(1, qt_("Numbered"));
+ numberingModule->tocTW->headerItem()->setText(2, qt_("Appears in TOC"));
biblioModule = new UiWidget<Ui::BiblioUi>;
- connect( biblioModule->citeNatbibRB, SIGNAL( toggled(bool) ), biblioModule->citationStyleL, SLOT( setEnabled(bool) ) );
- connect( biblioModule->citeNatbibRB, SIGNAL( toggled(bool) ), biblioModule->citeStyleCO, SLOT( setEnabled(bool) ) );
+ connect( biblioModule->citeNatbibRB, SIGNAL( toggled(bool) ), biblioModule->citationStyleL, SLOT( setEnabled(bool) ) );
+ connect( biblioModule->citeNatbibRB, SIGNAL( toggled(bool) ), biblioModule->citeStyleCO, SLOT( setEnabled(bool) ) );
// biblio
connect(biblioModule->citeDefaultRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
connect(biblioModule->citeNatbibRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
biblioModule->citeStyleCO->insertItem(qt_("Numerical"));
biblioModule->citeStyleCO->setCurrentItem(0);
-
-
+
+
mathsModule = new UiWidget<Ui::MathsUi>;
connect( mathsModule->amsautoCB, SIGNAL( toggled(bool) ), mathsModule->amsCB, SLOT( setDisabled(bool) ) );
// maths
connect(mathsModule->amsCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
connect(mathsModule->amsautoCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
-
+
latexModule = new UiWidget<Ui::LaTeXUi>;
// latex class
connect(latexModule->classCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
latexModule->classCO->insertItem(toqstr(item));
}
}
-
-
+
+
branchesModule = new QBranches;
-
+ connect(branchesModule, SIGNAL(changed()), this, SLOT(change_adaptor()));
+
preambleModule = new UiWidget<Ui::PreambleUi>;
// preamble
- connect(preambleModule->preambleMLE, SIGNAL(textChanged()), this, SLOT(change_adaptor()));
+ connect(preambleModule->preambleTE, SIGNAL(textChanged()), this, SLOT(change_adaptor()));
bulletsModule = new BulletsModule;
// bullets
connect(bulletsModule, SIGNAL(changed()), this, SLOT(change_adaptor()));
-
- floatModule = new FloatPlacement(this);
+
+ floatModule = new FloatPlacement;
// float
connect(floatModule, SIGNAL(changed()), this, SLOT(change_adaptor()));
docPS->addPanel(branchesModule, _("Branches"));
docPS->addPanel(preambleModule, _("LaTeX Preamble"));
docPS->setCurrentPanel(_("Document Class"));
-}
+}
QDocumentDialog::~QDocumentDialog()
LyXTextClass const & tclass =
form_->controller().params().getLyXTextClass();
- //numberingModule->tocLV->setUpdatesEnabled(false);
+ numberingModule->tocTW->setUpdatesEnabled(false);
+ numberingModule->tocTW->clear();
- // Update the example QListView
int const depth = numberingModule->depthSL->value();
int const toc = numberingModule->tocSL->value();
QString const no = qt_("No");
QString const yes = qt_("Yes");
LyXTextClass::const_iterator end = tclass.end();
LyXTextClass::const_iterator cit = tclass.begin();
- numberingModule->tocLV->clear();
- Q3ListViewItem * item = 0;
+ QTreeWidgetItem * item = 0;
for ( ; cit != end ; ++cit) {
int const toclevel = (*cit)->toclevel;
if (toclevel != LyXLayout::NOT_IN_TOC) {
- item = new Q3ListViewItem(numberingModule->tocLV,
- item, qt_((*cit)->name()));
+ item = new QTreeWidgetItem(numberingModule->tocTW);
+ item->setText(0, qt_((*cit)->name()));
item->setText(1, (toclevel <= depth) ? yes : no);
item->setText(2, (toclevel <= toc) ? yes : no);
}
}
- //numberingModule->tocLV->setUpdatesEnabled(true);
- //numberingModule->tocLV->update();
+ numberingModule->tocTW->setUpdatesEnabled(true);
+ numberingModule->tocTW->update();
}
void QDocumentDialog::apply(BufferParams & params)
{
// preamble
params.preamble =
- fromqstr(preambleModule->preambleMLE->text());
+ fromqstr(preambleModule->preambleTE->document()->toPlainText());
// biblio
params.cite_engine = biblio::ENGINE_BASIC;
params.language = languages.getLanguage(lang_[pos]);
// numbering
- params.tocdepth = numberingModule->tocSL->value();
- params.secnumdepth = numberingModule->depthSL->value();
+ if (params.getLyXTextClass().hasTocLevels()) {
+ params.tocdepth = numberingModule->tocSL->value();
+ params.secnumdepth = numberingModule->depthSL->value();
+ }
// bullets
params.user_defined_bullet(0) = bulletsModule->getBullet(0);
// preamble
QString preamble = toqstr(params.preamble);
- preambleModule->preambleMLE->setText(preamble);
+ preambleModule->preambleTE->document()->setPlainText(preamble);
// biblio
biblioModule->citeDefaultRB->setChecked(
// numbering
int const min_toclevel = form_->controller().textClass().min_toclevel();
int const max_toclevel = form_->controller().textClass().max_toclevel();
- if (min_toclevel != LyXLayout::NOT_IN_TOC)
+ if (form_->controller().textClass().hasTocLevels()) {
numberingModule->setEnabled(true);
- else {
+ numberingModule->depthSL->setMinValue(min_toclevel - 1);
+ numberingModule->depthSL->setMaxValue(max_toclevel);
+ numberingModule->depthSL->setValue(params.secnumdepth);
+ numberingModule->tocSL->setMinValue(min_toclevel - 1);
+ numberingModule->tocSL->setMaxValue(max_toclevel);
+ numberingModule->tocSL->setValue(params.tocdepth);
+ updateNumbering();
+ } else {
numberingModule->setEnabled(false);
- numberingModule->tocLV->clear();
+ numberingModule->tocTW->clear();
}
- numberingModule->depthSL->setMinValue(min_toclevel - 1);
- numberingModule->depthSL->setMaxValue(max_toclevel);
- numberingModule->depthSL->setValue(params.secnumdepth);
- numberingModule->tocSL->setMinValue(min_toclevel - 1);
- numberingModule->tocSL->setMaxValue(max_toclevel);
- numberingModule->tocSL->setValue(params.tocdepth);
- updateNumbering();
// bullets
bulletsModule->setBullet(0,params.user_defined_bullet(0));