1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-19 01:37:17 +01:00

see #2468 clean up filter/ilbrary box; moved buttons "new object" and "back" to the top toolbar

This commit is contained in:
Vadim Kurland 2011-06-06 19:15:05 -07:00
parent bd5212e0c6
commit 0b46b5c0b9
7 changed files with 116 additions and 199 deletions

View File

@ -9,7 +9,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>1144</width>
<width>1124</width>
<height>846</height>
</rect>
</property>
@ -662,12 +662,12 @@
</widget>
<widget class="QWidget" name="page_35">
<layout class="QGridLayout" name="gridLayout_40">
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="MetricEditorPanel" name="w_MetricEditorPanel" native="true"/>
</item>
@ -738,6 +738,8 @@
<addaction name="toolbarFileOpen"/>
<addaction name="toolbarFileSave"/>
<addaction name="separator"/>
<addaction name="backAction"/>
<addaction name="newObjectAction"/>
<addaction name="findAction"/>
<addaction name="separator"/>
<addaction name="compileAction"/>
@ -748,8 +750,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1144</width>
<height>26</height>
<width>1124</width>
<height>20</height>
</rect>
</property>
<widget class="QMenu" name="editMenu">
@ -2297,6 +2299,22 @@
</hint>
</hints>
</connection>
<connection>
<sender>backAction</sender>
<signal>triggered()</signal>
<receiver>FWBMainWindow_q</receiver>
<slot>back()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>561</x>
<y>422</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>clearRecentFilesMenu()</slot>
@ -2312,5 +2330,6 @@
<slot>inspect()</slot>
<slot>toolsImportAddressesFromFile()</slot>
<slot>toolsSNMPDiscovery()</slot>
<slot>back()</slot>
</slots>
</ui>

View File

@ -265,8 +265,8 @@ FWWindow::FWWindow() : QMainWindow(), // QMainWindow(NULL, Qt::Desktop),
// connect( m_mainWindow->newObjectAction, SIGNAL( triggered() ),
// this, SLOT(newObject() ) );
connect( m_mainWindow->backAction, SIGNAL( triggered() ),
this, SLOT(back() ) );
// connect( m_mainWindow->backAction, SIGNAL( triggered() ),
// this, SLOT(back() ) );
connect( m_mainWindow->findAction, SIGNAL( triggered() ),
this, SLOT(search()) );
@ -1797,3 +1797,15 @@ void FWWindow::transferfw()
ed->show();
}
void FWWindow::addNewObjectMenu(QMenu *m)
{
QMenu *old_menu = m_mainWindow->newObjectAction->menu();
if (old_menu) delete old_menu;
m_mainWindow->newObjectAction->setMenu( m );
}
void FWWindow::showNewObjectMenu()
{
m_mainWindow->newObjectAction->menu()->show();
}

View File

@ -150,8 +150,11 @@ public slots:
void editorPanelTabChanged(int);
void back();
void minimize();
void maximize();
virtual void search();
virtual void restoreRuleSetTab();
@ -216,7 +219,6 @@ public slots:
virtual void pasteRuleAbove();
virtual void pasteRuleBelow();
virtual void back();
virtual void newObject();
virtual void lockObject();
virtual void unlockObject();
@ -368,6 +370,9 @@ public slots:
QPixmap *pm,
bool include_file_name);
void showIntroDialog();
void addNewObjectMenu(QMenu*);
void showNewObjectMenu();
protected:

View File

@ -67,7 +67,6 @@ using namespace Ui;
/*************************************************************************/
bool FWWindow::saveIfModified()
{
if (activeProject()) return activeProject()->saveIfModified();
@ -388,7 +387,10 @@ void FWWindow::back()
void FWWindow::newObject()
{
if (activeProject()) activeProject()->newObject();
if (activeProject())
{
activeProject()->newObject();
}
}
// ObjectManipulator::lockObject calls

View File

@ -131,7 +131,7 @@ ObjectManipulator::ObjectManipulator(QWidget *parent):
// used in duplicateWithDependencies()
dedup_marker_global_counter = time(NULL);
buildNewObjectMenu();
// buildNewObjectMenu();
}
@ -1371,7 +1371,7 @@ void ObjectManipulator::updateCreateObjectMenu(FWObject* lib)
);
bool new_object_op_possible = !f;
emit libraryAccessChanged(new_object_op_possible);
m_objectManipulator->newButton->setEnabled(new_object_op_possible);
// m_objectManipulator->newButton->setEnabled(new_object_op_possible);
QAction *noa = (QAction*)(mw->findChild<QAction*>("newObjectAction"));
noa->setEnabled(new_object_op_possible);
}
@ -1400,7 +1400,8 @@ void ObjectManipulator::openLib(FWObject *obj)
void ObjectManipulator::newObject()
{
m_objectManipulator->newButton->showMenu();
// m_objectManipulator->newButton->showMenu();
buildNewObjectMenu();
}
void ObjectManipulator::select()

View File

