mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
merge QTexinfo and QTexinfoDialog
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17952 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
1ed0c6be12
commit
735934a376
@ -73,7 +73,6 @@ libqt4_la_SOURCES = \
|
||||
QSpellchecker.C QSpellchecker.h \
|
||||
QTabular.C QTabular.h \
|
||||
QTabularCreate.C QTabularCreate.h \
|
||||
QTexinfo.C QTexinfo.h \
|
||||
Qt2BC.C Qt2BC.h \
|
||||
checkedwidgets.C checkedwidgets.h \
|
||||
panelstack.h panelstack.C \
|
||||
|
@ -126,7 +126,7 @@ MOCFILES = \
|
||||
QDialogView.C QDialogView.h \
|
||||
QTabularCreateDialog.C QTabularCreateDialog.h \
|
||||
QTabularDialog.C QTabularDialog.h \
|
||||
QTexinfoDialog.C QTexinfoDialog.h \
|
||||
QTexinfo.C QTexinfo.h \
|
||||
QThesaurus.C QThesaurus.h \
|
||||
TocModel.C TocModel.h \
|
||||
TocWidget.C TocWidget.h \
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "QTexinfo.h"
|
||||
#include "QTexinfoDialog.h"
|
||||
#include "Qt2BC.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
@ -22,10 +21,106 @@
|
||||
#include <QPushButton>
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QTexinfoDialog
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
QTexinfoDialog::QTexinfoDialog(QTexinfo * form)
|
||||
: form_(form)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
|
||||
|
||||
connect(viewPB, SIGNAL(clicked()), this, SLOT(viewClicked()));
|
||||
connect(whatStyleCO, SIGNAL(activated(const QString &)),
|
||||
this, SLOT(enableViewPB()));
|
||||
connect(whatStyleCO, SIGNAL(activated(int)), this, SLOT(update()));
|
||||
connect(pathCB, SIGNAL(stateChanged(int)), this, SLOT(update()));
|
||||
connect(rescanPB, SIGNAL(clicked()), this, SLOT(enableViewPB()));
|
||||
connect(rescanPB, SIGNAL(clicked()), this, SLOT(rescanClicked()));
|
||||
connect(fileListLW, SIGNAL(itemClicked(QListWidgetItem *)),
|
||||
this, SLOT( enableViewPB() ) );
|
||||
connect(fileListLW, SIGNAL(itemSelectionChanged()),
|
||||
this, SLOT(enableViewPB()));
|
||||
}
|
||||
|
||||
|
||||
void QTexinfoDialog::change_adaptor()
|
||||
{
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QTexinfoDialog::closeEvent(QCloseEvent * e)
|
||||
{
|
||||
form_->slotWMHide();
|
||||
e->accept();
|
||||
}
|
||||
|
||||
|
||||
void QTexinfoDialog::rescanClicked()
|
||||
{
|
||||
// build new *Files.lst
|
||||
rescanTexStyles();
|
||||
form_->updateStyles();
|
||||
enableViewPB();
|
||||
}
|
||||
|
||||
|
||||
void QTexinfoDialog::viewClicked()
|
||||
{
|
||||
vector<string>::size_type const fitem = fileListLW->currentRow();
|
||||
vector<string> const & data = form_->texdata_[form_->activeStyle];
|
||||
string file = data[fitem];
|
||||
if (!pathCB->isChecked())
|
||||
file = getTexFileFromList(data[fitem],
|
||||
form_->controller().getFileType(form_->activeStyle));
|
||||
form_->controller().viewFile(file);
|
||||
}
|
||||
|
||||
|
||||
void QTexinfoDialog::update()
|
||||
{
|
||||
switch (whatStyleCO->currentIndex()) {
|
||||
case 0:
|
||||
form_->updateStyles(ControlTexinfo::cls);
|
||||
break;
|
||||
case 1:
|
||||
form_->updateStyles(ControlTexinfo::sty);
|
||||
break;
|
||||
case 2:
|
||||
form_->updateStyles(ControlTexinfo::bst);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
enableViewPB();
|
||||
}
|
||||
|
||||
|
||||
void QTexinfoDialog::enableViewPB()
|
||||
{
|
||||
viewPB->setEnabled(fileListLW->currentRow() > -1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QTexinfo
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef QController<ControlTexinfo, QView<QTexinfoDialog> > texinfo_base_class;
|
||||
|
||||
QTexinfo::QTexinfo(Dialog & parent)
|
||||
@ -69,3 +164,6 @@ void QTexinfo::updateStyles()
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
|
||||
#include "QTexinfo_moc.cpp"
|
||||
|
@ -13,9 +13,12 @@
|
||||
#define QTEXINFO_H
|
||||
|
||||
#include "QDialogView.h"
|
||||
#include "QTexinfoDialog.h"
|
||||
|
||||
#include "ControlTexinfo.h"
|
||||
#include "ui/TexinfoUi.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QCloseEvent>
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
@ -23,6 +26,26 @@
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QTexinfo;
|
||||
|
||||
class QTexinfoDialog : public QDialog, public Ui::QTexinfoUi {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QTexinfoDialog(QTexinfo * form);
|
||||
public Q_SLOTS:
|
||||
virtual void update();
|
||||
protected Q_SLOTS:
|
||||
virtual void change_adaptor();
|
||||
virtual void rescanClicked();
|
||||
virtual void viewClicked();
|
||||
virtual void enableViewPB();
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent * e);
|
||||
private:
|
||||
QTexinfo * form_;
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
class QTexinfo
|
||||
: public QController<ControlTexinfo, QView<QTexinfoDialog> > {
|
||||
|
@ -1,109 +0,0 @@
|
||||
/**
|
||||
* \file QTexinfoDialog.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Edwin Leuven
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "QTexinfoDialog.h"
|
||||
#include "QTexinfo.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QListWidget>
|
||||
#include <QPushButton>
|
||||
#include <QCloseEvent>
|
||||
|
||||
using std::vector;
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
|
||||
QTexinfoDialog::QTexinfoDialog(QTexinfo * form)
|
||||
:form_(form)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
connect(closePB, SIGNAL(clicked()),
|
||||
form, SLOT(slotClose()));
|
||||
|
||||
connect( viewPB, SIGNAL( clicked() ), this, SLOT( viewClicked() ) );
|
||||
connect( whatStyleCO, SIGNAL( activated(const QString&) ), this, SLOT( enableViewPB() ) );
|
||||
connect( whatStyleCO, SIGNAL( activated(int) ), this, SLOT( update() ) );
|
||||
connect( pathCB, SIGNAL( stateChanged(int) ), this, SLOT( update() ) );
|
||||
connect( rescanPB, SIGNAL( clicked() ), this, SLOT( enableViewPB() ) );
|
||||
connect( rescanPB, SIGNAL( clicked() ), this, SLOT( rescanClicked() ) );
|
||||
connect( fileListLW, SIGNAL( itemClicked(QListWidgetItem*) ), this, SLOT( enableViewPB() ) );
|
||||
connect( fileListLW, SIGNAL( itemSelectionChanged() ), this, SLOT( enableViewPB() ) );
|
||||
}
|
||||
|
||||
|
||||
void QTexinfoDialog::change_adaptor()
|
||||
{
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QTexinfoDialog::closeEvent(QCloseEvent * e)
|
||||
{
|
||||
form_->slotWMHide();
|
||||
e->accept();
|
||||
}
|
||||
|
||||
|
||||
void QTexinfoDialog::rescanClicked()
|
||||
{
|
||||
// build new *Files.lst
|
||||
rescanTexStyles();
|
||||
form_->updateStyles();
|
||||
enableViewPB();
|
||||
}
|
||||
|
||||
|
||||
void QTexinfoDialog::viewClicked()
|
||||
{
|
||||
vector<string>::size_type const fitem = fileListLW->currentRow();
|
||||
vector<string> const & data = form_->texdata_[form_->activeStyle];
|
||||
string file = data[fitem];
|
||||
if (!pathCB->isChecked())
|
||||
file = getTexFileFromList(data[fitem],
|
||||
form_->controller().getFileType(form_->activeStyle));
|
||||
form_->controller().viewFile(file);
|
||||
}
|
||||
|
||||
|
||||
void QTexinfoDialog::update()
|
||||
{
|
||||
switch (whatStyleCO->currentIndex()) {
|
||||
case 0:
|
||||
form_->updateStyles(ControlTexinfo::cls);
|
||||
break;
|
||||
case 1:
|
||||
form_->updateStyles(ControlTexinfo::sty);
|
||||
break;
|
||||
case 2:
|
||||
form_->updateStyles(ControlTexinfo::bst);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
enableViewPB();
|
||||
}
|
||||
|
||||
|
||||
void QTexinfoDialog::enableViewPB()
|
||||
{
|
||||
viewPB->setEnabled(fileListLW->currentRow() > -1);
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QTexinfoDialog_moc.cpp"
|
@ -1,45 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QTexinfoDialog.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Edwin Leuven
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QTEXINFODIALOG_H
|
||||
#define QTEXINFODIALOG_H
|
||||
|
||||
#include "ui/TexinfoUi.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QCloseEvent>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QTexinfo;
|
||||
|
||||
class QTexinfoDialog : public QDialog, public Ui::QTexinfoUi {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QTexinfoDialog(QTexinfo * form);
|
||||
public Q_SLOTS:
|
||||
virtual void update();
|
||||
protected Q_SLOTS:
|
||||
virtual void change_adaptor();
|
||||
virtual void rescanClicked();
|
||||
virtual void viewClicked();
|
||||
virtual void enableViewPB();
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent * e);
|
||||
private:
|
||||
QTexinfo * form_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QTEXINFODIALOG_H
|
Loading…
Reference in New Issue
Block a user