source: trunk/tools/designer/plugins/rc/main.cpp

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

Added QtDesigner

File size: 2.8 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 <filterinterface.h>
29
30#include <qapplication.h>
31
32#include "rc2ui.h"
33
34class RCFilter : public ImportFilterInterface, public QLibraryInterface
35{
36public:
37 RCFilter();
38
39 QRESULT queryInterface( const QUuid&, QUnknownInterface **iface );
40 Q_REFCOUNT;
41
42 QStringList featureList() const;
43 QStringList import( const QString& filter, const QString& filename );
44
45 bool init();
46 void cleanup();
47 bool canUnload() const;
48};
49
50RCFilter::RCFilter()
51{
52}
53
54QRESULT RCFilter::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
55{
56 *iface = 0;
57 if ( uuid == IID_QUnknown )
58 *iface = (QUnknownInterface*)(ImportFilterInterface*)this;
59 else if ( uuid == IID_QFeatureList )
60 *iface = (QFeatureListInterface*)this;
61 else if ( uuid == IID_ImportFilter )
62 *iface = (ImportFilterInterface*)this;
63 else if ( uuid == IID_QLibrary )
64 *iface = (QLibraryInterface*)this;
65 else
66 return QE_NOINTERFACE;
67
68 (*iface)->addRef();
69 return QS_OK;
70}
71
72QStringList RCFilter::featureList() const
73{
74 QStringList list;
75 list << "Microsoft Resource Files (*.rc)" ;
76 return list;
77}
78
79QStringList RCFilter::import( const QString &, const QString& filename )
80{
81 QFile file( filename );
82 if ( !file.open( IO_ReadOnly ) )
83 qWarning( "uic: Could not open file '%s' ", filename.latin1() );
84 QTextStream in;
85 in.setDevice( &file );
86
87 RC2UI c( &in );
88 QStringList files;
89 c.parse();
90 return c.targetFiles;
91}
92
93bool RCFilter::init()
94{
95 return TRUE;
96}
97
98void RCFilter::cleanup()
99{
100}
101
102bool RCFilter::canUnload() const
103{
104 return TRUE;
105}
106
107Q_EXPORT_COMPONENT()
108{
109 Q_CREATE_INSTANCE( RCFilter )
110}
Note: See TracBrowser for help on using the repository browser.