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