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