@ -94,7 +94,7 @@ void ObjectManipulator::buildNewObjectMenu()
popup_menu = new QMenu(this);
popup_menu->setObjectName("objectTreeContextMenu");
QMenu* newObjectPopup = new QMenu( this );
QMenu* newObjectPopup = new QMenu( mw );
newObjectPopup->setObjectName("newObjectPopup");
@ -130,7 +130,10 @@ void ObjectManipulator::buildNewObjectMenu()
addNewObjectMenuItem(newObjectPopup, Interval::TYPENAME);
m_objectManipulator->newButton->setMenu( newObjectPopup );
mw->addNewObjectMenu(newObjectPopup);
mw->showNewObjectMenu();
// m_objectManipulator->newButton->setMenu( newObjectPopup );
}
QAction* ObjectManipulator::addNewObjectMenuItem(QMenu *menu,

View File

@ -22,145 +22,20 @@
<property name="windowTitle">
<string>Tree of Objects</string>
</property>
<layout class="QGridLayout" name="gridLayout_103">
<property name="verticalSpacing">
<number>2</number>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QGroupBox" name="buttonGroup1">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">
QGroupBox {
margin-top: 1ex;
padding: 0px;
}
QComboBox {
margin-top: 0px;
padding: 0px;
}
</string>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>2</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QToolButton" name="backButton">
<property name="toolTip">
<string>Back</string>
</property>
<property name="whatsThis">
<string>Go back to the previous object</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="MainRes.qrc">
<normaloff>:/Icons/Return/icon</normaloff>:/Icons/Return/icon</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Line" name="line1">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>32767</width>
<height>16</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::VLine</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QComboBox" name="libs">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Object libraries&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Library &lt;span style=&quot; font-weight:600;&quot;&gt;&amp;quot;Standard&amp;quot;&lt;/span&gt; holds predefined&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;collection of service and address objects&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;that ships with the package. Library &lt;span style=&quot; font-weight:600;&quot;&gt;&amp;quot;User&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;is where you create your own objects.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="styleSheet">
<string notr="true">QComboBox { padding: 2px;}
</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="newButton">
<property name="toolTip">
<string>New Object</string>
</property>
<property name="whatsThis">
<string>Create New Object</string>
</property>
<property name="icon">
<iconset resource="MainRes.qrc">
<normaloff>:/Icons/newobject_25.png</normaloff>:/Icons/newobject_25.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Filter:</string>
</property>
</widget>
</item>
<item>
<item row="0" column="1">
<widget class="AutocompletedComboBox" name="filter">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@ -176,7 +51,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item>
<item row="0" column="2">
<widget class="QToolButton" name="clearFilter">
<property name="toolTip">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
@ -186,17 +61,46 @@ p, li { white-space: pre-wrap; }
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Clear filter&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
<string>Clear</string>
</property>
<property name="icon">
<iconset resource="MainRes.qrc">
<normaloff>:/Icons/close.png</normaloff>:/Icons/close.png</iconset>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Library:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="libs">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Object libraries&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Library &lt;span style=&quot; font-weight:600;&quot;&gt;&amp;quot;Standard&amp;quot;&lt;/span&gt; holds predefined&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;collection of service and address objects&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;that ships with the package. Library &lt;span style=&quot; font-weight:600;&quot;&gt;&amp;quot;User&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;is where you create your own objects.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="styleSheet">
<string notr="true">QComboBox { padding: 2px;}
</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<item row="1" column="0">
<widget class="QStackedWidget" name="widgetStack">
<widget class="QWidget" name="page">
<property name="palette">
@ -253,54 +157,6 @@ p, li { white-space: pre-wrap; }
<include location="MainRes.qrc"/>
</resources>
<connections>
<connection>
<sender>libs</sender>
<signal>activated(int)</signal>
<receiver>ObjectManipulator_q</receiver>
<slot>libChanged(int)</slot>
<hints>
<hint type="sourcelabel">
<x>74</x>
<y>31</y>
</hint>
<hint type="destinationlabel">
<x>20</x>
<y>20</y>
</hint>
</hints>
</connection>
<connection>
<sender>backButton</sender>
<signal>clicked()</signal>
<receiver>ObjectManipulator_q</receiver>
<slot>back()</slot>
<hints>
<hint type="sourcelabel">
<x>20</x>
<y>20</y>
</hint>
<hint type="destinationlabel">
<x>20</x>
<y>20</y>
</hint>
</hints>
</connection>
<connection>
<sender>newButton</sender>
<signal>clicked()</signal>
<receiver>ObjectManipulator_q</receiver>
<slot>newObject()</slot>
<hints>
<hint type="sourcelabel">
<x>50</x>
<y>30</y>
</hint>
<hint type="destinationlabel">
<x>20</x>
<y>20</y>
</hint>
</hints>
</connection>
<connection>
<sender>widgetStack</sender>
<signal>currentChanged(int)</signal>
@ -333,5 +189,24 @@ p, li { white-space: pre-wrap; }
</hint>
</hints>
</connection>
<connection>
<sender>libs</sender>
<signal>activated(int)</signal>
<receiver>ObjectManipulator_q</receiver>
<slot>libChanged(int)</slot>
<hints>
<hint type="sourcelabel">
<x>119</x>
<y>38</y>
</hint>
<hint type="destinationlabel">
<x>119</x>
<y>220</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>libChanged(int)</slot>
</slots>
</ui>