~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to kdevdesigner/designer/designerappiface.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2010-05-05 07:21:55 UTC
  • mfrom: (1.2.3 upstream) (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100505072155-h78lx19pu04sbhtn
Tags: 4:4.0.0-2
* Upload to unstable (Closes: #579947, #481832).
* Acknowledge obsolete NMU fixes (Closes: #562410, #546961).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 /**********************************************************************
2
 
** Copyright (C) 2000 Trolltech AS.  All rights reserved.
3
 
**
4
 
** This file is part of Qt Designer.
5
 
**
6
 
** This file may be distributed and/or modified under the terms of the
7
 
** GNU General Public License version 2 as published by the Free Software
8
 
** Foundation and appearing in the file LICENSE.GPL included in the
9
 
** packaging of this file.
10
 
**
11
 
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
12
 
** licenses may use this file in accordance with the Qt Commercial License
13
 
** Agreement provided with the Software.
14
 
**
15
 
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16
 
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17
 
**
18
 
** See http://www.trolltech.com/gpl/ for GPL licensing information.
19
 
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
20
 
**   information about Qt Commercial License Agreements.
21
 
**
22
 
** Contact info@trolltech.com if any conditions of this licensing are
23
 
** not clear to you.
24
 
**
25
 
**********************************************************************/
26
 
 
27
 
#include <qmenubar.h>
28
 
#include <qpopupmenu.h>
29
 
#include "designerappiface.h"
30
 
#include "mainwindow.h"
31
 
#include "project.h"
32
 
#include "formwindow.h"
33
 
#include "workspace.h"
34
 
#include "widgetfactory.h"
35
 
#include "command.h"
36
 
#include "outputwindow.h"
37
 
#include "../shared/widgetdatabase.h"
38
 
#include <qvariant.h>
39
 
#include <qlistview.h>
40
 
#include <qtextedit.h>
41
 
#include <qstatusbar.h>
42
 
#include "pixmapcollection.h"
43
 
#include "hierarchyview.h"
44
 
#include <stdlib.h>
45
 
#include <qmetaobject.h>
46
 
#include "popupmenueditor.h"
47
 
#include "menubareditor.h"
48
 
 
49
 
DesignerInterfaceImpl::DesignerInterfaceImpl( MainWindow *mw )
50
 
    : mainWindow( mw )
51
 
{
52
 
}
53
 
 
54
 
QRESULT DesignerInterfaceImpl::queryInterface( const QUuid &uuid, QUnknownInterface** iface )
55
 
{
56
 
    *iface = 0;
57
 
 
58
 
    if ( uuid == IID_QUnknown )
59
 
        *iface = (QUnknownInterface*)this;
60
 
    else if ( uuid == IID_QComponentInformation )
61
 
        *iface = (QComponentInformationInterface*)this;
62
 
    else if ( uuid == IID_Designer )
63
 
        *iface = (DesignerInterface*)this;
64
 
    else
65
 
        return QE_NOINTERFACE;
66
 
 
67
 
    (*iface)->addRef();
68
 
    return QS_OK;
69
 
}
70
 
 
71
 
 
72
 
DesignerProject *DesignerInterfaceImpl::currentProject() const
73
 
{
74
 
    return mainWindow->currProject()->iFace();
75
 
}
76
 
 
77
 
DesignerFormWindow *DesignerInterfaceImpl::currentForm() const
78
 
{
79
 
    if ( mainWindow->formWindow() )
80
 
        return mainWindow->formWindow()->iFace();
81
 
    return 0;
82
 
}
83
 
 
84
 
DesignerSourceFile *DesignerInterfaceImpl::currentSourceFile() const
85
 
{
86
 
    if ( mainWindow->sourceFile() )
87
 
        return mainWindow->sourceFile()->iFace();
88
 
    return 0;
89
 
}
90
 
 
91
 
QPtrList<DesignerProject> DesignerInterfaceImpl::projectList() const
92
 
{
93
 
    return mainWindow->projectList();
94
 
}
95
 
 
96
 
void DesignerInterfaceImpl::showStatusMessage( const QString &text, int ms ) const
97
 
{
98
 
    if ( text.isEmpty() ) {
99
 
        mainWindow->statusBar()->clear();
100
 
        return;
101
 
    }
102
 
    if ( ms )
103
 
        mainWindow->statusMessage( text/*, ms*/ );
104
 
    else
105
 
        mainWindow->statusMessage( text );
106
 
}
107
 
 
108
 
DesignerDock *DesignerInterfaceImpl::createDock() const
109
 
{
110
 
    return 0;
111
 
}
112
 
 
113
 
DesignerOutputDock *DesignerInterfaceImpl::outputDock() const
114
 
{
115
 
    return mainWindow->outputWindow() ? mainWindow->outputWindow()->iFace() : 0;
116
 
}
117
 
 
118
 
void DesignerInterfaceImpl::setModified( bool b, QWidget *window )
119
 
{
120
 
    mainWindow->setModified( b, window );
121
 
}
122
 
 
123
 
void DesignerInterfaceImpl::updateFunctionList()
124
 
{
125
 
    mainWindow->updateFunctionList();
126
 
    if ( mainWindow->objectHierarchy()->sourceEditor() )
127
 
        mainWindow->objectHierarchy()->updateClassBrowsers();
128
 
}
129
 
 
130
 
void DesignerInterfaceImpl::onProjectChange( QObject *receiver, const char *slot )
131
 
{
132
 
    QObject::connect( mainWindow, SIGNAL( projectChanged() ), receiver, slot );
133
 
}
134
 
 
135
 
void DesignerInterfaceImpl::onFormChange( QObject *receiver, const char *slot )
136
 
{
137
 
    QObject::connect( mainWindow, SIGNAL( formWindowChanged() ), receiver, slot );
138
 
    QObject::connect( mainWindow, SIGNAL( editorChanged() ), receiver, slot );
139
 
}
140
 
 
141
 
bool DesignerInterfaceImpl::singleProjectMode() const
142
 
{
143
 
    return mainWindow->singleProjectMode();
144
 
}
145
 
 
146
 
void DesignerInterfaceImpl::showError( QWidget *widget,
147
 
                                       int line, const QString &message )
148
 
{
149
 
    mainWindow->showErrorMessage( widget, line, message );
150
 
}
151
 
 
152
 
void DesignerInterfaceImpl::runFinished()
153
 
{
154
 
    mainWindow->finishedRun();
155
 
}
156
 
 
157
 
void DesignerInterfaceImpl::showStackFrame( QWidget *w, int line )
158
 
{
159
 
    mainWindow->showStackFrame( w, line );
160
 
}
161
 
 
162
 
void DesignerInterfaceImpl::showDebugStep( QWidget *w, int line )
163
 
{
164
 
    mainWindow->showDebugStep( w, line );
165
 
}
166
 
 
167
 
void DesignerInterfaceImpl::runProjectPrecondition()
168
 
{
169
 
    mainWindow->runProjectPrecondition();
170
 
}
171
 
 
172
 
void DesignerInterfaceImpl::runProjectPostcondition( QObjectList *l )
173
 
{
174
 
    mainWindow->runProjectPostcondition( l );
175
 
}
176
 
 
177
 
DesignerProjectImpl::DesignerProjectImpl( Project *pr )
178
 
    : project( pr )
179
 
{
180
 
}
181
 
 
182
 
QPtrList<DesignerFormWindow> DesignerProjectImpl::formList() const
183
 
{
184
 
    QPtrList<DesignerFormWindow> list;
185
 
    QObjectList *forms = project->formList();
186
 
    if ( !forms )
187
 
        return list;
188
 
 
189
 
    QPtrListIterator<QObject> it( *forms );
190
 
    while ( it.current() ) {
191
 
        QObject *obj = it.current();
192
 
        ++it;
193
 
        QWidget *par = ::qt_cast<FormWindow*>(obj->parent());
194
 
        if ( !obj->isWidgetType() || !par )
195
 
            continue;
196
 
 
197
 
        list.append( ((FormWindow*)par)->iFace() );
198
 
    }
199
 
 
200
 
    delete forms;
201
 
    return list;
202
 
}
203
 
 
204
 
QString DesignerProjectImpl::formFileName( const QString &form ) const
205
 
{
206
 
    for ( QPtrListIterator<FormFile> forms = project->formFiles();
207
 
          forms.current(); ++forms ) {
208
 
        if ( QString( forms.current()->formName() ) == form )
209
 
            return forms.current()->fileName();
210
 
    }
211
 
    return QString::null;
212
 
}
213
 
 
214
 
QStringList DesignerProjectImpl::formNames() const
215
 
{
216
 
    QStringList l;
217
 
    for ( QPtrListIterator<FormFile> forms = project->formFiles();
218
 
          forms.current(); ++forms ) {
219
 
        FormFile* f = forms.current();
220
 
        if ( f->isFake() )
221
 
            continue;
222
 
        l << f->formName();
223
 
    }
224
 
    return l;
225
 
}
226
 
 
227
 
void DesignerProjectImpl::addForm( DesignerFormWindow * )
228
 
{
229
 
}
230
 
 
231
 
void DesignerProjectImpl::removeForm( DesignerFormWindow * )
232
 
{
233
 
}
234
 
 
235
 
QString DesignerProjectImpl::fileName() const
236
 
{
237
 
    return project->fileName();
238
 
}
239
 
 
240
 
void DesignerProjectImpl::setFileName( const QString & )
241
 
{
242
 
}
243
 
 
244
 
QString DesignerProjectImpl::projectName() const
245
 
{
246
 
    return project->projectName();
247
 
}
248
 
 
249
 
void DesignerProjectImpl::setProjectName( const QString & )
250
 
{
251
 
}
252
 
 
253
 
QString DesignerProjectImpl::databaseFile() const
254
 
{
255
 
    return QString::null;
256
 
}
257
 
 
258
 
void DesignerProjectImpl::setDatabaseFile( const QString & )
259
 
{
260
 
}
261
 
 
262
 
void DesignerProjectImpl::setupDatabases() const
263
 
{
264
 
    MainWindow::self->editDatabaseConnections();
265
 
}
266
 
 
267
 
QPtrList<DesignerDatabase> DesignerProjectImpl::databaseConnections() const
268
 
{
269
 
    QPtrList<DesignerDatabase> lst;
270
 
#ifndef QT_NO_SQL
271
 
    QPtrList<DatabaseConnection> conns = project->databaseConnections();
272
 
    for ( DatabaseConnection *d = conns.first(); d; d = conns.next() )
273
 
        lst.append( d->iFace() );
274
 
#endif
275
 
    return lst;
276
 
}
277
 
 
278
 
void DesignerProjectImpl::addDatabase( DesignerDatabase * )
279
 
{
280
 
}
281
 
 
282
 
void DesignerProjectImpl::removeDatabase( DesignerDatabase * )
283
 
{
284
 
}
285
 
 
286
 
void DesignerProjectImpl::save() const
287
 
{
288
 
}
289
 
 
290
 
void DesignerProjectImpl::setLanguage( const QString &l )
291
 
{
292
 
    project->setLanguage( l );
293
 
}
294
 
 
295
 
QString DesignerProjectImpl::language() const
296
 
{
297
 
    return project->language();
298
 
}
299
 
 
300
 
void DesignerProjectImpl::setCustomSetting( const QString &key, const QString &value )
301
 
{
302
 
    project->setCustomSetting( key, value );
303
 
}
304
 
 
305
 
QString DesignerProjectImpl::customSetting( const QString &key ) const
306
 
{
307
 
    if ( key == "QTSCRIPT_PACKAGES" ) {
308
 
        QString s = getenv( "QTSCRIPT_PACKAGES" );
309
 
        QString s2 = project->customSetting( "QUICK_PACKAGES" );
310
 
        if ( !s.isEmpty() && !s2.isEmpty() )
311
 
#if defined(Q_OS_WIN32)
312
 
            s += ";";
313
 
#else
314
 
        s += ":";
315
 
#endif
316
 
        s += s2;
317
 
        return s;
318
 
    }
319
 
    return project->customSetting( key );
320
 
}
321
 
 
322
 
DesignerPixmapCollection *DesignerProjectImpl::pixmapCollection() const
323
 
{
324
 
    return project->pixmapCollection()->iFace();
325
 
}
326
 
 
327
 
void DesignerProjectImpl::breakPoints( QMap<QString, QValueList<uint> > &bps ) const
328
 
{
329
 
    MainWindow::self->saveAllBreakPoints();
330
 
    for ( QPtrListIterator<SourceFile> sources = project->sourceFiles();
331
 
          sources.current(); ++sources ) {
332
 
        SourceFile* f = sources.current();
333
 
        bps.insert( project->makeRelative( f->fileName() ) + " <Source-File>", MetaDataBase::breakPoints( f ) );
334
 
    }
335
 
    for ( QPtrListIterator<FormFile> forms = project->formFiles();
336
 
          forms.current(); ++forms ) {
337
 
        if ( forms.current()->formWindow() )
338
 
            bps.insert( QString( forms.current()->formWindow()->name() ) + " <Form>", MetaDataBase::breakPoints( forms.current()->formWindow() ) );
339
 
    }
340
 
}
341
 
 
342
 
QString DesignerProjectImpl::breakPointCondition( QObject *o, int line ) const
343
 
{
344
 
    return MetaDataBase::breakPointCondition( MainWindow::self->findRealObject( o ), line );
345
 
}
346
 
 
347
 
void DesignerProjectImpl::setBreakPointCondition( QObject *o, int line, const QString &condition )
348
 
{
349
 
    MetaDataBase::setBreakPointCondition( MainWindow::self->findRealObject( o ), line, condition );
350
 
}
351
 
 
352
 
void DesignerProjectImpl::clearAllBreakpoints() const
353
 
{
354
 
    QValueList<uint> empty;
355
 
    for ( QPtrListIterator<SourceFile> sources = project->sourceFiles();
356
 
          sources.current(); ++sources ) {
357
 
        SourceFile* f = sources.current();
358
 
        MetaDataBase::setBreakPoints( f, empty );
359
 
    }
360
 
    for ( QPtrListIterator<FormFile> forms = project->formFiles();
361
 
          forms.current(); ++forms ) {
362
 
        if ( forms.current()->formWindow() )
363
 
            MetaDataBase::setBreakPoints( forms.current()->formWindow(), empty );
364
 
        MainWindow::self->resetBreakPoints();
365
 
    }
366
 
}
367
 
 
368
 
void DesignerProjectImpl::setIncludePath( const QString &platform, const QString &path )
369
 
{
370
 
    project->setIncludePath( platform, path );
371
 
}
372
 
 
373
 
void DesignerProjectImpl::setLibs( const QString &platform, const QString &path )
374
 
{
375
 
    project->setLibs( platform, path );
376
 
}
377
 
 
378
 
void DesignerProjectImpl::setDefines( const QString &platform, const QString &path )
379
 
{
380
 
    project->setDefines( platform, path );
381
 
}
382
 
 
383
 
void DesignerProjectImpl::setConfig( const QString &platform, const QString &config )
384
 
{
385
 
    project->setConfig( platform, config );
386
 
}
387
 
 
388
 
void DesignerProjectImpl::setTemplate( const QString &t )
389
 
{
390
 
    project->setTemplate( t );
391
 
}
392
 
 
393
 
QString DesignerProjectImpl::config( const QString &platform ) const
394
 
{
395
 
    return project->config( platform );
396
 
}
397
 
 
398
 
QString DesignerProjectImpl::libs( const QString &platform ) const
399
 
{
400
 
    return project->libs( platform );
401
 
}
402
 
 
403
 
QString DesignerProjectImpl::defines( const QString &platform ) const
404
 
{
405
 
    return project->defines( platform );
406
 
}
407
 
 
408
 
QString DesignerProjectImpl::includePath( const QString &platform ) const
409
 
{
410
 
    return project->includePath( platform );
411
 
}
412
 
 
413
 
QString DesignerProjectImpl::templte() const
414
 
{
415
 
    return project->templte();
416
 
}
417
 
 
418
 
bool DesignerProjectImpl::isGenericObject( QObject *o ) const
419
 
{
420
 
    return !!project->fakeFormFileFor( o );
421
 
}
422
 
 
423
 
 
424
 
 
425
 
 
426
 
 
427
 
 
428
 
 
429
 
#ifndef QT_NO_SQL
430
 
DesignerDatabaseImpl::DesignerDatabaseImpl( DatabaseConnection *d )
431
 
    : db( d )
432
 
{
433
 
}
434
 
 
435
 
QString DesignerDatabaseImpl::name() const
436
 
{
437
 
    return db->name();
438
 
}
439
 
 
440
 
void DesignerDatabaseImpl::setName( const QString & )
441
 
{
442
 
}
443
 
 
444
 
QString DesignerDatabaseImpl::driver() const
445
 
{
446
 
    return db->driver();
447
 
}
448
 
 
449
 
void DesignerDatabaseImpl::setDriver( const QString & )
450
 
{
451
 
}
452
 
 
453
 
QString DesignerDatabaseImpl::database() const
454
 
{
455
 
    return db->database();
456
 
}
457
 
 
458
 
void DesignerDatabaseImpl::setDatabase( const QString & )
459
 
{
460
 
}
461
 
 
462
 
QString DesignerDatabaseImpl::userName() const
463
 
{
464
 
    return db->username();
465
 
}
466
 
 
467
 
void DesignerDatabaseImpl::setUserName( const QString & )
468
 
{
469
 
}
470
 
 
471
 
QString DesignerDatabaseImpl::password() const
472
 
{
473
 
    return db->password();
474
 
}
475
 
 
476
 
void DesignerDatabaseImpl::setPassword( const QString & )
477
 
{
478
 
}
479
 
 
480
 
QString DesignerDatabaseImpl::hostName() const
481
 
{
482
 
    return db->hostname();
483
 
}
484
 
 
485
 
void DesignerDatabaseImpl::setHostName( const QString & )
486
 
{
487
 
}
488
 
 
489
 
QStringList DesignerDatabaseImpl::tables() const
490
 
{
491
 
    return db->tables();
492
 
}
493
 
 
494
 
QMap<QString, QStringList> DesignerDatabaseImpl::fields() const
495
 
{
496
 
    return db->fields();
497
 
}
498
 
 
499
 
void DesignerDatabaseImpl::open( bool suppressDialog ) const
500
 
{
501
 
    db->open( suppressDialog );
502
 
}
503
 
 
504
 
void DesignerDatabaseImpl::close() const
505
 
{
506
 
    db->close();
507
 
}
508
 
 
509
 
void DesignerDatabaseImpl::setFields( const QMap<QString, QStringList> & )
510
 
{
511
 
}
512
 
 
513
 
void DesignerDatabaseImpl::setTables( const QStringList & )
514
 
{
515
 
}
516
 
 
517
 
QSqlDatabase* DesignerDatabaseImpl::connection()
518
 
{
519
 
    return db->connection();
520
 
}
521
 
#endif
522
 
 
523
 
 
524
 
 
525
 
DesignerPixmapCollectionImpl::DesignerPixmapCollectionImpl( PixmapCollection *coll )
526
 
    : pixCollection( coll )
527
 
{
528
 
}
529
 
 
530
 
void DesignerPixmapCollectionImpl::addPixmap( const QPixmap &p, const QString &name, bool force )
531
 
{
532
 
    PixmapCollection::Pixmap pix;
533
 
    pix.pix = p;
534
 
    pix.name = name;
535
 
    pixCollection->addPixmap( pix, force );
536
 
    FormWindow *fw = MainWindow::self->formWindow();
537
 
    if ( fw )
538
 
        MetaDataBase::setPixmapKey( fw, p.serialNumber(), name );
539
 
}
540
 
 
541
 
QPixmap DesignerPixmapCollectionImpl::pixmap( const QString &name ) const
542
 
{
543
 
    return pixCollection->pixmap( name );
544
 
}
545
 
 
546
 
 
547
 
 
548
 
DesignerFormWindowImpl::DesignerFormWindowImpl( FormWindow *fw )
549
 
    : formWindow( fw )
550
 
{
551
 
}
552
 
 
553
 
QString DesignerFormWindowImpl::name() const
554
 
{
555
 
    return formWindow->name();
556
 
 }
557
 
 
558
 
void DesignerFormWindowImpl::setName( const QString &n )
559
 
{
560
 
    formWindow->setName( n );
561
 
}
562
 
 
563
 
QString DesignerFormWindowImpl::fileName() const
564
 
{
565
 
    return formWindow->fileName();
566
 
}
567
 
 
568
 
void DesignerFormWindowImpl::setFileName( const QString & )
569
 
{
570
 
}
571
 
 
572
 
void DesignerFormWindowImpl::save() const
573
 
{
574
 
}
575
 
 
576
 
bool DesignerFormWindowImpl::isModified() const
577
 
{
578
 
    return formWindow->commandHistory()->isModified();
579
 
}
580
 
 
581
 
void DesignerFormWindowImpl::insertWidget( QWidget * )
582
 
{
583
 
}
584
 
 
585
 
QWidget *DesignerFormWindowImpl::create( const char *className, QWidget *parent, const char *name )
586
 
{
587
 
    QWidget *w = WidgetFactory::create( WidgetDatabase::idFromClassName( className ), parent, name );
588
 
    formWindow->insertWidget( w, TRUE );
589
 
    formWindow->killAccels( formWindow->mainContainer() );
590
 
    return w;
591
 
}
592
 
 
593
 
void DesignerFormWindowImpl::removeWidget( QWidget * )
594
 
{
595
 
}
596
 
 
597
 
QWidgetList DesignerFormWindowImpl::widgets() const
598
 
{
599
 
    return QWidgetList();
600
 
}
601
 
 
602
 
void DesignerFormWindowImpl::undo()
603
 
{
604
 
}
605
 
 
606
 
void DesignerFormWindowImpl::redo()
607
 
{
608
 
}
609
 
 
610
 
void DesignerFormWindowImpl::cut()
611
 
{
612
 
}
613
 
 
614
 
void DesignerFormWindowImpl::copy()
615
 
{
616
 
}
617
 
 
618
 
void DesignerFormWindowImpl::paste()
619
 
{
620
 
}
621
 
 
622
 
void DesignerFormWindowImpl::adjustSize()
623
 
{
624
 
}
625
 
 
626
 
void DesignerFormWindowImpl::editConnections()
627
 
{
628
 
}
629
 
 
630
 
void DesignerFormWindowImpl::checkAccels()
631
 
{
632
 
}
633
 
 
634
 
void DesignerFormWindowImpl::layoutH()
635
 
{
636
 
    formWindow->layoutHorizontal();
637
 
}
638
 
 
639
 
void DesignerFormWindowImpl::layoutV()
640
 
{
641
 
}
642
 
 
643
 
void DesignerFormWindowImpl::layoutHSplit()
644
 
{
645
 
}
646
 
 
647
 
void DesignerFormWindowImpl::layoutVSplit()
648
 
{
649
 
}
650
 
 
651
 
void DesignerFormWindowImpl::layoutG()
652
 
{
653
 
    formWindow->layoutGrid();
654
 
}
655
 
 
656
 
void DesignerFormWindowImpl::layoutHContainer( QWidget* w )
657
 
{
658
 
    formWindow->layoutHorizontalContainer( w );
659
 
}
660
 
 
661
 
void DesignerFormWindowImpl::layoutVContainer( QWidget* w )
662
 
{
663
 
    formWindow->layoutVerticalContainer( w );
664
 
}
665
 
 
666
 
void DesignerFormWindowImpl::layoutGContainer( QWidget* w )
667
 
{
668
 
    formWindow->layoutGridContainer( w );
669
 
}
670
 
 
671
 
void DesignerFormWindowImpl::breakLayout()
672
 
{
673
 
}
674
 
 
675
 
void DesignerFormWindowImpl::selectWidget( QWidget * w )
676
 
{
677
 
    formWindow->selectWidget( w, TRUE );
678
 
}
679
 
 
680
 
void DesignerFormWindowImpl::selectAll()
681
 
{
682
 
}
683
 
 
684
 
void DesignerFormWindowImpl::clearSelection()
685
 
{
686
 
    formWindow->clearSelection();
687
 
}
688
 
 
689
 
bool DesignerFormWindowImpl::isWidgetSelected( QWidget * ) const
690
 
{
691
 
    return FALSE;
692
 
}
693
 
 
694
 
QWidgetList DesignerFormWindowImpl::selectedWidgets() const
695
 
{
696
 
    return formWindow->selectedWidgets();
697
 
}
698
 
 
699
 
QWidget *DesignerFormWindowImpl::currentWidget() const
700
 
{
701
 
    return formWindow->currentWidget();
702
 
}
703
 
 
704
 
QWidget *DesignerFormWindowImpl::form() const
705
 
{
706
 
    return formWindow;
707
 
}
708
 
 
709
 
 
710
 
void DesignerFormWindowImpl::setCurrentWidget( QWidget * )
711
 
{
712
 
}
713
 
 
714
 
QPtrList<QAction> DesignerFormWindowImpl::actionList() const
715
 
{
716
 
    return QPtrList<QAction>();
717
 
}
718
 
 
719
 
QAction *DesignerFormWindowImpl::createAction( const QString& text, const QIconSet& icon, const QString& menuText, int accel,
720
 
                                               QObject* parent, const char* name, bool toggle )
721
 
{
722
 
    QDesignerAction *a = new QDesignerAction( parent );
723
 
    a->setName( name );
724
 
    a->setText( text );
725
 
    if ( !icon.isNull() && !icon.pixmap().isNull() )
726
 
    a->setIconSet( icon );
727
 
    a->setMenuText( menuText );
728
 
    a->setAccel( accel );
729
 
    a->setToggleAction( toggle );
730
 
    return a;
731
 
}
732
 
 
733
 
void DesignerFormWindowImpl::addAction( QAction *a )
734
 
{
735
 
    if ( formWindow->actionList().findRef( a ) != -1 )
736
 
        return;
737
 
    formWindow->actionList().append( a );
738
 
    MetaDataBase::addEntry( a );
739
 
    setPropertyChanged( a, "name", TRUE );
740
 
    setPropertyChanged( a, "text", TRUE );
741
 
    setPropertyChanged( a, "menuText", TRUE );
742
 
    setPropertyChanged( a, "accel", TRUE );
743
 
    if ( !a->iconSet().isNull() && !a->iconSet().pixmap().isNull() )
744
 
        setPropertyChanged( a, "iconSet", TRUE );
745
 
}
746
 
 
747
 
void DesignerFormWindowImpl::removeAction( QAction *a )
748
 
{
749
 
    formWindow->actionList().removeRef( a );
750
 
}
751
 
 
752
 
void DesignerFormWindowImpl::preview() const
753
 
{
754
 
}
755
 
 
756
 
void DesignerFormWindowImpl::addConnection( QObject *sender, const char *signal, QObject *receiver, const char *slot )
757
 
{
758
 
    MetaDataBase::addConnection( formWindow, sender, signal, receiver, slot );
759
 
}
760
 
 
761
 
void DesignerFormWindowImpl::addFunction( const QCString &function, const QString &specifier,
762
 
                                          const QString &access, const QString &type,
763
 
                                          const QString &language, const QString &returnType )
764
 
{
765
 
    MetaDataBase::addFunction( formWindow, function, specifier, access, type, language, returnType );
766
 
    formWindow->mainWindow()->functionsChanged();
767
 
}
768
 
 
769
 
 
770
 
 
771
 
void DesignerFormWindowImpl::setProperty( QObject *o, const char *property, const QVariant &value )
772
 
{
773
 
    int id = o->metaObject()->findProperty( property, TRUE );
774
 
    const QMetaProperty* p = o->metaObject()->property( id, TRUE );
775
 
    if ( p && p->isValid() )
776
 
        o->setProperty( property, value );
777
 
    else
778
 
        MetaDataBase::setFakeProperty( o, property, value );
779
 
}
780
 
 
781
 
QVariant DesignerFormWindowImpl::property( QObject *o, const char *prop ) const
782
 
{
783
 
    int id = o->metaObject()->findProperty( prop, TRUE );
784
 
    const QMetaProperty* p = o->metaObject()->property( id, TRUE );
785
 
    if ( p && p->isValid() )
786
 
        return o->property( prop );
787
 
    return MetaDataBase::fakeProperty( o, prop );
788
 
}
789
 
 
790
 
void DesignerFormWindowImpl::setPropertyChanged( QObject *o, const char *property, bool changed )
791
 
{
792
 
    MetaDataBase::setPropertyChanged( o, property, changed );
793
 
}
794
 
 
795
 
bool DesignerFormWindowImpl::isPropertyChanged( QObject *o, const char *property ) const
796
 
{
797
 
    return MetaDataBase::isPropertyChanged( o, property );
798
 
}
799
 
 
800
 
void DesignerFormWindowImpl::setColumnFields( QObject *o, const QMap<QString, QString> &f )
801
 
{
802
 
    MetaDataBase::setColumnFields( o, f );
803
 
}
804
 
 
805
 
QStringList DesignerFormWindowImpl::implementationIncludes() const
806
 
{
807
 
    QValueList<MetaDataBase::Include> includes = MetaDataBase::includes( formWindow );
808
 
    QStringList lst;
809
 
    for ( QValueList<MetaDataBase::Include>::Iterator it = includes.begin(); it != includes.end(); ++it ) {
810
 
        MetaDataBase::Include inc = *it;
811
 
        if ( inc.implDecl != "in implementation" )
812
 
            continue;
813
 
        QString s = inc.header;
814
 
        if ( inc.location == "global" ) {
815
 
            s.prepend( "<" );
816
 
            s.append( ">" );
817
 
        } else {
818
 
            s.prepend( "\"" );
819
 
            s.append( "\"" );
820
 
        }
821
 
        lst << s;
822
 
    }
823
 
    return lst;
824
 
}
825
 
 
826
 
QStringList DesignerFormWindowImpl::declarationIncludes() const
827
 
{
828
 
    QValueList<MetaDataBase::Include> includes = MetaDataBase::includes( formWindow );
829
 
    QStringList lst;
830
 
    for ( QValueList<MetaDataBase::Include>::Iterator it = includes.begin(); it != includes.end(); ++it ) {
831
 
        MetaDataBase::Include inc = *it;
832
 
        if ( inc.implDecl == "in implementation" )
833
 
            continue;
834
 
        QString s = inc.header;
835
 
        if ( inc.location == "global" ) {
836
 
            s.prepend( "<" );
837
 
            s.append( ">" );
838
 
        } else {
839
 
            s.prepend( "\"" );
840
 
            s.append( "\"" );
841
 
        }
842
 
        lst << s;
843
 
    }
844
 
    return lst;
845
 
}
846
 
 
847
 
void DesignerFormWindowImpl::setImplementationIncludes( const QStringList &lst )
848
 
{
849
 
    QValueList<MetaDataBase::Include> oldIncludes = MetaDataBase::includes( formWindow );
850
 
    QValueList<MetaDataBase::Include> includes;
851
 
    for ( QValueList<MetaDataBase::Include>::Iterator it = oldIncludes.begin(); it != oldIncludes.end(); ++it ) {
852
 
        MetaDataBase::Include inc = *it;
853
 
        if ( inc.implDecl == "in implementation" )
854
 
            continue;
855
 
        includes << inc;
856
 
    }
857
 
 
858
 
    for ( QStringList::ConstIterator sit = lst.begin(); sit != lst.end(); ++sit ) {
859
 
        QString s = *sit;
860
 
        if ( s.startsWith( "#include" ) )
861
 
            s.remove( (uint)0, 8 );
862
 
        s = s.simplifyWhiteSpace();
863
 
        if ( s[ 0 ] != '<' && s[ 0 ] != '"' ) {
864
 
            s.prepend( "\"" );
865
 
            s.append( "\"" );
866
 
        }
867
 
        if ( s[ 0 ] == '<' ) {
868
 
            s.remove( (uint)0, 1 );
869
 
            s.remove( s.length() - 1, 1 );
870
 
            MetaDataBase::Include inc;
871
 
            inc.header = s;
872
 
            inc.implDecl = "in implementation";
873
 
            inc.location = "global";
874
 
            includes << inc;
875
 
        } else {
876
 
            s.remove( (uint)0, 1 );
877
 
            s.remove( s.length() - 1, 1 );
878
 
            MetaDataBase::Include inc;
879
 
            inc.header = s;
880
 
            inc.implDecl = "in implementation";
881
 
            inc.location = "local";
882
 
            includes << inc;
883
 
        }
884
 
    }
885
 
    MetaDataBase::setIncludes( formWindow, includes );
886
 
    formWindow->mainWindow()->objectHierarchy()->formDefinitionView()->setup();
887
 
}
888
 
 
889
 
void DesignerFormWindowImpl::setDeclarationIncludes( const QStringList &lst )
890
 
{
891
 
    QValueList<MetaDataBase::Include> oldIncludes = MetaDataBase::includes( formWindow );
892
 
    QValueList<MetaDataBase::Include> includes;
893
 
    for ( QValueList<MetaDataBase::Include>::Iterator it = oldIncludes.begin(); it != oldIncludes.end(); ++it ) {
894
 
        MetaDataBase::Include inc = *it;
895
 
        if ( inc.implDecl == "in declaration" )
896
 
            continue;
897
 
        includes << inc;
898
 
    }
899
 
 
900
 
    for ( QStringList::ConstIterator sit = lst.begin(); sit != lst.end(); ++sit ) {
901
 
        QString s = *sit;
902
 
        if ( s.startsWith( "#include" ) )
903
 
            s.remove( (uint)0, 8 );
904
 
        s = s.simplifyWhiteSpace();
905
 
        if ( s[ 0 ] != '<' && s[ 0 ] != '"' ) {
906
 
            s.prepend( "\"" );
907
 
            s.append( "\"" );
908
 
        }
909
 
        if ( s[ 0 ] == '<' ) {
910
 
            s.remove( (uint)0, 1 );
911
 
            s.remove( s.length() - 1, 1 );
912
 
            MetaDataBase::Include inc;
913
 
            inc.header = s;
914
 
            inc.implDecl = "in declaration";
915
 
            inc.location = "global";
916
 
            includes << inc;
917
 
        } else {
918
 
            s.remove( (uint)0, 1 );
919
 
            s.remove( s.length() - 1, 1 );
920
 
            MetaDataBase::Include inc;
921
 
            inc.header = s;
922
 
            inc.implDecl = "in declaration";
923
 
            inc.location = "local";
924
 
            includes << inc;
925
 
        }
926
 
    }
927
 
    MetaDataBase::setIncludes( formWindow, includes );
928
 
    formWindow->mainWindow()->objectHierarchy()->formDefinitionView()->setup();
929
 
}
930
 
 
931
 
QStringList DesignerFormWindowImpl::forwardDeclarations() const
932
 
{
933
 
    return MetaDataBase::forwards( formWindow );
934
 
}
935
 
 
936
 
void DesignerFormWindowImpl::setForwardDeclarations( const QStringList &lst )
937
 
{
938
 
    MetaDataBase::setForwards( formWindow, lst );
939
 
    formWindow->mainWindow()->objectHierarchy()->formDefinitionView()->setup();
940
 
}
941
 
 
942
 
QStringList DesignerFormWindowImpl::signalList() const
943
 
{
944
 
    return MetaDataBase::signalList( formWindow );
945
 
}
946
 
 
947
 
void DesignerFormWindowImpl::setSignalList( const QStringList &lst )
948
 
{
949
 
    MetaDataBase::setSignalList( formWindow, lst );
950
 
    formWindow->mainWindow()->objectHierarchy()->formDefinitionView()->setup();
951
 
}
952
 
 
953
 
void DesignerFormWindowImpl::onModificationChange( QObject *receiver, const char *slot )
954
 
{
955
 
    QObject::connect( formWindow, SIGNAL( modificationChanged( bool, FormWindow * ) ), receiver, slot );
956
 
}
957
 
 
958
 
void DesignerFormWindowImpl::addMenu( const QString &text, const QString &name )
959
 
{
960
 
    if ( !::qt_cast<QMainWindow*>(formWindow->mainContainer()) )
961
 
        return;
962
 
 
963
 
    QMainWindow *mw = (QMainWindow*)formWindow->mainContainer();
964
 
    PopupMenuEditor *popup = new PopupMenuEditor( formWindow, mw );
965
 
    QString n = name;
966
 
    formWindow->unify( popup, n, TRUE );
967
 
    popup->setName( n );
968
 
    MenuBarEditor *mb = (MenuBarEditor *)mw->child( 0, "MenuBarEditor" );
969
 
    if ( !mb ) {
970
 
        mb = new MenuBarEditor( formWindow, mw );
971
 
        mb->setName( "MenuBar" );
972
 
        MetaDataBase::addEntry( mb );
973
 
    }
974
 
    mb->insertItem( text, popup );
975
 
    MetaDataBase::addEntry( popup );
976
 
}
977
 
 
978
 
void DesignerFormWindowImpl::addMenuAction( const QString &menu, QAction *a )
979
 
{
980
 
    if ( !::qt_cast<QMainWindow*>(formWindow->mainContainer()) )
981
 
        return;
982
 
    QMainWindow *mw = (QMainWindow*)formWindow->mainContainer();
983
 
    if ( !mw->child( 0, "MenuBarEditor" ) )
984
 
        return;
985
 
    PopupMenuEditor *popup = (PopupMenuEditor*)mw->child( menu, "PopupMenuEditor" );
986
 
    if ( !popup )
987
 
        return;
988
 
    popup->insert( a );
989
 
}
990
 
 
991
 
void DesignerFormWindowImpl::addMenuSeparator( const QString &menu )
992
 
{
993
 
    if ( !::qt_cast<QMainWindow*>(formWindow->mainContainer()) )
994
 
        return;
995
 
    QMainWindow *mw = (QMainWindow*)formWindow->mainContainer();
996
 
    if ( !mw->child( 0, "MenuBarEditor" ) )
997
 
        return;
998
 
    PopupMenuEditor *popup = (PopupMenuEditor*)mw->child( menu, "PopupMenuEditor" );
999
 
    if ( !popup )
1000
 
        return;
1001
 
    QAction *a = new QSeparatorAction( 0 );
1002
 
    popup->insert( a );
1003
 
}
1004
 
 
1005
 
void DesignerFormWindowImpl::addToolBar( const QString &text, const QString &name )
1006
 
{
1007
 
    if ( !::qt_cast<QMainWindow*>(formWindow->mainContainer()) )
1008
 
        return;
1009
 
    QMainWindow *mw = (QMainWindow*)formWindow->mainContainer();
1010
 
    QToolBar *tb = new QDesignerToolBar( mw );
1011
 
    QString n = name;
1012
 
    formWindow->unify( tb, n, TRUE );
1013
 
    tb->setName( n );
1014
 
    mw->addToolBar( tb, text );
1015
 
}
1016
 
 
1017
 
void DesignerFormWindowImpl::addToolBarAction( const QString &tbn, QAction *a )
1018
 
{
1019
 
    if ( !::qt_cast<QMainWindow*>(formWindow->mainContainer()) )
1020
 
        return;
1021
 
    QMainWindow *mw = (QMainWindow*)formWindow->mainContainer();
1022
 
    QDesignerToolBar *tb = (QDesignerToolBar*)mw->child( tbn, "QDesignerToolBar" );
1023
 
    if ( !tb )
1024
 
        return;
1025
 
    a->addTo( tb );
1026
 
    tb->addAction( a );
1027
 
}
1028
 
 
1029
 
void DesignerFormWindowImpl::addToolBarSeparator( const QString &tbn )
1030
 
{
1031
 
    if ( !::qt_cast<QMainWindow*>(formWindow->mainContainer()) )
1032
 
        return;
1033
 
    QMainWindow *mw = (QMainWindow*)formWindow->mainContainer();
1034
 
    QDesignerToolBar *tb = (QDesignerToolBar*)mw->child( tbn, "QDesignerToolBar" );
1035
 
    if ( !tb )
1036
 
        return;
1037
 
    QAction *a = new QSeparatorAction( 0 );
1038
 
    a->addTo( tb );
1039
 
    tb->addAction( a );
1040
 
}
1041
 
 
1042
 
DesignerDockImpl::DesignerDockImpl()
1043
 
{
1044
 
}
1045
 
 
1046
 
QDockWindow *DesignerDockImpl::dockWindow() const
1047
 
{
1048
 
    return 0;
1049
 
}
1050
 
 
1051
 
DesignerOutputDockImpl::DesignerOutputDockImpl( OutputWindow *ow )
1052
 
    : outWin( ow )
1053
 
{
1054
 
}
1055
 
 
1056
 
QWidget *DesignerOutputDockImpl::addView( const QString &title )
1057
 
{
1058
 
    QWidget *page = new QWidget( outWin );
1059
 
    outWin->addTab( page, title );
1060
 
    return page;
1061
 
}
1062
 
 
1063
 
void DesignerOutputDockImpl::appendDebug( const QString &s )
1064
 
{
1065
 
    outWin->appendDebug( s );
1066
 
}
1067
 
 
1068
 
void DesignerOutputDockImpl::clearDebug()
1069
 
{
1070
 
}
1071
 
 
1072
 
void DesignerOutputDockImpl::appendError( const QString &s, int l )
1073
 
{
1074
 
    QStringList ls;
1075
 
    ls << s;
1076
 
    QValueList<uint> ll;
1077
 
    ll << l;
1078
 
    outWin->setErrorMessages( ls, ll, FALSE, QStringList(), QObjectList() );
1079
 
}
1080
 
 
1081
 
void DesignerOutputDockImpl::clearError()
1082
 
{
1083
 
}
1084
 
 
1085
 
DesignerSourceFileImpl::DesignerSourceFileImpl( SourceFile *e )
1086
 
    : ed( e )
1087
 
{
1088
 
}
1089
 
 
1090
 
QString DesignerSourceFileImpl::fileName() const
1091
 
{
1092
 
    return ed->fileName();
1093
 
}