mainwindow.h
author insilmaril
Tue, 30 Mar 2010 17:30:39 +0000
changeset 842 bec082472471
parent 837 5ecd0462f76b
child 845 b98c1793bb8b
permissions -rw-r--r--
Much improved results in FindResultsWidget
insilmaril@0
     1
#ifndef MAINWINDOW_H 
insilmaril@0
     2
#define MAINWINDOW_H
insilmaril@0
     3
insilmaril@366
     4
#include <QMainWindow>
insilmaril@781
     5
#include <QtDBus>
insilmaril@0
     6
insilmaril@781
     7
insilmaril@421
     8
#include "branchpropwindow.h"
insilmaril@721
     9
#include "extrainfodialog.h"
insilmaril@767
    10
#include "flag.h"
insilmaril@175
    11
#include "file.h"
insilmaril@404
    12
#include "historywindow.h"
insilmaril@175
    13
#include "mapeditor.h"
insilmaril@824
    14
#include "shortcuts.h"
insilmaril@432
    15
#include "simplescripteditor.h"
insilmaril@175
    16
#include "texteditor.h"
insilmaril@726
    17
#include "vymview.h"
insilmaril@0
    18
insilmaril@0
    19
class Main : public QMainWindow 
insilmaril@0
    20
{
insilmaril@0
    21
    Q_OBJECT
insilmaril@0
    22
insilmaril@0
    23
public:
insilmaril@473
    24
	/*! Modifier modes are used when CTRL together with a mouse button is pressed */
insilmaril@473
    25
	enum ModMode {
insilmaril@473
    26
		ModModeNone,	//!< Unused
insilmaril@473
    27
		ModModeColor,	//!< Pick color from object
insilmaril@473
    28
		ModModeCopy,	//!< Copy object
insilmaril@473
    29
		ModModeXLink	//!< Create a XLink (XLinkObj) from selected object
insilmaril@473
    30
		};
insilmaril@473
    31
insilmaril@366
    32
    Main(QWidget* parent=0, const char* name=0, Qt::WFlags f=0);
insilmaril@0
    33
    ~Main();
insilmaril@0
    34
	void loadCmdLine();
insilmaril@742
    35
insilmaril@742
    36
private:
insilmaril@821
    37
	QProgressDialog progressDialog;
insilmaril@742
    38
	int progressMax;
insilmaril@742
    39
	int progressMin;
insilmaril@821
    40
	int progressCounter;
insilmaril@821
    41
	int progressCounterTotal;
insilmaril@742
    42
public:	
insilmaril@0
    43
	void statusMessage (const QString &);
insilmaril@742
    44
	void setProgressMaximum (int max);
insilmaril@821
    45
	void addProgressValue (float v);
insilmaril@821
    46
	void setProgressCounter (int v);
insilmaril@822
    47
	void removeProgressCounter();
insilmaril@0
    48
insilmaril@0
    49
public slots:
insilmaril@0
    50
    void fileNew();
insilmaril@491
    51
    void fileNewCopy();
insilmaril@0
    52
insilmaril@0
    53
protected:
insilmaril@0
    54
	void closeEvent( QCloseEvent* );
insilmaril@0
    55
insilmaril@0
    56
private:
insilmaril@0
    57
    void setupFileActions();
insilmaril@0
    58
    void setupEditActions();
insilmaril@0
    59
    void setupFormatActions();
insilmaril@0
    60
    void setupViewActions();
insilmaril@89
    61
    void setupModeActions();
insilmaril@0
    62
    void setupWindowActions();
insilmaril@767
    63
    void setupFlag(Flag *flag, QToolBar *tb, const QString &name, const QString &tooltip);
insilmaril@0
    64
    void setupFlagActions();
insilmaril@528
    65
    void setupNetworkActions();
insilmaril@0
    66
    void setupSettingsActions();
insilmaril@0
    67
    void setupTestActions();
insilmaril@0
    68
    void setupHelpActions();
insilmaril@0
    69
    void setupContextMenus();
insilmaril@401
    70
	void setupRecentMapsMenu();
insilmaril@445
    71
    void setupMacros();
insilmaril@0
    72
	void hideEvent (QHideEvent * );
insilmaril@0
    73
	void showEvent (QShowEvent * );
insilmaril@0
    74
	MapEditor* currentMapEditor() const;
insilmaril@721
    75
	VymModel* currentModel() const;
insilmaril@823
    76
public:	
insilmaril@832
    77
	uint currentModelID() const;
insilmaril@823
    78
	VymModel* getModel(uint) const;
insilmaril@0
    79
    
insilmaril@0
    80
private slots:
insilmaril@0
    81
	void editorChanged(QWidget*);
insilmaril@0
    82
insilmaril@571
    83
    ErrorCode fileLoad(QString ,const LoadMode &, const FileType & ftype=VymMap);
insilmaril@0
    84
    void fileLoad(const LoadMode &);
insilmaril@0
    85
    void fileLoad();
insilmaril@401
    86
	void fileLoadRecent();
insilmaril@401
    87
	void addRecentMap (const QString &);
insilmaril@721
    88
    void fileSave(VymModel*, const SaveMode & );
insilmaril@0
    89
    void fileSave();
insilmaril@473
    90
public slots:	
insilmaril@721
    91
    void fileSave(VymModel*);	// autosave from MapEditor
insilmaril@473
    92
private slots:	
insilmaril@0
    93
    void fileSaveAs(const SaveMode &);
insilmaril@0
    94
    void fileSaveAs();
insilmaril@742
    95
    void fileImportKDE3Bookmarks();
insilmaril@742
    96
    void fileImportKDE4Bookmarks();
insilmaril@314
    97
    void fileImportFirefoxBookmarks();
insilmaril@571
    98
    void fileImportFreemind();
insilmaril@215
    99
    void fileImportMM();
insilmaril@0
   100
    void fileImportDir();
insilmaril@0
   101
    void fileExportXML();
insilmaril@819
   102
    void fileExportHTML();
insilmaril@0
   103
    void fileExportXHTML();
insilmaril@366
   104
    void fileExportImage();
insilmaril@807
   105
    void fileExportAO();
insilmaril@0
   106
    void fileExportASCII();
insilmaril@497
   107
    void fileExportCSV();
insilmaril@163
   108
    void fileExportLaTeX();
insilmaril@742
   109
    void fileExportKDE3Bookmarks();
insilmaril@742
   110
    void fileExportKDE4Bookmarks();
insilmaril@228
   111
    void fileExportTaskjuggler();
insilmaril@163
   112
    void fileExportOOPresentation();
insilmaril@0
   113
    void fileCloseMap();
insilmaril@0
   114
    void filePrint();
insilmaril@0
   115
    void fileExitVYM();
insilmaril@0
   116
insilmaril@404
   117
public slots:
insilmaril@0
   118
    void editUndo();	
insilmaril@0
   119
    void editRedo();	
insilmaril@404
   120
	void gotoHistoryStep (int);
insilmaril@404
   121
private slots:	
insilmaril@0
   122
    void editCopy();	
insilmaril@0
   123
    void editPaste();	
insilmaril@0
   124
    void editCut();	
insilmaril@808
   125
    void editOpenFindWidget();
insilmaril@829
   126
    void editHideFindWidget();
insilmaril@829
   127
	void editFindNext(QString s);
insilmaril@821
   128
    void editFindDuplicateURLs();
insilmaril@366
   129
private:
insilmaril@366
   130
	void openTabs(QStringList);
insilmaril@0
   131
public slots:
insilmaril@0
   132
	void editOpenURL();
insilmaril@266
   133
	void editOpenURLTab();
insilmaril@0
   134
private slots:
insilmaril@821
   135
	void editOpenMultipleVisURLTabs(bool ignoreScrolled=true);
insilmaril@366
   136
	void editOpenMultipleURLTabs();
insilmaril@0
   137
	void editURL();
insilmaril@528
   138
	void editLocalURL();
insilmaril@0
   139
	void editHeading2URL();
insilmaril@0
   140
	void editBugzilla2URL();
insilmaril@820
   141
	void getBugzillaData();
insilmaril@175
   142
	void editFATE2URL();
insilmaril@366
   143
	void openVymLinks(const QStringList &);
insilmaril@0
   144
	void editVymLink();
insilmaril@366
   145
	void editOpenMultipleVymLinks();
insilmaril@0
   146
public slots:
insilmaril@721
   147
    void editHeadingFinished(VymModel *m);
insilmaril@721
   148
//    void editHeading();
insilmaril@0
   149
	void editOpenVymLink();
insilmaril@0
   150
private slots:
insilmaril@0
   151
	void editDeleteVymLink();
insilmaril@243
   152
	void editToggleHideExport();
insilmaril@804
   153
	void editAddTimestamp();
insilmaril@0
   154
	void editMapInfo();
insilmaril@0
   155
    void editMoveUp();	
insilmaril@0
   156
    void editMoveDown();	
insilmaril@795
   157
    void editDetach();	
insilmaril@608
   158
	void editSortChildren();
insilmaril@822
   159
	void editSortBackChildren();
insilmaril@0
   160
    void editToggleScroll();
insilmaril@763
   161
    void editExpandAll();
insilmaril@804
   162
    void editExpandOneLevel();
insilmaril@804
   163
    void editCollapseOneLevel();
insilmaril@721
   164
    void editUnscrollChildren();
insilmaril@786
   165
    void editAddAttribute();
insilmaril@684
   166
    void editAddMapCenter();
insilmaril@0
   167
    void editNewBranch();
insilmaril@394
   168
    void editNewBranchBefore();
insilmaril@0
   169
    void editNewBranchAbove();
insilmaril@0
   170
    void editNewBranchBelow();
insilmaril@0
   171
    void editImportAdd();
insilmaril@0
   172
    void editImportReplace();
insilmaril@0
   173
    void editSaveBranch();
insilmaril@721
   174
    void editDeleteKeepChildren();
insilmaril@721
   175
    void editDeleteChildren();
insilmaril@0
   176
    void editDeleteSelection();
insilmaril@0
   177
    void editLoadImage();
insilmaril@366
   178
    void editSaveImage();
insilmaril@366
   179
    void editEditXLink (QAction *);
insilmaril@0
   180
insilmaril@0
   181
    void formatSelectColor();
insilmaril@0
   182
    void formatPickColor();
insilmaril@0
   183
    void colorChanged(QColor);
insilmaril@0
   184
    void formatColorBranch();
insilmaril@417
   185
    void formatColorSubtree();
insilmaril@0
   186
	void formatLinkStyleLine();
insilmaril@0
   187
	void formatLinkStyleParabel();
insilmaril@0
   188
	void formatLinkStylePolyLine();
insilmaril@0
   189
	void formatLinkStylePolyParabel();
insilmaril@0
   190
    void formatSelectBackColor();
insilmaril@408
   191
    void formatSelectBackImage();
insilmaril@0
   192
    void formatSelectLinkColor();
insilmaril@442
   193
    void formatSelectSelectionColor();
insilmaril@0
   194
    void formatToggleLinkColorHint();
insilmaril@160
   195
	void formatHideLinkUnselected();
insilmaril@0
   196
insilmaril@804
   197
public slots:
insilmaril@0
   198
    void viewZoomReset();
insilmaril@0
   199
    void viewZoomIn();
insilmaril@0
   200
    void viewZoomOut();
insilmaril@526
   201
    void viewCenter();
insilmaril@0
   202
insilmaril@0
   203
public slots:
insilmaril@528
   204
	void networkStartServer();
insilmaril@528
   205
	void networkConnect();
insilmaril@0
   206
	bool settingsPDF();
insilmaril@0
   207
	bool settingsURL();
insilmaril@450
   208
	void settingsMacroDir();
insilmaril@328
   209
	void settingsToggleDelKey();
insilmaril@473
   210
	void settingsUndoLevels();
insilmaril@473
   211
	void settingsAutosaveToggle();
insilmaril@473
   212
	void settingsAutosaveTime();
insilmaril@837
   213
	void settingsAutoLayoutToggle();
insilmaril@625
   214
	void settingsWriteBackupFileToggle();
insilmaril@690
   215
	void settingsToggleAnimation();
insilmaril@0
   216
insilmaril@0
   217
	void windowToggleNoteEditor();
insilmaril@823
   218
	void windowToggleTreeEditor();
insilmaril@294
   219
	void windowToggleHistory();
insilmaril@473
   220
	void windowToggleProperty();
insilmaril@404
   221
	void updateHistory(SimpleSettings &);
insilmaril@408
   222
	void windowToggleAntiAlias();
insilmaril@732
   223
public:
insilmaril@732
   224
	bool isAliased();
insilmaril@732
   225
	bool hasSmoothPixmapTransform();
insilmaril@732
   226
public slots:
insilmaril@408
   227
	void windowToggleSmoothPixmap();
insilmaril@160
   228
	void updateNoteFlag();
insilmaril@753
   229
	void updateNoteEditor (QModelIndex index);
insilmaril@842
   230
	void selectInNoteEditor (QString s, int i);
insilmaril@746
   231
	void changeSelection (VymModel *model,const QItemSelection &newSel, const QItemSelection &delSel);
insilmaril@746
   232
insilmaril@390
   233
	void updateActions();
insilmaril@390
   234
	ModMode getModMode();
insilmaril@537
   235
	bool autoEditNewBranch();
insilmaril@537
   236
	bool autoSelectNewBranch();
insilmaril@434
   237
	void setScript(const QString &);
insilmaril@434
   238
	void runScript(const QString &);
insilmaril@514
   239
	void runScriptEverywhere (const QString &);
insilmaril@160
   240
insilmaril@0
   241
private slots:
insilmaril@0
   242
	void windowNextEditor();
insilmaril@0
   243
	void windowPreviousEditor();
insilmaril@0
   244
	void windowShowNoteEditor();
insilmaril@0
   245
	void windowHideNoteEditor();
insilmaril@0
   246
insilmaril@0
   247
	void standardFlagChanged();
insilmaril@0
   248
insilmaril@527
   249
    void testFunction1();
insilmaril@527
   250
    void testFunction2();
insilmaril@393
   251
    void testCommand();
insilmaril@0
   252
insilmaril@0
   253
    void helpDoc();
insilmaril@505
   254
    void helpDemo();
insilmaril@0
   255
    void helpAbout();
insilmaril@0
   256
    void helpAboutQT();
insilmaril@0
   257
insilmaril@445
   258
	void callMacro ();
insilmaril@473
   259
insilmaril@0
   260
private:
insilmaril@0
   261
	QTabWidget *tabWidget;
insilmaril@804
   262
	QProcess *procBrowser;		//FIXME-2 remove this...
insilmaril@804
   263
	qint64 *browserPID;
insilmaril@366
   264
insilmaril@366
   265
	QStringList imageTypes;
insilmaril@366
   266
insilmaril@772
   267
	QList <VymView*> vymViews;		//! Keeps track of models and views related to a tab 
insilmaril@394
   268
	QString prevSelection;
insilmaril@390
   269
insilmaril@404
   270
	HistoryWindow *historyWindow;
insilmaril@404
   271
insilmaril@421
   272
	BranchPropertyWindow *branchPropertyWindow;
insilmaril@432
   273
	SimpleScriptEditor *scriptEditor;
insilmaril@421
   274
insilmaril@406
   275
	QList <QAction*> actionListBranches;
insilmaril@390
   276
insilmaril@395
   277
	QColor currentColor;
insilmaril@395
   278
insilmaril@600
   279
	int xLinkMenuWidth;
insilmaril@600
   280
insilmaril@401
   281
	QMenu *recentFilesMenu;
insilmaril@401
   282
	enum { MaxRecentFiles = 9 };
insilmaril@445
   283
    QAction *recentFileActions[MaxRecentFiles];
insilmaril@445
   284
insilmaril@445
   285
    QAction *macroActions[12];
insilmaril@445
   286
	QStringList macro;
insilmaril@401
   287
insilmaril@824
   288
	Switchboard switchboard;
insilmaril@824
   289
insilmaril@690
   290
	QAction* actionFileNewCopy;
insilmaril@390
   291
	QAction* actionFileSave;
insilmaril@390
   292
	QAction* actionFilePrint;
insilmaril@723
   293
	QAction* actionUndo;
insilmaril@723
   294
	QAction* actionRedo;
insilmaril@723
   295
	QAction *actionCopy;
insilmaril@723
   296
	QAction *actionCut;
insilmaril@723
   297
	QAction *actionPaste;
insilmaril@723
   298
	QAction *actionMoveUp;
insilmaril@723
   299
	QAction *actionMoveDown;
insilmaril@795
   300
	QAction *actionDetach;
insilmaril@723
   301
	QAction *actionSortChildren;
insilmaril@822
   302
	QAction *actionSortBackChildren;
insilmaril@723
   303
	QAction *actionToggleScroll;
insilmaril@763
   304
	QAction *actionExpandAll;
insilmaril@804
   305
	QAction *actionExpandOneLevel;
insilmaril@804
   306
	QAction *actionCollapseOneLevel;
insilmaril@723
   307
	QAction* actionOpenURL;
insilmaril@723
   308
	QAction* actionOpenURLTab;
insilmaril@821
   309
	QAction* actionOpenMultipleVisURLTabs;
insilmaril@723
   310
	QAction* actionOpenMultipleURLTabs;
insilmaril@723
   311
	QAction* actionURL;
insilmaril@723
   312
	QAction* actionLocalURL;
insilmaril@723
   313
	QAction* actionHeading2URL;
insilmaril@723
   314
	QAction* actionBugzilla2URL;
insilmaril@820
   315
	QAction* actionGetBugzillaData;
insilmaril@723
   316
	QAction* actionFATE2URL;
insilmaril@723
   317
	QAction *actionOpenVymLink;
insilmaril@723
   318
	QAction *actionOpenMultipleVymLinks;
insilmaril@723
   319
	QAction *actionVymLink;
insilmaril@723
   320
	QAction *actionDeleteVymLink;
insilmaril@804
   321
	QAction *actionAddTimestamp;
insilmaril@723
   322
	QAction *actionToggleHideExport;
insilmaril@723
   323
	QAction *actionMapInfo;
insilmaril@723
   324
	QAction *actionHeading;
insilmaril@723
   325
	QAction *actionDelete;
insilmaril@786
   326
	QAction *actionAddAttribute;
insilmaril@723
   327
public:
insilmaril@723
   328
	QAction *actionAddMapCenter;
insilmaril@723
   329
insilmaril@723
   330
private:	
insilmaril@723
   331
	QAction *actionAddBranch;
insilmaril@723
   332
	QAction *actionAddBranchBefore;
insilmaril@723
   333
	QAction *actionAddBranchAbove;
insilmaril@723
   334
	QAction *actionAddBranchBelow;
insilmaril@723
   335
	QAction *actionDeleteKeepChildren;
insilmaril@723
   336
	QAction *actionDeleteChildren;
insilmaril@723
   337
	QAction *actionImportAdd;
insilmaril@723
   338
	QAction *actionImportReplace;
insilmaril@723
   339
	QAction *actionSaveBranch;
insilmaril@723
   340
	QAction *actionLoadImage;
insilmaril@390
   341
insilmaril@390
   342
	QAction* actionFormatColor;
insilmaril@390
   343
	QAction* actionFormatPickColor;
insilmaril@390
   344
	QAction* actionFormatColorBranch;
insilmaril@390
   345
	QAction* actionFormatColorSubtree;
insilmaril@390
   346
	QAction* actionFormatLinkColorHint;
insilmaril@390
   347
	QAction* actionFormatBackColor;
insilmaril@408
   348
	QAction* actionFormatBackImage;
insilmaril@390
   349
	QAction* actionFormatLinkColor;
insilmaril@442
   350
	QAction* actionFormatSelectionColor;
insilmaril@390
   351
insilmaril@390
   352
	QActionGroup* actionGroupModModes;
insilmaril@390
   353
	QAction* actionModModeColor;
insilmaril@390
   354
	QAction* actionModModeXLink;
insilmaril@390
   355
	QAction* actionModModeCopy;
insilmaril@390
   356
insilmaril@390
   357
	QActionGroup *actionGroupFormatFrameTypes;
insilmaril@421
   358
insilmaril@390
   359
insilmaril@390
   360
	QActionGroup *actionGroupFormatLinkStyles;
insilmaril@390
   361
	QAction *actionFormatLinkStyleLine;
insilmaril@390
   362
	QAction *actionFormatLinkStyleParabel;
insilmaril@390
   363
	QAction *actionFormatLinkStylePolyLine;
insilmaril@390
   364
	QAction *actionFormatLinkStylePolyParabel;
insilmaril@390
   365
	QAction *actionFormatHideLinkUnselected;
insilmaril@390
   366
insilmaril@390
   367
	QAction *actionViewToggleNoteEditor;
insilmaril@823
   368
	QAction *actionViewToggleTreeEditor;
insilmaril@390
   369
	QAction *actionViewToggleHistoryWindow;
insilmaril@486
   370
	QAction *actionViewTogglePropertyWindow;
insilmaril@408
   371
	QAction *actionViewToggleAntiAlias;
insilmaril@408
   372
	QAction *actionViewToggleSmoothPixmapTransform;
insilmaril@526
   373
	QAction* actionViewCenter;
insilmaril@390
   374
insilmaril@537
   375
	QAction* actionSettingsAutoEditNewBranch;
insilmaril@537
   376
	QAction* actionSettingsAutoSelectNewBranch;
insilmaril@390
   377
	QAction* actionSettingsAutoSelectText;
insilmaril@390
   378
	QAction* actionSettingsUseDelKey;
insilmaril@390
   379
	QAction* actionSettingsUseFlagGroups;
insilmaril@390
   380
	QAction* actionSettingsUseHideExport;
insilmaril@473
   381
	QAction* actionSettingsAutosaveToggle;
insilmaril@473
   382
	QAction* actionSettingsAutosaveTime;
insilmaril@837
   383
	QAction* actionSettingsAutoLayoutToggle;
insilmaril@625
   384
	QAction* actionSettingsWriteBackupFile;
insilmaril@690
   385
	QAction* actionSettingsUseAnimation;
insilmaril@0
   386
};
insilmaril@0
   387
insilmaril@0
   388
insilmaril@0
   389
#endif
insilmaril@0
   390