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