Chris@57: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@57: Chris@57: /* Chris@57: EasyMercurial Chris@57: Chris@98: Based on hgExplorer by Jari Korhonen Chris@57: Copyright (c) 2010 Jari Korhonen Chris@57: Copyright (c) 2010 Chris Cannam Chris@57: Copyright (c) 2010 Queen Mary, University of London Chris@57: Chris@57: This program is free software; you can redistribute it and/or Chris@57: modify it under the terms of the GNU General Public License as Chris@57: published by the Free Software Foundation; either version 2 of the Chris@57: License, or (at your option) any later version. See the file Chris@57: COPYING included with this distribution for more information. Chris@57: */ jtkorhonen@0: jtkorhonen@0: #ifndef MAINWINDOW_H jtkorhonen@0: #define MAINWINDOW_H jtkorhonen@0: Chris@96: #include "hgtabwidget.h" jtkorhonen@0: #include "hgrunner.h" jtkorhonen@0: #include "common.h" Chris@106: #include "changeset.h" Chris@109: #include "hgaction.h" jtkorhonen@0: Chris@50: #include Chris@50: #include Chris@90: #include Chris@50: jtkorhonen@0: QT_BEGIN_NAMESPACE jtkorhonen@0: class QAction; jtkorhonen@0: class QMenu; jtkorhonen@0: QT_END_NAMESPACE jtkorhonen@0: jtkorhonen@0: class MainWindow : public QMainWindow jtkorhonen@0: { jtkorhonen@0: Q_OBJECT jtkorhonen@0: jtkorhonen@0: public: jtkorhonen@0: MainWindow(); Chris@98: HgTabWidget *hgTabs; jtkorhonen@0: void writeSettings(); jtkorhonen@0: jtkorhonen@0: //Paths to remote repo & workfolder jtkorhonen@0: //Local repo is directory "./hg/" under work folder jtkorhonen@0: QString remoteRepoPath; jtkorhonen@0: QString workFolderPath; Chris@106: QString currentBranch; Chris@106: Changesets currentHeads; Chris@108: Changesets currentParents; Chris@133: int commitsSincePush; Chris@120: bool needNewLog; jtkorhonen@0: jtkorhonen@0: protected: jtkorhonen@0: void closeEvent(QCloseEvent *event); jtkorhonen@0: jtkorhonen@0: public slots: Chris@145: void open(QString local); Chris@120: void hgRefresh(); Chris@142: void commandCompleted(HgAction action, QString stdOut); Chris@142: void commandFailed(HgAction action, QString stdErr); Chris@95: void enableDisableActions(); jtkorhonen@0: jtkorhonen@0: private slots: jtkorhonen@0: void about(); Chris@64: void settings(); Chris@69: void open(); Chris@64: void startupDialog(); Chris@94: void clearSelections(); Chris@64: Chris@120: void hgQueryPaths(); Chris@120: void hgStat(); jtkorhonen@0: void hgRemove(); jtkorhonen@0: void hgAdd(); jtkorhonen@0: void hgCommit(); jtkorhonen@0: void hgFileDiff(); jtkorhonen@0: void hgFolderDiff(); Chris@148: void hgDiffToCurrent(QString); Chris@148: void hgDiffToParent(QString, QString); jtkorhonen@0: void hgUpdate(); jtkorhonen@0: void hgRevert(); jtkorhonen@0: void hgMerge(); jtkorhonen@33: void hgRetryMerge(); jtkorhonen@0: void hgCloneFromRemote(); jtkorhonen@0: void hgInit(); jtkorhonen@0: void hgIncoming(); jtkorhonen@0: void hgPush(); jtkorhonen@0: void hgPull(); Chris@148: void hgUpdateToRev(QString); Chris@148: void hgMergeFrom(QString); jtkorhonen@0: void hgAnnotate(); jtkorhonen@0: void hgResolveList(); jtkorhonen@0: void hgResolveMark(); jtkorhonen@34: void hgTag(); jtkorhonen@11: void hgServe(); jtkorhonen@34: void hgIgnore(); jtkorhonen@0: Chris@90: void fsDirectoryChanged(QString); Chris@90: void fsFileChanged(QString); Chris@90: jtkorhonen@0: private: Chris@109: void hgQueryBranch(); Chris@109: void hgQueryHeads(); Chris@109: void hgQueryParents(); jtkorhonen@0: void hgLog(); Chris@150: void hgLogIncremental(QStringList prune); jtkorhonen@0: void createActions(); jtkorhonen@0: void connectActions(); Chris@141: void connectTabsSignals(); jtkorhonen@0: void createMenus(); jtkorhonen@0: void createToolBars(); jtkorhonen@0: void createStatusBar(); jtkorhonen@0: void readSettings(); jtkorhonen@0: void splitChangeSets(QStringList *list, QString hgLogOutput); jtkorhonen@2: void presentLongStdoutToUser(QString stdo); Chris@95: jtkorhonen@28: QString listAllUpIpV4Addresses(); jtkorhonen@34: QString filterTag(QString tag); jtkorhonen@0: Chris@64: QString getUserInfo() const; Chris@64: Chris@79: bool openLocal(QString); Chris@79: bool openRemote(QString, QString); Chris@79: bool openInit(QString); Chris@79: Chris@79: bool complainAboutFilePath(QString); Chris@79: bool complainAboutUnknownFolder(QString); Chris@84: bool complainAboutInitInRepo(QString); Chris@84: bool complainAboutInitFile(QString); Chris@84: bool complainAboutCloneToExisting(QString); Chris@84: bool complainAboutCloneToFile(QString); Chris@84: bool complainAboutCloneToExistingFolder(QString); //!!! not sure about this one Chris@84: Chris@79: bool askToInitExisting(QString); Chris@79: bool askToInitNew(QString); Chris@79: bool askToOpenParentRepo(QString, QString); Chris@84: bool askToOpenInsteadOfInit(QString); Chris@79: Chris@120: void showIncoming(QString); Chris@120: void showPullResult(QString); Chris@120: void showPushResult(QString); Chris@125: int extractChangeCount(QString); Chris@125: QString format3(QString, QString, QString); Chris@120: Chris@120: void clearState(); Chris@120: Chris@90: void updateFileSystemWatcher(); Chris@90: Chris@64: bool firstStart; Chris@64: jtkorhonen@0: //Actions enabled flags jtkorhonen@0: bool remoteRepoActionsEnabled; jtkorhonen@0: bool localRepoActionsEnabled; jtkorhonen@0: jtkorhonen@0: //File menu actions jtkorhonen@0: QAction *hgInitAct; jtkorhonen@0: QAction *hgCloneFromRemoteAct; Chris@69: QAction *openAct; jtkorhonen@0: QAction *settingsAct; jtkorhonen@0: QAction *exitAct; jtkorhonen@0: jtkorhonen@33: //Repo actions jtkorhonen@0: QAction *hgIncomingAct; jtkorhonen@0: QAction *hgPushAct; jtkorhonen@0: QAction *hgPullAct; Chris@120: QAction *hgRefreshAct; jtkorhonen@0: QAction *hgFileDiffAct; jtkorhonen@0: QAction *hgFolderDiffAct; jtkorhonen@0: QAction *hgChgSetDiffAct; jtkorhonen@0: QAction *hgRevertAct; jtkorhonen@0: QAction *hgAddAct; jtkorhonen@0: QAction *hgRemoveAct; jtkorhonen@0: QAction *hgUpdateAct; jtkorhonen@0: QAction *hgCommitAct; jtkorhonen@0: QAction *hgMergeAct; jtkorhonen@33: QAction *hgRetryMergeAct; jtkorhonen@0: QAction *hgUpdateToRevAct; jtkorhonen@0: QAction *hgAnnotateAct; jtkorhonen@0: QAction *hgResolveListAct; jtkorhonen@0: QAction *hgResolveMarkAct; jtkorhonen@34: QAction *hgTagAct; jtkorhonen@34: QAction *hgIgnoreAct; jtkorhonen@11: QAction *hgServeAct; jtkorhonen@0: jtkorhonen@0: //Menus jtkorhonen@0: QMenu *fileMenu; jtkorhonen@0: QMenu *advancedMenu; jtkorhonen@0: QMenu *helpMenu; jtkorhonen@0: jtkorhonen@0: //Help menu actions jtkorhonen@0: QAction *aboutAct; jtkorhonen@0: QAction *aboutQtAct; jtkorhonen@0: Chris@94: // Other actions Chris@94: QAction *clearSelectionsAct; Chris@94: jtkorhonen@0: QToolBar *fileToolBar; jtkorhonen@0: QToolBar *repoToolBar; jtkorhonen@0: QToolBar *workFolderToolBar; jtkorhonen@0: Chris@109: HgRunner *runner; jtkorhonen@0: Chris@112: void findDiffBinaryName(); Chris@112: QString diffBinaryName; Chris@112: Chris@90: QFileSystemWatcher *fsWatcher; Chris@90: Chris@112: bool justMerged; Chris@157: QString mergeCommitComment; jtkorhonen@0: }; jtkorhonen@0: jtkorhonen@0: #endif