From 0b46b5c0b90ca6b30f778df6d1e38f825dc23d7d Mon Sep 17 00:00:00 2001 From: Vadim Kurland Date: Mon, 6 Jun 2011 19:15:05 -0700 Subject: [PATCH] see #2468 clean up filter/ilbrary box; moved buttons "new object" and "back" to the top toolbar --- src/libgui/FWBMainWindow_q.ui | 31 ++- src/libgui/FWWindow.cpp | 16 +- src/libgui/FWWindow.h | 7 +- src/libgui/FWWindow_wrappers.cpp | 6 +- src/libgui/ObjectManipulator.cpp | 7 +- src/libgui/ObjectManipulator_create_new.cpp | 7 +- src/libgui/objectmanipulator_q.ui | 241 +++++--------------- 7 files changed, 116 insertions(+), 199 deletions(-) diff --git a/src/libgui/FWBMainWindow_q.ui b/src/libgui/FWBMainWindow_q.ui index 8e05f9d17..f165f2ec9 100644 --- a/src/libgui/FWBMainWindow_q.ui +++ b/src/libgui/FWBMainWindow_q.ui @@ -9,7 +9,7 @@ 0 0 - 1144 + 1124 846 @@ -662,12 +662,12 @@ - - 6 - 0 + + 6 + @@ -738,6 +738,8 @@ + + @@ -748,8 +750,8 @@ 0 0 - 1144 - 26 + 1124 + 20 @@ -2297,6 +2299,22 @@ + + backAction + triggered() + FWBMainWindow_q + back() + + + -1 + -1 + + + 561 + 422 + + + clearRecentFilesMenu() @@ -2312,5 +2330,6 @@ inspect() toolsImportAddressesFromFile() toolsSNMPDiscovery() + back() diff --git a/src/libgui/FWWindow.cpp b/src/libgui/FWWindow.cpp index 68c51341e..c9633e5cc 100644 --- a/src/libgui/FWWindow.cpp +++ b/src/libgui/FWWindow.cpp @@ -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(); +} + diff --git a/src/libgui/FWWindow.h b/src/libgui/FWWindow.h index eff6cfbbf..dfeea78a5 100644 --- a/src/libgui/FWWindow.h +++ b/src/libgui/FWWindow.h @@ -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: diff --git a/src/libgui/FWWindow_wrappers.cpp b/src/libgui/FWWindow_wrappers.cpp index c83e35f3a..fb6fe9835 100644 --- a/src/libgui/FWWindow_wrappers.cpp +++ b/src/libgui/FWWindow_wrappers.cpp @@ -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 diff --git a/src/libgui/ObjectManipulator.cpp b/src/libgui/ObjectManipulator.cpp index 069d16cea..30067aab2 100644 --- a/src/libgui/ObjectManipulator.cpp +++ b/src/libgui/ObjectManipulator.cpp @@ -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("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() diff --git a/src/libgui/ObjectManipulator_create_new.cpp b/src/libgui/ObjectManipulator_create_new.cpp index 4c7507dc9..bccb70c8b 100644 --- a/src/libgui/ObjectManipulator_create_new.cpp +++ b/src/libgui/ObjectManipulator_create_new.cpp @@ -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, diff --git a/src/libgui/objectmanipulator_q.ui b/src/libgui/objectmanipulator_q.ui index 1bdf8326b..b6274e940 100644 --- a/src/libgui/objectmanipulator_q.ui +++ b/src/libgui/objectmanipulator_q.ui @@ -22,145 +22,20 @@ Tree of Objects - - - 2 - + 0 - - - - 0 - 0 - - - - -QGroupBox { - margin-top: 1ex; - padding: 0px; -} - -QComboBox { - margin-top: 0px; - padding: 0px; -} - - - - - 2 - - - 0 - - - - - Back - - - Go back to the previous object - - - - - - - :/Icons/Return/icon:/Icons/Return/icon - - - true - - - - - - - - 0 - 0 - - - - - 32767 - 16 - - - - QFrame::VLine - - - QFrame::Plain - - - 1 - - - Qt::Vertical - - - - - - - - 0 - 0 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Object libraries</p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Library <span style=" font-weight:600;">&quot;Standard&quot;</span> holds predefined</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">collection of service and address objects</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">that ships with the package. Library <span style=" font-weight:600;">&quot;User&quot;</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">is where you create your own objects.</p></body></html> - - - QComboBox { padding: 2px;} - - - - - - - - New Object - - - Create New Object - - - - :/Icons/newobject_25.png:/Icons/newobject_25.png - - - true - - - - - - - - - + + Filter: - + @@ -176,7 +51,7 @@ p, li { white-space: pre-wrap; } - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> @@ -186,17 +61,46 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Clear filter</p></body></html> - + Clear - - - :/Icons/close.png:/Icons/close.png + + + + + + Library: + + + + + + + + 0 + 0 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Object libraries</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Library <span style=" font-weight:600;">&quot;Standard&quot;</span> holds predefined</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">collection of service and address objects</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">that ships with the package. Library <span style=" font-weight:600;">&quot;User&quot;</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">is where you create your own objects.</p></body></html> + + + QComboBox { padding: 2px;} + - + @@ -253,54 +157,6 @@ p, li { white-space: pre-wrap; } - - libs - activated(int) - ObjectManipulator_q - libChanged(int) - - - 74 - 31 - - - 20 - 20 - - - - - backButton - clicked() - ObjectManipulator_q - back() - - - 20 - 20 - - - 20 - 20 - - - - - newButton - clicked() - ObjectManipulator_q - newObject() - - - 50 - 30 - - - 20 - 20 - - - widgetStack currentChanged(int) @@ -333,5 +189,24 @@ p, li { white-space: pre-wrap; } + + libs + activated(int) + ObjectManipulator_q + libChanged(int) + + + 119 + 38 + + + 119 + 220 + + + + + libChanged(int) +