24 #include <QPushButton>
26 #include <QGridLayout>
27 #include <QMessageBox>
28 #include <QApplication>
32 using namespace berry;
35 : m_MainControl(nullptr)
65 auto layout =
new QGridLayout;
70 layout->addWidget(
new QLabel(it->first), i,0);
71 layout->addWidget(it->second, i,1);
72 layout->setRowStretch(i,0);
75 layout->setRowStretch(i+1,10);
89 if(_DataManagerHotkeysPreferencesNode.
IsNotNull())
91 bool duplicate =
false;
97 keyString = it->second->GetKeySequenceAsString();
99 if(keyString.isEmpty())
100 errString = QString(
"No valid key sequence for \"%1\"").arg(it->first);
102 if(errString.isEmpty())
104 std::map<QString, QmitkHotkeyLineEdit*>::iterator it2;
108 if(it->first != it2->first && keyString == it2->second->GetKeySequenceAsString())
114 if(duplicate ==
true)
115 errString = QString(
"Duplicate hot key for \"%1\" and \"%2\"").arg(it->first).arg(it2->first);
118 if(!errString.isEmpty())
120 QMessageBox::critical(QApplication::activeWindow(),
"Error", errString);
128 _DataManagerHotkeysPreferencesNode->Put(it->first
129 , it->second->GetKeySequenceAsString());
131 _DataManagerHotkeysPreferencesNode->Flush();
146 if(_DataManagerHotkeysPreferencesNode.
IsNotNull())
151 it->second->setText(_DataManagerHotkeysPreferencesNode->Get(it->first, it->second->text()));
virtual void PerformCancel() override
virtual bool PerformOk() override
virtual SmartPointer< IPreferences > GetSystemPreferences()=0
berry::IPreferences::WeakPtr m_DataManagerHotkeysPreferencesNode
std::map< QString, QmitkHotkeyLineEdit * > m_HotkeyEditors
virtual void Update() override
QmitkDataManagerHotkeysPrefPage()
void CreateQtControl(QWidget *parent) override
QWidget * GetQtControl() const override
SmartPointer< ObjectType > Lock() const
void Init(berry::IWorkbench::Pointer workbench) override