Commit 69ce606d authored by Dirk Wilden's avatar Dirk Wilden

type selection in headerContextMenu

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5549 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 9a40c1f7
......@@ -339,7 +339,16 @@ void DataControlPlugin::groupObjects(idList _objectIDs, QString _groupName) {
*
*/
void DataControlPlugin::setAllTarget() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
DataType type = DATA_ALL;
//try to find dataType restriction if called by contextMenu
QAction* action = dynamic_cast< QAction* > ( sender() );
if ( action != 0 && action->data().isValid() )
type = (DataType) action->data().toUInt();
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS, type) ;
o_it != PluginFunctions::objectsEnd(); ++o_it){
o_it->target(true);
......@@ -354,7 +363,16 @@ void DataControlPlugin::setAllTarget() {
*
*/
void DataControlPlugin::setAllSource() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
DataType type = DATA_ALL;
//try to find dataType restriction if called by contextMenu
QAction* action = dynamic_cast< QAction* > ( sender() );
if ( action != 0 && action->data().isValid() )
type = (DataType) action->data().toUInt();
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS, type) ;
o_it != PluginFunctions::objectsEnd(); ++o_it){
o_it->source(true);
......@@ -369,7 +387,16 @@ void DataControlPlugin::setAllSource() {
*
*/
void DataControlPlugin::clearAllTarget() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
DataType type = DATA_ALL;
//try to find dataType restriction if called by contextMenu
QAction* action = dynamic_cast< QAction* > ( sender() );
if ( action != 0 && action->data().isValid() )
type = (DataType) action->data().toUInt();
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS, type) ;
o_it != PluginFunctions::objectsEnd(); ++o_it){
o_it->target(false);
......@@ -384,7 +411,16 @@ void DataControlPlugin::clearAllTarget() {
*
*/
void DataControlPlugin::clearAllSource() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
DataType type = DATA_ALL;
//try to find dataType restriction if called by contextMenu
QAction* action = dynamic_cast< QAction* > ( sender() );
if ( action != 0 && action->data().isValid() )
type = (DataType) action->data().toUInt();
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS, type) ;
o_it != PluginFunctions::objectsEnd(); ++o_it){
o_it->source(false);
......@@ -399,7 +435,16 @@ void DataControlPlugin::clearAllSource() {
*
*/
void DataControlPlugin::hideAll() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
DataType type = DATA_ALL;
//try to find dataType restriction if called by contextMenu
QAction* action = dynamic_cast< QAction* > ( sender() );
if ( action != 0 && action->data().isValid() )
type = (DataType) action->data().toUInt();
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS,type) ;
o_it != PluginFunctions::objectsEnd(); ++o_it){
o_it->hide();
......@@ -416,8 +461,16 @@ void DataControlPlugin::hideAll() {
*
*/
void DataControlPlugin::showAll() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
o_it != PluginFunctions::objectsEnd(); ++o_it){
DataType type = DATA_ALL;
//try to find dataType restriction if called by contextMenu
QAction* action = dynamic_cast< QAction* > ( sender() );
if ( action != 0 && action->data().isValid() )
type = (DataType) action->data().toUInt();
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS, type); o_it != PluginFunctions::objectsEnd(); ++o_it){
o_it->show();
visibilityChanged( o_it->id() );
......
......@@ -305,7 +305,15 @@ void DataControlPlugin::slotHeaderCustomContextMenuRequested ( const QPoint & _p
QIcon icon;
//get all used types
QVector<DataType> types;
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
o_it != PluginFunctions::objectsEnd(); ++o_it)
if ( !types.contains( o_it->dataType() ) )
types.push_back( o_it->dataType() );
QAction* action;
switch (headerPopupType_) {
// case 0 :
......@@ -314,18 +322,69 @@ void DataControlPlugin::slotHeaderCustomContextMenuRequested ( const QPoint & _p
//Show / Hide
case 1 :
icon.addFile(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"drawModes.png");
menu.addAction(icon,"Show all",this,SLOT ( showAll() ));
menu.addAction("Hide all",this,SLOT ( hideAll() ));
action = menu.addAction(icon,"Show all",this,SLOT ( showAll() ));
action->setData( QVariant() );
if (types.count() > 1)
for (int i=0; i < types.count(); i++){
action = menu.addAction(icon, "Show all of type '" + typeName(types[i]) + "'",this,SLOT ( showAll() ));
action->setData( QVariant( types[i] ) );
}
menu.addSeparator();
action = menu.addAction("Hide all",this,SLOT ( hideAll() ));
action->setData( QVariant() );
if (types.count() > 1)
for (int i=0; i < types.count(); i++){
action = menu.addAction("Hide all of type '" + typeName(types[i]) + "'",this,SLOT ( hideAll() ));
action->setData( QVariant( types[i] ) );
}
break;
// Source
case 2 :
menu.addAction("Select all",this,SLOT ( setAllSource() ));
menu.addAction("Deselect all",this,SLOT ( clearAllSource() ));
action = menu.addAction("Select all",this,SLOT ( setAllSource() ));
action->setData( QVariant() );
if (types.count() > 1)
for (int i=0; i < types.count(); i++){
action = menu.addAction(icon, "Select all of type '" + typeName(types[i]) + "'",this,SLOT ( setAllSource() ));
action->setData( QVariant( types[i] ) );
}
menu.addSeparator();
action = menu.addAction("Deselect all",this,SLOT ( clearAllSource() ));
action->setData( QVariant() );
if (types.count() > 1)
for (int i=0; i < types.count(); i++){
action = menu.addAction(icon, "Deselect all of type '" + typeName(types[i]) + "'",this,SLOT ( clearAllSource() ));
action->setData( QVariant( types[i] ) );
}
break;
// Target
case 3 :
menu.addAction("Select all",this,SLOT ( setAllTarget() ));
menu.addAction("Deselect all",this,SLOT ( clearAllTarget() ));
action = menu.addAction("Select all",this,SLOT ( setAllTarget() ));
action->setData( QVariant() );
if (types.count() > 1)
for (int i=0; i < types.count(); i++){
action = menu.addAction(icon, "Select all of type '" + typeName(types[i]) + "'",this,SLOT ( setAllTarget() ));
action->setData( QVariant( types[i] ) );
}
menu.addSeparator();
action = menu.addAction("Deselect all",this,SLOT ( clearAllTarget() ));
action->setData( QVariant() );
if (types.count() > 1)
for (int i=0; i < types.count(); i++){
action = menu.addAction(icon, "Deselect all of type '" + typeName(types[i]) + "'",this,SLOT ( clearAllTarget() ));
action->setData( QVariant( types[i] ) );
}
break;
default :
// std::cerr << "def";
......
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