Am Donnerstag, den 08.09.2016, 20:28 +0200 schrieb Jürgen Spitzmüller: > How about the attached alternative (not yet finished) design?
Patch attached. I had to do some limbo dance in order to get the resizing of the dialog working. It works now as intended, at least in my testing. Jürgen
diff --git a/src/frontends/qt4/GuiCitation.cpp b/src/frontends/qt4/GuiCitation.cpp index a99db88..420de20 100644 --- a/src/frontends/qt4/GuiCitation.cpp +++ b/src/frontends/qt4/GuiCitation.cpp @@ -119,6 +119,8 @@ GuiCitation::GuiCitation(GuiView & lv) connect(selectionManager, SIGNAL(okHook()), this, SLOT(on_okPB_clicked())); + searchOptsW->setVisible(false); + setFocusProxy(availableLV); } @@ -150,41 +152,30 @@ void GuiCitation::applyView() } -void GuiCitation::showEvent(QShowEvent * e) +void GuiCitation::adjustSearchOptsSize(bool init) { - findLE->clear(); - availableLV->setFocus(); - - // Set the minimal size of the QToolbox. Without this, the size of the - // QToolbox is only determined by values in the ui file (e.g. computed by - // qtcreator) and therefore causes portability and localisation issues. Note - // that the page widgets must have a layout with layoutSizeContraint = - // SetMinimumSize or similar. KNOWN ISSUE: the calculations are incorrect - // the first time the dialog is shown. This problem is mitigated by the fact - // that LyX remembers the dialog sizes between sessions. + // Adjust the size of the hideable Search Options. QSize minimum_size = QSize(0,0); - // Compute the max of the minimal sizes of the pages - QWidget * page; - for (int i = 0; (page = citationTB->widget(i)); ++i) - minimum_size = minimum_size.expandedTo(page->minimumSizeHint()); - // Add the height of the tabs - if (citationTB->currentWidget()) - minimum_size.rheight() += citationTB->height() - - citationTB->currentWidget()->height(); - citationTB->setMinimumSize(minimum_size); + if (searchOptsW->isVisible()) + minimum_size = searchOptsW->minimumSizeHint(); + else if (!init) + // if the dialog is not shown for the first time + // and search opt are visible, we have to adjust + // the minimum height to make it shrink when the opts + // are hidden + setMinimumHeight(minimumHeight() + - searchOptsW->minimumSizeHint().height()); - DialogView::showEvent(e); + searchOptsW->setFixedSize(minimum_size); } -void GuiCitation::on_citationTB_currentChanged(int i) +void GuiCitation::showEvent(QShowEvent * e) { - if (i == 0) - findLE->setFocus(); - else if (citationStyleCO->isEnabled()) - citationStyleCO->setFocus(); - else - textAfterED->setFocus(); + findLE->clear(); + availableLV->setFocus(); + adjustSearchOptsSize(true); + DialogView::showEvent(e); } @@ -214,6 +205,22 @@ void GuiCitation::on_restorePB_clicked() init(); } +void GuiCitation::on_searchOptionsPB_clicked() +{ + bool const was_visible = searchOptsW->isVisible(); + searchOptsW->setVisible(!was_visible); + + if (was_visible) + searchOptionsPB->setText(qt_("Show O&ptions")); + else + searchOptionsPB->setText(qt_("Hide O&ptions")); + + adjustSearchOptsSize(); + // this is necessary to get the latest size hints. + QCoreApplication::processEvents(); + adjustSize(); +} + void GuiCitation::updateControls() { diff --git a/src/frontends/qt4/GuiCitation.h b/src/frontends/qt4/GuiCitation.h index cc24eb9..6af68f6 100644 --- a/src/frontends/qt4/GuiCitation.h +++ b/src/frontends/qt4/GuiCitation.h @@ -44,12 +44,12 @@ public: ~GuiCitation(); private Q_SLOTS: - void on_citationTB_currentChanged(int i); void on_okPB_clicked(); void on_cancelPB_clicked(); void on_restorePB_clicked(); void on_applyPB_clicked(); void on_searchPB_clicked(); + void on_searchOptionsPB_clicked(); void on_findLE_textChanged(const QString & text); void on_fieldsCO_currentIndexChanged(int index); void on_entriesCO_currentIndexChanged(int index); @@ -84,6 +84,8 @@ private: //@} /// + void adjustSearchOptsSize(bool init = false); + /// void showEvent(QShowEvent * e); /// void closeEvent(QCloseEvent * e); diff --git a/src/frontends/qt4/ui/CitationUi.ui b/src/frontends/qt4/ui/CitationUi.ui index 360d941..ec77afc 100644 --- a/src/frontends/qt4/ui/CitationUi.ui +++ b/src/frontends/qt4/ui/CitationUi.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>590</width> - <height>506</height> + <width>614</width> + <height>637</height> </rect> </property> <property name="windowTitle"> @@ -16,7 +16,7 @@ <property name="sizeGripEnabled"> <bool>true</bool> </property> - <layout class="QGridLayout" name="gridLayout_4" rowstretch="1,0,0"> + <layout class="QGridLayout" name="gridLayout_5"> <item row="0" column="0"> <layout class="QVBoxLayout" name="verticalLayout_2"> <item> @@ -104,8 +104,7 @@ </property> <property name="icon"> <iconset> - <normaloff/> - </iconset> + <normaloff>.</normaloff>.</iconset> </property> <property name="autoDefault"> <bool>false</bool> @@ -128,8 +127,7 @@ </property> <property name="icon"> <iconset> - <normaloff/> - </iconset> + <normaloff>.</normaloff>.</iconset> </property> <property name="autoDefault"> <bool>false</bool> @@ -143,7 +141,7 @@ <item> <widget class="QLabel" name="selectedKeysLA"> <property name="text"> - <string>S&elected Citations:</string> + <string>Selected &Citations:</string> </property> <property name="buddy"> <cstring>selectedLV</cstring> @@ -182,296 +180,294 @@ </layout> </item> <item row="1" column="0"> - <widget class="lyx::frontend::LyXToolBox" name="citationTB"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <widget class="QGroupBox" name="searchGB"> + <property name="title"> + <string>Search</string> </property> - <property name="accessibleName"> - <string/> - </property> - <property name="currentIndex"> - <number>1</number> - </property> - <widget class="QWidget" name="page"> - <attribute name="label"> - <string>&Search Citation</string> - </attribute> - <layout class="QGridLayout" name="gridLayout_3" columnstretch="0,1,0,0,0,0"> - <property name="sizeConstraint"> - <enum>QLayout::SetMinimumSize</enum> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="findKeysLA"> - <property name="text"> - <string>Searc&h:</string> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> - </property> - <property name="buddy"> - <cstring>findLE</cstring> - </property> - </widget> - </item> - <item row="0" column="1" colspan="4"> - <widget class="QLineEdit" name="findLE"> - <property name="toolTip"> - <string>Enter the text to search for and press Enter or click the button to search</string> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="0" column="5"> - <widget class="QPushButton" name="searchPB"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="toolTip"> - <string>Click or press Enter in the search box to search</string> - </property> - <property name="text"> - <string>&Search</string> - </property> - <property name="autoDefault"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="fieldsLA"> - <property name="text"> - <string>Search &field:</string> - </property> - <property name="buddy"> - <cstring>fieldsCO</cstring> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QComboBox" name="fieldsCO"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maxVisibleItems"> - <number>16</number> - </property> - <property name="insertPolicy"> - <enum>QComboBox::NoInsert</enum> - </property> - <property name="sizeAdjustPolicy"> - <enum>QComboBox::AdjustToContents</enum> - </property> - <item> + <layout class="QGridLayout" name="gridLayout_4"> + <item row="0" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QLabel" name="findKeysLA"> <property name="text"> - <string>All fields</string> + <string>&Find:</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + <property name="buddy"> + <cstring>findLE</cstring> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="findLE"> + <property name="toolTip"> + <string>Enter the text to search for and press Enter or click the button to search</string> </property> - </item> - </widget> - </item> - <item row="1" column="2"> - <spacer> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="1" column="3"> - <widget class="QCheckBox" name="regexCB"> - <property name="text"> - <string>Regular e&xpression</string> - </property> - </widget> - </item> - <item row="1" column="4" colspan="2"> - <widget class="QCheckBox" name="caseCB"> - <property name="text"> - <string>Case se&nsitive</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="entriesLA"> - <property name="text"> - <string>Entry t&ypes:</string> - </property> - <property name="buddy"> - <cstring>entriesCO</cstring> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QComboBox" name="entriesCO"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="insertPolicy"> - <enum>QComboBox::NoInsert</enum> - </property> - <property name="sizeAdjustPolicy"> - <enum>QComboBox::AdjustToContents</enum> - </property> - <item> <property name="text"> - <string>All entry types</string> + <string/> </property> - </item> - </widget> - </item> - <item row="2" column="2"> - <spacer> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="2" column="4" colspan="2"> - <widget class="QCheckBox" name="asTypeCB"> - <property name="text"> - <string>Search as you &type</string> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="page_2"> - <attribute name="label"> - <string>For&matting</string> - </attribute> - <layout class="QGridLayout" name="gridLayout_2"> - <property name="sizeConstraint"> - <enum>QLayout::SetMinimumSize</enum> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="citationStyleLA"> - <property name="text"> - <string>Citation st&yle:</string> - </property> - <property name="buddy"> - <cstring>citationStyleCO</cstring> - </property> - </widget> - </item> - <item row="0" column="1" colspan="3"> - <widget class="QComboBox" name="citationStyleCO"> - <property name="toolTip"> - <string>Natbib citation style to use</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="textBeforeLA"> - <property name="text"> - <string>Text &before:</string> - </property> - <property name="buddy"> - <cstring>textBeforeED</cstring> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="textBeforeED"> - <property name="toolTip"> - <string>Text to place before citation</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="textAfterLA"> - <property name="text"> - <string>&Text after:</string> - </property> - <property name="buddy"> - <cstring>textAfterED</cstring> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QLineEdit" name="textAfterED"> - <property name="toolTip"> - <string>Text to place after citation</string> - </property> - </widget> - </item> - <item row="2" column="0" colspan="4"> - <layout class="QHBoxLayout"> - <property name="spacing"> - <number>6</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <spacer> - <property name="orientation"> - <enum>Qt::Horizontal</enum> + </widget> + </item> + <item> + <widget class="QPushButton" name="searchPB"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Click or press Enter in the search box to search</string> + </property> + <property name="text"> + <string>&Search</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="searchOptionsPB"> + <property name="text"> + <string>Show O&ptions</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="1" column="0"> + <widget class="QWidget" name="searchOptsW" native="true"> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="0" column="0"> + <widget class="QLabel" name="fieldsLA"> + <property name="text"> + <string>Search &field:</string> </property> - <property name="sizeHint" stdset="0"> - <size> - <width>21</width> - <height>26</height> - </size> + <property name="buddy"> + <cstring>fieldsCO</cstring> </property> - </spacer> + </widget> </item> - <item> - <widget class="QCheckBox" name="fulllistCB"> - <property name="toolTip"> - <string>List all authors</string> + <item row="0" column="1"> + <widget class="QComboBox" name="fieldsCO"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maxVisibleItems"> + <number>16</number> </property> + <property name="insertPolicy"> + <enum>QComboBox::NoInsert</enum> + </property> + <property name="sizeAdjustPolicy"> + <enum>QComboBox::AdjustToContents</enum> + </property> + <item> + <property name="text"> + <string>All fields</string> + </property> + </item> + </widget> + </item> + <item row="0" column="2" rowspan="2"> + <layout class="QVBoxLayout" name="verticalLayout_5"> + <item> + <widget class="QCheckBox" name="regexCB"> + <property name="text"> + <string>Regular e&xpression</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="caseCB"> + <property name="text"> + <string>Case se&nsitive</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="asTypeCB"> + <property name="text"> + <string>Search as you &type</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="entriesLA"> <property name="text"> - <string>&Full author list</string> + <string>Entry t&ypes:</string> + </property> + <property name="buddy"> + <cstring>entriesCO</cstring> </property> </widget> </item> - <item> - <widget class="QCheckBox" name="forceuppercaseCB"> - <property name="toolTip"> - <string>Force upper case in citation</string> + <item row="1" column="1"> + <widget class="QComboBox" name="entriesCO"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <property name="text"> - <string>Force u&pper case</string> + <property name="insertPolicy"> + <enum>QComboBox::NoInsert</enum> + </property> + <property name="sizeAdjustPolicy"> + <enum>QComboBox::AdjustToContents</enum> </property> + <item> + <property name="text"> + <string>All entry types</string> + </property> + </item> </widget> </item> + <item row="1" column="3"> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> </layout> - </item> - </layout> - </widget> + </widget> + </item> + </layout> </widget> </item> <item row="2" column="0"> + <widget class="QGroupBox" name="FormattingGB"> + <property name="title"> + <string>Formatting</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLabel" name="citationStyleLA"> + <property name="text"> + <string>Citation st&yle:</string> + </property> + <property name="buddy"> + <cstring>citationStyleCO</cstring> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="citationStyleCO"> + <property name="toolTip"> + <string>Natbib citation style to use</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="1" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <widget class="QLabel" name="textBeforeLA"> + <property name="text"> + <string>Text &before:</string> + </property> + <property name="buddy"> + <cstring>textBeforeED</cstring> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="textBeforeED"> + <property name="toolTip"> + <string>Text to place before citation</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="textAfterLA"> + <property name="text"> + <string>&Text after:</string> + </property> + <property name="buddy"> + <cstring>textAfterED</cstring> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="textAfterED"> + <property name="toolTip"> + <string>Text to place after citation</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="2" column="0"> + <layout class="QHBoxLayout"> + <property name="spacing"> + <number>6</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <spacer> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>21</width> + <height>26</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QCheckBox" name="forceuppercaseCB"> + <property name="toolTip"> + <string>Force upper case in citation</string> + </property> + <property name="text"> + <string>Force upcas&ing</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="fulllistCB"> + <property name="toolTip"> + <string>List all authors</string> + </property> + <property name="text"> + <string>All aut&hors</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item row="3" column="0"> <layout class="QHBoxLayout"> <property name="spacing"> <number>6</number> @@ -548,14 +544,6 @@ </item> </layout> </widget> - <customwidgets> - <customwidget> - <class>lyx::frontend::LyXToolBox</class> - <extends>QToolBox</extends> - <header>LyXToolBox.h</header> - <container>1</container> - </customwidget> - </customwidgets> <tabstops> <tabstop>availableLV</tabstop> <tabstop>addPB</tabstop> @@ -565,7 +553,6 @@ <tabstop>selectedLV</tabstop> <tabstop>infoML</tabstop> <tabstop>fulllistCB</tabstop> - <tabstop>forceuppercaseCB</tabstop> <tabstop>restorePB</tabstop> <tabstop>okPB</tabstop> <tabstop>applyPB</tabstop>
signature.asc
Description: This is a digitally signed message part