diff --git a/Plugins/org.mitk.gui.qt.datamanager/plugin.xml b/Plugins/org.mitk.gui.qt.datamanager/plugin.xml index 41bb36aa92..d238dfdf6f 100644 --- a/Plugins/org.mitk.gui.qt.datamanager/plugin.xml +++ b/Plugins/org.mitk.gui.qt.datamanager/plugin.xml @@ -1,32 +1,32 @@ - + diff --git a/Plugins/org.mitk.gui.qt.datamanager/src/QmitkDataManagerHotkeysPrefPage.cpp b/Plugins/org.mitk.gui.qt.datamanager/src/QmitkDataManagerHotkeysPrefPage.cpp index c7097045dc..499f9ffead 100644 --- a/Plugins/org.mitk.gui.qt.datamanager/src/QmitkDataManagerHotkeysPrefPage.cpp +++ b/Plugins/org.mitk.gui.qt.datamanager/src/QmitkDataManagerHotkeysPrefPage.cpp @@ -1,159 +1,159 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "QmitkDataManagerHotkeysPrefPage.h" #include #include "berryIPreferencesService.h" #include "berryPlatform.h" #include #include #include #include #include #include #include using namespace berry; QmitkDataManagerHotkeysPrefPage::QmitkDataManagerHotkeysPrefPage() : m_MainControl(0) { } void QmitkDataManagerHotkeysPrefPage::Init(berry::IWorkbench::Pointer ) { } void QmitkDataManagerHotkeysPrefPage::CreateQtControl(QWidget* parent) { IPreferencesService::Pointer prefService = Platform::GetServiceRegistry().GetServiceById(IPreferencesService::ID); - berry::IPreferences::Pointer _DataManagerHotkeysPreferencesNode = prefService->GetSystemPreferences()->Node("/DataManager/Hotkeys"); + berry::IPreferences::Pointer _DataManagerHotkeysPreferencesNode = prefService->GetSystemPreferences()->Node("/Data Manager/Hotkeys"); m_DataManagerHotkeysPreferencesNode = _DataManagerHotkeysPreferencesNode; m_HotkeyEditors["Make all nodes invisible"] = new QmitkHotkeyLineEdit("Ctrl+, V"); m_HotkeyEditors["Toggle visibility of selected nodes"] = new QmitkHotkeyLineEdit("V"); m_HotkeyEditors["Delete selected nodes"] = new QmitkHotkeyLineEdit("Del"); m_HotkeyEditors["Reinit selected nodes"] = new QmitkHotkeyLineEdit("R"); m_HotkeyEditors["Global Reinit"] = new QmitkHotkeyLineEdit("Ctrl+, R"); m_HotkeyEditors["Save selected nodes"] = new QmitkHotkeyLineEdit("Ctrl+, S"); m_HotkeyEditors["Load"] = new QmitkHotkeyLineEdit("Ctrl+, L"); m_HotkeyEditors["Show Node Information"] = new QmitkHotkeyLineEdit("Ctrl+, I"); m_MainControl = new QWidget(parent); QGridLayout* layout = new QGridLayout; int i = 0; for (std::map::iterator it = m_HotkeyEditors.begin() ; it != m_HotkeyEditors.end(); ++it) { layout->addWidget(new QLabel(it->first), i,0); layout->addWidget(it->second, i,1); layout->setRowStretch(i,0); ++i; } layout->setRowStretch(i+1,10); m_MainControl->setLayout(layout); this->Update(); } QWidget* QmitkDataManagerHotkeysPrefPage::GetQtControl() const { return m_MainControl; } bool QmitkDataManagerHotkeysPrefPage::PerformOk() { IPreferences::Pointer _DataManagerHotkeysPreferencesNode = m_DataManagerHotkeysPreferencesNode.Lock(); if(_DataManagerHotkeysPreferencesNode.IsNotNull()) { bool duplicate = false; QString keyString; QString errString; for (std::map::iterator it = m_HotkeyEditors.begin() ; it != m_HotkeyEditors.end(); ++it) { keyString = it->second->GetKeySequenceAsString(); if(keyString.isEmpty()) errString = QString("No valid key sequence for \"%1\"").arg(it->first); if(errString.isEmpty()) { std::map::iterator it2; // search for duplicated key for (it2 = m_HotkeyEditors.begin(); it2 != m_HotkeyEditors.end(); ++it2) { if(it->first != it2->first && keyString == it2->second->GetKeySequenceAsString()) { duplicate = true; break; } } if(duplicate == true) errString = QString("Duplicate hot key for \"%1\" and \"%2\"").arg(it->first).arg(it2->first); } if(!errString.isEmpty()) { QMessageBox::critical(QApplication::activeWindow(), "Error", errString); return false; } } //# no errors -> save all values and flush to file for (std::map::iterator it = m_HotkeyEditors.begin() ; it != m_HotkeyEditors.end(); ++it) _DataManagerHotkeysPreferencesNode->Put(it->first.toStdString() , it->second->GetKeySequenceAsString().toStdString()); _DataManagerHotkeysPreferencesNode->Flush(); return true; } return false; } void QmitkDataManagerHotkeysPrefPage::PerformCancel() { } void QmitkDataManagerHotkeysPrefPage::Update() { IPreferences::Pointer _DataManagerHotkeysPreferencesNode = m_DataManagerHotkeysPreferencesNode.Lock(); if(_DataManagerHotkeysPreferencesNode.IsNotNull()) { for (std::map::iterator it = m_HotkeyEditors.begin() ; it != m_HotkeyEditors.end(); ++it) { it->second->setText(QString::fromStdString(_DataManagerHotkeysPreferencesNode->Get(it->first.toStdString() , it->second->text().toStdString()))); } } } diff --git a/Plugins/org.mitk.gui.qt.datamanager/src/internal/QmitkNodeTableViewKeyFilter.cpp b/Plugins/org.mitk.gui.qt.datamanager/src/internal/QmitkNodeTableViewKeyFilter.cpp index 5da10116c8..df209a6577 100644 --- a/Plugins/org.mitk.gui.qt.datamanager/src/internal/QmitkNodeTableViewKeyFilter.cpp +++ b/Plugins/org.mitk.gui.qt.datamanager/src/internal/QmitkNodeTableViewKeyFilter.cpp @@ -1,103 +1,103 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "QmitkNodeTableViewKeyFilter.h" #include #include #include "../QmitkDataManagerView.h" QmitkNodeTableViewKeyFilter::QmitkNodeTableViewKeyFilter( QObject* _DataManagerView ) : QObject(_DataManagerView) { m_PreferencesService = berry::Platform::GetServiceRegistry().GetServiceById(berry::IPreferencesService::ID); } bool QmitkNodeTableViewKeyFilter::eventFilter( QObject *obj, QEvent *event ) { QmitkDataManagerView* _DataManagerView = qobject_cast(this->parent()); if (event->type() == QEvent::KeyPress && _DataManagerView) { berry::IPreferencesService::Pointer prefService = m_PreferencesService.Lock(); - berry::IPreferences::Pointer nodeTableKeyPrefs = prefService->GetSystemPreferences()->Node("/DataManager/Hotkeys"); + berry::IPreferences::Pointer nodeTableKeyPrefs = prefService->GetSystemPreferences()->Node("/Data Manager/Hotkeys"); QKeySequence _MakeAllInvisible = QKeySequence(QString::fromStdString(nodeTableKeyPrefs->Get("Make all nodes invisible", "Ctrl+, V"))); QKeySequence _ToggleVisibility = QKeySequence(QString::fromStdString(nodeTableKeyPrefs->Get("Toggle visibility of selected nodes", "V"))); QKeySequence _DeleteSelectedNodes = QKeySequence(QString::fromStdString(nodeTableKeyPrefs->Get("Delete selected nodes", "Del"))); QKeySequence _Reinit = QKeySequence(QString::fromStdString(nodeTableKeyPrefs->Get("Reinit selected nodes", "R"))); QKeySequence _GlobalReinit = QKeySequence(QString::fromStdString(nodeTableKeyPrefs->Get("Global Reinit", "Ctrl+, R"))); QKeySequence _Save = QKeySequence(QString::fromStdString(nodeTableKeyPrefs->Get("Save selected nodes", "Ctrl+, S"))); QKeySequence _Load = QKeySequence(QString::fromStdString(nodeTableKeyPrefs->Get("Load", "Ctrl+, L"))); QKeySequence _ShowInfo = QKeySequence(QString::fromStdString(nodeTableKeyPrefs->Get("Show Node Information", "Ctrl+, I"))); QKeyEvent *keyEvent = static_cast(event); QKeySequence _KeySequence = QKeySequence(keyEvent->modifiers(), keyEvent->key()); // if no modifier was pressed the sequence is now empty if(_KeySequence.isEmpty()) _KeySequence = QKeySequence(keyEvent->key()); if(_KeySequence == _MakeAllInvisible) { // trigger deletion of selected node(s) _DataManagerView->MakeAllNodesInvisible(true); // return true: this means the delete key event is not send to the table return true; } else if(_KeySequence == _DeleteSelectedNodes) { // trigger deletion of selected node(s) _DataManagerView->RemoveSelectedNodes(true); // return true: this means the delete key event is not send to the table return true; } else if(_KeySequence == _ToggleVisibility) { // trigger deletion of selected node(s) _DataManagerView->ToggleVisibilityOfSelectedNodes(true); // return true: this means the delete key event is not send to the table return true; } else if(_KeySequence == _Reinit) { _DataManagerView->ReinitSelectedNodes(true); return true; } else if(_KeySequence == _GlobalReinit) { _DataManagerView->GlobalReinit(true); return true; } else if(_KeySequence == _Save) { _DataManagerView->SaveSelectedNodes(true); return true; } else if(_KeySequence == _Load) { _DataManagerView->Load(true); return true; } else if(_KeySequence == _ShowInfo) { _DataManagerView->ShowInfoDialogForSelectedNodes(true); return true; } } // standard event processing return QObject::eventFilter(obj, event); }