Bo Peng wrote: > On 5/12/07, Bo Peng <[EMAIL PROTECTED]> wrote: >> Please test this listings dialog, which looks more like Herbert's >> original one. >> I plan to add it before beta3. > > The patch has been committed after some more testing. > >> I would appreciate it if someone can show me how to call >> this dialog from Include dialog and TextLayout dialog. > > I tried to mimic how Bibtex dialog call the add sub-dialog and find > that I need to control widgets in the Listings dialog directly, > basically calling all functions in QListings.cpp. A partial patch is > attached along with the new Include dialog. > > Is there an easier way to fire QListings dialog and let it edit given > param string? I ask this because I also want to call it from > textlayout dialog. >
Seeing all the trouble to simply add a new insert the idea pops up in my head that the insert stuff needs a redesign... > Thanks. > Bo > > > ------------------------------------------------------------------------ > > Index: src/frontends/qt4/QInclude.cpp > =================================================================== > --- src/frontends/qt4/QInclude.cpp (revision 18281) > +++ src/frontends/qt4/QInclude.cpp (working copy) > @@ -13,6 +13,7 @@ > #include "support/os.h" > > #include "QInclude.h" > +#include "ui/ListingsUi.h" > > #include "CheckedLineEdit.h" > #include "Qt2BC.h" > @@ -23,6 +24,7 @@ > > #include "insets/InsetListingsParams.h" > #include "controllers/ControlInclude.h" > +#include "controllers/ButtonPolicy.h" > > #include <QPushButton> > #include <QCheckBox> > @@ -60,9 +62,14 @@ > connect(previewCB, SIGNAL(clicked()), this, SLOT(change_adaptor())); > connect(listingsED, SIGNAL(textChanged()), this, > SLOT(change_adaptor())); > connect(listingsED, SIGNAL(textChanged()), this, > SLOT(validate_listings_params())); > - > + connect(editParamsPB, SIGNAL(clicked()), this, SLOT(editPressed())); > filenameED->setValidator(new PathValidator(true, filenameED)); > setFocusProxy(filenameED); > + > + edit_ = new UiDialog<Ui::QListingsUi>(this, true); > + Qt2BC * bcview = new Qt2BC(edit_bc_); > + edit_bc_.view(bcview); > + edit_bc_.bp(new OkCancelPolicy); > } > > > @@ -86,13 +93,13 @@ > if (!isOK) { > isOK = true; > // listingsTB->setTextColor("black"); > - listingsTB->setPlainText("Input listings parameters > below. Enter ? for a list of parameters."); > + //listingsTB->setPlainText("Input listings parameters > below. Enter ? for a list of parameters."); > okPB->setEnabled(true); > } > } catch (invalidParam & e) { unreferenced variables are errors for when buidling with msvc, please remember for your final patch. > class QIncludeDialog : public QDialog, public Ui::QIncludeUi { > Q_OBJECT > public: > @@ -31,16 +38,21 @@ > void updateLists(); > > virtual void show(); > + > + UiDialog<Ui::QListingsUi> * edit_; > + No get/set function? > protected Q_SLOTS: > virtual void change_adaptor(); > void validate_listings_params(); > virtual void loadClicked(); > virtual void browseClicked(); > virtual void typeChanged(int v); > + virtual void editPressed(); > protected: > virtual void closeEvent(QCloseEvent * e); > private: > QInclude * form_; > + ButtonController edit_bc_; > }; > > > > > ------------------------------------------------------------------------ > -- Peter Kümmel