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
+25 -6
View File
@@ -9,7 +9,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1144</width> <width>1124</width>
<height>846</height> <height>846</height>
</rect> </rect>
</property> </property>
@@ -662,12 +662,12 @@
</widget> </widget>
<widget class="QWidget" name="page_35"> <widget class="QWidget" name="page_35">
<layout class="QGridLayout" name="gridLayout_40"> <layout class="QGridLayout" name="gridLayout_40">
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="margin"> <property name="margin">
<number>0</number> <number>0</number>
</property> </property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="MetricEditorPanel" name="w_MetricEditorPanel" native="true"/> <widget class="MetricEditorPanel" name="w_MetricEditorPanel" native="true"/>
</item> </item>
@@ -738,6 +738,8 @@
<addaction name="toolbarFileOpen"/> <addaction name="toolbarFileOpen"/>
<addaction name="toolbarFileSave"/> <addaction name="toolbarFileSave"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="backAction"/>
<addaction name="newObjectAction"/>
<addaction name="findAction"/> <addaction name="findAction"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="compileAction"/> <addaction name="compileAction"/>
@@ -748,8 +750,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1144</width> <width>1124</width>
<height>26</height> <height>20</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="editMenu"> <widget class="QMenu" name="editMenu">
@@ -2297,6 +2299,22 @@
</hint> </hint>
</hints> </hints>
</connection> </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> </connections>
<slots> <slots>
<slot>clearRecentFilesMenu()</slot> <slot>clearRecentFilesMenu()</slot>
@@ -2312,5 +2330,6 @@
<slot>inspect()</slot> <slot>inspect()</slot>
<slot>toolsImportAddressesFromFile()</slot> <slot>toolsImportAddressesFromFile()</slot>
<slot>toolsSNMPDiscovery()</slot> <slot>toolsSNMPDiscovery()</slot>
<slot>back()</slot>
</slots> </slots>
</ui> </ui>
+14 -2
View File
@@ -265,8 +265,8 @@ FWWindow::FWWindow() : QMainWindow(), // QMainWindow(NULL, Qt::Desktop),
// connect( m_mainWindow->newObjectAction, SIGNAL( triggered() ), // connect( m_mainWindow->newObjectAction, SIGNAL( triggered() ),
// this, SLOT(newObject() ) ); // this, SLOT(newObject() ) );
connect( m_mainWindow->backAction, SIGNAL( triggered() ), // connect( m_mainWindow->backAction, SIGNAL( triggered() ),
this, SLOT(back() ) ); // this, SLOT(back() ) );
connect( m_mainWindow->findAction, SIGNAL( triggered() ), connect( m_mainWindow->findAction, SIGNAL( triggered() ),
this, SLOT(search()) ); this, SLOT(search()) );
@@ -1797,3 +1797,15 @@ void FWWindow::transferfw()
ed->show(); 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();
}
+6 -1
View File
@@ -150,8 +150,11 @@ public slots:
void editorPanelTabChanged(int); void editorPanelTabChanged(int);
void back();
void minimize(); void minimize();
void maximize(); void maximize();
virtual void search(); virtual void search();
virtual void restoreRuleSetTab(); virtual void restoreRuleSetTab();
@@ -216,7 +219,6 @@ public slots:
virtual void pasteRuleAbove(); virtual void pasteRuleAbove();
virtual void pasteRuleBelow(); virtual void pasteRuleBelow();
virtual void back();
virtual void newObject(); virtual void newObject();
virtual void lockObject(); virtual void lockObject();
virtual void unlockObject(); virtual void unlockObject();
@@ -368,6 +370,9 @@ public slots:
QPixmap *pm, QPixmap *pm,
bool include_file_name); bool include_file_name);
void showIntroDialog(); void showIntroDialog();
void addNewObjectMenu(QMenu*);
void showNewObjectMenu();
protected: protected:
+4 -2
View File
@@ -67,7 +67,6 @@ using namespace Ui;
/*************************************************************************/ /*************************************************************************/
bool FWWindow::saveIfModified() bool FWWindow::saveIfModified()
{ {
if (activeProject()) return activeProject()->saveIfModified(); if (activeProject()) return activeProject()->saveIfModified();
@@ -388,7 +387,10 @@ void FWWindow::back()
void FWWindow::newObject() void FWWindow::newObject()
{ {
if (activeProject()) activeProject()->newObject(); if (activeProject())
{
activeProject()->newObject();
}
} }
// ObjectManipulator::lockObject calls // ObjectManipulator::lockObject calls
+4 -3
View File
@@ -131,7 +131,7 @@ ObjectManipulator::ObjectManipulator(QWidget *parent):
// used in duplicateWithDependencies() // used in duplicateWithDependencies()
dedup_marker_global_counter = time(NULL); dedup_marker_global_counter = time(NULL);
buildNewObjectMenu(); // buildNewObjectMenu();
} }
@@ -1371,7 +1371,7 @@ void ObjectManipulator::updateCreateObjectMenu(FWObject* lib)
); );
bool new_object_op_possible = !f; bool new_object_op_possible = !f;
emit libraryAccessChanged(new_object_op_possible); 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")); QAction *noa = (QAction*)(mw->findChild<QAction*>("newObjectAction"));
noa->setEnabled(new_object_op_possible); noa->setEnabled(new_object_op_possible);
} }
@@ -1400,7 +1400,8 @@ void ObjectManipulator::openLib(FWObject *obj)
void ObjectManipulator::newObject() void ObjectManipulator::newObject()
{ {
m_objectManipulator->newButton->showMenu(); // m_objectManipulator->newButton->showMenu();
buildNewObjectMenu();
} }
void ObjectManipulator::select() void ObjectManipulator::select()
+5 -2
View File
@@ -94,7 +94,7 @@ void ObjectManipulator::buildNewObjectMenu()
popup_menu = new QMenu(this); popup_menu = new QMenu(this);
popup_menu->setObjectName("objectTreeContextMenu"); popup_menu->setObjectName("objectTreeContextMenu");
QMenu* newObjectPopup = new QMenu( this ); QMenu* newObjectPopup = new QMenu( mw );
newObjectPopup->setObjectName("newObjectPopup"); newObjectPopup->setObjectName("newObjectPopup");
@@ -130,7 +130,10 @@ void ObjectManipulator::buildNewObjectMenu()
addNewObjectMenuItem(newObjectPopup, Interval::TYPENAME); addNewObjectMenuItem(newObjectPopup, Interval::TYPENAME);
m_objectManipulator->newButton->setMenu( newObjectPopup ); mw->addNewObjectMenu(newObjectPopup);
mw->showNewObjectMenu();
// m_objectManipulator->newButton->setMenu( newObjectPopup );
} }
QAction* ObjectManipulator::addNewObjectMenuItem(QMenu *menu, QAction* ObjectManipulator::addNewObjectMenuItem(QMenu *menu,
+58 -183
View File
@@ -22,145 +22,20 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Tree of Objects</string> <string>Tree of Objects</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_103"> <layout class="QGridLayout" name="gridLayout_2">
<property name="verticalSpacing">
<number>2</number>
</property>
<property name="margin"> <property name="margin">
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QGroupBox" name="buttonGroup1"> <layout class="QGridLayout" name="gridLayout">
<property name="sizePolicy"> <item row="0" column="0">
<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>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>Filter:</string> <string>Filter:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="1">
<widget class="AutocompletedComboBox" name="filter"> <widget class="AutocompletedComboBox" name="filter">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@@ -176,7 +51,7 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="2">
<widget class="QToolButton" name="clearFilter"> <widget class="QToolButton" name="clearFilter">
<property name="toolTip"> <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; <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> &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>
<property name="text"> <property name="text">
<string/> <string>Clear</string>
</property> </property>
<property name="icon"> </widget>
<iconset resource="MainRes.qrc"> </item>
<normaloff>:/Icons/close.png</normaloff>:/Icons/close.png</iconset> <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> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item row="2" column="0"> <item row="1" column="0">
<widget class="QStackedWidget" name="widgetStack"> <widget class="QStackedWidget" name="widgetStack">
<widget class="QWidget" name="page"> <widget class="QWidget" name="page">
<property name="palette"> <property name="palette">
@@ -253,54 +157,6 @@ p, li { white-space: pre-wrap; }
<include location="MainRes.qrc"/> <include location="MainRes.qrc"/>
</resources> </resources>
<connections> <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> <connection>
<sender>widgetStack</sender> <sender>widgetStack</sender>
<signal>currentChanged(int)</signal> <signal>currentChanged(int)</signal>
@@ -333,5 +189,24 @@ p, li { white-space: pre-wrap; }
</hint> </hint>
</hints> </hints>
</connection> </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> </connections>
<slots>
<slot>libChanged(int)</slot>
</slots>
</ui> </ui>