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