source: trunk/tools/designer/plugins/cppeditor/common.cpp

Last change on this file was 197, checked in by rudi, 14 years ago

Added QtDesigner

File size: 3.2 KB
Line 
1/**********************************************************************
2**
3** Copyright (C) 2005-2007 Trolltech ASA. All rights reserved.
4**
5** This file is part of Qt Designer.
6**
7** This file may be distributed and/or modified under the terms of the
8** GNU General Public License version 2 as published by the Free Software
9** Foundation and appearing in the file LICENSE.GPL included in the
10** packaging of this file.
11**
12** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
13** licenses may use this file in accordance with the Qt Commercial License
14** Agreement provided with the Software.
15**
16** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
17** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18**
19** See http://www.trolltech.com/gpl/ for GPL licensing information.
20** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
21** information about Qt Commercial License Agreements.
22**
23** Contact info@trolltech.com if any conditions of this licensing are
24** not clear to you.
25**
26**********************************************************************/
27
28#include "editorinterfaceimpl.h"
29#include "languageinterfaceimpl.h"
30#include "preferenceinterfaceimpl.h"
31#include "projectsettingsinterfaceimpl.h"
32#include "sourcetemplateinterfaceimpl.h"
33
34class CommonInterface : public QComponentInformationInterface
35{
36public:
37 CommonInterface();
38 virtual ~CommonInterface();
39
40 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
41 Q_REFCOUNT;
42
43 QString name() const { return "C++"; }
44 QString description() const { return "C++ Integration"; }
45 QString version() const { return "0.1"; }
46 QString author() const { return "Trolltech AS"; }
47
48private:
49 LanguageInterfaceImpl *langIface;
50 PreferenceInterfaceImpl *prefIface;
51 ProjectSettingsInterfaceImpl *proIface;
52 SourceTemplateInterfaceImpl *srcIface;
53
54};
55
56CommonInterface::CommonInterface()
57{
58 langIface = new LanguageInterfaceImpl( this );
59 langIface->addRef();
60 prefIface = new PreferenceInterfaceImpl( this );
61 prefIface->addRef();
62 proIface = new ProjectSettingsInterfaceImpl( this );
63 proIface->addRef();
64 srcIface = new SourceTemplateInterfaceImpl;
65 srcIface->addRef();
66}
67
68CommonInterface::~CommonInterface()
69{
70 langIface->release();
71 prefIface->release();
72 proIface->release();
73 srcIface->release();
74}
75
76QRESULT CommonInterface::queryInterface( const QUuid &uuid, QUnknownInterface** iface )
77{
78 *iface = 0;
79 if ( uuid == IID_QUnknown )
80 *iface = (QUnknownInterface*)this;
81 else if ( uuid == IID_QComponentInformation )
82 *iface = (QComponentInformationInterface*)this;
83 else if ( uuid == IID_Editor )
84 *iface = new EditorInterfaceImpl;
85 else if ( uuid == IID_Language )
86 *iface = langIface;
87 else if ( uuid == IID_Preference )
88 *iface = prefIface;
89 else if ( uuid == IID_ProjectSettings )
90 *iface = proIface;
91 else if ( uuid == IID_SourceTemplate )
92 *iface = srcIface;
93 else
94 return QE_NOINTERFACE;
95
96 (*iface)->addRef();
97 return QS_OK;
98}
99
100
101Q_EXPORT_COMPONENT()
102{
103 Q_CREATE_INSTANCE( CommonInterface )
104}
Note: See TracBrowser for help on using the repository browser.