Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berryQtWorkbenchAdvisor.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 BlueBerry Platform
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
18 #include "internal/berryQtGlobalEventFilter.h"
19 #include "internal/berryWorkbenchPlugin.h"
20 #include "berryQtPreferences.h"
21 
22 #include <berryPlatform.h>
24 #include <berryIPreferences.h>
25 #include <berryIQtStyleManager.h>
26 
27 #include <QApplication>
28 #include <QString>
29 #include <QTextCodec>
30 
31 #include <Poco/File.h>
32 #include <Poco/FileStream.h>
33 
34 #include <vector>
35 
36 namespace berry
37 {
38 
40 {
41  WorkbenchAdvisor::Initialize(configurer);
42 
43  IPreferencesService* prefService = WorkbenchPlugin::GetDefault()->GetPreferencesService();
45  QString styleName = prefs->Get(QtPreferences::QT_STYLE_NAME, "");
46 
47  ctkServiceReference serviceRef = WorkbenchPlugin::GetDefault()->GetPluginContext()->getServiceReference<IQtStyleManager>();
48  if (serviceRef)
49  {
50  IQtStyleManager* styleManager = WorkbenchPlugin::GetDefault()->GetPluginContext()->getService<IQtStyleManager>(serviceRef);
51  styleManager->SetStyle(styleName);
52  }
53 
54  QObject* eventFilter = new QtGlobalEventFilter(qApp);
55  qApp->installEventFilter(eventFilter);
56 }
57 
58 }
void Initialize(IWorkbenchConfigurer::Pointer configurer) override
virtual SmartPointer< IPreferences > GetSystemPreferences()=0
static const QString QT_STYLE_NAME
virtual void SetStyle(const QString &fileName)=0
static const QString QT_STYLES_NODE
virtual void Initialize(IWorkbenchConfigurer::Pointer configurer)