From 5a4d33d97e65893fbf13153c0d910186d0d2a000 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Wed, 29 Mar 2006 16:57:47 +0000 Subject: [PATCH] Add outlining functionality to the Qt4 TOC dialog. The Toc dialog is not finished yet, there's some clean-up to do especially in select_adapdator which doesn't seem to work. This makes lyx crash when clicking on the Up, Down, In or Out buttons. * frontends/qt4/QTocDialog.[Ch]: add automatic slots * frontends/qt4/QTocDialog.[Ch]: add "enableButtons(bool)" * frontends/qt4/ui/QTocUi.ui: add pushbuttons * frontends/qt4/QToc.[Ch]: add move* methods. The following Qt4 equivalent changes to revision r13521 are not done yet: * frontends/qt2/QToc.[Ch]: add move* method. (QToc::updateToc): (QToc::select): add code for TOC window positioning, and outlining methods git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13530 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/QToc.C | 28 ++++ src/frontends/qt4/QToc.h | 5 + src/frontends/qt4/QTocDialog.C | 37 +++++ src/frontends/qt4/QTocDialog.h | 9 + src/frontends/qt4/ui/QTocUi.ui | 292 ++++++++++++++++++++------------- 5 files changed, 253 insertions(+), 118 deletions(-) diff --git a/src/frontends/qt4/QToc.C b/src/frontends/qt4/QToc.C index 20086079ce..f5918da769 100644 --- a/src/frontends/qt4/QToc.C +++ b/src/frontends/qt4/QToc.C @@ -70,5 +70,33 @@ void QToc::select(string const & text) controller().goTo(*iter); } +void QToc::moveUp() +{ + controller().outline(toc::UP); + update_contents(); +} + + +void QToc::moveDown() +{ + controller().outline(toc::DOWN); + update_contents(); +} + + +void QToc::moveIn() +{ + controller().outline(toc::IN); + update_contents(); +} + + +void QToc::moveOut() +{ + controller().outline(toc::OUT); + update_contents(); +} + + } // namespace frontend } // namespace lyx diff --git a/src/frontends/qt4/QToc.h b/src/frontends/qt4/QToc.h index 0a7de2a35c..278931ea3b 100644 --- a/src/frontends/qt4/QToc.h +++ b/src/frontends/qt4/QToc.h @@ -35,6 +35,11 @@ public: /// return the toc list lyx::toc::Toc & get_toclist() { return toclist;} + void moveUp(); + void moveDown(); + void moveIn(); + void moveOut(); + private: /// select an entry diff --git a/src/frontends/qt4/QTocDialog.C b/src/frontends/qt4/QTocDialog.C index 79b8d30dff..b3c706c8ff 100644 --- a/src/frontends/qt4/QTocDialog.C +++ b/src/frontends/qt4/QTocDialog.C @@ -63,6 +63,43 @@ QTocDialog::~QTocDialog() { } +void QTocDialog::on_moveUpPB_clicked() +{ + enableButtons(false); + form_->moveUp(); + enableButtons(); +} + +void QTocDialog::on_moveDownPB_clicked() +{ + enableButtons(false); + form_->moveDown(); + enableButtons(); +} + +void QTocDialog::on_moveInPB_clicked() +{ + enableButtons(false); + form_->moveIn(); + enableButtons(); +} + +void QTocDialog::on_moveOutPB_clicked() +{ + enableButtons(false); + form_->moveOut(); + enableButtons(); +} + +void QTocDialog::enableButtons(bool enable) +{ + moveUpPB->setEnabled(enable); + moveDownPB->setEnabled(enable); + moveInPB->setEnabled(enable); + moveOutPB->setEnabled(enable); + updatePB->setEnabled(enable); +} + void QTocDialog::updateType() { typeCO->clear(); diff --git a/src/frontends/qt4/QTocDialog.h b/src/frontends/qt4/QTocDialog.h index cffca6679a..9c8e1b8447 100644 --- a/src/frontends/qt4/QTocDialog.h +++ b/src/frontends/qt4/QTocDialog.h @@ -44,8 +44,17 @@ public slots: void depth_adaptor(int); void select_adaptor(QTreeWidgetItem *); void update_adaptor(); + +protected slots: + void on_moveUpPB_clicked(); + void on_moveDownPB_clicked(); + void on_moveInPB_clicked(); + void on_moveOutPB_clicked(); + protected: + void enableButtons(bool enable = true); void closeEvent(QCloseEvent * e); + private: void populateItem(QTreeWidgetItem * parentItem, toc::Toc::const_iterator& iter); diff --git a/src/frontends/qt4/ui/QTocUi.ui b/src/frontends/qt4/ui/QTocUi.ui index aada6c5060..a60386bbb5 100644 --- a/src/frontends/qt4/ui/QTocUi.ui +++ b/src/frontends/qt4/ui/QTocUi.ui @@ -8,8 +8,8 @@ 0 0 - 357 - 313 + 358 + 351 @@ -18,124 +18,180 @@ true - - - 11 + + + + 0 + + + 6 + + + + + &Type: + + + typeCO + + + + + + + + 3 + 0 + 0 + 0 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + + + 11 + 248 + 335 + 21 + - - 6 + + 5 - - - - 0 - - - 6 - - - - - &Type: - - - typeCO - - - - - - - - 3 - 0 - 0 - 0 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - - - - - - 5 - - - 1 - - - 1 - - - Qt::Horizontal - - - - - - - 0 - - - 6 - - - - - &Update - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - &Close - - - true - - - - - - + + 1 + + + 1 + + + Qt::Horizontal + + + + + + 20 + 280 + 328 + 27 + + + + + 0 + + + 6 + + + + + &Up + + + + + + + &Down + + + + + + + &Out + + + + + + + &In + + + + + + + + + 140 + 320 + 208 + 27 + + + + + 0 + + + 6 + + + + + &Close + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + &Update + + + + + + + + + 11 + 39 + 331 + 203 + + + qPixmapFromMimeSource -- 2.39.2