1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
|
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qt Designer.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "metadatabase.h"
#include "../interfaces/actioninterface.h" // for GCC 2.7.* compatibility
#include "../interfaces/editorinterface.h"
#include "../interfaces/templatewizardiface.h"
#include "../interfaces/languageinterface.h"
#include "../interfaces/filterinterface.h"
#include "../interfaces/interpreterinterface.h"
#include "../interfaces/preferenceinterface.h"
#include "../interfaces/projectsettingsiface.h"
#include "../interfaces/sourcetemplateiface.h"
#include "sourceeditor.h"
#include <tqaction.h>
#include <tqmainwindow.h>
#include <tqmap.h>
#include <tqguardedptr.h>
#include <private/qpluginmanager_p.h>
#include <tqobjectlist.h>
class QToolBox;
class PropertyEditor;
class QWorkspace;
class QMenuBar;
class FormWindow;
class QPopupMenu;
class HierarchyView;
class QCloseEvent;
class Workspace;
class ActionEditor;
class Project;
class OutputWindow;
class QTimer;
class FindDialog;
struct DesignerProject;
class ReplaceDialog;
class GotoLineDialog;
class SourceFile;
class FormFile;
class QAssistantClient;
class DesignerAction;
#if defined(Q_FULL_TEMPLATE_INSTANTIATION)
#include <tqtoolbar.h>
#else
class QToolBar;
#endif
class Preferences;
class KDevDesignerPart;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
enum LineMode { Error, Step, StackFrame };
MainWindow( KDevDesignerPart *part, bool asClient, bool single = FALSE, const TQString &plgDir = "/designer" );
~MainWindow();
HierarchyView *objectHierarchy() const;
Workspace *workspace() const;
PropertyEditor *propertyeditor() const;
ActionEditor *actioneditor() const;
void resetTool();
int currentTool() const;
FormWindow *formWindow();
bool unregisterClient( FormWindow *w );
void editorClosed( SourceEditor *e );
TQWidget *isAFormWindowChild( TQObject *o ) const;
TQWidget *isAToolBarChild( TQObject *o ) const;
void insertFormWindow( FormWindow *fw );
TQWorkspace *qWorkspace() const;
void popupFormWindowMenu( const TQPoint &gp, FormWindow *fw );
void popupWidgetMenu( const TQPoint &gp, FormWindow *fw, TQWidget *w );
TQPopupMenu *setupNormalHierarchyMenu( TQWidget *parent );
TQPopupMenu *setupTabWidgetHierarchyMenu( TQWidget *parent, const char *addSlot, const char *removeSlot );
FormWindow *openFormWindow( const TQString &fn, bool validFileName = TRUE, FormFile *ff = 0 );
bool isCustomWidgetUsed( MetaDataBase::CustomWidget *w );
void setGrid( const TQPoint &p );
void setShowGrid( bool b );
void setSnapGrid( bool b );
TQPoint grid() const { return grd; }
bool showGrid() const { return sGrid; }
bool snapGrid() const { return snGrid && sGrid; }
TQString documentationPath() const;
static MainWindow *self;
TQString templatePath() const { return templPath; }
void editFunction( const TQString &func, bool rereadSource = FALSE );
bool isPreviewing() const { return previewing; }
Project *currProject() const { return currentProject; }
FormWindow *activeForm() const { return lastActiveFormWindow; }
TemplateWizardInterface* templateWizardInterface( const TQString& className );
TQStringList sourceTemplates() const;
SourceTemplateInterface* sourceTemplateInterface( const TQString& templ );
QUnknownInterface* designerInterface() const { return desInterface; }
TQPtrList<DesignerProject> projectList() const;
TQStringList projectNames() const;
TQStringList projectFileNames() const;
Project *findProject( const TQString &projectName ) const;
void setCurrentProject( Project *pro );
void setCurrentProjectByFilename( const TQString& proFilename );
OutputWindow *outputWindow() const { return oWindow; }
void addPreferencesTab( TQWidget *tab, const TQString &title, TQObject *receiver, const char *init_slot, const char *accept_slot );
void addProjectTab( TQWidget *tab, const TQString &title, TQObject *receiver, const char *init_slot, const char *accept_slot );
void setModified( bool b, TQWidget *window );
void functionsChanged();
void updateFunctionList();
void updateWorkspace();
void runProjectPrecondition();
void runProjectPostcondition( TQObjectList *l );
void formNameChanged( FormWindow *fw );
int currentLayoutDefaultSpacing() const;
int currentLayoutDefaultMargin() const;
void saveAllBreakPoints();
void resetBreakPoints();
SourceFile *sourceFile();
void createNewProject( const TQString &lang );
void popupProjectMenu( const TQPoint &pos );
TQObject *findRealObject( TQObject *o );
void setSingleProject( Project *pro );
bool singleProjectMode() const { return singleProject; }
void showSourceLine( TQObject *o, int line, LineMode lm );
void shuttingDown();
void showGUIStuff( bool b );
void setEditorsReadOnly( bool b );
bool areEditorsReadOnly() const { return editorsReadOnly; }
void toggleSignalHandlers( bool show );
bool showSignalHandlers() const { return sSignalHandlers; }
void writeConfig();
void openProject( const TQString &fn );
void setPluginDirectory( const TQString &pd );
TQString pluginDirectory() const { return pluginDir; }
QAssistantClient* assistantClient() const { return assistant; }
void addRecentlyOpenedFile( const TQString &fn ) { addRecentlyOpened( fn, recentlyFiles ); }
void statusMessage(const TQString &msg);
//integration
KDevDesignerPart *part() const { return m_part; }
public slots:
void showProperties( TQObject *w );
void updateProperties( TQObject *w );
void showDialogHelp();
void showDebugStep( TQObject *o, int line );
void showStackFrame( TQObject *o, int line );
void showErrorMessage( TQObject *o, int line, const TQString &errorMessage );
void finishedRun();
void breakPointsChanged();
signals:
void currentToolChanged();
void hasActiveForm( bool );
void hasActiveWindow( bool );
void hasActiveWindowOrProject( bool );
void hasNonDummyProject( bool );
void formModified( bool );
void formWindowsChanged();
void formWindowChanged();
void projectChanged();
void editorChanged();
protected:
bool eventFilter( TQObject *o, TQEvent *e );
void closeEvent( TQCloseEvent *e );
public slots:
void fileNew();
void fileNewDialog();
void fileNewFile();
void fileClose();
void fileQuit();
void fileCloseProject(); // not visible in menu, called from fileClose
void fileOpen();
void fileOpen( const TQString &filter, const TQString &extension, const TQString &filename = "" , bool inProject = TRUE );
bool fileSave();
bool fileSaveForm(); // not visible in menu, called from fileSave
bool fileSaveProject(); // not visible in menu, called from fileSaveProject
bool fileSaveAs();
void fileSaveAll();
void fileCreateTemplate();
public slots:
void editUndo();
void editRedo();
void editCut();
void editCopy();
void editPaste();
void editDelete();
void editSelectAll();
void editLower();
void editRaise();
void editAdjustSize();
void editLayoutHorizontal();
void editLayoutVertical();
void editLayoutHorizontalSplit();
void editLayoutVerticalSplit();
void editLayoutGrid();
void editLayoutContainerHorizontal();
void editLayoutContainerVertical();
void editLayoutContainerGrid();
void editBreakLayout();
void editAccels();
void editFunctions();
void editConnections();
SourceEditor *editSource();
SourceEditor *editSource( SourceFile *f );
SourceEditor *openSourceEditor();
SourceEditor *createSourceEditor( TQObject *object, Project *project,
const TQString &lang = TQString::null,
const TQString &func = TQString::null,
bool rereadSource = FALSE );
void editFormSettings();
void editProjectSettings();
void editPixmapCollection();
void editDatabaseConnections();
void editPreferences();
void projectInsertFile();
void searchFind();
void searchIncremetalFindMenu();
void searchIncremetalFind();
void searchIncremetalFindNext();
void searchReplace();
void searchGotoLine();
void previewForm();
void previewForm( const TQString& );
void toolsCustomWidget();
void toolsConfigure();
void helpContents();
void helpManual();
void helpAbout();
void helpAboutQt();
void helpRegister();
private slots:
void activeWindowChanged( TQWidget *w );
void updateUndoRedo( bool, bool, const TQString &, const TQString & );
void updateEditorUndoRedo();
void toolSelected( TQAction* );
void clipboardChanged();
void selectionChanged();
void windowsMenuActivated( int id );
void setupWindowActions();
void createNewTemplate();
void projectSelected( TQAction *a );
void setupRecentlyFilesMenu();
void setupRecentlyProjectsMenu();
void recentlyFilesMenuActivated( int id );
void recentlyProjectsMenuActivated( int id );
void emitProjectSignals();
void showStartDialog();
private:
void setupMDI();
void setupMenuBar();
void setupEditActions();
void setupProjectActions();
void setupSearchActions();
void setupToolActions();
void setupLayoutActions();
void setupFileActions();
void setupPreviewActions();
void setupHelpActions();
void setupRMBMenus();
void setupPropertyEditor();
void setupHierarchyView();
void setupWorkspace();
void setupActionEditor();
void setupOutputWindow();
void setupToolbox();
void setupActionManager();
void setupPluginManagers();
void enableAll( bool enable );
TQWidget* previewFormInternal( TQStyle* style = 0, TQPalette* pal = 0 );
void readConfig();
void setupRMBProperties( TQValueList<uint> &ids, TQMap<TQString, int> &props, TQWidget *w );
void handleRMBProperties( int id, TQMap<TQString, int> &props, TQWidget *w );
void setupRMBSpecialCommands( TQValueList<uint> &ids, TQMap<TQString, int> &commands, TQWidget *w );
void handleRMBSpecialCommands( int id, TQMap<TQString, int> &commands, TQWidget *w );
void setupRMBSpecialCommands( TQValueList<uint> &ids, TQMap<TQString, int> &commands, FormWindow *w );
void handleRMBSpecialCommands( int id, TQMap<TQString, int> &commands, FormWindow *w );
bool openEditor( TQWidget *w, FormWindow *fw );
void rebuildCustomWidgetGUI();
void rebuildCommonWidgetsToolBoxPage();
void checkTempFiles();
void addRecentlyOpened( const TQString &fn, TQStringList &lst );
TQString whatsThisFrom( const TQString &key );
private slots:
void doFunctionsChanged();
bool openProjectSettings( Project *pro );
private:
struct Tab
{
TQWidget *w;
TQString title;
TQObject *receiver;
const char *init_slot, *accept_slot;
Q_DUMMY_COMPARISON_OPERATOR( Tab )
};
private:
PropertyEditor *propertyEditor;
HierarchyView *hierarchyView;
Workspace *wspace;
TQWidget *lastPressWidget;
TQWorkspace *qworkspace;
TQMenuBar *menubar;
TQGuardedPtr<FormWindow> lastActiveFormWindow;
bool breakLayout, layoutChilds, layoutSelected;
TQPoint grd;
bool sGrid, snGrid;
bool restoreConfig;
bool backPix;
bool splashScreen;
TQString fileFilter;
TQMap<TQAction*, Project*> projects;
DesignerAction *actionEditUndo, *actionEditRedo, *actionEditCut, *actionEditCopy,
*actionEditPaste, *actionEditDelete,
*actionEditAdjustSize,
*actionEditHLayout, *actionEditVLayout, *actionEditGridLayout,
*actionEditSplitHorizontal, *actionEditSplitVertical,
*actionEditSelectAll, *actionEditBreakLayout, *actionEditFunctions, *actionEditConnections,
*actionEditLower, *actionEditRaise;
TQAction *actionInsertSpacer;
TQActionGroup *actionGroupTools, *actionGroupProjects;
TQAction* actionPointerTool, *actionConnectTool, *actionOrderTool, *actionBuddyTool;
TQAction* actionCurrentTool;
DesignerAction *actionHelpContents, *actionHelpAbout, *actionHelpAboutQt, *actionHelpWhatsThis;
DesignerAction *actionHelpManual;
#if defined(QT_NON_COMMERCIAL)
DesignerAction *actionHelpRegister;
#endif
DesignerAction *actionToolsCustomWidget, *actionEditPreferences;
DesignerAction *actionWindowTile, *actionWindowCascade, *actionWindowClose, *actionWindowCloseAll;
DesignerAction *actionWindowNext, *actionWindowPrevious;
DesignerAction *actionEditFormSettings, *actionEditAccels;
DesignerAction *actionEditSource, *actionNewFile, *actionFileSave, *actionFileExit;
DesignerAction *actionFileClose, *actionFileSaveAs, *actionFileSaveAll;
DesignerAction *actionSearchFind, *actionSearchIncremetal, *actionSearchReplace, *actionSearchGotoLine;
DesignerAction *actionProjectAddFile, *actionEditPixmapCollection, *actionEditDatabaseConnections,
*actionEditProjectSettings, *actionPreview;
TQActionGroup *actionGroupNew;
TQPopupMenu *rmbWidgets;
TQPopupMenu *rmbFormWindow;
TQPopupMenu *customWidgetMenu, *windowMenu, *fileMenu, *recentlyFilesMenu, *recentlyProjectsMenu;
TQPopupMenu *toolsMenu, *layoutMenu, *previewMenu;
TQToolBar *customWidgetToolBar, *layoutToolBar, *projectToolBar, *customWidgetToolBar2, *toolsToolBar;
TQToolBar *commonWidgetsToolBar;
TQPtrList<TQToolBar> widgetToolBars;
Preferences *prefDia;
TQMap<TQString,TQString> propertyDocumentation;
bool client;
TQString templPath;
ActionEditor *actionEditor;
Project *currentProject;
QPluginManager<ActionInterface> *actionPluginManager;
QPluginManager<EditorInterface> *editorPluginManager;
QPluginManager<TemplateWizardInterface> *templateWizardPluginManager;
QPluginManager<InterpreterInterface> *interpreterPluginManager;
QPluginManager<PreferenceInterface> *preferencePluginManager;
QPluginManager<ProjectSettingsInterface> *projectSettingsPluginManager;
QPluginManager<SourceTemplateInterface> *sourceTemplatePluginManager;
TQPtrList<SourceEditor> sourceEditors;
bool previewing;
QUnknownInterface *desInterface;
TQStringList recentlyFiles;
TQStringList recentlyProjects;
OutputWindow *oWindow;
TQValueList<Tab> preferenceTabs;
TQValueList<Tab> projectTabs;
bool databaseAutoEdit;
TQTimer *updateFunctionsTimer;
TQTimer *autoSaveTimer;
bool autoSaveEnabled;
int autoSaveInterval;
TQLineEdit *incrementalSearch;
TQGuardedPtr<FindDialog> findDialog;
TQGuardedPtr<ReplaceDialog> replaceDialog;
TQGuardedPtr<GotoLineDialog> gotoLineDialog;
Project *eProject;
bool inDebugMode;
TQObjectList debuggingForms;
TQString lastOpenFilter;
TQGuardedPtr<TQWidget> previewedForm;
TQPopupMenu *projectMenu;
TQString menuHelpFile;
bool singleProject;
TQToolBox *toolBox;
int toolsMenuId, toolsMenuIndex;
uint guiStuffVisible : 1;
uint editorsReadOnly : 1;
uint savePluginPaths : 1;
QAssistantClient *assistant;
bool shStartDialog;
TQString pluginDir;
bool sSignalHandlers;
KDevDesignerPart *m_part;
public:
TQString lastSaveFilter;
TQPtrList<TQAction> toolActions;
TQPtrList<TQAction> commonWidgetsPage;
friend class KDevDesignerPart;
};
class SenderObject : public QObject
{
Q_OBJECT
public:
SenderObject( QUnknownInterface *i ) : iface( i ) { iface->addRef(); }
~SenderObject() { iface->release(); }
public slots:
void emitInitSignal() { emit initSignal( iface ); }
void emitAcceptSignal() { emit acceptSignal( iface ); }
signals:
void initSignal( QUnknownInterface * );
void acceptSignal( QUnknownInterface * );
private:
QUnknownInterface *iface;
};
#endif
|