mainwindow.h
author insilmaril
Fri, 19 Feb 2010 13:47:03 +0000
changeset 823 0bba81dde1bc
parent 822 c2ce9944148c
child 824 36eb4b8f409e
permissions -rw-r--r--
More fixes
     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 "simplescripteditor.h"
    15 #include "texteditor.h"
    16 #include "vymview.h"
    17 
    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 	VymModel* getModel(uint) const;
    78     
    79 private slots:
    80 	void editorChanged(QWidget*);
    81 
    82     ErrorCode fileLoad(QString ,const LoadMode &, const FileType & ftype=VymMap);
    83     void fileLoad(const LoadMode &);
    84     void fileLoad();
    85 	void fileLoadRecent();
    86 	void addRecentMap (const QString &);
    87     void fileSave(VymModel*, const SaveMode & );
    88     void fileSave();
    89 public slots:	
    90     void fileSave(VymModel*);	// autosave from MapEditor
    91 private slots:	
    92     void fileSaveAs(const SaveMode &);
    93     void fileSaveAs();
    94     void fileImportKDE3Bookmarks();
    95     void fileImportKDE4Bookmarks();
    96     void fileImportFirefoxBookmarks();
    97     void fileImportFreemind();
    98     void fileImportMM();
    99     void fileImportDir();
   100     void fileExportXML();
   101     void fileExportHTML();
   102     void fileExportXHTML();
   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     void 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 editFindDuplicateURLs();
   126 private:
   127 	void openTabs(QStringList);
   128 public slots:
   129 	void editOpenURL();
   130 	void editOpenURLTab();
   131 private slots:
   132 	void editOpenMultipleVisURLTabs(bool ignoreScrolled=true);
   133 	void editOpenMultipleURLTabs();
   134 	void editURL();
   135 	void editLocalURL();
   136 	void editHeading2URL();
   137 	void editBugzilla2URL();
   138 	void getBugzillaData();
   139 	void editFATE2URL();
   140 	void openVymLinks(const QStringList &);
   141 	void editVymLink();
   142 	void editOpenMultipleVymLinks();
   143 public slots:
   144     void editHeadingFinished(VymModel *m);
   145 //    void editHeading();
   146 	void editOpenVymLink();
   147 private slots:
   148 	void editDeleteVymLink();
   149 	void editToggleHideExport();
   150 	void editAddTimestamp();
   151 	void editMapInfo();
   152     void editMoveUp();	
   153     void editMoveDown();	
   154     void editDetach();	
   155 	void editSortChildren();
   156 	void editSortBackChildren();
   157     void editToggleScroll();
   158     void editExpandAll();
   159     void editExpandOneLevel();
   160     void editCollapseOneLevel();
   161     void editUnscrollChildren();
   162     void editAddAttribute();
   163     void editAddMapCenter();
   164     void editNewBranch();
   165     void editNewBranchBefore();
   166     void editNewBranchAbove();
   167     void editNewBranchBelow();
   168     void editImportAdd();
   169     void editImportReplace();
   170     void editSaveBranch();
   171     void editDeleteKeepChildren();
   172     void editDeleteChildren();
   173     void editDeleteSelection();
   174     void editLoadImage();
   175     void editSaveImage();
   176     void editEditXLink (QAction *);
   177 
   178     void formatSelectColor();
   179     void formatPickColor();
   180     void colorChanged(QColor);
   181     void formatColorBranch();
   182     void formatColorSubtree();
   183 	void formatLinkStyleLine();
   184 	void formatLinkStyleParabel();
   185 	void formatLinkStylePolyLine();
   186 	void formatLinkStylePolyParabel();
   187     void formatSelectBackColor();
   188     void formatSelectBackImage();
   189     void formatSelectLinkColor();
   190     void formatSelectSelectionColor();
   191     void formatToggleLinkColorHint();
   192 	void formatHideLinkUnselected();
   193 
   194 public slots:
   195     void viewZoomReset();
   196     void viewZoomIn();
   197     void viewZoomOut();
   198     void viewCenter();
   199 
   200 public slots:
   201 	void networkStartServer();
   202 	void networkConnect();
   203 	bool settingsPDF();
   204 	bool settingsURL();
   205 	void settingsMacroDir();
   206 	void settingsToggleDelKey();
   207 	void settingsUndoLevels();
   208 	void settingsAutosaveToggle();
   209 	void settingsAutosaveTime();
   210 	void settingsWriteBackupFileToggle();
   211 	void settingsToggleAnimation();
   212 
   213 	void windowToggleNoteEditor();
   214 	void windowToggleTreeEditor();
   215 	void windowToggleHistory();
   216 	void windowToggleProperty();
   217 	void updateHistory(SimpleSettings &);
   218 	void windowToggleAntiAlias();
   219 public:
   220 	bool isAliased();
   221 	bool hasSmoothPixmapTransform();
   222 public slots:
   223 	void windowToggleSmoothPixmap();
   224 	void updateNoteFlag();
   225 	void updateNoteEditor (QModelIndex index);
   226 	void changeSelection (VymModel *model,const QItemSelection &newSel, const QItemSelection &delSel);
   227 
   228 	void updateActions();
   229 	ModMode getModMode();
   230 	bool autoEditNewBranch();
   231 	bool autoSelectNewBranch();
   232 	void setScript(const QString &);
   233 	void runScript(const QString &);
   234 	void runScriptEverywhere (const QString &);
   235 
   236 private slots:
   237 	void windowNextEditor();
   238 	void windowPreviousEditor();
   239 	void windowShowNoteEditor();
   240 	void windowHideNoteEditor();
   241 
   242 	void standardFlagChanged();
   243 
   244     void testFunction1();
   245     void testFunction2();
   246     void testCommand();
   247 
   248     void helpDoc();
   249     void helpDemo();
   250     void helpAbout();
   251     void helpAboutQT();
   252 
   253 	void callMacro ();
   254 
   255 private:
   256 	QTabWidget *tabWidget;
   257 	QProcess *procBrowser;		//FIXME-2 remove this...
   258 	qint64 *browserPID;
   259 
   260 	QStringList imageTypes;
   261 
   262 	QList <VymView*> vymViews;		//! Keeps track of models and views related to a tab 
   263 	QString prevSelection;
   264 
   265 	HistoryWindow *historyWindow;
   266 
   267 	BranchPropertyWindow *branchPropertyWindow;
   268 	SimpleScriptEditor *scriptEditor;
   269 
   270 	QList <QAction*> actionListBranches;
   271 
   272 	QColor currentColor;
   273 
   274 	int xLinkMenuWidth;
   275 
   276 	QMenu *recentFilesMenu;
   277 	enum { MaxRecentFiles = 9 };
   278     QAction *recentFileActions[MaxRecentFiles];
   279 
   280     QAction *macroActions[12];
   281 	QStringList macro;
   282 
   283 	QAction* actionFileNewCopy;
   284 	QAction* actionFileSave;
   285 	QAction* actionFilePrint;
   286 	QAction* actionUndo;
   287 	QAction* actionRedo;
   288 	QAction *actionCopy;
   289 	QAction *actionCut;
   290 	QAction *actionPaste;
   291 	QAction *actionMoveUp;
   292 	QAction *actionMoveDown;
   293 	QAction *actionDetach;
   294 	QAction *actionSortChildren;
   295 	QAction *actionSortBackChildren;
   296 	QAction *actionToggleScroll;
   297 	QAction *actionExpandAll;
   298 	QAction *actionExpandOneLevel;
   299 	QAction *actionCollapseOneLevel;
   300 	QAction* actionOpenURL;
   301 	QAction* actionOpenURLTab;
   302 	QAction* actionOpenMultipleVisURLTabs;
   303 	QAction* actionOpenMultipleURLTabs;
   304 	QAction* actionURL;
   305 	QAction* actionLocalURL;
   306 	QAction* actionHeading2URL;
   307 	QAction* actionBugzilla2URL;
   308 	QAction* actionGetBugzillaData;
   309 	QAction* actionFATE2URL;
   310 	QAction *actionOpenVymLink;
   311 	QAction *actionOpenMultipleVymLinks;
   312 	QAction *actionVymLink;
   313 	QAction *actionDeleteVymLink;
   314 	QAction *actionAddTimestamp;
   315 	QAction *actionToggleHideExport;
   316 	QAction *actionMapInfo;
   317 	QAction *actionHeading;
   318 	QAction *actionDelete;
   319 	QAction *actionAddAttribute;
   320 public:
   321 	QAction *actionAddMapCenter;
   322 
   323 private:	
   324 	QAction *actionAddBranch;
   325 	QAction *actionAddBranchBefore;
   326 	QAction *actionAddBranchAbove;
   327 	QAction *actionAddBranchBelow;
   328 	QAction *actionDeleteKeepChildren;
   329 	QAction *actionDeleteChildren;
   330 	QAction *actionImportAdd;
   331 	QAction *actionImportReplace;
   332 	QAction *actionSaveBranch;
   333 	QAction *actionLoadImage;
   334 
   335 	QAction* actionFormatColor;
   336 	QAction* actionFormatPickColor;
   337 	QAction* actionFormatColorBranch;
   338 	QAction* actionFormatColorSubtree;
   339 	QAction* actionFormatLinkColorHint;
   340 	QAction* actionFormatBackColor;
   341 	QAction* actionFormatBackImage;
   342 	QAction* actionFormatLinkColor;
   343 	QAction* actionFormatSelectionColor;
   344 
   345 	QActionGroup* actionGroupModModes;
   346 	QAction* actionModModeColor;
   347 	QAction* actionModModeXLink;
   348 	QAction* actionModModeCopy;
   349 
   350 	QActionGroup *actionGroupFormatFrameTypes;
   351 
   352 
   353 	QActionGroup *actionGroupFormatLinkStyles;
   354 	QAction *actionFormatLinkStyleLine;
   355 	QAction *actionFormatLinkStyleParabel;
   356 	QAction *actionFormatLinkStylePolyLine;
   357 	QAction *actionFormatLinkStylePolyParabel;
   358 	QAction *actionFormatHideLinkUnselected;
   359 
   360 	QAction *actionViewToggleNoteEditor;
   361 	QAction *actionViewToggleTreeEditor;
   362 	QAction *actionViewToggleHistoryWindow;
   363 	QAction *actionViewTogglePropertyWindow;
   364 	QAction *actionViewToggleAntiAlias;
   365 	QAction *actionViewToggleSmoothPixmapTransform;
   366 	QAction* actionViewCenter;
   367 
   368 	QAction* actionSettingsAutoEditNewBranch;
   369 	QAction* actionSettingsAutoSelectNewBranch;
   370 	QAction* actionSettingsAutoSelectText;
   371 	QAction* actionSettingsUseDelKey;
   372 	QAction* actionSettingsUseFlagGroups;
   373 	QAction* actionSettingsUseHideExport;
   374 	QAction* actionSettingsAutosaveToggle;
   375 	QAction* actionSettingsAutosaveTime;
   376 	QAction* actionSettingsWriteBackupFile;
   377 	QAction* actionSettingsUseAnimation;
   378 };
   379 
   380 
   381 #endif
   382