Commit 17cda25a authored by Mathias Goldau's avatar Mathias Goldau
Browse files

[CHANGE] Improved documentation, header include ordering and dataset browser shortcut

parent 7cd1ba93
......@@ -25,8 +25,9 @@
#include <cassert>
#include <string>
#include "WIconManager.h"
#include "../../common/WAssert.h"
#include "../../kernel/WModuleFactory.h"
#include "WIconManager.h"
void WIconManager::addIcon( std::string name, const char* const xpm[] )
{
......@@ -48,7 +49,9 @@ QIcon WIconManager::getIcon( const std::string name )
icon = QIcon( QPixmap( WModuleFactory::getModuleFactory()->getPrototypeByName( name )->getXPMIcon() ) );
}
else
assert( 0 && "No icon with the given name found." );
{
WAssert( 0, "Found no icon named: " + name );
}
return icon;
}
......@@ -31,27 +31,28 @@
#include <QtGui/QIcon>
/**
* class to store and handle access to all available icons
* Manages icon access. Icons stored either here inside or inside of modules.
*/
class WIconManager
{
public:
/**
* function to add an Icon to the icon store
* \param name the icon's name
* \param xpm the icon itself in XPM format
* Adds an Icon to the icon store
* \param name The icon's name
* \param xpm The icon itself in XPM format
*/
void addIcon( std::string name, const char* const xpm[] );
/**
* returns a previously stored icon
* \param name name of the requested icon
* Searches icons in the internal map and all modules for the given icon name.
* \param name Name of the requested icon
* \return A QIcon copy if the icon name was found otherwise a WAssert will fail.
*/
QIcon getIcon( const std::string name );
protected:
private:
std::map< std::string, QIcon* >m_iconList; //!< A map storing icons and the names used to identify them
std::map< std::string, QIcon* > m_iconList; //!< A map storing icons and the names used to identify them
};
#endif // WICONMANAGER_H
......@@ -120,11 +120,7 @@ void WMainWindow::setupGUI()
// directly -> set shortcuts, and some further properties using QAction's interface
QMenu* viewMenu = m_menuBar->addMenu( "View" );
QAction* dsbTrigger = m_datasetBrowser->toggleViewAction();
QList< QKeySequence > dsbShortcut;
dsbShortcut.append( QKeySequence( Qt::Key_F9 ) );
dsbTrigger->setShortcuts( dsbShortcut );
viewMenu->addAction( dsbTrigger );
viewMenu->addAction( m_datasetBrowser->toggleViewAction() );
viewMenu->addSeparator();
// NOTE: the shortcuts for these view presets should be chosen carefully. Most keysequences have another meaning in the most applications
......
......@@ -29,32 +29,30 @@
#include <vector>
#include <QtCore/QList>
#include <QtGui/QMenu>
#include <QtGui/QScrollArea>
#include <QtGui/QShortcut>
#include <QtGui/QMenu>
#include "../../../common/WLogger.h"
#include "../../../common/WPreferences.h"
#include "../../../dataHandler/WDataSet.h"
#include "../../../kernel/WModuleFactory.h"
#include "../../../kernel/WKernel.h"
#include "../../../kernel/WModuleFactory.h"
#include "../../../modules/data/WMData.h"
#include "../events/WEventTypes.h"
#include "../events/WModuleAssocEvent.h"
#include "../events/WRoiAssocEvent.h"
#include "../events/WRoiRemoveEvent.h"
#include "../events/WModuleReadyEvent.h"
#include "../events/WModuleDeleteEvent.h"
#include "../events/WModuleReadyEvent.h"
#include "../events/WModuleRemovedEvent.h"
#include "../events/WEventTypes.h"
#include "../events/WRoiAssocEvent.h"
#include "../events/WRoiRemoveEvent.h"
#include "../guiElements/WQtApplyModulePushButton.h"
#include "../WMainWindow.h"
#include "../WQt4Gui.h"
#include "WQtBranchTreeItem.h"
#include "WQtNumberEdit.h"
#include "WQtNumberEditDouble.h"
#include "WQtTextureSorter.h"
#include "WQtBranchTreeItem.h"
#include "WQtDatasetBrowser.h"
......@@ -818,6 +816,15 @@ boost::shared_ptr< WRMROIRepresentation > WQtDatasetBrowser::getFirstRoiInSelect
return roi;
}
QAction* WQtDatasetBrowser::toggleViewAction() const
{
QAction* result = QDockWidget::toggleViewAction();
QList< QKeySequence > shortcut;
shortcut.append( QKeySequence( Qt::Key_F9 ) );
result->setShortcuts( shortcut );
return result;
}
void WQtDatasetBrowser::deleteModuleTreeItem()
{
if ( m_moduleTreeWidget->selectedItems().count() > 0 )
......
......@@ -56,21 +56,19 @@ class WQtDatasetBrowser : public QDockWidget
public:
/**
* Default constructor.
* Constructor.
*
* \param parent Parent widget.
*
* \return
*/
explicit WQtDatasetBrowser( WMainWindow* parent = 0 );
/**
* Destructor.
* Default Destructor.
*/
virtual ~WQtDatasetBrowser();
/**
* adds a page to the context widget
* Adds a page to the context widget
*
* \param content A widget with controls
*
......@@ -79,7 +77,7 @@ public:
int addTabWidgetContent( WQtDSBWidget* content );
/**
* adds a subject entry to the tree widget
* Adds a subject entry to the tree widget
*
* \param name The entry name of the subjectin the tree widget
* \return A pointer to the tree widget item
......@@ -87,7 +85,7 @@ public:
WQtSubjectTreeItem* addSubject( std::string name );
/**
* adds a dataset entry to any given subject in the tree widget
* Adds a dataset entry to any given subject in the tree widget
*
* \param module shared pointer to the module associated with this tree widget entry
* \param subjectId subject id this dataset belongs to
......@@ -145,6 +143,16 @@ public:
*/
boost::shared_ptr< WRMROIRepresentation > getFirstRoiInSelectedBranch();
/**
* Returns a checkable action that can be used to show or close this dock widget.
* The action's text is set to the dock widget's window title.
*
* This member function is overwritten to add a keyboard shortcut to this action.
*
* \return Modified QAction
*/
QAction* toggleViewAction() const;
protected:
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment