1 | /**********************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2000-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 <filterinterface.h>
|
---|
29 | #include <qapplication.h>
|
---|
30 |
|
---|
31 | #include "dlg2ui.h"
|
---|
32 |
|
---|
33 | class DlgFilter : public ImportFilterInterface, public QLibraryInterface
|
---|
34 | {
|
---|
35 | public:
|
---|
36 | DlgFilter();
|
---|
37 |
|
---|
38 | QRESULT queryInterface( const QUuid&, QUnknownInterface **iface );
|
---|
39 | Q_REFCOUNT;
|
---|
40 |
|
---|
41 | QStringList featureList() const;
|
---|
42 | QStringList import( const QString& filter, const QString& filename );
|
---|
43 |
|
---|
44 | bool init();
|
---|
45 | void cleanup();
|
---|
46 | bool canUnload() const;
|
---|
47 | };
|
---|
48 |
|
---|
49 | DlgFilter::DlgFilter()
|
---|
50 | {
|
---|
51 | }
|
---|
52 |
|
---|
53 | QRESULT DlgFilter::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
|
---|
54 | {
|
---|
55 | *iface = 0;
|
---|
56 | if ( uuid == IID_QUnknown )
|
---|
57 | *iface = (QUnknownInterface*)(ImportFilterInterface*)this;
|
---|
58 | else if ( uuid == IID_QFeatureList )
|
---|
59 | *iface = (QFeatureListInterface*)this;
|
---|
60 | else if ( uuid == IID_ImportFilter )
|
---|
61 | *iface = (ImportFilterInterface*)this;
|
---|
62 | else if ( uuid == IID_QLibrary )
|
---|
63 | *iface = (QLibraryInterface*)this;
|
---|
64 | else
|
---|
65 | return QE_NOINTERFACE;
|
---|
66 |
|
---|
67 | (*iface)->addRef();
|
---|
68 | return QS_OK;
|
---|
69 | }
|
---|
70 |
|
---|
71 | QStringList DlgFilter::featureList() const
|
---|
72 | {
|
---|
73 | QStringList list;
|
---|
74 | list << "Qt Architect Dialog Files (*.dlg)" ;
|
---|
75 | return list;
|
---|
76 | }
|
---|
77 |
|
---|
78 | QStringList DlgFilter::import( const QString &, const QString& filename )
|
---|
79 | {
|
---|
80 | Dlg2Ui d;
|
---|
81 | return d.convertQtArchitectDlgFile( filename );
|
---|
82 | }
|
---|
83 |
|
---|
84 | bool DlgFilter::init()
|
---|
85 | {
|
---|
86 | return TRUE;
|
---|
87 | }
|
---|
88 |
|
---|
89 | void DlgFilter::cleanup()
|
---|
90 | {
|
---|
91 | }
|
---|
92 |
|
---|
93 | bool DlgFilter::canUnload() const
|
---|
94 | {
|
---|
95 | return TRUE;
|
---|
96 | }
|
---|
97 |
|
---|
98 | Q_EXPORT_COMPONENT()
|
---|
99 | {
|
---|
100 | Q_CREATE_INSTANCE( DlgFilter )
|
---|
101 | }
|
---|