mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-26 18:07:18 +00:00
Merge Dialog and Controller in DockView. Still crashes...
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20855 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f63c57f0c2
commit
8dc0c09d72
@ -25,8 +25,7 @@ namespace frontend {
|
|||||||
/// Dock Widget container for LyX dialogs.
|
/// Dock Widget container for LyX dialogs.
|
||||||
/// This template class that encapsulates a given Widget inside a
|
/// This template class that encapsulates a given Widget inside a
|
||||||
/// QDockWidget and presents a Dialog interface
|
/// QDockWidget and presents a Dialog interface
|
||||||
template<class MyController, class MyWidget>
|
class DockView : public QDockWidget, public Dialog, public Controller
|
||||||
class DockView : public QDockWidget, public Dialog
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DockView(
|
DockView(
|
||||||
@ -35,19 +34,15 @@ public:
|
|||||||
Qt::DockWidgetArea area = Qt::LeftDockWidgetArea, ///< Position of the dock (and also drawer)
|
Qt::DockWidgetArea area = Qt::LeftDockWidgetArea, ///< Position of the dock (and also drawer)
|
||||||
Qt::WindowFlags flags = 0
|
Qt::WindowFlags flags = 0
|
||||||
)
|
)
|
||||||
: QDockWidget(&parent, flags), name_(name)
|
: QDockWidget(&parent, flags), name_(name), Controller(this)
|
||||||
{
|
{
|
||||||
if (flags & Qt::Drawer)
|
if (flags & Qt::Drawer)
|
||||||
setFeatures(QDockWidget::NoDockWidgetFeatures);
|
setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||||
MyController * c = new MyController(*this);
|
setLyXView(parent);
|
||||||
controller_ = c;
|
|
||||||
controller_->setLyXView(parent);
|
|
||||||
widget_ = new MyWidget(*c);
|
|
||||||
setWidget(widget_);
|
|
||||||
setWindowTitle(widget_->windowTitle());
|
|
||||||
parent.addDockWidget(area, this);
|
parent.addDockWidget(area, this);
|
||||||
}
|
}
|
||||||
~DockView() { delete widget_; delete controller_; }
|
|
||||||
|
virtual ~DockView() {}
|
||||||
|
|
||||||
/// Dialog inherited methods
|
/// Dialog inherited methods
|
||||||
//@{
|
//@{
|
||||||
@ -55,12 +50,12 @@ public:
|
|||||||
void hideView() { QDockWidget::hide(); }
|
void hideView() { QDockWidget::hide(); }
|
||||||
void showData(std::string const & data)
|
void showData(std::string const & data)
|
||||||
{
|
{
|
||||||
controller_->initialiseParams(data);
|
initialiseParams(data);
|
||||||
showView();
|
showView();
|
||||||
}
|
}
|
||||||
void showView()
|
void showView()
|
||||||
{
|
{
|
||||||
widget_->updateView(); // make sure its up-to-date
|
updateView(); // make sure its up-to-date
|
||||||
QDockWidget::show();
|
QDockWidget::show();
|
||||||
}
|
}
|
||||||
bool isVisibleView() const { return QDockWidget::isVisible(); }
|
bool isVisibleView() const { return QDockWidget::isVisible(); }
|
||||||
@ -69,23 +64,15 @@ public:
|
|||||||
void redrawView() {}
|
void redrawView() {}
|
||||||
void updateData(std::string const & data)
|
void updateData(std::string const & data)
|
||||||
{
|
{
|
||||||
controller_->initialiseParams(data);
|
initialiseParams(data);
|
||||||
updateView();
|
updateView();
|
||||||
}
|
}
|
||||||
void updateView()
|
|
||||||
{
|
|
||||||
widget_->updateView();
|
|
||||||
QDockWidget::update();
|
|
||||||
}
|
|
||||||
bool isClosing() const { return false; }
|
bool isClosing() const { return false; }
|
||||||
void partialUpdateView(int /*id*/) {}
|
void partialUpdateView(int /*id*/) {}
|
||||||
Controller & controller() { return *controller_; }
|
Controller & controller() { return *this; }
|
||||||
std::string name() const { return name_; }
|
std::string name() const { return name_; }
|
||||||
//@}
|
//@}
|
||||||
private:
|
private:
|
||||||
/// The encapsulated widget.
|
|
||||||
MyWidget * widget_;
|
|
||||||
Controller * controller_;
|
|
||||||
std::string name_;
|
std::string name_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -38,8 +38,8 @@ using support::FileFilterList;
|
|||||||
using support::FileName;
|
using support::FileName;
|
||||||
using support::libFileSearch;
|
using support::libFileSearch;
|
||||||
|
|
||||||
GuiEmbeddedFilesDialog::GuiEmbeddedFilesDialog
|
EmbeddedFilesWidget::EmbeddedFilesWidget
|
||||||
(ControlEmbeddedFiles & controller)
|
(GuiEmbeddedFiles & controller)
|
||||||
: controller_(controller)
|
: controller_(controller)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
@ -60,7 +60,7 @@ GuiEmbeddedFilesDialog::GuiEmbeddedFilesDialog
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiEmbeddedFilesDialog::on_filesLW_itemChanged(QListWidgetItem* item)
|
void EmbeddedFilesWidget::on_filesLW_itemChanged(QListWidgetItem* item)
|
||||||
{
|
{
|
||||||
EmbeddedFiles & files = controller_.embeddedFiles();
|
EmbeddedFiles & files = controller_.embeddedFiles();
|
||||||
if (item->checkState() == Qt::Checked) {
|
if (item->checkState() == Qt::Checked) {
|
||||||
@ -79,7 +79,7 @@ void GuiEmbeddedFilesDialog::on_filesLW_itemChanged(QListWidgetItem* item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiEmbeddedFilesDialog::on_filesLW_itemSelectionChanged()
|
void EmbeddedFilesWidget::on_filesLW_itemSelectionChanged()
|
||||||
{
|
{
|
||||||
if (controller_.isReadonly())
|
if (controller_.isReadonly())
|
||||||
return;
|
return;
|
||||||
@ -113,7 +113,7 @@ void GuiEmbeddedFilesDialog::on_filesLW_itemSelectionChanged()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiEmbeddedFilesDialog::on_filesLW_itemClicked(QListWidgetItem* item)
|
void EmbeddedFilesWidget::on_filesLW_itemClicked(QListWidgetItem* item)
|
||||||
{
|
{
|
||||||
EmbeddedFiles & files = controller_.embeddedFiles();
|
EmbeddedFiles & files = controller_.embeddedFiles();
|
||||||
int idx = filesLW->row(item);
|
int idx = filesLW->row(item);
|
||||||
@ -134,14 +134,14 @@ void GuiEmbeddedFilesDialog::on_filesLW_itemClicked(QListWidgetItem* item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiEmbeddedFilesDialog::on_filesLW_itemDoubleClicked(QListWidgetItem* item)
|
void EmbeddedFilesWidget::on_filesLW_itemDoubleClicked(QListWidgetItem* item)
|
||||||
{
|
{
|
||||||
EmbeddedFiles & files = controller_.embeddedFiles();
|
EmbeddedFiles & files = controller_.embeddedFiles();
|
||||||
controller_.view(files[filesLW->row(item)]);
|
controller_.view(files[filesLW->row(item)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiEmbeddedFilesDialog::updateView()
|
void EmbeddedFilesWidget::updateView()
|
||||||
{
|
{
|
||||||
bool readOnly = controller_.isReadonly();
|
bool readOnly = controller_.isReadonly();
|
||||||
fullpathLE->setEnabled(!readOnly);
|
fullpathLE->setEnabled(!readOnly);
|
||||||
@ -179,7 +179,7 @@ void GuiEmbeddedFilesDialog::updateView()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiEmbeddedFilesDialog::on_selectPB_clicked()
|
void EmbeddedFilesWidget::on_selectPB_clicked()
|
||||||
{
|
{
|
||||||
EmbeddedFiles & files = controller_.embeddedFiles();
|
EmbeddedFiles & files = controller_.embeddedFiles();
|
||||||
// this should not be needed after EmbeddedFiles are updated correctly.
|
// this should not be needed after EmbeddedFiles are updated correctly.
|
||||||
@ -194,7 +194,7 @@ void GuiEmbeddedFilesDialog::on_selectPB_clicked()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiEmbeddedFilesDialog::on_unselectPB_clicked()
|
void EmbeddedFilesWidget::on_unselectPB_clicked()
|
||||||
{
|
{
|
||||||
EmbeddedFiles & files = controller_.embeddedFiles();
|
EmbeddedFiles & files = controller_.embeddedFiles();
|
||||||
// this should not be needed after EmbeddedFiles are updated correctly.
|
// this should not be needed after EmbeddedFiles are updated correctly.
|
||||||
@ -209,14 +209,14 @@ void GuiEmbeddedFilesDialog::on_unselectPB_clicked()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiEmbeddedFilesDialog::on_addPB_clicked()
|
void EmbeddedFilesWidget::on_addPB_clicked()
|
||||||
{
|
{
|
||||||
if (controller_.browseAndAddFile())
|
if (controller_.browseAndAddFile())
|
||||||
updateView();
|
updateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiEmbeddedFilesDialog::on_extractPB_clicked()
|
void EmbeddedFilesWidget::on_extractPB_clicked()
|
||||||
{
|
{
|
||||||
EmbeddedFiles const & files = controller_.embeddedFiles();
|
EmbeddedFiles const & files = controller_.embeddedFiles();
|
||||||
QList<QListWidgetItem *> selection = filesLW->selectedItems();
|
QList<QListWidgetItem *> selection = filesLW->selectedItems();
|
||||||
@ -228,7 +228,7 @@ void GuiEmbeddedFilesDialog::on_extractPB_clicked()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiEmbeddedFilesDialog::on_updatePB_clicked()
|
void EmbeddedFilesWidget::on_updatePB_clicked()
|
||||||
{
|
{
|
||||||
EmbeddedFiles const & files = controller_.embeddedFiles();
|
EmbeddedFiles const & files = controller_.embeddedFiles();
|
||||||
QList<QListWidgetItem *> selection = filesLW->selectedItems();
|
QList<QListWidgetItem *> selection = filesLW->selectedItems();
|
||||||
@ -241,31 +241,41 @@ void GuiEmbeddedFilesDialog::on_updatePB_clicked()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void GuiEmbeddedFilesDialog::on_enableCB_toggled(bool enable)
|
void EmbeddedFilesWidget::on_enableCB_toggled(bool enable)
|
||||||
{
|
{
|
||||||
controller_.setEmbedding(enable);
|
controller_.setEmbedding(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ControlEmbeddedFiles::ControlEmbeddedFiles(Dialog & parent)
|
GuiEmbeddedFiles::GuiEmbeddedFiles(GuiViewBase & parent, Qt::DockWidgetArea area, Qt::WindowFlags flags)
|
||||||
: Controller(parent)
|
: DockView(parent, "embedded", area, flags)
|
||||||
{}
|
{
|
||||||
|
widget_ = new EmbeddedFilesWidget(*this);
|
||||||
|
setWidget(widget_);
|
||||||
|
setWindowTitle(widget_->windowTitle());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
EmbeddedFiles & ControlEmbeddedFiles::embeddedFiles()
|
void GuiEmbeddedFiles::updateView()
|
||||||
|
{
|
||||||
|
widget_->updateView();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
EmbeddedFiles & GuiEmbeddedFiles::embeddedFiles()
|
||||||
{
|
{
|
||||||
return buffer().embeddedFiles();
|
return buffer().embeddedFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ControlEmbeddedFiles::initialiseParams(string const &)
|
bool GuiEmbeddedFiles::initialiseParams(string const &)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ControlEmbeddedFiles::updateEmbeddedFiles()
|
void GuiEmbeddedFiles::updateEmbeddedFiles()
|
||||||
{
|
{
|
||||||
// copy buffer embeddedFiles to a local copy
|
// copy buffer embeddedFiles to a local copy
|
||||||
buffer().embeddedFiles().update();
|
buffer().embeddedFiles().update();
|
||||||
@ -273,7 +283,7 @@ void ControlEmbeddedFiles::updateEmbeddedFiles()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ControlEmbeddedFiles::dispatchMessage(string const & msg)
|
void GuiEmbeddedFiles::dispatchMessage(string const & msg)
|
||||||
{
|
{
|
||||||
// FIXME: the right thing to do? QT guys?
|
// FIXME: the right thing to do? QT guys?
|
||||||
// lyx view will only be updated if we do something to the main window. :-)
|
// lyx view will only be updated if we do something to the main window. :-)
|
||||||
@ -281,13 +291,13 @@ void ControlEmbeddedFiles::dispatchMessage(string const & msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ControlEmbeddedFiles::isReadonly()
|
bool GuiEmbeddedFiles::isReadonly()
|
||||||
{
|
{
|
||||||
return buffer().isReadonly();
|
return buffer().isReadonly();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ControlEmbeddedFiles::setEmbedding(bool enable)
|
void GuiEmbeddedFiles::setEmbedding(bool enable)
|
||||||
{
|
{
|
||||||
if (embeddedFiles().enabled() == enable)
|
if (embeddedFiles().enabled() == enable)
|
||||||
return;
|
return;
|
||||||
@ -300,7 +310,7 @@ void ControlEmbeddedFiles::setEmbedding(bool enable)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ControlEmbeddedFiles::goTo(EmbeddedFile const & item, int idx)
|
void GuiEmbeddedFiles::goTo(EmbeddedFile const & item, int idx)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(idx < item.refCount());
|
BOOST_ASSERT(idx < item.refCount());
|
||||||
item.saveBookmark(&buffer(), idx);
|
item.saveBookmark(&buffer(), idx);
|
||||||
@ -308,13 +318,13 @@ void ControlEmbeddedFiles::goTo(EmbeddedFile const & item, int idx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ControlEmbeddedFiles::view(EmbeddedFile const & item)
|
void GuiEmbeddedFiles::view(EmbeddedFile const & item)
|
||||||
{
|
{
|
||||||
formats.view(buffer(), item, formats.getFormatFromFile(item));
|
formats.view(buffer(), item, formats.getFormatFromFile(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ControlEmbeddedFiles::setEmbed(EmbeddedFile & item, bool embed, bool update)
|
void GuiEmbeddedFiles::setEmbed(EmbeddedFile & item, bool embed, bool update)
|
||||||
{
|
{
|
||||||
if (item.embedded() == embed)
|
if (item.embedded() == embed)
|
||||||
return;
|
return;
|
||||||
@ -337,7 +347,7 @@ void ControlEmbeddedFiles::setEmbed(EmbeddedFile & item, bool embed, bool update
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ControlEmbeddedFiles::browseAndAddFile()
|
bool GuiEmbeddedFiles::browseAndAddFile()
|
||||||
{
|
{
|
||||||
std::pair<docstring, docstring> dir1(_("Documents|#o#O"),
|
std::pair<docstring, docstring> dir1(_("Documents|#o#O"),
|
||||||
from_utf8(lyxrc.document_path));
|
from_utf8(lyxrc.document_path));
|
||||||
@ -357,7 +367,7 @@ bool ControlEmbeddedFiles::browseAndAddFile()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ControlEmbeddedFiles::extract(EmbeddedFile const & item)
|
bool GuiEmbeddedFiles::extract(EmbeddedFile const & item)
|
||||||
{
|
{
|
||||||
if (item.embedded())
|
if (item.embedded())
|
||||||
return item.extract(&buffer());
|
return item.extract(&buffer());
|
||||||
@ -366,7 +376,7 @@ bool ControlEmbeddedFiles::extract(EmbeddedFile const & item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ControlEmbeddedFiles::update(EmbeddedFile const & item)
|
bool GuiEmbeddedFiles::update(EmbeddedFile const & item)
|
||||||
{
|
{
|
||||||
if (item.embedded())
|
if (item.embedded())
|
||||||
return item.updateFromExternalFile(&buffer());
|
return item.updateFromExternalFile(&buffer());
|
||||||
@ -375,16 +385,15 @@ bool ControlEmbeddedFiles::update(EmbeddedFile const & item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GuiEmbeddedFiles::GuiEmbeddedFiles(LyXView & lv)
|
|
||||||
: DockView<ControlEmbeddedFiles, GuiEmbeddedFilesDialog>(
|
|
||||||
static_cast<GuiViewBase &>(lv),
|
|
||||||
"embedded", Qt::RightDockWidgetArea)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Dialog * createGuiEmbeddedFiles(LyXView & lv)
|
Dialog * createGuiEmbeddedFiles(LyXView & lv)
|
||||||
{
|
{
|
||||||
return new GuiEmbeddedFiles(lv);
|
GuiViewBase & guiview = static_cast<GuiViewBase &>(lv);
|
||||||
|
#ifdef Q_WS_MACX
|
||||||
|
// On Mac show as a drawer at the right
|
||||||
|
return new GuiEmbeddedFiles(guiview, Qt::RightDockWidgetArea, Qt::Drawer);
|
||||||
|
#else
|
||||||
|
return new GuiEmbeddedFiles(guiview, Qt::RightDockWidgetArea);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,12 +20,21 @@
|
|||||||
namespace lyx {
|
namespace lyx {
|
||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
class ControlEmbeddedFiles : public Controller {
|
class EmbeddedFilesWidget;
|
||||||
|
|
||||||
|
class GuiEmbeddedFiles : public DockView
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
ControlEmbeddedFiles(Dialog &);
|
GuiEmbeddedFiles(
|
||||||
|
GuiViewBase & parent, ///< the main window where to dock.
|
||||||
|
Qt::DockWidgetArea area = Qt::LeftDockWidgetArea, ///< Position of the dock (and also drawer)
|
||||||
|
Qt::WindowFlags flags = 0);
|
||||||
///
|
///
|
||||||
~ControlEmbeddedFiles() {}
|
void updateView();
|
||||||
|
|
||||||
///
|
///
|
||||||
EmbeddedFiles & embeddedFiles();
|
EmbeddedFiles & embeddedFiles();
|
||||||
///
|
///
|
||||||
@ -62,16 +71,19 @@ public:
|
|||||||
bool update(EmbeddedFile const & item);
|
bool update(EmbeddedFile const & item);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//
|
///
|
||||||
|
EmbeddedFilesWidget * widget_;
|
||||||
|
///
|
||||||
std::string message_;
|
std::string message_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GuiEmbeddedFilesDialog : public QWidget, public Ui::GuiEmbeddedFilesUi
|
|
||||||
|
class EmbeddedFilesWidget : public QWidget, public Ui::GuiEmbeddedFilesUi
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GuiEmbeddedFilesDialog(ControlEmbeddedFiles &);
|
EmbeddedFilesWidget(GuiEmbeddedFiles &);
|
||||||
std::string name() const { return "embedding"; }
|
std::string name() const { return "embedding"; }
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
@ -92,19 +104,11 @@ public Q_SLOTS:
|
|||||||
void on_updatePB_clicked();
|
void on_updatePB_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ControlEmbeddedFiles & controller_;
|
GuiEmbeddedFiles & controller_;
|
||||||
void set_embedding_status(bool embed);
|
void set_embedding_status(bool embed);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class GuiEmbeddedFiles
|
|
||||||
: public DockView<ControlEmbeddedFiles, GuiEmbeddedFilesDialog>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
GuiEmbeddedFiles(LyXView & lv);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace frontend
|
} // namespace frontend
|
||||||
} // namespace lyx
|
} // namespace lyx
|
||||||
|
|
||||||
|
@ -43,9 +43,13 @@ using std::string;
|
|||||||
namespace lyx {
|
namespace lyx {
|
||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
GuiToc::GuiToc(Dialog & dialog)
|
GuiToc::GuiToc(GuiViewBase & parent, Qt::DockWidgetArea area, Qt::WindowFlags flags)
|
||||||
: Controller(dialog), params_("toc")
|
: DockView(parent, "toc", area, flags), params_("toc")
|
||||||
{}
|
{
|
||||||
|
widget_ = new TocWidget(*this);
|
||||||
|
setWidget(widget_);
|
||||||
|
setWindowTitle(widget_->windowTitle());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int GuiToc::getTocDepth(int type)
|
int GuiToc::getTocDepth(int type)
|
||||||
@ -235,10 +239,9 @@ Dialog * createGuiToc(LyXView & lv)
|
|||||||
GuiViewBase & guiview = static_cast<GuiViewBase &>(lv);
|
GuiViewBase & guiview = static_cast<GuiViewBase &>(lv);
|
||||||
#ifdef Q_WS_MACX
|
#ifdef Q_WS_MACX
|
||||||
// On Mac show as a drawer at the right
|
// On Mac show as a drawer at the right
|
||||||
return new DockView<GuiToc, TocWidget>(guiview, "toc",
|
return new GuiToc(guiview, Qt::RightDockWidgetArea, Qt::Drawer);
|
||||||
Qt::RightDockWidgetArea, Qt::Drawer);
|
|
||||||
#else
|
#else
|
||||||
return new DockView<GuiToc, TocWidget>(guiview, "toc");
|
return new GuiToc(guiview);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,10 +15,12 @@
|
|||||||
#ifndef GUITOC_H
|
#ifndef GUITOC_H
|
||||||
#define GUITOC_H
|
#define GUITOC_H
|
||||||
|
|
||||||
#include "TocBackend.h"
|
#include "DockView.h"
|
||||||
#include "Dialog.h"
|
|
||||||
#include "insets/InsetCommandParams.h"
|
#include "insets/InsetCommandParams.h"
|
||||||
|
|
||||||
|
#include "TocBackend.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
#include <QStringListModel>
|
#include <QStringListModel>
|
||||||
@ -29,14 +31,18 @@ namespace lyx {
|
|||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
class TocModel;
|
class TocModel;
|
||||||
|
class TocWidget;
|
||||||
|
|
||||||
class GuiToc : public QObject, public Controller
|
class GuiToc : public DockView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
GuiToc(Dialog &);
|
GuiToc(
|
||||||
|
GuiViewBase & parent, ///< the main window where to dock.
|
||||||
|
Qt::DockWidgetArea area = Qt::LeftDockWidgetArea, ///< Position of the dock (and also drawer)
|
||||||
|
Qt::WindowFlags flags = 0);
|
||||||
|
|
||||||
///
|
///
|
||||||
bool initialiseParams(std::string const & data);
|
bool initialiseParams(std::string const & data);
|
||||||
@ -60,10 +66,12 @@ Q_SIGNALS:
|
|||||||
void modelReset();
|
void modelReset();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class TocWidget;
|
///
|
||||||
|
TocWidget * widget_;
|
||||||
///
|
///
|
||||||
std::vector<TocModel *> toc_models_;
|
std::vector<TocModel *> toc_models_;
|
||||||
|
|
||||||
|
public:
|
||||||
///
|
///
|
||||||
TocList const & tocs() const;
|
TocList const & tocs() const;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user